@openmrs/esm-form-builder-app 3.5.2-pre.3800 → 3.5.2-pre.3804
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/3334.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
failing expression: ${e}`)}return null}async function nB(e,n,D,t,S){if(!e?.trim())return null;let i=nG(e);nK(i,n,D);try{return(0,o.evaluateAsTypeAsync)(i,nq(n,D,t,S),nz)}catch(n){console.error(`Error: ${n}
|
|
4
4
|
|
|
5
|
-
failing expression: ${e}`)}return null}function nq(e,n,D,t){let{myValue:S,patient:i}=t,{sex:r,age:o}=i??{};"field"===e.type&&void 0===S&&e.value&&(S=D[e.value.id]);let g=new nV;g.putObject("prevEnc",{value:t.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(n=>n.concept.uuid==e)}});let s=t?.visit??{},a=s?.visitType||{uuid:""},l=a.uuid??"",c={isEmpty:nl.A};return{...new nN(e,i,n,D),...iq(),...t,...D,patient:i,myValue:S,sex:r,age:o,HD:g,visit:s,visitType:a,visitTypeUuid:l,_:c}}function nG(e){let n=nP(e);if(nH.has(n))return nH.get(n);let D=(0,o.compile)(e);return nH.set(n,D),D}function nK(e,n,D){for(let t of(0,o.extractVariableNames)(e)){let e=D.find(e=>e.id===t);e&&nF(n,e)}}function nY(e,n,D,t){return"embedded-view"==t||("automatic"==e?"maximized"==D&&n.endsWith("desktop"):"single-line"==e)}function nQ(e,n){let D=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,t=n.find(e=>e.id==D);t&&(t.fieldDependents||(t.fieldDependents=new Set)).add(e.id)}function nZ(e,n,D){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:t,referenceQuestionId:S}=e.required,i=n.find(e=>e.id==S);return!!i&&((i.fieldDependents||(i.fieldDependents=new Set)).add(e.id),t?.includes(D[S]))}function nJ(e,n,D,t,S,i){let{value:r}=e;return i(r.disabled?.disableWhenExpression,e,n,D,{mode:t,patient:S})}function nX(e,n,D,t,S,i,r){let{value:o,type:g}=e,s=i(o.hide?.hideWhenExpression,e,n,D,{mode:t,patient:S});e.value.isHidden=s,"field"==g&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=s}),"page"==g&&o.sections.forEach(e=>{e.isParentHidden=s,n1(s,e,n,r)}),"section"==g&&n1(s,o,n,r)}function n1(e,n,D,t){let S=n.questions.map(e=>e.id);D.filter(e=>S.includes(e.id)).forEach(n=>{n.isParentHidden=e,"group"==n.questionOptions.rendering&&n.questions.forEach(n=>{n.isParentHidden=e}),t?.(n)})}function n2(e,n){if(!e?.includes(":"))return n?.find(n=>n.uuid===e);{let[D,t]=e.split(":");return n?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===D.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===t.toUpperCase()))}}function n4(e,n=!1){let D=document.getElementById(e);D?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),n&&D?.focus()}let n3=(e,n)=>{let D=e.questionOptions.rendering;if("object"!=typeof n)return{value:n,display:n};let t="Observation"===n.resourceType?n8(n,D):n;if(!t)return{value:null,display:null};if("string"==typeof t.value||"number"==typeof t.value){if("date"===D||"datetime"===D){let e=nr(`${t.value}`);return{value:e,display:e4()(e).format("YYYY-MM-DD HH:mm")}}return{value:t.value,display:t.value}}return["toggle","checkbox"].includes(D)?{value:t.value?.uuid,display:t.value?.name?.name}:{value:t.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===t.value?.uuid)?.label}};function n0(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function n8(e,n){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:n9(e,n)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function n9(e,n){switch(n){case"toggle":return e.valueBoolean?{uuid:g.t$}:{uuid:g.Mi};case"date":case"datetime":return e.valueDateTime;case"number":return e.valueQuantity?.value??null;case"radio":case"checkbox":case"select":case"content-switcher":return e.valueCodeableConcept?.coding[0]?{uuid:e.valueCodeableConcept?.coding[0].code,name:{name:e.valueCodeableConcept?.coding[0].display}}:null;default:return e.valueString}}function n7(e,n){return e.pages.find(e=>n.meta.pageId===e.id).sections.find(e=>e.questions.find(e=>e.id===n.id))}var n6=D(10578);function n5(e,n){let{methods:{getValues:D}}=n,t=D();g.FU.includes(e.questionOptions.rendering)&&De(e,t,n),Dn(e,t,n)}function De(e,n,D){let{sessionMode:t,formFields:S,patient:i,visit:r}=D;e.questionOptions.answers.forEach(D=>{let o=D.disable?.disableWhenExpression;o&&o.includes("myValue")&&(D.disable.isDisabled=nW(D.disable?.disableWhenExpression,{value:e,type:"field"},S,n,{mode:t,patient:i,visit:r}))})}function Dn(e,n,D){let{sessionMode:t,formFields:S,patient:i,formFieldValidators:r,formJson:o,methods:{setValue:g},updateFormField:s,setForm:a,visit:l}=D,c=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let a=S.find(n=>n.id==e);if(a.questionOptions.calculate?.calculateExpression&&nB(a.questionOptions.calculate.calculateExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l}).then(e=>{g(a.id,e);let{errors:r,warnings:o}=DD(a,e,D.formFieldValidators,{formFields:S,values:n,expressionContext:{patient:i,mode:t}});a.meta.submission||(a.meta.submission={}),a.meta.submission.errors=r,a.meta.submission.warnings=o,r.length||D.formFieldAdapters[a.type].transformFieldValue(a,e,D),s(a)}).catch(e=>{(0,n6.N)(e,"Error evaluating calculate expression")}),a.hide){let e=n7(o,a),D=e?.questions.some(e=>!e.isHidden);if(nX({value:a,type:"field"},S,n,t,i,nW,s),e){e.questions=e?.questions.map(e=>e.id===a.id?a:e);let n=a.isHidden,t=[...e.questions,a].some(e=>!e.isHidden);D||n?D&&!t&&(e.isHidden=!0,c=!0):(e.isHidden=!1,c=!0)}}if("object"==typeof a.disabled&&a.disabled.disableWhenExpression&&(a.isDisabled=nJ({value:a,type:"field"},S,n,t,i,nW)),"object"==typeof a.required&&a.required?.type==="conditionalRequired"&&(a.isRequired=nZ(a,S,n)),a.validators?.some(e=>"conditionalAnswered"===e.type)){let e=a.validators?.find(e=>"conditionalAnswered"===e.type),D=r.conditionalAnswered.validate(a,a.meta.submission?.newValue,{...e,expressionContext:{patient:i,mode:t},values:n,formFields:S});a.meta.submission={...a.meta.submission,errors:D}}a?.questionOptions.answers?.filter(e=>!e7(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=nW(e.hide?.hideWhenExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})}),a?.questionOptions.answers?.filter(e=>!e7(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=nW(e.disable?.disableWhenExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})}),!a.isHidden&&a.meta.readonlyExpression&&(a.readonly=nW(a.meta.readonlyExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})),nn(a,"repeating")&&!e7(a.questionOptions.repeatOptions?.limitExpression)&&(a.questionOptions.repeatOptions.limit=nW(a.questionOptions.repeatOptions?.limitExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})),s(a)}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let D=0;D<o.pages.length;D++){let r=o.pages[D].sections.find(n=>n.label==e);if(r){nX({value:r,type:"section"},S,n,t,i,nW,s),c=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{nX({value:o.pages.find(n=>n.label==e),type:"page"},S,n,t,i,nW,s),c=!0}),c&&a(o)}function DD(e,n,D,t){let S=[],i=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(r=>{let o=D[r.type]?.validate?.(e,n,{...r,...t});o&&o.forEach(e=>{"error"===e.resultType?S.push(e):"warning"===e.resultType&&i.push(e)})})}catch(e){console.error(e)}return{errors:S,warnings:i}}var Dt=D(6232);let DS=a().createContext(void 0),Di=({methods:e,children:n,...D})=>a().createElement(DS.Provider,{value:{...D,methods:e}},n),Dr=()=>{let e=a().useContext(DS);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e},Do="-esm-form-builder__value__value___GMGmn",Dg="-esm-form-builder__value__item___U1v45",Ds="-esm-form-builder__value__empty___sor36",Da=()=>{let{t:e}=(0,eX.useTranslation)();return a().createElement("div",null,a().createElement("span",{className:Ds},"(",e("blank","Blank"),")"))},Dl=({value:e})=>Array.isArray(e)?a().createElement(Dc,{valueArray:e}):a().createElement("div",{className:Do},e),Dc=({valueArray:e})=>a().createElement("ul",null,e.map(e=>a().createElement("li",{className:Dg},e))),Du="-esm-form-builder__previous-value-review__formField___vrMDb",Dh="-esm-form-builder__previous-value-review__row___XRir3",Dd="-esm-form-builder__previous-value-review__value___OZCed",Dp="-esm-form-builder__previous-value-review__reuseButton___mtoQ-",Df=({previousValue:e,displayText:n,field:D,hideHeader:t,onAfterChange:S})=>{let{t:i}=(0,eX.useTranslation)(),{methods:{setValue:r}}=Dr(),o=n=>{n.preventDefault(),r(D.id,e),S(e)};return a().createElement("div",{className:Du},a().createElement("div",{className:Dh},!t&&a().createElement("div",null,i("previousValue","Previous value:")),a().createElement("div",{className:Dd},a().createElement(Dl,{value:n}))),a().createElement("div",{className:Dp,role:"button",tabIndex:0,onClick:o},i("reuseValue","Reuse value")))},Dm="-esm-form-builder__unspecified__unspecified___suBpN",Dy=({field:e,fieldValue:n,setFieldValue:D,onAfterChange:t})=>{let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)(!1),{sessionMode:o,updateFormField:g}=Dr();(0,s.useEffect)(()=>{e7(n)&&"edit"===o&&(r(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,s.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!e7(n))&&(r(!1),e.meta.submission.unspecified=!1,g(e))},[e.meta?.submission,n]);let l=(0,s.useCallback)(n=>{let S=e.questionOptions.rendering;if(n.target.checked){r(!0);let n="checkbox"===S?[]:"";nD(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],g(e),D(n),t(n)}else r(!1),e.meta.submission.unspecified=!1,g(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,Dt.H)(e.readonly)&&!ni(o)&&a().createElement("div",{className:Dm},a().createElement(h.Sc0,{id:`${e.id}-unspecified`,labelText:S("unspecified","Unspecified"),value:S("unspecified","Unspecified"),onChange:l,checked:i,disabled:e.isDisabled}))};function Dv(e,n,D,t){return!("embedded-view"===e&&D&&(n||t))}let Db="-esm-form-builder__form-field-renderer__unspecifiedContainer___Z9L4T",Dw=({fieldId:e,valueAdapter:n,repeatOptions:D})=>{let[t,S]=(0,s.useState)(null),[i,r]=(0,s.useState)([]),[g,l]=(0,s.useState)([]),[c,u]=(0,s.useState)(null),h=Dr(),d=!1;try{let e=(0,o.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});d=e?.hideUnansweredQuestionsInReadonlyForms??!1}catch(e){console.warn("Failed to load @openmrs/esm-form engine-app config - using hideUnansweredQuestionsInReadonlyForms=false (empty fields will be visible in readonly mode): ",e)}let{methods:{control:p,getValues:f,getFieldState:m},patient:y,sessionMode:v,formFields:b,formFieldValidators:w,addInvalidField:M,removeInvalidField:L,updateFormField:$}=h,_=ei({control:p,name:e,exact:!0}),x=()=>{},C=(0,s.useMemo)(()=>b.find(n=>n.id===e),[e,b]);(0,s.useEffect)(()=>{if(nn(C,"repeating")&&D?.targetRendering?iF(D.targetRendering).then(e=>{e&&S({value:e})}):iU(C).then(e=>{e&&S({value:e})}),"enter"===v&&(C.historicalExpression||h.previousDomainObjectValue))try{h.processor.getHistoricalValue(C,h).then(e=>{u(e)})}catch(e){console.error(e)}},[]),(0,s.useEffect)(()=>{let{isDirty:e,isTouched:D}=m(C.id),{submission:t,unspecified:S}=C.meta,{calculate:i,defaultValue:r}=C.questionOptions;!e7(_)&&!t?.newValue&&!e&&!S&&(i?.calculateExpression||r)&&n.transformFieldValue(C,_,h),(e||D)&&E(_)},[_]),(0,s.useEffect)(()=>{C.meta.submission?.errors&&r(C.meta.submission.errors),C.meta.submission?.warnings&&l(C.meta.submission.warnings),C.meta.submission?.unspecified&&(r([]),L(C.id))},[C.meta.submission]);let E=e=>{let{errors:D,warnings:t}=DD(C,e,w,{formFields:b,values:f(),expressionContext:{patient:y,mode:v}});if(C.meta.submission&&(C.meta.submission.errors=void 0,C.meta.submission.warnings=void 0),i.length&&!D.length?(L(C.id),r([])):D.length&&(r(D),M(C)),D.length||n.transformFieldValue(C,e,h),l(t),n5(C,h),C.meta.groupId){let e=b.find(e=>e.id===C.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===C.id?C:e),$(e))}};if(!t)return null;let k=t.value;return!D?.targetRendering&&D$(C.questionOptions.rendering)?a().createElement(k,{key:C.id,field:C,value:null,errors:i,warnings:g,setFieldValue:null}):Dv(v,!!C.questionOptions.isTransient,e7(_),d)?a().createElement(e1.tH,{FallbackComponent:DM,onReset:x},a().createElement(eo,{control:p,name:C.id,render:({field:{value:e,onChange:n,onBlur:D}})=>a().createElement("div",null,a().createElement(k,{key:`${C.id}-input-component`,field:C,value:e,errors:i,warnings:g,setFieldValue:e=>{n(e),E(e),D()}}),DL(C)&&a().createElement("div",{className:Db},C.unspecified&&a().createElement(Dy,{key:`${C.id}-unspecified`,field:C,setFieldValue:n,onAfterChange:E,fieldValue:e})),c?.value&&a().createElement("div",null,a().createElement(Df,{key:`${C.id}-previous-value-review`,previousValue:c.value,displayText:c.display,onAfterChange:E,field:C})))})):null};function DM({error:e}){let{t:n}=(0,eX.useTranslation)();return a().createElement(h.HYS,{"aria-label":n("closesNotification","Closes notification"),caption:"",hideCloseButton:!0,lowContrast:!0,onClose:function(){},onCloseButtonClick:function(){},statusIconDescription:n("notification","Notification"),subtitle:e.message,title:n("errorRenderingField","Error rendering field")})}function DL(e){let{rendering:n}=e.questionOptions;return(0,Dt.H)(e.unspecified)&&"toggle"!=n&&"group"!=n&&"repeating"!=n&&"markdown"!=n&&"extension-widget"!=n&&"workspace-launcher"!=n}function D$(e){return"group"===e||"repeating"===e}let D_=({field:e,...n})=>{let{t:D}=(0,eX.useTranslation)(),{formFieldAdapters:t,formFields:S}=Dr(),i=(0,s.useMemo)(()=>e.questions.map(e=>S.find(n=>n.id===e.id)).filter(e=>!e.isHidden).map((D,S)=>{let i=`${D.id}_${S}`;return D.id===e.id?a().createElement(DM,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===D.type&&D$(D.questionOptions.rendering)?a().createElement("div",{key:i,className:u.nestedGroupContainer},a().createElement(D_,{field:D,...n})):t[D.type]?a().createElement("div",{className:c()(u.flexColumn),key:i},a().createElement("div",{className:u.groupContainer},a().createElement(Dw,{fieldId:D.id,valueAdapter:t[D.type]}))):void 0}),[e,S]);return a().createElement("div",{className:u.groupContainer},i.length>1?a().createElement(h.gE_,{legendText:D(e.label),className:u.boldLegend},i):i)},Dx=D_,DC="-esm-form-builder__label__label___hCNId",DE=({value:e,tooltipText:n})=>a().createElement("div",{className:DC},a().createElement(h.lrh,{autoAlign:!0,tabIndex:0,definition:n??""},a().createElement("span",{className:"cds--label"},`${e}:`))),Dk="-esm-form-builder__field-value-view__formField___03eTm",DA="-esm-form-builder__field-value-view__readonly___EsDxp",DT="-esm-form-builder__field-value-view__value___Uo2uV",DO="-esm-form-builder__field-value-view__inlineFlexRow___b4Ii6",DR="-esm-form-builder__field-value-view__inlineFlexColumn___9opmW",DI=({label:e,conceptName:n,value:D,isInline:t})=>a().createElement(a().Fragment,null,t?a().createElement("div",{className:DO},a().createElement("div",{className:DR},a().createElement(DE,{value:e,tooltipText:n})),a().createElement("div",{className:DR},e7(D)?a().createElement(Da,null):a().createElement(Dl,{value:D}))):a().createElement("div",{className:DA},a().createElement("div",{className:Dk},a().createElement(DE,{value:e,tooltipText:n}),a().createElement("div",{className:DT},e7(D)?a().createElement(Da,null):a().createElement(Dl,{value:D}))))),Dj="-esm-form-builder__content-switcher__formField___7p+cd",DN="-esm-form-builder__content-switcher__errorLegend___Wo7IC",DP="-esm-form-builder__content-switcher__boldedLegend___ocVuA",DF="-esm-form-builder__content-switcher__selectedOption___Nhf+y";var DU=D(31362);let DV="-esm-form-builder__field-label__required___v5kNF",DH="-esm-form-builder__field-label__questionLabel___iTCWA",Dz="-esm-form-builder__field-label__tooltipIcon___i1hW9",DW=({field:e,children:n})=>{let{t:D}=(0,eX.useTranslation)();return e.questionInfo?a().createElement(h.m_M,{autoAlign:!0,label:D(e.questionInfo)},a().createElement("div",null,n)):a().createElement(a().Fragment,null,n)},DB=({field:e,customLabel:n})=>{let{t:D}=(0,eX.useTranslation)(),t=!!e.questionInfo,S=n||D(e.label);return a().createElement(DW,{field:e},a().createElement("div",{className:DH,"data-testid":`${e.id}-label`},a().createElement("span",null,S),e.isRequired&&a().createElement("span",{title:D("required","Required"),className:DV},"*"),t&&a().createElement(DU.$$,{size:16,"aria-hidden":"true",className:Dz,"data-testid":`${e.id}-information-icon`})))},Dq=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),u=(0,s.useCallback)(e=>{S(e.name)},[S]),d=(0,s.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),p=(0,s.useMemo)(()=>d.findIndex(e=>e.concept==n),[n,d]),f=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o||(0,Dt.H)(e.readonly)?a().createElement("div",{className:Dj},a().createElement(DI,{label:i(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:f})):!e.isHidden&&a().createElement(h.gE_,{legendText:a().createElement("div",{className:DP},a().createElement(DB,{field:e})),className:c()({[DN]:D.length>0,[DP]:0===D.length})},a().createElement(h.Tps,{onChange:u,selectedIndex:p,className:DF,size:"md"},d.map((n,D)=>a().createElement(h.dOG,{name:n.concept||n.value,text:i(n.label),key:D,disabled:e.isDisabled}))))},DG="-esm-form-builder__date__datePickerWarn___kHnXv",DK="-esm-form-builder__date__datePickerLabel___jB51j",DY="-esm-form-builder__date__boldedLabel___iRLd7",DQ="-esm-form-builder__date__datetime___Vcy8S",DZ="-esm-form-builder__date__datePickerSpacing___qjcEN",DJ="-esm-form-builder__date__timeInput___LsT4x",DX=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),[r,g]=(0,s.useState)(""),{layoutType:l,sessionMode:u,workspaceLayout:d}=Dr(),p=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(u)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,l,d,u),[u,e.readonly,e.inlineRendering,l,d]),f=(0,s.useCallback)(e=>{m(e,r),S(e)},[S,r]),m=(0,s.useCallback)((e,n)=>{if(!e7(n)){let[D,t]=n.split(":").map(Number);e.setHours(D??0,t??0)}},[]),y=(0,s.useCallback)(D=>{let t=D.target.value;g(t);let i="timer"===e.datePickerFormat?new Date:new Date(n);m(i,t),S(i)},[S,m,n]);(0,s.useEffect)(()=>{n&&n instanceof Date&&g([10>n.getHours()?`0${n.getHours()}`:`${n.getHours()}`,10>n.getMinutes()?`0${n.getMinutes()}`:`${n.getMinutes()}`].join(":"))},[n]);let v=(0,s.useMemo)(()=>"timer"===e.datePickerFormat?a().createElement(DB,{field:e}):a().createElement(DB,{field:e,customLabel:i("time","Time")}),[e.datePickerFormat,e.label,i]);return"view"==u||"embedded-view"==u||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:i(e.label),value:n instanceof Date?ng(e,n):n,conceptName:e.meta?.concept?.display,isInline:p}):!e.isHidden&&a().createElement("div",{className:DQ},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&a().createElement("div",{className:DZ},a().createElement(h.Wdr,null,a().createElement(o.OpenmrsDatePicker,{id:e.id,onChange:f,labelText:a().createElement("span",{className:DK},a().createElement(DB,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,Dt.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:D.length>0,invalidText:D[0]?.message,value:n})),t.length>0?a().createElement("div",{className:DG},t[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?a().createElement("div",null,a().createElement(h.Wdr,null,a().createElement(h.AG,{className:c()(DY,DJ),id:e.id,labelText:v,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!n,invalid:D.length>0,invalidText:D[0]?.message,readOnly:(0,Dt.H)(e.readonly),warning:t.length>0,warningText:t[0]?.message,value:r||(n instanceof Date?n.toLocaleDateString(window.navigator.language):n),onChange:y}))):null)},D1=({field:e,setFieldValue:n})=>{let D=Dr();return(0,s.useEffect)(()=>{e.meta?.initialValue?.omrsObject||e7(e.meta.fixedValue)||(n(e.meta.fixedValue),D.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,D))},[]),a().createElement(a().Fragment,null)};var D2=D(29012);let D4="-esm-form-builder__markdown-wrapper__markdownWrapper___l1Syp",D3={a:({node:e,...n})=>a().createElement("a",{...n,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},D0=({markdown:e})=>a().createElement("div",{className:D4},a().createElement(D2.o,{children:e,unwrapDisallowed:!0,allowedElements:["h1","h2","h3","h4","h5","h6","p","strong","em","code","pre","ul","ol","li","a","blockquote","hr","br"],components:D3})),D8=({field:e})=>{let{t:n}=(0,eX.useTranslation)(),D=e=>Array.isArray(e)?e.map(e=>n(e,{defaultValue:e,interpolation:{escapeValue:!1}})).join("\n\n"):"string"==typeof e?n(e,{defaultValue:e,interpolation:{escapeValue:!1}}):e;return!e.isHidden&&a().createElement(D0,{markdown:D(e.value)})},D9={boldedLabel:"-esm-form-builder__multi-select__boldedLabel___S2peR",errorLabel:"-esm-form-builder__multi-select__errorLabel___E6HgK",selectionDisplay:"-esm-form-builder__multi-select__selectionDisplay___ToQER",tagContainer:"-esm-form-builder__multi-select__tagContainer___rt9TQ",checkbox:"-esm-form-builder__multi-select__checkbox___+3cXj"},D7=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),[c,u]=(0,s.useState)(0),[d,p]=(0,s.useState)([]),f=(0,s.useRef)(!0),m=e.questionOptions.answers.filter(e=>!e.isHidden).map((n,D)=>({id:`${e.id}-${n.concept}`,concept:n.concept,label:i(n.label),key:D,disabled:n.disable?.isDisabled,readonly:(0,Dt.H)(e.readonly)})),y=(0,s.useMemo)(()=>n?.length&&c<1?(u(c+1),m.filter(e=>n?.includes(e.concept))):[],[n]),v=({selectedItems:e})=>{S(e.map(e=>e.concept))},b=(0,s.useMemo)(()=>(0,Dt.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,s.useEffect)(()=>{f.current&&1===c&&(p(y.map(e=>e.concept)),f.current=!1)},[y,f]);let w=e=>{let n,D=e.concept;p(n=d.some(e=>e===D)?d.filter(e=>e!==D):d.some(e=>e===D)?d.filter(e=>e!==D):[...d,D]),S(n)},M=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o?a().createElement("div",{className:D9.formField},a().createElement(DI,{label:i(e.label),value:n?l[e.type]?.getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:M})):!e.isHidden&&a().createElement(a().Fragment,null,a().createElement("div",{className:D9.boldedLabel},a().createElement(h.Wdr,null,b?a().createElement(h.Qp5,{disabled:e.isDisabled,id:e.id,initialSelectedItems:y,invalid:D.length>0,invalidText:D[0]?.message,items:m,itemToString:e=>e?i(e.label):" ",key:e.id,onChange:v,placeholder:i("search","Search")+"...",readOnly:(0,Dt.H)(e.readonly),titleText:a().createElement(DB,{field:e}),warn:t.length>0,warnText:t[0]?.message}):a().createElement(h.$QX,{legendText:a().createElement(DB,{field:e}),readOnly:(0,Dt.H)(e.readonly)},m?.map((n,D)=>a().createElement(h.Sc0,{className:D9.checkbox,checked:d.some(e=>e===n.concept),disabled:n.disabled,id:`${e.id}-${n.concept}`,key:`${e.id}-${n.concept}-${D}`,labelText:i(n.label),name:n.concept,onChange:()=>w(n),readOnly:(0,Dt.H)(e.readonly)}))))),b&&a().createElement("div",{className:D9.selectionDisplay},n?.length?a().createElement("div",{className:D9.tagContainer},l[e.type]?.getDisplayValue(e,n)?.map((e,n)=>a().createElement(h.vwO,{key:n,type:"cool-gray"},i(e)))):a().createElement(Da,null)))},D6={boldedLabel:"-esm-form-builder__number__boldedLabel___knlll",errorLabel:"-esm-form-builder__number__errorLabel___nt7Zx",controlWidthConstrained:"-esm-form-builder__number__controlWidthConstrained___dJyLz"},D5=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g}=Dr(),l=(0,s.useMemo)(()=>isNaN(n)?"":n??"",[n]),u=(0,s.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),d=(0,s.useCallback)((e,{value:n})=>{let D=u(n);S(isNaN(D)?void 0:D)},[S,u]),p=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]),f=u(e.questionOptions.max),m=u(e.questionOptions.min);return"view"==o||"embedded-view"==o?a().createElement("div",{className:D6.formField},a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:p})):!e.isHidden&&a().createElement(h.Wdr,null,a().createElement(h.Q7x,{id:e.id,invalid:D.length>0,invalidText:D[0]?.message,label:a().createElement(DB,{field:e}),max:f,min:m,name:e.id,value:l,onChange:d,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),className:c()(D6.controlWidthConstrained,D6.boldedLabel),warn:t.length>0,warnText:t[0]?.message,step:e.questionOptions.step??.01}))},te="-esm-form-builder__radio__boldedLegend___MaNSB",tn="-esm-form-builder__radio__errorMessage___oqROk",tD=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),c=e=>{S(e)},u=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:i(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&a().createElement(h.gE_,{legendText:a().createElement(DB,{field:e}),className:te,disabled:e.isDisabled,invalid:D?.length>0},a().createElement(h.zWQ,{name:e.id,valueSelected:n,onChange:c,readOnly:(0,Dt.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((D,t)=>a().createElement(h.aaP,{id:`${e.id}-${D.label}`,labelText:i(D.label)??"",value:D.concept,key:t,onClick:e=>{n&&e.target.checked?(e.target.checked=!1,e.preventDefault(),c(null)):c(D.concept)}}))),(D?.length>0||t?.length>0)&&a().createElement("div",null,a().createElement("div",{className:tn},D.length>0?D[0].message:t.length>0?t[0].message:null)))},tt="-esm-form-builder__dropdown__boldedLabel___y7U7P",tS=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:l,formFieldAdapters:c}=Dr(),u=(0,s.useCallback)(({selectedItem:e})=>{S(e===g.ZA?null:e)},[S]),d=(0,s.useCallback)(n=>{let D=e.questionOptions.answers.find(e=>e.value?e.value==n:e.concept==n);return D?i(D.label):""},[e.questionOptions.answers,i]),p=(0,s.useMemo)(()=>{let n=e.questionOptions.answers;return n.some(e=>e.value===g.ZA)||n.unshift({value:g.ZA,label:i("chooseAnOption","Choose an option")}),n.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),f=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,l,o),[o,e.readonly,e.inlineRendering,r,l]);return"view"==o||"embedded-view"==o?a().createElement(DI,{label:i(e.label),value:n?c[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&a().createElement("div",{className:tt},a().createElement(h.Wdr,null,a().createElement(h.msM,{"aria-label":i(e.label),disabled:e.isDisabled,id:e.id,invalid:D.length>0,invalidText:D[0]?.message,items:p,itemToString:d,label:"",onChange:u,readOnly:(0,Dt.H)(e.readonly),selectedItem:e7(n)?g.ZA:n,titleText:a().createElement(DB,{field:e}),warn:t.length>0,warnText:t[0]?.message})))},ti="-esm-form-builder__text-area__boldedLabel___SSRKf",tr=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),[r,o]=(0,s.useState)(n),{layoutType:g,sessionMode:l,workspaceLayout:c}=Dr(),u=e=>{e.preventDefault(),r!==n&&o(n)},d=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(l)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,g,c,l),[l,e.readonly,e.inlineRendering,g,c]);return"view"==l||"embedded-view"==l?a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:d}):!e.isHidden&&a().createElement("div",{className:ti},a().createElement(h.Wdr,null,a().createElement(h.fs1,{id:e.id,labelText:a().createElement(DB,{field:e}),name:e.id,onChange:S,onBlur:u,value:n||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),invalid:D.length>0,invalidText:D[0]?.message,warn:t.length>0,warnText:t[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))},to="-esm-form-builder__text__boldedLabel___LG-wl",tg=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g}=Dr(),[l,c]=(0,s.useState)(null),u=e=>{e.preventDefault(),l!==n&&c(n)},d=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o?a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:d}):!e.isHidden&&a().createElement("div",{className:to},a().createElement(h.Wdr,null,a().createElement(h.ksK,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:D.length>0,invalidText:D[0]?.message,labelText:a().createElement(DB,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:u,onChange:e=>{S(e.target.value)},readOnly:(0,Dt.H)(e.readonly),value:n??"",warn:t.length>0,warnText:t.length>0?t[0].message:void 0})))},ts="-esm-form-builder__toggle__boldedLabel___mj4Gi",ta=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),r=Dr(),o=e=>{S(e)};(0,s.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=r.sessionMode||r.formFieldAdapters[e.type].transformFieldValue(e,n??!1,r)},[]);let g=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(r.sessionMode)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r.layoutType,r.workspaceLayout,r.sessionMode),[r.sessionMode,e.readonly,e.inlineRendering,r.layoutType,r.workspaceLayout]);return"view"==r.sessionMode||"embedded-view"==r.sessionMode?a().createElement(DI,{label:i(e.label),value:e7(n)?n:r.formFieldAdapters[e.type].getDisplayValue(e,n),conceptName:e.meta?.concept?.display,isInline:g}):!e.isHidden&&a().createElement("div",{className:ts},a().createElement(h.lMk,{labelText:i(e.label),className:ts,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:o,toggled:!!n,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly)}))};var tl=D(44861);let tc=[{name:"drug",datasource:{name:"drug_datasource",config:{class:"8d490dfc-c2cc-11de-8d13-0010c6dffd0f"}}},{name:"select-concept-answers",datasource:{name:"select_concept_answers_datasource",config:{concept:""}}},{name:"encounter-provider",datasource:{name:"provider_datasource"}},{name:"encounter-role",datasource:{name:"encounter_role_datasource"}},{name:"encounter-location",datasource:{name:"location_datasource"}},{name:"problem",datasource:{name:"problem_datasource",config:{class:["8d4918b0-c2cc-11de-8d13-0010c6dffd0f","8d492954-c2cc-11de-8d13-0010c6dffd0f","8d492b2a-c2cc-11de-8d13-0010c6dffd0f"]}}}],tu=e=>tc.find(n=>n.name===e),th=e=>{let n=e.questionOptions.config?.referencedField,{methods:{control:D}}=Dr();return ei({control:D,name:n,exact:!0,disabled:!n})},td="-esm-form-builder__ui-select-extended__boldedLabel___nE2bK",tp="-esm-form-builder__ui-select-extended__loader___F1lqE",tf="-esm-form-builder__ui-select-extended__item___1+q74",tm="-esm-form-builder__ui-select-extended__code___Cd2IH",ty="-esm-form-builder__ui-select-extended__label___GOcHS",tv=({field:e,errors:n,warnings:D,setFieldValue:t})=>{let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)([]),[o,g]=(0,s.useState)(!1),[l,c]=(0,s.useState)(!1),[u,d]=(0,s.useState)(""),p=(0,s.useRef)(!1),[f,m]=(0,s.useState)(null),[y,v]=(0,s.useState)({}),b=th(e),w=(0,Dt.H)(e.questionOptions.isSearchable),{layoutType:M,sessionMode:L,workspaceLayout:$,methods:{control:_,getFieldState:x}}=Dr(),C=ei({control:_,name:e.id,exact:!0}),{isDirty:E}=x(e.id),k=(0,s.useMemo)(()=>!!(ni(L)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,M,$,L),[L,e.readonly,e.inlineRendering,M,$]),A=(0,s.useMemo)(()=>i.find(e=>e.uuid==C)||null,[i,C]),T=(0,tl.A)((e,n)=>{c(!0),n.fetchData(e,y).then(e=>{if(e.length){let D=i.find(e=>e.uuid==C),t=e.map(e=>n.toUuidAndDisplay(e,y));D&&!t.some(e=>e.uuid==D.uuid)&&t.unshift(D),r(t)}c(!1)}).catch(e=>{console.error(e),c(!1)})},300),O=(0,s.useCallback)(e=>i.some(n=>n.display?.toLowerCase().includes(e.toLowerCase())),[i]);return((0,s.useEffect)(()=>{let n=e.questionOptions?.datasource?.name;v(n?e.questionOptions.datasource?.config:tu(e.questionOptions.rendering)?.datasource?.config),iB(n||e.questionOptions.rendering).then(e=>m(e))},[e.questionOptions?.datasource]),(0,s.useEffect)(()=>{let n=!1;return f&&!(0,Dt.H)(e.questionOptions.isSearchable)&&(r([]),g(!0),f.fetchData(null,{...y,referencedValue:b}).then(e=>{n||(r(e.map(e=>f.toUuidAndDisplay(e,y))),g(!1))}).catch(e=>{n||(console.error(e),g(!1),r([]))})),()=>{n=!0}},[f,y,b]),(0,s.useEffect)(()=>{f&&w&&!e7(u)&&!O(u)&&T(u,f)},[f,u,y]),(0,s.useEffect)(()=>{let e=!1;return C&&!E&&f&&w&&!i.length&&(g(!0),f.fetchSingleItem(C,y).then(n=>{e||(r([f.toUuidAndDisplay(n,y)]),g(!1))}).catch(n=>{e||(console.error(n),g(!1))})),()=>{e=!0}},[C,E,f,w,i,y]),o)?a().createElement(h.dF7,null):ni(L)||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:S(e.label),value:C?tb(i.find(e=>e.uuid==C)):C,conceptName:e.meta?.concept?.display,isInline:k}):!e.isHidden&&a().createElement("div",{className:td},a().createElement(h.Wdr,null,a().createElement(h.a32,{id:e.id,titleText:a().createElement(DB,{field:e}),items:i,itemToElement:e=>a().createElement("span",{className:tf},e?.code&&a().createElement("span",{className:tm},e.code),a().createElement("span",{className:ty},e?.display)),itemToString:tb,selectedItem:A,placeholder:w?S("search","Search")+"...":null,onChange:({selectedItem:e})=>{p.current=!0,t(e?.uuid)},disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),invalid:n.length>0,invalidText:n.length&&n[0].message,onInputChange:n=>{if(p.current){p.current=!1;return}e.questionOptions.isSearchable&&d(n)},onBlur:e=>{e.target.value||t(null)}}),l&&a().createElement(h.OuH,{className:tp,description:S("searching","Searching")+"..."})))};function tb(e){return e?.code?`${e.code} ${e.display}`:e?.display??""}let tw="-esm-form-builder__workspace-launcher__label___E9RiP",tM="-esm-form-builder__workspace-launcher__workspaceButton___MlMFr",tL="-esm-form-builder__workspace-launcher__noPatientNotification___28OZv",t$=({field:e})=>{let{t:n}=(0,eX.useTranslation)(),{sessionMode:D,patient:t,visit:S}=Dr(),i=async()=>{let D=e.questionOptions?.workspaceName;if(!D)return void(0,o.showSnackbar)({title:n("invalidWorkspaceName","Invalid workspace name."),subtitle:n("invalidWorkspaceNameSubtitle","Please provide a valid workspace name."),kind:"error",isLowContrast:!0});let i=e.questionOptions?.workspaceProps??{},r={patient:t,patientUuid:t?.id,visitContext:S};try{await (0,o.launchWorkspace2)(D,i,r)}catch(e){(0,o.showSnackbar)({title:n("errorLaunchingWorkspace","Error launching workspace"),subtitle:e?.message??n("errorLaunchingWorkspaceSubtitle","An unexpected error occurred while launching the workspace."),kind:"error",isLowContrast:!0})}};return e.isHidden||ni(D)?null:a().createElement("div",null,a().createElement("div",{className:tw},a().createElement(DB,{field:e})),a().createElement("div",{className:tM},a().createElement(h.$nd,{disabled:(0,Dt.H)(e.readonly??!1)||!t,onClick:i},e.questionOptions.buttonLabel?n(e.questionOptions.buttonLabel):n("launchWorkspace","Launch Workspace")),!t&&a().createElement(h.jeF,{className:tL,kind:"info",lowContrast:!0,hideCloseButton:!0,title:n("noPatientContext","No patient selected"),subtitle:n("noPatientContextSubtitle","This button is only active when a patient chart is open.")})))};var t_=D(20903);function tx(e,n,D){let t=[],S=(0,t_.A)(e);return S.questionOptions.repeatOptions={...S.questionOptions.repeatOptions??{}},S.meta={repeat:{...S.meta??{},isClone:!0},initialValue:{omrsObject:n}},S.id=`${S.id}_${D}`,S.questions?.forEach(e=>{t.push(e.id),e.id=`${e.id}_${D}`,e.meta.groupId=S.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,nD(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=tC(e.hide.hideWhenExpression,D,t)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=tC(e.failsWhenExpression,D,t))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=tC(e.questionOptions.calculate?.calculateExpression,D,t))}),S}function tC(e,n,D){let t=[...new Set(D)];if(!t.length)return e;let S=t.slice().sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return e.replace(RegExp(`\\b(?:${S})\\b`,"g"),e=>`${e}_${n}`)}function tE(e,n){let D=Number(e);return!(e7(e)||isNaN(D))&&n>=D}let tk=[],tA={async getInitialValue(e,n,D){let t=tU(ne((n??D.domainObjectValue).obs),tk,e);return nn(e,"file")&&t?.length?tV(e,t):tT(e,t,!0)},async getPreviousValue(e,n,D){let t=n??D.previousDomainObjectValue;if(t){let n=tT(e,tU(ne(t.obs),tk,e),!0);if(!e7(n))return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:(e,n)=>{let D=e.questionOptions.rendering;return e7(n)?n:n instanceof Date?ng(e,n):"checkbox"===D?n.map(n=>e.questionOptions.answers?.find(e=>e.concept==n)?.label):"toggle"===D?n?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:g.FU.includes(D)?e.questionOptions.answers?.find(e=>e.concept==n)?.label:n},transformFieldValue:(e,n,D)=>(nD(e),!e.meta.initialValue?.omrsObject&&e7(n))?null:nn(e,"checkbox")?tP(e,Array.isArray(n)?n:[n]):nn(e,"file")?tF(e,n):!e7(n)&&tN(e,n)?nt(e,tI(e,n),void 0):e.meta.initialValue?.omrsObject&&e7(n)?nt(e,void 0,tR(e.meta.initialValue.omrsObject)):e7(n)?null:nt(e,tO(e,n),void 0),tearDown:function(){tk=[]}};function tT(e,n=[],D=!1){let t=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),n.length){if("checkbox"==t)return tk.push(...n.map(e=>e.uuid)),e.meta.initialValue.omrsObject=D?n:null,n.map(e=>e.value.uuid);let S=n[0];if(D&&(e.meta.initialValue.omrsObject={...S}),tk.push(S.uuid),"string"==typeof S.value||"number"==typeof S.value){if(t.startsWith("date")){let n=nr(S.value);return D&&(e.meta.initialValue.omrsObject.value=e4()(n).format("YYYY-MM-DD HH:mm")),n}return S.value}return"toggle"==t?S.value.uuid===g.t$:"fixed-value"==t?e.fixedValue:S.value?.uuid}return""}function tO(e,n){return e7(n)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?tj(e,n):n},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function tR(e){return{uuid:e.uuid,voided:!0}}function tI(e,n){let D=e.meta.initialValue?.omrsObject,t=e.questionOptions.rendering.startsWith("date")?tj(e,n):n;return{uuid:D.uuid,value:t,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function tj(e,n){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return e4()(n).format("YYYY-MM-DD");case"timer":return e4()(n).format("HH:mm");case"both":return e4()(n).format("YYYY-MM-DD HH:mm")}return n}function tN(e,n){let D=e.meta.initialValue?.omrsObject;return!e7(D)&&(g.FU.includes(e.questionOptions.rendering)?D.value.uuid!==n:nn(e,"date")?0!==e4()(n).diff(e4()(D.value),"D"):nn(e,"datetime")||"both"===e.datePickerFormat?0!==e4()(n).diff(e4()(D.value),"minute"):nn(e,"toggle")?D.value.uuid===g.t$!==n:D.value!==n)}function tP(e,n=[]){let D=e.meta.initialValue?.omrsObject;if(D?.length&&e7(n))return nt(e,null,D.map(e=>tR(e)));if(D?.length&&!e7(n)){let t=D.filter(e=>!n.includes(e.value.uuid));return nt(e,n.filter(e=>!D.some(n=>n.value.uuid===e)).map(n=>tO(e,n)),t.map(e=>tR(e)))}return nt(e,n.map(n=>tO(e,n)),void 0)}function tF(e,n=[]){let D=n.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),t=e.meta.submission.newValue=n.filter(e=>!e.uuid).map(n=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...n}));return nt(e,t,D)}function tU(e,n,D){let t=e.filter(e=>!!nn(D,"file")&&e.formFieldPath==`rfe-forms-${D.id}`||e.formFieldPath==`rfe-forms-${D.id}`&&e.concept.uuid==D.questionOptions.concept);if(!t?.length){let t=e.filter(e=>e.concept.uuid==D.questionOptions.concept);return n?.length?t.filter(e=>!n.includes(e.uuid)):t}return t}async function tV(e,n){let D=new AbortController,t=await Promise.all(n.map(e=>(0,o.getAttachmentByUuid)(e.uuid,D).then(e=>e.data).catch(n=>(console.error(`Failed to fetch attachment ${e.uuid}:`,n),null))));return e.meta.initialValue={omrsObject:n},t.filter(Boolean).map(e=>({uuid:e.uuid,base64Content:`${window.openmrsBase}${o.attachmentUrl}/${e.uuid}/bytes`,fileName:e.filename,fileDescription:e.comment,fileType:e.bytesContentFamily?.toLowerCase()}))}let tH={validate:(e,n)=>!e7(n)&&g.FU.includes(e.questionOptions.rendering)&&!(Array.isArray(n)?n:[n]).every(n=>e.questionOptions.answers?.find(e=>e.concept===n||e.value===n))?[{resultType:"error",errCode:"invalid.defaultValue",message:"Value not found in coded answers list"}]:e7(n)||"date"!=e.questionOptions.rendering||e4()(n).isValid()?!e7(n)&&"number"==e.questionOptions.rendering&&isNaN(n)?[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid numerical value: '${n}'`}]:[]:[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid date value: '${n}'`}]},tz=[],tW="testorder",tB="6f0c9a92-6f24-11e3-af88-005056821db0",tq={transformFieldValue:function(e,n,D){if("edit"==D.sessionMode&&e.meta.initialValue?.omrsObject)return tK(n,e,D.currentProvider.uuid);let t=tG(n,e,D.currentProvider.uuid);return nt(e,t,null),t},getInitialValue:function(e,n,D){let t=e.questionOptions.answers?.map(e=>e.concept)||[],S=n?.orders.filter(e=>!tz.includes(e.uuid)&&!e.voided).find(e=>t.includes(e.concept.uuid));return S?(e.meta={...e.meta||{},initialValue:{omrsObject:S,refinedValue:S.concept.uuid}},tz.push(S.uuid),S.concept.uuid):null},getPreviousValue:function(e,n,D){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){tz=[]}};function tG(e,n,D){return e?{action:"NEW",concept:e,type:n?.questionOptions?.orderType||tW,careSetting:n?.questionOptions?.orderSettingUuid||tB,orderer:D}:null}function tK(e,n,D){let t=n.meta.initialValue?.omrsObject;if(e===t?.concept?.uuid)return nD(n),null;let S={uuid:t?.uuid,voided:!0};return nt(n,tG(e,n,D),S),n.meta.submission.newValue||null}let tY=[],tQ={transformFieldValue:function(e,n,D){if(e.meta.initialValue?.omrsObject&&e7(n))return nt(e,void 0,t1(e.meta.initialValue.omrsObject));if(!e7(n)){let t=e.meta.initialValue?.omrsObject;if(tX(t,n))return nt(e,tJ(n,e,t,D.patient.id),void 0)}let t=tZ(n,e,D.patient.id);return nt(e,t,null),t},getInitialValue:function(e,n,D){let t=(n??D.domainObjectValue).diagnoses.find(n=>n.formFieldPath===`rfe-forms-${e.id}`);return t?(e.meta={...e.meta||{},initialValue:{omrsObject:t,refinedValue:t.diagnosis?.coded.uuid}},tY.includes(t.diagnosis?.coded?.uuid)||tY.push(t.diagnosis?.coded?.uuid),t.diagnosis?.coded.uuid):null},getPreviousValue:function(e,n,D){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){tY=[]}},tZ=(e,n,D)=>e?{patient:D,condition:null,diagnosis:{coded:e},certainty:(0,Dt.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms"}:null;function tJ(e,n,D,t){return{patient:t,condition:null,diagnosis:{coded:e},certainty:(0,Dt.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms",uuid:D.uuid}}function tX(e,n){return!e7(e)&&e.value!==n}function t1(e){return{uuid:e.uuid,voided:!0}}function t2(e,n,D,t,S){let{patient:i,formJson:r,domainObjectValue:o,formFields:g,visit:s,deletedFields:a}=e,l=[...g,...a],c=[];Se(c,l);let u=St(l),h=Sg(l),d={};return o?(Object.assign(d,o),-1===d.encounterProviders.findIndex(e=>e.provider.uuid==t)&&(d.encounterProviders=[...d.encounterProviders,{provider:t,encounterRole:D}]),n&&(d.encounterDatetime=n),d.location=S,d.form={uuid:r.uuid},s&&(d.visit=s.uuid),d.obs=c,d.orders=u,d.diagnoses=h):(d={patient:i.id,location:S,encounterType:r.encounterType,encounterProviders:[{provider:t,encounterRole:D}],obs:c,form:{uuid:r.uuid},visit:s?.uuid,orders:u,diagnoses:h},n&&(d.encounterDatetime=n)),d}function t4(e,n){return e.filter(e=>"patientIdentifier"===e.type&&nS(e)).map(e=>e.meta.submission.newValue)}function t3(e,n){return n.map(n=>(0,nL.savePatientIdentifier)(n,e.id))}function t0(e){return e.filter(e=>"personAttribute"===e.type&&nS(e)).map(e=>e.meta.submission.newValue)}function t8(e,n){return n.map(n=>(0,nL.savePersonAttribute)(n,e.id))}function t9(e,n,D){let t=e.filter(e=>"programState"===e.type&&nS(e)),S=new Map;return t.forEach(e=>{let t=e.questionOptions.programUuid,i=e.meta.submission.newValue,r=D.find(e=>e.program.uuid===t);r?S.has(t)?S.get(t).states.push(i):S.set(t,{uuid:r.uuid,states:[i]}):S.has(t)?S.get(t).states.push(i):S.set(t,{patient:n.id,program:t,states:[i],dateEnrolled:e4()().format()})}),Array.from(S.values())}function t7(e){let n=new AbortController;return Promise.all(e.map(e=>(0,nL.saveProgramEnrollment)(e,n)))}function t6(e,n,D){let t=e?.filter(e=>e?.questionOptions.rendering==="file"&&nS(e));return t?.length?Promise.all(t.flatMap(e=>{let D="string"==typeof n?.patient?n?.patient:n?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,nL.createAttachment)(D,n.uuid,e))})):[]}function t5(e){let{formFields:n,location:D,currentProvider:t,customDependencies:S,sessionDate:i,domainObjectValue:r,visit:o}=e,{defaultEncounterRole:g}=S,s=n.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||g?.uuid,a=n.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||t.uuid,l=n.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,c=o?.stopDatetime?i:void 0;return{encounterRole:s,encounterProvider:a,encounterDate:l??(r?.encounterDatetime?new Date(r.encounterDatetime):c),encounterLocation:n.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||r?.location?.uuid||D.uuid}}function Se(e,n){n.filter(e=>Si(e)).forEach(n=>Sn(e,n))}function Sn(e,n){(n.isHidden||n.isParentHidden)&&n.meta.initialValue.omrsObject?SS(e,(Array.isArray(n.meta.initialValue.omrsObject)?n.meta.initialValue.omrsObject:[n.meta.initialValue.omrsObject]).map(e=>tR(e))):"obsGroup"===n.type?SD(e,n):(nn(n,"file")||SS(e,n.meta.submission.newValue),SS(e,n.meta.submission.voidedValue))}function SD(e,n){if(n.meta.submission?.voidedValue)return void SS(e,n.meta.submission.voidedValue);let D=tO(n,null);n.meta.initialValue?.omrsObject&&(D.uuid=n.meta.initialValue.omrsObject.uuid),n.questions.forEach(e=>{if("obsGroup"===e.type){let n=[];SD(n,e),SS(D.groupMembers,n)}else nS(e)&&(SS(D.groupMembers,e.meta.submission.newValue),SS(D.groupMembers,e.meta.submission.voidedValue))}),(D.groupMembers?.length||D.voided)&&SS(e,D)}function St(e){return e.filter(e=>"testOrder"===e.type&&nS(e)).flatMap(e=>[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function SS(e,n){n&&(Array.isArray(n)?e.push(...n):e.push(n))}function Si(e){let{questionOptions:{isTransient:n},type:D}=e;return!n&&!!["obs","obsGroup"].includes(D)&&!e.meta.groupId&&(!!((e.isHidden||e.isParentHidden)&&e.meta.initialValue?.omrsObject)||!e.isHidden&&!e.isParentHidden&&("obsGroup"===D||nS(e)))}function Sr(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==g.t$;let n=tH.validate(e,e.questionOptions.defaultValue);return n.length?(console.error(`Default value validation errors for field "${e.id}" with value "${e.questionOptions.defaultValue}":`,n),null):e.questionOptions.defaultValue}async function So(e,n,D,t){let S=1,{formFieldAdapters:i}=t,r=n.obs.filter(n=>n.concept.uuid===e.questionOptions.concept&&n.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!tk.includes(n.uuid)),o=n.orders.filter(n=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(n.concept?.uuid)&&!tz.includes(n.uuid));if("testOrder"===e.type)return Promise.all(o.filter(e=>!e.voided).map(async n=>{let r=tx(e,n,S++);return D[r.id]=await i[e.type].getInitialValue(r,{orders:[n]},t),r}));let g=n.diagnoses.filter(n=>!n.voided&&!tY.includes(n?.diagnosis?.coded.uuid)&&n.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(g.map(async n=>{let S=parseInt(n.formFieldPath.split("_")[1]),r=tx(e,n,S);return D[r.id]=await i[e.type].getInitialValue(r,{diagnoses:[n]},t),tY.includes(n.diagnosis.coded.uuid)||tY.push(n.diagnosis.coded.uuid),r})):Promise.all(r.map(async n=>{let r=tx(e,n,S++);return await Promise.all(r.questions.map(async S=>{D[S.id]=await i[e.type].getInitialValue(S,{obs:[n]},t)})),tk.push(n.uuid),[r,...r.questions]})).then(e=>e.flat())}function Sg(e){return e.filter(e=>"diagnosis"===e.type&&nS(e)).map(e=>e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function Ss(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class Sa{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,n,D){return Promise.resolve({})}constructor(e){Ss(this,"formJson",void 0),Ss(this,"domainObjectValue",void 0),this.formJson=e}}var Sl=D(45278),Sc=D(18348),Su=D(92049),Sh=D(53098),Sd="[object String]";let Sp=function(e){return"string"==typeof e||!(0,Su.A)(e)&&(0,Sh.A)(e)&&(0,Sc.A)(e)==Sd};function Sf(e){let[n,D]=(0,s.useState)(null),[t,S]=(0,s.useState)(!0),[i,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let n=new AbortController;return!e7(e.encounter)&&Sp(e.encounter)?(0,o.openmrsFetch)(`${o.restBaseUrl}/encounter/${e.encounter}?v=${g.RZ}`,{signal:n.signal}).then(e=>{D(e.data),S(!1)}).catch(e=>{r(e)}):(e7(e.encounter)||D(e.encounter),S(!1)),()=>{n.abort()}},[e.encounter]),{encounter:n,error:i,isLoading:t}}var Sm=D(66148),Sy=D.n(Sm);function Sv(){let{data:e,error:n,isLoading:D}=Sy()(`${o.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,o.openmrsFetch),t=e?.data.results.find(e=>"Clinician"===e.name);return t?{encounterRole:t,error:n,isLoading:D}:{encounterRole:e?.data.results[0],error:n,isLoading:D}}var Sb=D(73391),Sw=D.n(Sb);let SM=e=>{let n="custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,state:(uuid,name,retired,concept:(uuid),programWorkflow:(uuid)))",D=`${o.restBaseUrl}/programenrollment?patient=${e}&v=${n}`,{data:t,error:S,isLoading:i}=Sw()(e?D:null,o.openmrsFetch),r=t?.data?.results.length>0?t?.data.results.sort((e,n)=>n.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:r?.filter(e=>!e.dateCompleted),error:S,isLoading:i}},SL=(e,n)=>{let{activePrograms:D,error:t,isLoading:S}=SM(n.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:D,errorFetchingPatientPrograms:t,isLoadingPatientPrograms:S}};function S$(e){let[n,D]=(0,s.useState)(!0),{encounter:t,isLoading:S}=Sf(e.formJson),{encounterRole:i,isLoading:r}=Sv(),{isLoadingPatientPrograms:o,patientPrograms:g}=SL(e.patient?.id,e.formJson);return(0,s.useEffect)(()=>{D(o||S||r)},[o,S,r]),{data:{encounter:t,patientPrograms:g,encounterRole:i},isLoading:n,error:null,updateContext:(n,{setDomainObjectValue:D,setCustomDependencies:S})=>{e.processor.domainObjectValue=t,D(t),S(e=>({...e,patientPrograms:g,defaultEncounterRole:i}))}}}let S_={checkbox:[],toggle:!1,text:""},Sx=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class SC extends Sa{prepareFormSchema(e){let n=new Set;function D(e,t,S,i){e.id&&n.add(e.id),e.inlineRendering=e.inlineRendering??t.inlineRendering??S.inlineRendering??i.inlineRendering,e.readonly=e.readonly??t.readonly??S.readonly??i.readonly,e.questionOptions?.rendering!="fixed-value"||e.meta.fixedValue||(e.meta.fixedValue=e.value,delete e.value),(e.questionOptions?.rendering=="group"||"obsGroup"===e.type)&&e.questions?.forEach(n=>(n.readonly=n.readonly??e.readonly,D(n,t,S,i)))}return e.pages.forEach(n=>{n.sections.forEach(t=>{t.questions.forEach(S=>{D(S,t,n,e)})})}),Sk(e,n),e}async processSubmission(e,n){let{encounterRole:D,encounterProvider:t,encounterDate:S,encounterLocation:i}=t5(e),r=(e,n,D)=>(0,o.translateFrom)(Sl.L,e,n,D),g=t4(e.formFields,i),s=t2(e,S,D,t,i);try{await Promise.all(t3(e.patient,g)),g?.length&&(0,o.showSnackbar)({title:r("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let n=t0(e.formFields);await Promise.all(t8(e.patient,n)),n?.length&&(0,o.showSnackbar)({title:r("personAttributesSaved","Person attribute(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let n=t9(e.formFields,e.patient,e.customDependencies.patientPrograms),D=await await t7(n);D?.length&&(0,o.showSnackbar)({title:r("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:D}=await (0,nL.saveEncounter)(n,s,s.uuid),t=D.orders.map(e=>e.orderNumber),S=D.diagnoses.map(e=>e.display);t.length&&(0,o.showSnackbar)({title:r("ordersSaved","Order(s) saved successfully"),subtitle:t.join(", "),kind:"success",isLowContrast:!0}),S.length&&(0,o.showSnackbar)({title:r("diagnosisSaved","Diagnosis(es) saved successfully"),subtitle:S.join(", "),kind:"success",isLowContrast:!0});try{let t=await t6(e.formFields,D,n);t?.length&&(0,o.showSnackbar)({title:r("attachmentsSaved","Attachment(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){console.error("Error saving attachments",n);let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return D}catch(n){console.error("Error saving encounter",n);let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:S$}}async getInitialValues(e){let{domainObjectValue:n,formFields:D,formFieldAdapters:t}=e,S={},i=[];if(n){await Promise.all(D.map(async D=>{let r=t[D.type];if(D.meta.initialValue?.omrsObject&&!e7(D.meta.initialValue.refinedValue)){S[D.id]=D.meta.initialValue.refinedValue;return}if(r){nn(D,"repeating")&&!D.meta?.repeat?.isClone&&i.push(D);let t=null;try{t=await r.getInitialValue(D,n,e),D.meta.initialValue.refinedValue=t}catch(e){console.error(e)}if("obsGroup"===D.type)return;if(e7(t)?e7(D.questionOptions.defaultValue)?S[D.id]=S_[D.questionOptions.rendering]??"":S[D.id]=Sr(D):S[D.id]=t,D.questionOptions.calculate?.calculateExpression)try{await SE(D,S,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${D.type}`)}));let r=await Promise.all(i.flatMap(D=>So(D,n,S,e))).then(e=>e.flat());D.push(...r)}else{let n=D.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),i=[];await Promise.all(n.map(async n=>{let D=t[n.type];if(S[n.id]=S_[n.questionOptions.rendering]??null,e7(S[n.id])&&Sx.includes(n.type))try{S[n.id]=await D.getInitialValue(n,null,e)}catch(e){console.error(e)}n.questionOptions.defaultValue&&(S[n.id]=Sr(n)),n.questionOptions.calculate?.calculateExpression&&i.push(n)})),await Promise.all(i.map(async n=>{try{await SE(n,S,e)}catch(e){console.error(e)}}))}return S}async loadDependencies(e,n,{setPreviousDomainObjectValue:D}){let{patient:t,formJson:S}=e;return D(await (0,nL.getPreviousEncounter)(t?.id,S.encounterType)),e}async getHistoricalValue(e,n){let{formFields:D,sessionMode:t,patient:S,methods:{getValues:i},formFieldAdapters:r,previousDomainObjectValue:o,visit:g}=n,s={value:e,type:"field"},a=r[e.type];if(e.historicalExpression){let n=await nB(e.historicalExpression,s,D,i(),{mode:t,patient:S,previousEncounter:o,visit:g});return n?n3(e,n):null}return o&&e.questionOptions.enablePreviousValue?await a.getPreviousValue(e,o,n):null}}async function SE(e,n,D){let{formFields:t,sessionMode:S,patient:i,visit:r}=D,o=e.questionOptions.calculate.calculateExpression,g={value:e,type:"field"},s={mode:S,patient:i,visit:r},a=await nB(o,g,t,n,s);e7(a)||(n[e.id]=a)}function Sk(e,n){let D=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function t(e,t){for(let S of e.matchAll(D)){let e=S[2];n.has(e)&&console.error(`The calculateExpression for the field '${t}' incorrectly quotes the field ID '${e}' as a string. Field IDs must be referenced as variables without quotes to access their values. Remove the quotes: use ${e} instead of '${e}'.`)}}function S(e){e.questionOptions?.calculate?.calculateExpression&&t(e.questionOptions.calculate.calculateExpression,e.id),e.questions&&e.questions.forEach(S)}e.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(S)})})}var SA=D(77541);function ST(e){let{formFields:n,formFieldValidators:D,patient:t,sessionMode:S,addInvalidField:i,updateFormField:r,methods:{getValues:o,trigger:g}}=e,s=o();return 0===n.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(o=>{let g=D[o.type];if(g){let D=g.validate(e,s[e.id],{formFields:n,values:s,expressionContext:{patient:t,mode:S},...o}).filter(e=>"error"===e.resultType);return D.length&&(e.meta.submission={...e.meta.submission,errors:D},r(e),i(e)),D}})).filter(e=>!!e).length}async function SO(e,n,D,t,S){return Promise.all(e.map(async({postAction:e,config:i,actionId:r,enabled:g})=>{try{let S=[];if(n)if(n.forEach(e=>{e?.data&&S.push(e.data),e?.uuid&&S.push(e)}),S.length)(!g||(0,SA.g)(g,S))&&await e.applyAction({patient:D,sessionMode:t,encounters:S},i);else throw Error("No encounter data to process post submission action");else throw Error("No handlers available to process post submission action")}catch(n){let e=(0,n6.j)(n);(0,o.showSnackbar)({title:String(S("errorDescriptionTitle",r?r.replace(/([a-z])([A-Z])/g,"$1 $2"):"Post Submission Error")),subtitle:String(S("errorDescription","{{errors}}",{errors:e.join(", ")})),kind:"error",isLowContrast:!1})}}))}function SR({patientUuid:e,formUuid:n,setIsSubmitting:D,setIsValidating:t}){let{t:S}=(0,eX.useTranslation)();(0,s.useEffect)(()=>{let i=i=>{let{formUuid:r,patientUuid:o,action:g}=i.detail;if(!g||!r||!o)return void(0,n6.N)(Error("The form action event is missing required details (formUuid, patientUuid, or action)."),S("formActionFailed","Form action failed"));if(r===n&&o===e)switch(g){case"onSubmit":D(!0);break;case"validateForm":t(!0);break;default:(0,n6.N)(Error(`Unsupported form action: "${g}"`),S("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",i),()=>{window.removeEventListener("ampath-form-action",i)}},[D,t,n,e])}function SI(e){let[n,D]=(0,s.useState)([]);return(0,s.useEffect)(()=>{let n=[];e?.length&&e.map(e=>{let D="string"==typeof e?e:e.actionId;iz(D)?.then(t=>n.push({postAction:t,config:e.config,actionId:D,enabled:e.enabled}))}),D(n)},[e]),n}let Sj=(0,s.createContext)(void 0),SN=({patient:e,patientUUID:n,sessionMode:D,sessionDate:t,formJson:S,workspaceLayout:i,location:r,provider:g,visit:l,isFormExpanded:c=!0,children:u,formSubmissionProps:h,hideFormCollapseToggle:d,handleConfirmQuestionDeletion:p,setIsFormDirty:f})=>{let{t:m}=(0,eX.useTranslation)(),y=(0,s.useRef)(),v=(0,s.useRef)({}),b=(0,o.useLayoutType)(),{isSubmitting:w,setIsSubmitting:M,onSubmit:L,onError:$,handleClose:_}=h,[x,C]=(0,s.useState)(!1),E=SI(S.postSubmissionActions),k=new AbortController,A=(0,s.useCallback)((e,n,D)=>{n?v.current[e]=D:y.current=D},[]),T=(0,s.useRef)({EncounterFormProcessor:SC}),O=(0,s.useCallback)(()=>{let e=[y.current,...Object.values(v.current)],n=e.every(e=>ST(e));return{forms:e,isValid:n}},[]);return SR({patientUuid:n,formUuid:S?.uuid,setIsSubmitting:M,setIsValidating:C}),(0,s.useEffect)(()=>{x&&(O(),C(!1))},[x,O]),(0,s.useEffect)(()=>{if(w){let{forms:n,isValid:t}=O();t?Promise.all(n.map(e=>e.processor.processSubmission(e,k))).then(async n=>{h.setIsSubmitting(!1),"edit"===D?(0,o.showSnackbar)({title:m("updatedRecord","Record updated"),subtitle:m("updatedRecordDescription","The patient encounter was updated"),kind:"success",isLowContrast:!0}):(0,o.showSnackbar)({title:m("submittedForm","Form submitted"),subtitle:m("submittedFormDescription","Form submitted successfully"),kind:"success",isLowContrast:!0}),E&&await SO(E,n,e,D,m),d(),L?L(n):_()}).catch(e=>{M(!1),e instanceof Error?(0,o.showSnackbar)({title:m("errorProcessingFormSubmission","Error processing form submission"),kind:"error",subtitle:e.message,isLowContrast:!1}):(0,o.showSnackbar)(e)}):M(!1)}return()=>{k.abort()}},[w,O]),a().createElement(Sj.Provider,{value:{patient:e,sessionMode:D,sessionDate:t,formJson:S,formProcessors:T.current,layoutType:b,workspaceLayout:i,visit:l,location:r,provider:g,isFormExpanded:c,registerForm:A,handleConfirmQuestionDeletion:p,setIsFormDirty:f}},T.current&&u)},SP=()=>{let e=(0,s.useContext)(Sj);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e},SF={actionButtons:"-esm-form-builder__repeat-controls__actionButtons___LgvQb"},SU=function({question:e,rows:n,handleDelete:D,handleAdd:t,questionIndex:S}){let{t:i}=(0,eX.useTranslation)();return a().createElement("div",{className:SF.actionButtons},S>0&&a().createElement(h.$nd,{className:SF.button,kind:"danger",onClick:D},a().createElement("span",null,i("remove","Remove"))),S===n.length-1&&a().createElement(h.$nd,{className:SF.button,iconDescription:i("add","Add"),kind:"primary",disabled:tE(e.questionOptions.repeatOptions?.limit,n.length),onClick:t},a().createElement("span",null,e.questionOptions.repeatOptions?.addText||i("add","Add"))))},SV="-esm-form-builder__repeat__nodeContainer___APyxV",SH="-esm-form-builder__repeat__divider___h9XcK",Sz={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function SW(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function SB(e){return{...e,questionOptions:{...e.questionOptions,rendering:Sz[e.type]||null}}}let Sq=({field:e})=>{let[n,D]=(0,s.useState)([]),t=Dr(),{handleConfirmQuestionDeletion:S}=SP(),{patient:i,sessionMode:r,formFieldAdapters:g,formFields:l,methods:{getValues:c,setValue:u,unregister:h},addFormField:d,removeFormField:p,deletedFields:f,setDeletedFields:m,visit:y}=t;(0,s.useEffect)(()=>{D(l.filter(n=>n.questionOptions.concept===e.questionOptions.concept&&n.id.startsWith(e.id)&&!n.meta?.repeat?.wasDeleted))},[l,e]);let v=(0,s.useCallback)(S=>{let o=[];function s(e){e.hide?.hideWhenExpression&&(e.isHidden=nW(e.hide.hideWhenExpression,{value:e,type:"field"},[...l,...o],c(),{mode:r,patient:i,visit:y})),e.questionOptions.calculate?.calculateExpression&&nB(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...l,...o],c(),{mode:r,patient:i,visit:y}).then(n=>{e7(n)||(u(e.id,n),g[e.type]?.transformFieldValue(e,n,t))})}let a=tx(e,null,S);o.push(a),"obsGroup"===a.type&&a.questions?.forEach(e=>{o.push(e)}),o.forEach(e=>{s(e),d(e)}),D([...n,a])},[l,e,n,t]),b=e=>{e.meta.initialValue?.omrsObject?(g[e.type]?.transformFieldValue(e,null,t),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(n=>{n.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},g[n.type]?.transformFieldValue(n,null,t)})):(nD(e),h(e.id),e.questions?.forEach(e=>h(e.id))),D(n.filter(n=>n.id!==e.id)),m([...f,e]),p(e.id)},w=e=>{if(S&&"function"==typeof S){let n=S(e);n&&"function"==typeof n.then&&"function"==typeof n.catch?n.then(()=>b(e)).catch(()=>(0,o.createErrorHandler)()):"boolean"==typeof n?n&&b(e):b(e)}else b(e)},M=(0,s.useMemo)(()=>n.map((D,t)=>{let S=a().createElement(Dw,{fieldId:D.id,valueAdapter:g[D.type],repeatOptions:{targetRendering:SB(D).questionOptions.rendering}});return a().createElement("div",{key:D.id+"_wrapper"},0!==t&&a().createElement("div",null,a().createElement("hr",{className:SH})),a().createElement("div",{className:SV},S),!ni(r)&&a().createElement(SU,{question:D,rows:n,questionIndex:t,handleDelete:()=>{w(D)},handleAdd:()=>{v(n.reduce((n,D)=>{let t=Number(D.id.slice(e.id.length+1));return Number.isFinite(t)?Math.max(n,t):n},0)+1)}}))}),[n]);return!e.isHidden&&M&&SW(e)?a().createElement(a().Fragment,null,a().createElement("div",null,M)):null};var SG=D(92137);let SK={label:"-esm-form-builder__file__label___ltBsg",thumbnailGrid:"-esm-form-builder__file__thumbnailGrid___rstZS",thumbnailContainer:"-esm-form-builder__file__thumbnailContainer___Z0tS3"},SY="-esm-form-builder__file-thumbnail__thumbnail___WlgwA",SQ="-esm-form-builder__file-thumbnail__imageThumbnail___gZWBB",SZ="-esm-form-builder__file-thumbnail__pdfThumbnail___49Zd9",SJ="-esm-form-builder__file-thumbnail__removeButton___y2WED",SX="-esm-form-builder__file-thumbnail__closeIcon___2MzVN";var S1=D(59184),S2=D(63654);function S4({bytesContentFamily:e,removeFileCb:n,...D}){let t=(0,s.useMemo)(()=>{switch(e){case"image":return S3;case"pdf":return S0;default:return S8}},[]);return a().createElement("div",{className:SY},a().createElement(t,D),a().createElement(h.$nd,{kind:"ghost",className:SJ,onClick:n},a().createElement(S1.R9,{size:16,className:SX})))}function S3(e){return a().createElement("img",{className:SQ,src:e.src,alt:e.title})}function S0(e){return a().createElement("div",{className:SZ,role:"button",tabIndex:0},a().createElement(S2.aD,{size:24}))}function S8(e){return a().createElement("div",{className:SZ,role:"button",tabIndex:0},a().createElement(S2.WZ,{size:24}))}let S9=[{name:"drug",baseControlComponent:tv},{name:"problem",baseControlComponent:tv},{name:"encounter-provider",baseControlComponent:tv},{name:"encounter-location",baseControlComponent:tv},{name:"select-concept-answers",baseControlComponent:tv},{name:"encounter-role",baseControlComponent:tv}],S7=[{name:"text",component:tg},{name:"textarea",component:tr},{name:"select",component:tS},{name:"checkbox",component:D7},{name:"radio",component:tD},{name:"date",component:DX},{name:"datetime",component:DX},{name:"number",component:D5},{name:"content-switcher",component:Dq},{name:"toggle",component:ta},{name:"workspace-launcher",component:t$},{name:"group",component:Dx},{name:"repeating",component:Sq},{name:"markdown",component:D8},{name:"fixed-value",component:D1},{name:"ui-select-extended",component:tv},{name:"file",component:({field:e,value:n,setFieldValue:D})=>{let{t}=(0,eX.useTranslation)(),{sessionMode:S}=Dr(),i="tablet"===(0,o.useLayoutType)(),r=(0,s.useCallback)(()=>{let t=(0,o.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),D([...n||[],e]),t(),Promise.resolve()),closeModal:()=>{t()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[n,e]),g=(0,s.useCallback)(e=>{let t=[...n],S=t[e];S.uuid?t[e]={...S,voided:!0}:t.splice(e,1),D(t)},[n]);return ni(S)&&!n?a().createElement(DI,{label:t(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):a().createElement("div",null,a().createElement("div",{className:c()(SK.label,"cds--label")},a().createElement(DB,{field:e})),!ni(S)&&a().createElement("div",null,a().createElement(h.$nd,{className:SK.uploadButton,kind:i?"ghost":"tertiary",onClick:r,renderIcon:e=>a().createElement(SG.OM,{size:16,...e})},e.questionOptions.buttonLabel?t(e.questionOptions.buttonLabel):t("addFile","Add file"))),a().createElement("div",{className:SK.thumbnailGrid},n&&n.filter(e=>!e.voided).map((e,n)=>a().createElement("div",{className:SK.thumbnailContainer},a().createElement(S4,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>g(n)})))))}},...tc.map(e=>({name:e.name,component:S9.find(n=>n.name===e.name).baseControlComponent}))],S6={validate:(e,n,D)=>{let t=new Date,S=n?[]:e8.validate(e,n);return S.length?S:n&&!(0,Dt.H)(D?.allowFutureDates)&&n.getTime&&n.getTime()>t.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},S5=[{name:"default_value",component:tH},{name:"form_field",component:e8},{name:"date",component:S6},{name:"js_expression",component:{validate:function(e,n,D){let t="value.invalid",S="Invalid value",i="Field has warnings";return D.expressionContext.myValue=n,Object.keys(D).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(r=>{let o="failsWhenExpression"===r;return nW(D[r],{value:e,type:"field"},D.formFields,{...D.values,[e.id]:n},D.expressionContext)?[{resultType:o?"error":"warning",errCode:o?t:null,message:D.message?D.message:o?S:i}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,n,D){let{referenceQuestionId:t,referenceQuestionAnswers:S,values:i,formFields:r,message:o}=D,g=i[r.find(e=>e.id===t).id];return e7(n)||S.includes(g)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:o}]}}}];function ie(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class iD{fetchData(e){return(0,o.openmrsFetch)(e?`${this.url}&q=${e}`:this.url).then(({data:e})=>e.results)}fetchSingleItem(e){let n=this.url;if(n.includes("?")){let D=n.split("?");n=`${D[0]}/${e}?${D[1]}`}else n=`${n}/${e}`;return(0,o.openmrsFetch)(n).then(({data:e})=>e)}toUuidAndDisplay(e){if(void 0===e.uuid||void 0===e.display)throw Error("'uuid' or 'display' not found in the OpenMRS object.");return e}constructor(e){ie(this,"url",void 0),this.url=e}}let it="custom:(uuid,display,conceptClass:(uuid,display))",iS="custom:(uuid,display,conceptClass:(uuid,display),mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid))))",ii="35543629-7d8c-11e1-909d-c80aa9edcf4e";class ir extends iD{fetchData(e,n){if(e7(n?.class)&&e7(n?.concept)&&!n?.useSetMembersByConcept&&e7(e))return Promise.resolve([]);let D=n?.conceptSourceUuid?iS:it,t=`${o.restBaseUrl}/concept?name=&searchType=fuzzy&v=${D}`;if(n?.class)if("string"!=typeof n.class)return(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results.filter(e=>e.conceptClass&&n.class.includes(e.conceptClass.uuid)));else{let e=t.split("searchType=fuzzy");t=`${e[0]}searchType=fuzzy&class=${n.class}&${e[1]}`}if(n?.concept&&n?.useSetMembersByConcept){let D=t.split("?name=&searchType=fuzzy&v="),S=n?.conceptSourceUuid?"custom:(uuid,setMembers:(uuid,display,mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid)))))":"custom:(uuid,setMembers:(uuid,display))";return t=`${D[0]}/${n.concept}?v=${S}`,(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.setMembers)}return(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results)}fetchSingleItem(e,n){let D=n?.conceptSourceUuid?iS:it;return(0,o.openmrsFetch)(`${o.restBaseUrl}/concept/${e}?v=${D}`).then(({data:e})=>e)}toUuidAndDisplay(e,n){let D=super.toUuidAndDisplay(e),t=this.getConceptSourceMapping(e,n?.conceptSourceUuid)?.conceptReferenceTerm?.code;return t?{...D,code:t}:D}getConceptSourceMapping(e,n){if(!n)return;let D=e.mappings?.filter(e=>e.conceptReferenceTerm?.conceptSource?.uuid===n)??[];return D.find(e=>e.conceptMapType?.uuid===ii||e.conceptMapType?.display?.toUpperCase()==="SAME-AS")??D[0]}constructor(){super(`${o.restBaseUrl}/concept?v=${it}`)}}class io extends iD{fetchData(e,n,D){let t=this.url,S=t.split("?");return n?.tag&&(t=`${S[0]}?tag=${n.tag}&${S[1]}`),D&&(t=`${S[0]}/${D}?${S[1]}`),(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${o.restBaseUrl}/location?v=custom:(uuid,display)`)}}class ig extends iD{async fetchData(e,n){let D="v=custom:(uuid,display)",t=`${o.restBaseUrl}/provider?${D}`,{data:S}=await (0,o.openmrsFetch)(e?`${t}&q=${e}`:t);return S?.results}async fetchSingleItem(e){let{data:n}=await (0,o.openmrsFetch)(`${o.restBaseUrl}/provider/${e}?v=custom:(uuid,display)`);return n}constructor(){super(null)}}class is extends iD{fetchSingleItem(e){return(0,o.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,n){let D=this.buildUrl(n.referencedValue||n.concept);return(0,o.openmrsFetch)(D).then(({data:e})=>e.setMembers.length?e.setMembers:e.answers)}buildUrl(e){return this.url.replace(":conceptUuid",e)}constructor(){super(`${o.restBaseUrl}/concept/:conceptUuid?v=custom:(uuid,display,setMembers:(uuid,display),answers:(uuid,display))`)}}class ia extends iD{async fetchData(e,n){let D="v=custom:(uuid,display,name)",t=`${o.restBaseUrl}/encounterrole?${D}`,{data:S}=await (0,o.openmrsFetch)(e?`${t}&q=${e}`:t);return S?.results}constructor(){super(null)}}let il=[{name:"location_datasource",component:new io},{name:"drug_datasource",component:new ir},{name:"problem_datasource",component:new ir},{name:"select_concept_answers_datasource",component:new is},{name:"provider_datasource",component:new ig},{name:"encounter_role_datasource",component:new ia}],ic=[{name:"ProgramEnrollmentSubmissionAction",load:()=>D.e("4831").then(D.bind(D,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>D.e("7484").then(D.bind(D,26679))}];function iu(e,n,D){if("programState"===e.type){let e=D.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},D.meta=e}try{id(e),im(e),iy(e),iv(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>iu(e,n,D)):e.questions.forEach(e=>iu(e,n,D))),e.meta.pageId=n.id}catch(e){console.error(e)}}function ih(e){let n=[];return e?.forEach(e=>{if(n.push(e),"inlineDate"!==e.type&&(0,Dt.H)(e.questionOptions?.showDate)){let D={id:`${e.id}_inline_date`,label:`Date for ${e.label}`,type:"inlineDate",questionOptions:{rendering:"date",isTransient:!0},validators:e.questionOptions.shownDateOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownDateOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.obsDatetime}}};n.push(D)}}),n}function id(e){ip(e,"readonly"),ip(e,"required"),ip(e,"unspecified"),ip(e.questionOptions,"disallowDecimals"),ip(e.questionOptions,"isSearchable"),ip(e.questionOptions,"isTransient"),ip(e.questionOptions,"enablePreviousValue"),ip(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function ip(e,n){if(e&&"string"==typeof e[n]){let D=e[n].trim().toLowerCase();("true"===D||"false"===D)&&(e[n]="true"===D)}return e}function im(e){!nn(e,"group")&&(e.validators=e.validators||[],0>e.validators.findIndex(e=>"form_field"===e.type)&&e.validators.push({type:"form_field"}),0>e.validators.findIndex(e=>"default_value"===e.type)&&e.validators.push({type:"default_value"}))}function iy(e){switch(e.type){case"encounterProvider":e.questionOptions.rendering="encounter-provider";break;case"encounterLocation":e.questionOptions.rendering="encounter-location";break;case"encounterRole":e.questionOptions.rendering="encounter-role";break;case"encounterDatetime":e.questionOptions.rendering=nn(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":i_(e)}}function iv(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":ib(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":iM(e);break;case"repeating":case"group":iw(e);break;case"date":e.datePickerFormat=e.datePickerFormat??"calendar";break;case"datetime":e.datePickerFormat=e.datePickerFormat??"both";break;case"workspace-launcher":case"markdown":e.type="control";break;case"drug":case"problem":e.questionOptions.isSearchable=!0}return e}function ib(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,Dt.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),nn(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function iw(e){nn(e,"group")&&e.questions?.length&&e.questions.forEach(iw),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function iM(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function iL(e){if(e.meta.programs.isEnrollment||e.meta.programs.discontinuationDateQuestionId){let n={programUuid:e.meta.programs.uuid};e.meta.programs.isEnrollment?n.enrollmentDate="":n.completionDate=e.meta.programs.discontinuationDateQuestionId,e.postSubmissionActions=[{actionId:"ProgramEnrollmentSubmissionAction",enabled:"true",config:n}]}}function i$(e){let n=[];return e?.forEach(e=>{if(n.push(e),"obsComment"!==e.type&&(0,Dt.H)(e.questionOptions?.showComment)){let D={id:`${e.id}_obs_comment`,label:`Comment for ${e.label}`,type:"obsComment",questionOptions:{rendering:"text",isTransient:!0},validators:e.questionOptions.shownCommentOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownCommentOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.comment}}};n.push(D)}}),n}function i_(e){if("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type){let n=e.questionOptions.datasource?.config;e.questionOptions.datasource={name:"problem_datasource",config:{...n,class:e.questionOptions.diagnosis?.conceptClasses??n?.class}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{...n,concept:e.questionOptions.diagnosis.conceptSet,useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource}}function ix(e,n){Object.entries(n).forEach(([n,D])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===n?e.questionOptions.defaultValue=D:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===n&&(e.questionOptions.defaultValue=D)})})})})})}let iC=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,n)=>(ip(e,"readonly"),e.pages.forEach((n,D)=>{let t=n.label??"";n.id=`page-${t.replace(/\s/g,"")}-${D}`,ip(n,"readonly"),n.sections&&n.sections.forEach(D=>{D.questions=ih(D.questions),D.questions=i$(D.questions),ip(D,"readonly"),ip(D,"isExpanded"),D?.questions?.forEach((D,t)=>iu(D,n,e))})}),n&&"object"==typeof n&&ix(e,n),e.meta?.programs&&iL(e),e)}}];function iE(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].provider}return null}function ik(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].encounterRole}return null}function iA(e,n){return tN(e,n)||!e7(e.meta.submission.newValue.obsDatetime)}let iT=[{type:"obs",component:tA},{type:"control",component:{getDisplayValue:(e,n)=>n,transformFieldValue:function(e,n,D){return null},getInitialValue:function(e,n,D){return null},getPreviousValue:function(e,n,D){return null},tearDown:function(){}}},{type:"obsGroup",component:tA},{type:"testOrder",component:tq},{type:"programState",component:{transformFieldValue:function(e,n,D){if(nD(e),e.meta?.initialValue?.omrsObject?.uuid===n||e7(n))return null;e.meta.submission.newValue={state:n,startDate:e4()().format()}},getInitialValue:function(e,n,D){let t=D.customDependencies.patientPrograms?.find(n=>n.program.uuid===e.questionOptions.programUuid);if(t?.states?.length>0){let n=t.states.filter(e=>!e.endDate).find(n=>n.state.programWorkflow?.uuid===e.questionOptions.workflowUuid)?.state;return e.meta={...e.meta||{},initialValue:{omrsObject:n}},n?.uuid}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){return n&&n.location?.uuid?n.location.uuid:D.location.uuid},getPreviousValue:function(e,n,D){let t=n??D.previousDomainObjectValue;return{value:t?.location?.uuid,display:t?.location?.name}},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){let t=iE(n);return t?.uuid?t.uuid:D.currentProvider?.uuid},getPreviousValue:function(e,n,D){let t=iE(n??D.previousDomainObjectValue);return{value:t?.uuid,display:t?.name}},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){let t=n??D.domainObjectValue;return t?ik(t)?.uuid:D.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,n,D){let t=n??D.previousDomainObjectValue;if(t){let e=ik(t);return{value:e?.uuid,display:e?.name}}return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"obsComment",component:{transformFieldValue:function(e,n,D){let t=D.getFormField(e.meta.targetField),S=D.methods.getValues(t.id),i=t.meta.initialValue?.omrsObject;if(t.meta.submission?.newValue)e7(n)&&!iA(t,S)?t.meta.submission.newValue=null:t.meta.submission.newValue.comment=n;else if(!nS(t)&&i){if(e7(n)&&e7(i.comment))return null;let e=tI(t,S);t.meta.submission={newValue:{...e,comment:n}}}return null},getInitialValue:function(e,n,D){if(n??D.domainObjectValue){let n=e.id.split("_obs_comment")[0],t=D.formFields.find(e=>e.id===n);return t?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){return n?.encounterDatetime?new Date(n.encounterDatetime):D.sessionDate},getPreviousValue:function(e,n,D){if(n?.encounterDatetime){let D=new Date(n.encounterDatetime);return{value:D,display:this.getDisplayValue(e,D)}}return null},getDisplayValue:function(e,n){return(0,o.formatDate)(n)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,n,D){let t=D.getFormField(e.meta.targetField),S=D.methods.getValues(t.id),i=n instanceof Date?(0,o.toOmrsIsoString)(n):n;if(t.meta.submission?.newValue)e7(i)&&!iA(t,S)?t.meta.submission.newValue=null:t.meta.submission.newValue.obsDatetime=i;else if(!nS(t)&&t.meta.initialValue?.omrsObject){if(e7(n)&&e7(t.meta.initialValue.omrsObject?.obsDatetime))return null;let e=tI(t,S);t.meta.submission={newValue:{...e,obsDatetime:i}}}},getInitialValue:function(e,n,D){if(n??D.domainObjectValue){let n=e.id.split("_inline_date")[0],t=D.formFields.find(e=>e.id===n),S=t?.meta.initialValue?.omrsObject;if(S?.obsDatetime)return(0,o.parseDate)(S.obsDatetime)}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?(0,o.formatDate)(n):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,n,D){return(nD(e),e.meta.initialValue?.refinedValue===n||e7(n))?null:(e.meta.submission.newValue={identifier:n,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:D.location},e.meta.submission.newValue)},getInitialValue:function(e,n,D){let t=D.patient?.identifier?.find(n=>n.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:t,refinedValue:t?.value}},t?.value},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,n,D){return(nD(e),e.meta.initialValue?.refinedValue===n||e7(n))?null:(e.meta.submission.newValue={value:n,attributeType:e.questionOptions.attributeType,uuid:e.meta.initialValue?.omrsObject?.uuid},e.meta.submission.newValue)},getInitialValue:function(e,n,D){let t=D.patient?.extension?.find(n=>n.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:t,refinedValue:t?.valueString||t?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"diagnosis",component:tQ}],iO={},iR={},iI={},ij={},iN={},iP={};async function iF(e){if(iR[e])return iR[e];let n=S7.find(n=>n.name===e||n?.alias===e)?.component;if(!n){let D=await iG().controls.find(n=>n.name===e||n?.alias===e)?.load?.();n=D?.default}return iR[e]=n,n}function iU(e){return iK(e)&&!nn(e,"file")?(e.disabled=!0,e.isDisabled=!0,iF("text")):iF(e.questionOptions.rendering)}async function iV(e){if(iI[e])return iI[e];let n=iT.find(n=>n.type===e)?.component;if(!n){let D=await iG().fieldValueAdapters.find(n=>n.type===e)?.load?.();n=D?.default}return iI[e]=n,n}async function iH(){let e=[],n=iP;if(Object.keys(n).length)return Object.values(n);let D=iG().formSchemaTransformers||[];return e.push(...(await Promise.all(D.map(async e=>{let n=await e.load?.();return n?.default}))).filter(e=>void 0!==e)),e.push(...iC.map(e=>e.component)),e.forEach(e=>{iP[iC.find(n=>n.component===e).name]=e}),e}async function iz(e){let n=ij[e];if(n)return n;let D=ic.find(n=>n.name===e);if(D){let n=D.load,t=await n();return ij[e]=t.default,t.default}let t=iG().postSubmissionActions.find(n=>n.name===e);if(t){let n=t.load,D=await n();return ij[e]=D.default,D.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function iW(e){if(iO[e])return iO[e];let n=S5.find(n=>n.name===e)?.component;if(!n){let D=await iG().fieldValidators.find(n=>n.name===e)?.load?.();n=D?.default}return iO[e]=n,n}async function iB(e){if(iN[e])return iN[e];let n=il.find(n=>n.name===e)?.component;if(!n){let D=tu(e);if(D)n=il.find(e=>e.name===D.datasource.name)?.component;else{let D=await iG().dataSources.find(n=>n.name===e)?.load?.();if(!D)throw Error("Datasource not found");n=D.default}}return iN[e]=n,n}function iq(){return iG().expressionHelpers}function iG(){return(0,o.getGlobalStore)(g.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function iK(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function iY(e,n,D,t,S){let[i,r]=(0,s.useState)(null),[o,g]=(0,s.useState)(i1(e,n));return(0,s.useEffect)(()=>{let i=new AbortController,o=e=>{if(e?.translations){let n=window.i18next.language;window.i18next.addResourceBundle(n,Sl.L,e.translations,!0,!0)}r(e)};return iQ(e,n,t,S).then(e=>{o({...e,encounter:D})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),g(Error("Error loading form JSON: "+e.message)))}),()=>{i.abort()}},[t,e,n,D]),{formJson:i,isLoading:!i&&!o,formError:o}}async function iQ(e,n,D,t){let S=await (0,nL.fetchOpenMRSForm)(e),i=await (0,nL.fetchClobData)(S),r=await iH(),o=i?{...i,uuid:S.uuid}:i4(n),g=iZ(o);iX(o,await iJ(g,D));let s=i8(o),a=await i9(s),l=s.reduce((e,n)=>(e[n.formName]=n.alias,e),{});return i6(o,i7(a),l),i2(o,r,D,t)}function iZ(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function iJ(e,n){return Promise.all(e.map(e=>iQ(e,null,n)))}function iX(e,n){n.forEach(n=>{let D=e.pages.find(e=>e.subform?.name===n.name);D&&(D.subform.form=n)})}function i1(e,n){return e||n?e&&n?Error("InvalidArgumentsErr: Both formUuid and formJson cannot be provided at the same time."):void 0:Error("InvalidArgumentsErr: Neither formUuid nor formJson was provided")}function i2(e,n=[],D,S){return i3(e,D),n.reduce((e,n)=>n.transform(e,S),e),i0(e),t(D,e)}function i4(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function i3(e,n){for(let D=e.pages.length-1;D>=0;D--){let t=e.pages[D];(0,Dt.H)(t.isSubform)&&!(0,Dt.H)(t.isHidden)&&t.subform?.form?.encounterType===e.encounterType&&(t.subform.form.pages.filter(e=>!(0,Dt.H)(e.isSubform)),e.pages.splice(D,1,...i2(t.subform.form,[],n).pages))}}function i0(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function i8(e){let n=e?.referencedForms;return n||[]}async function i9(e){return Promise.all(e.map(e=>iQ(e.formName,null,null)))}function i7(e){let n=new Map;return e.forEach(e=>{n.set(e.name,e)}),n}function i6(e,n,D){n.forEach((n,t)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===t||e.reference.form===D[t])){let D=i5(e,n);Object.assign(e,D)}})})})}function i5(e,n){let D,t=n.pages.filter(n=>n.label===e.reference.page);if(t.length>0){let n=t[0].sections.filter(n=>n.label===e.reference.section);n.length>0&&(D=n[0])}return re(D,e.reference)}function re(e,n){if(n?.excludeQuestions){let D=n.excludeQuestions;e.questions=e.questions.filter(e=>!D.includes(e.id))}return e}var rn=D(76922);function rD(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class rt{setEvaluatedPagesVisibility(e){this.evaluatedPagesVisibilitySubject.next(e)}updateScrollablePages(e){this.scrollablePagesSubject.next(e)}updatePagesWithErrors(e){this.pagesWithErrorsSubject.next(new Set(e))}addActivePage(e){let n=this.activePagesSubject.value;n.add(e),this.activePagesSubject.next(n)}removeInactivePage(e){let n=this.activePagesSubject.value;n.delete(e),this.activePagesSubject.next(n)}getActivePagesObservable(){return this.activePagesSubject.asObservable()}getScrollablePagesObservable(){return this.scrollablePagesSubject.asObservable()}getPagesWithErrorsObservable(){return this.pagesWithErrorsSubject.asObservable()}getEvaluatedPagesVisibilityObservable(){return this.evaluatedPagesVisibilitySubject.asObservable()}clear(){this.scrollablePagesSubject.next([]),this.pagesWithErrorsSubject.next(new Set),this.activePagesSubject.next(new Set),this.evaluatedPagesVisibilitySubject.next(!1)}constructor(){rD(this,"scrollablePagesSubject",new rn.BehaviorSubject([])),rD(this,"pagesWithErrorsSubject",new rn.BehaviorSubject(new Set)),rD(this,"activePagesSubject",new rn.BehaviorSubject(new Set)),rD(this,"evaluatedPagesVisibilitySubject",new rn.BehaviorSubject(null))}}let rS=new rt,ri=new Set;function rr(e){e&&Object.values(e).forEach(e=>{ri.add(e)})}function ro(){ri.forEach(e=>{try{e.tearDown()}catch(e){}}),ri.clear(),rS.clear()}function rg(e){let[n,D]=(0,s.useState)(void 0),t=(0,s.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),S=(0,s.useCallback)(e=>{D(e.detail.value)},[]);return(0,s.useEffect)(()=>{let n=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(n)},[e]),(0,s.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",S),()=>{window.removeEventListener("openmrs:form-collapse-toggle",S)}),[]),{isFormExpanded:n,hideFormCollapseToggle:t}}let rs=26.25,ra=32.25,rl=48.25;function rc(e){let[n,D]=(0,s.useState)(0),t=(0,s.useMemo)(()=>n<=rs?"narrow":n<=ra?"wider":n<=rl?"extra-wide":"ultra-wide",[n]);return(0,s.useLayoutEffect)(()=>{let n=()=>{let n=e.current?.parentElement?.offsetWidth,t=parseInt(getComputedStyle(document.documentElement).fontSize);n&&D(na(n,t))};n();let t=new ResizeObserver(e=>{n()});return e.current?.parentElement&&t.observe(e.current?.parentElement),()=>{t.disconnect()}},[e]),t}let ru=()=>{let[e,n]=(0,s.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,s.useEffect)(()=>{let e=[rS.getScrollablePagesObservable().subscribe(e=>{n(n=>({...n,pages:e,hasMultiplePages:e.length>1}))}),rS.getPagesWithErrorsObservable().subscribe(e=>{n(n=>({...n,pagesWithErrors:Array.from(e)}))}),rS.getActivePagesObservable().subscribe(e=>{n(n=>({...n,activePages:Array.from(e)}))}),rS.getEvaluatedPagesVisibilityObservable().subscribe(e=>{n(n=>({...n,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function rh(e){let n=new Date,D=n.getFullYear()-e.getFullYear();return n.getMonth()<e.getMonth()||n.getMonth()===e.getMonth()&&n.getDate()<e.getDate()?D-1:D}let rd={female:"F",male:"M",other:"O",unknown:"U"},rp=e=>{let{patient:n,isLoading:D,error:t}=(0,o.usePatient)(e);return n&&!D&&(n.age=rh(new Date(n?.birthDate)),n.sex=rd[n.gender]??"U"),{patient:n,isLoadingPatient:D,patientError:t}},rf=(e,n,D,t)=>{let[S,i]=(0,s.useState)(!1),[r,o]=(0,s.useState)(""),{loadDependencies:g}=e;return(0,s.useEffect)(()=>{let e=!1;return g&&(i(!0),g(n,D,t).then(()=>{e||i(!1)}).catch(n=>{e||(o(n),(0,n6.N)(n,"Encountered error while loading dependencies"))})),()=>{e=!0}},[g]),{isLoading:S,error:r}},rm=(e,n,D)=>{let[t,S]=(0,s.useState)(!0),[i,r]=(0,s.useState)({}),[o,g]=(0,s.useState)(null),a=(0,s.useRef)(D);a.current=D;let l=(0,s.useRef)(!1),c=D.formFields?.length>0,u=Object.keys(D.formFieldAdapters??{}).length>0;return(0,s.useEffect)(()=>{if(e&&!n&&c&&u&&!l.current){l.current=!0;let n=a.current;e.getInitialValues(n).then(e=>{r(e),S(!1)}).catch(e=>{console.error(e),g(e),S(!1)})}},[e,n,c,u]),{isLoadingInitialValues:t,initialValues:i,error:o}},ry="-esm-form-builder__section-renderer__section___+aK-S",rv="-esm-form-builder__section-renderer__sectionBody___0kmuN",rb=({section:e})=>{let{formFieldAdapters:n}=Dr(),D=(0,s.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return a().createElement("div",{className:ry},e.questions.map(e=>n[e.type]?a().createElement("div",{key:`${D}-${e.id}`,className:rv},a().createElement(Dw,{key:e.id,fieldId:e.id,valueAdapter:n[e.type]})):null))};var rw=D(20594),rM=!!("u">typeof window&&window.document&&window.document.createElement);function rL(){if(!rM||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),D=function(){};window.addEventListener("testPassiveEventSupport",D,n),window.removeEventListener("testPassiveEventSupport",D,n)}catch(e){}return e}var r$=void 0;function r_(){return void 0===r$&&(r$=rL()),r$}function rx(e){if(e)return r_()?e:!!e.capture}function rC(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function rE(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function rk(e){this.target=e,this.events={}}rk.prototype.getEventHandlers=function(){return function(e,n){var D=String(e)+" "+String(rC(n));return this.events[D]||(this.events[D]={handlers:[],handleEvent:void 0},this.events[D].nextHandlers=this.events[D].handlers),this.events[D]}}(),rk.prototype.handleEvent=function(){return function(e,n,D){var t=this.getEventHandlers(e,n);t.handlers=t.nextHandlers,t.handlers.forEach(function(e){e&&e(D)})}}(),rk.prototype.add=function(){return function(e,n,D){var t=this,S=this.getEventHandlers(e,D);rE(S),0===S.nextHandlers.length&&(S.handleEvent=this.handleEvent.bind(this,e,D),this.target.addEventListener(e,S.handleEvent,D)),S.nextHandlers.push(n);var i=!0;return function(){return function(){if(i){i=!1,rE(S);var r=S.nextHandlers.indexOf(n);S.nextHandlers.splice(r,1),0===S.nextHandlers.length&&(t.target&&t.target.removeEventListener(e,S.handleEvent,D),S.handleEvent=void 0)}}}()}}();var rA="__consolidated_events_handlers__";function rT(e,n,D,t){e[rA]||(e[rA]=new rk(e));var S=rx(t);return e[rA].add(n,D,S)}var rO=D(23286);function rR(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function rI(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function rj(e,n){var D=rI(e);if("number"==typeof D)return D;var t=rR(e);if("number"==typeof t)return t*n}var rN="above",rP="inside",rF="below",rU="invisible";function rV(e){return"string"==typeof e.type}var rH="<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n\nSee https://goo.gl/LrBNgw for more info.";function rz(e,n){if(e&&!rV(e)&&!n)throw Error(rH)}function rW(e){return e.viewportBottom-e.viewportTop==0?rU:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?rP:e.viewportBottom<e.waypointTop?rF:e.waypointTop<e.viewportTop?rN:rU}var rB=[];function rq(e){rB.push(e),r||(r=setTimeout(function(){var e;for(r=null;e=rB.shift();)e()},0));var n=!0;return function(){if(n){n=!1;var D=rB.indexOf(e);-1!==D&&(rB.splice(D,1),!rB.length&&r&&(clearTimeout(r),r=null))}}}function rG(e){return"window"===e?D.g.window:e}var rK="u">typeof window,rY={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},rQ=function(e){function n(n){var D;return(D=e.call(this,n)||this).refElement=function(e){D._ref=e},D}(0,rw.A)(n,e);var D=n.prototype;return D.componentDidMount=function(){var e=this;rK&&(this.cancelOnNextTick=rq(function(){e.cancelOnNextTick=null;var n=e.props,D=n.children;n.debug,rz(D,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=rT(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=rT(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},D.componentDidUpdate=function(){var e=this;rK&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=rq(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},D.componentWillUnmount=function(){rK&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},D._findScrollableAncestor=function(){var e=this.props,n=e.horizontal,D=e.scrollableAncestor;if(D)return rG(D);for(var t=this._ref;t.parentNode&&(t=t.parentNode)!==document.body;){var S=window.getComputedStyle(t),i=(n?S.getPropertyValue("overflow-x"):S.getPropertyValue("overflow-y"))||S.getPropertyValue("overflow");if("auto"===i||"scroll"===i||"overlay"===i)return t}return window},D._handleScroll=function(e){if(this._ref){var n=this._getBounds(),D=rW(n),t=this._previousPosition,S=this.props,i=(S.debug,S.onPositionChange),r=S.onEnter,o=S.onLeave,g=S.fireOnRapidScroll;if(this._previousPosition=D,t!==D){var s={currentPosition:D,previousPosition:t,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom};i.call(this,s),D===rP?r.call(this,s):t===rP&&o.call(this,s);var a=t===rF&&D===rN,l=t===rN&&D===rF;g&&(a||l)&&(r.call(this,{currentPosition:rP,previousPosition:t,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}),o.call(this,{currentPosition:D,previousPosition:rP,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}))}}},D._getBounds=function(){var e,n,D=this.props,t=D.horizontal;D.debug;var S=this._ref.getBoundingClientRect(),i=S.left,r=S.top,o=S.right,g=S.bottom,s=t?i:r,a=t?o:g;this.scrollableAncestor===window?(e=t?window.innerWidth:window.innerHeight,n=0):(e=t?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,n=t?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var l=this.props,c=l.bottomOffset,u=rj(l.topOffset,e),h=rj(c,e),d=n+e;return{waypointTop:s,waypointBottom:a,viewportTop:n+u,viewportBottom:d-h}},D.render=function(){var e=this,n=this.props.children;if(!n)return a().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(rV(n)||(0,rO.isForwardRef)(n)){var D=function(D){e.refElement(D),n.ref&&("function"==typeof n.ref?n.ref(D):n.ref.current=D)};return a().cloneElement(n,{ref:D})}return a().cloneElement(n,{innerRef:this.refElement})},n}(a().PureComponent);rQ.above=rN,rQ.below=rF,rQ.inside=rP,rQ.invisible=rU,rQ.defaultProps=rY,rQ.displayName="Waypoint";let rZ={pageContent:"-esm-form-builder__page-renderer__pageContent___1sqJE",pageHeader:"-esm-form-builder__page-renderer__pageHeader___5xq2Z",pageTitle:"-esm-form-builder__page-renderer__pageTitle___L0LWE",collapseIcon:"-esm-form-builder__page-renderer__collapseIcon___FAxsi",sectionContainer:"-esm-form-builder__page-renderer__sectionContainer___GuKLn",accordionContainer:"-esm-form-builder__page-renderer__accordionContainer___S5AuC",firstSection:"-esm-form-builder__page-renderer__firstSection___cvqEr",lastSection:"-esm-form-builder__page-renderer__lastSection___FcNvF",formSection:"-esm-form-builder__page-renderer__formSection___2sNJr",hiddenAccordion:"-esm-form-builder__page-renderer__hiddenAccordion___ldAud"};function rJ({section:e,sectionIndex:n,visibleSections:D,isFormExpanded:t}){let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)(t);return(0,s.useEffect)(()=>{r(t)},[t]),a().createElement(h.AsP,{title:S(e.label),open:i,className:c()(rZ.sectionContainer,{[rZ.firstSection]:0===n,[rZ.lastSection]:n===D.length-1})},a().createElement("div",{className:rZ.formSection},a().createElement(rb,{section:e})))}let rX=function({page:e,isFormExpanded:n}){let{t:D}=(0,eX.useTranslation)(),[t,S]=(0,s.useState)(!1),i=(0,s.useMemo)(()=>e.sections.filter(e=>{let n=e.questions.some(e=>!(0,Dt.H)(e.isHidden));return!(0,Dt.H)(e.isHidden)&&n}),[e.sections]),r=()=>S(!t);return(0,s.useEffect)(()=>(S(!n),()=>{rS.removeInactivePage(e.id)}),[n]),a().createElement("div",null,a().createElement(rQ,{key:e.id,onEnter:()=>rS.addActivePage(e.id),onLeave:()=>rS.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},a().createElement("div",{id:e.id,className:rZ.pageContent},a().createElement("div",{className:rZ.pageHeader,onClick:r},a().createElement("p",{className:rZ.pageTitle},D(e.label),a().createElement("span",{className:rZ.collapseIconWrapper},t?a().createElement(o.ChevronDownIcon,{className:rZ.collapseIcon,"aria-label":"Expand"}):a().createElement(o.ChevronUpIcon,{className:rZ.collapseIcon,"aria-label":"Collapse"})))),a().createElement("div",{className:c()({[rZ.hiddenAccordion]:t,[rZ.accordionContainer]:!t})},a().createElement(h.nD3,null,i.map((e,D)=>a().createElement(rJ,{key:`section-${e.label}`,section:e,sectionIndex:D,visibleSections:i,isFormExpanded:n})))))))},r1={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},r2=(e,n)=>{switch(n.type){case"SET_FORM_FIELDS":return{...e,formFields:n.value};case"ADD_FORM_FIELD":return{...e,formFields:[...e.formFields,n.value]};case"UPDATE_FORM_FIELD":return{...e,formFields:e.formFields.map(e=>e.id===n.value.id?n.value:e)};case"REMOVE_FORM_FIELD":return{...e,formFields:e.formFields.filter(e=>e.id!==n.value)};case"SET_INVALID_FIELDS":return{...e,invalidFields:n.value};case"ADD_INVALID_FIELD":return{...e,invalidFields:[...e.invalidFields,n.value]};case"REMOVE_INVALID_FIELD":return{...e,invalidFields:e.invalidFields.filter(e=>e.id!==n.value)};case"CLEAR_INVALID_FIELDS":return{...e,invalidFields:[]};case"SET_FORM_JSON":return{...e,formJson:n.value};case"SET_DELETED_FIELDS":return{...e,deletedFields:n.value};default:return e}},r4=(e,n)=>{let{formFields:D,patient:t,sessionMode:S,visit:i}=n,[r,o]=(0,s.useState)(n.formJson),[g,a]=(0,s.useState)(!1),l=(0,s.useMemo)(()=>D?.map(n=>{let r={value:n,type:"field"},o={patient:t,mode:S,visit:i};if(n.hide?.hideWhenExpression){let t=nW(n.hide.hideWhenExpression,r,D,e,o);n.isHidden=t,Array.isArray(n.questions)&&n.questions.forEach(e=>{e.isHidden=t})}else n.isHidden=!1;"object"==typeof n.required&&"conditionalRequired"===n.required.type?n.isRequired=nZ(n,D,e):n.isRequired=(0,Dt.H)(n.required),"object"==typeof n.disabled&&n.disabled.disableWhenExpression?n.isDisabled=nW(n.disabled.disableWhenExpression,r,D,e,o):n.isDisabled=(0,Dt.H)(n.disabled),n.validators?.some(e=>"conditionalAnswered"===e.type)&&nQ(n,D),n.questionOptions.answers?.filter(e=>!e7(e.hide?.hideWhenExpression)).forEach(n=>{n.isHidden=nW(n.hide.hideWhenExpression,r,D,e,o)}),n.questionOptions.answers?.filter(e=>!e7(e.disable?.disableWhenExpression)).forEach(n=>{n.disable.isDisabled=nW(n.disable?.disableWhenExpression,r,D,e,o)}),"string"==typeof n.readonly&&r3(n.readonly)&&(n.meta.readonlyExpression=n.readonly,n.readonly=nW(n.readonly,r,D,e,o));let g=n.questionOptions.repeatOptions?.limitExpression;return"repeating"!==n.questionOptions.rendering||e7(g)||(n.questionOptions.repeatOptions.limit=nW(g,r,D,e,o)),n}),[e,D,t,S]);return(0,s.useEffect)(()=>{n.formJson?.pages?.forEach(n=>{n.hide?nX({value:n,type:"page"},D,e,S,t,nW,null):n.isHidden=!1,n?.sections?.forEach(n=>{n.hide?nX({value:n,type:"section"},D,e,S,t,nW,null):n.isHidden=!1})}),o(ns(n.formJson)),a(!0)},[n.formJson,D]),{evaluatedFormJson:r,evaluatedFields:l,evaluatedPagesVisibility:g}};function r3(e){return"true"!==e&&"false"!==e}function r0(e,n){let D=(0,s.useCallback)(n=>{e({type:"ADD_FORM_FIELD",value:n})},[]),t=(0,s.useCallback)(D=>{if(D.meta.groupId){let e=n.find(e=>e.id===D.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===D.id?D:e),t(e))}e({type:"UPDATE_FORM_FIELD",value:(0,t_.A)(D)})},[n]),S=(0,s.useCallback)(e=>n.find(n=>n.id===e),[n]),i=(0,s.useCallback)(n=>{e({type:"REMOVE_FORM_FIELD",value:n})},[]),r=(0,s.useCallback)(n=>{e({type:"SET_INVALID_FIELDS",value:n})},[]),o=(0,s.useCallback)(n=>{e({type:"ADD_INVALID_FIELD",value:n})},[]),g=(0,s.useCallback)(n=>{e({type:"REMOVE_INVALID_FIELD",value:n})},[]);return{addFormField:D,updateFormField:t,getFormField:S,removeFormField:i,setInvalidFields:r,addInvalidField:o,removeInvalidField:g,setForm:(0,s.useCallback)(n=>{e({type:"SET_FORM_JSON",value:ns(n)})},[]),setDeletedFields:(0,s.useCallback)(n=>{e({type:"SET_DELETED_FIELDS",value:n})},[])}}let r8=({processorContext:e,initialValues:n,isSubForm:D,setIsLoadingFormDependencies:t})=>{let{evaluatedFields:S,evaluatedFormJson:i,evaluatedPagesVisibility:r}=r4(n,e),{registerForm:o,setIsFormDirty:g,workspaceLayout:l,isFormExpanded:c}=SP(),u=eJ({defaultValues:n,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:h}}=u,[{formFields:d,invalidFields:p,formJson:f,deletedFields:m},y]=(0,s.useReducer)(r2,{...r1,formFields:S,formJson:i}),{addFormField:v,updateFormField:b,getFormField:w,removeFormField:M,setInvalidFields:L,addInvalidField:$,removeInvalidField:_,setForm:x,setDeletedFields:C}=r0(y,d);(0,s.useEffect)(()=>{let e=f.pages.filter(e=>!e.isSubform).map(e=>e);rS.updateScrollablePages(e)},[f.pages]),(0,s.useEffect)(()=>{rS.setEvaluatedPagesVisibility(r)},[r]),(0,s.useEffect)(()=>{rS.updatePagesWithErrors(p.map(e=>e.meta.pageId))},[p]);let E=(0,s.useMemo)(()=>({...e,workspaceLayout:l,methods:u,formFields:d,formJson:f,invalidFields:p,deletedFields:m,addFormField:v,updateFormField:b,getFormField:w,removeFormField:M,setInvalidFields:L,addInvalidField:$,removeInvalidField:_,setForm:x,setDeletedFields:C}),[e,l,u,d,f,p,m]);return(0,s.useEffect)(()=>{o(f.name,D,E)},[f.name,D,E]),(0,s.useEffect)(()=>{g(h)},[h]),a().createElement(Di,E,f.pages.map(e=>e.isSubform||n0(e)?e.isSubform&&e.subform?.form?a().createElement(oa,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:t}):a().createElement(rX,{key:e.label,page:e,isFormExpanded:c}):null))},r9=({context:e,setContext:n,setters:D,useCustomHooks:t,setIsLoadingCustomHooks:S})=>{let{isLoading:i=!1,error:r=null,data:o,updateContext:g}=t(e);return(0,s.useEffect)(()=>{!i&&g&&(g(n,D),S(!1))},[i]),null};function r7(e){let[n,D]=(0,s.useMemo)(()=>{let n=[],D=new Set,t=(e,S)=>{let i=S?{...e,meta:{...e.meta,groupId:S}}:e;n.push(i),i.questionOptions?.concept&&D.add(i.questionOptions.concept),i.questionOptions?.answers?.forEach(e=>{e.concept&&D.add(e.concept)}),"obsGroup"===i.type&&i.questions&&i.questions.forEach(e=>{t(e,i.id)})};return e.pages?.forEach(e=>e.sections?.forEach(e=>{e.questions?.forEach(e=>t(e))})),[n,JSON.stringify(Array.from(D).sort())]},[e]);return{formFields:n,conceptReferences:(0,s.useMemo)(()=>new Set(JSON.parse(D)),[D])}}let r6="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function r5(e){let{data:n,error:D,isLoading:t}=Sw()([`${o.restBaseUrl}/conceptreferences?v=${r6}`,e],([e,n])=>(0,o.openmrsFetch)(e,{headers:{"Content-Type":"application/json"},body:{references:n},method:"POST"}),{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{concepts:(0,s.useMemo)(()=>n?.data?Object.values(n.data):void 0,[n]),isLoading:t,error:D}}let oe={};function on(e){let n=(0,s.useMemo)(()=>{let n=new Set;return e.forEach(e=>{e.validators?.forEach(e=>n.add(e.type))}),Array.from(n).sort().join(",")},[e]),{data:D}=Sy()(n?["formFieldValidators",n]:null,async([,e])=>{let n=e.split(","),D=await Promise.all(n.map(e=>iW(e))),t={};return n.forEach((e,n)=>{t[e]=D[n]}),t},{keepPreviousData:!0});return D??oe}function oD(e,n){return(0,s.useMemo)(()=>e.length&&n?.length?e.map(e=>{let D=n2(e.questionOptions.concept,n);return e.questionOptions.concept=D?D.uuid:e.questionOptions.concept,e.label=e.label?e.label:D?.display,g.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&D?.conceptClass?.display==="Question"&&D?.answers?.length&&(e.questionOptions.answers=D.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:D},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let D=n2(e.concept,n);return{...e,concept:D?D.uuid:e.concept,label:e.label?e.label:D?.display}})),e}):e??[],[n,e])}let ot={},oS=e=>{let n=(0,s.useMemo)(()=>{let n=new Set;return e.forEach(e=>n.add(e.type)),Array.from(n).sort().join(",")},[e]),{data:D}=Sy()(n?["formFieldValueAdapters",n]:null,async([,e])=>{let n=e.split(","),D=await Promise.all(n.map(e=>iV(e))),t={};return n.forEach((e,n)=>{t[e]=D[n]}),t},{keepPreviousData:!0});return D??ot},oi="-esm-form-builder__loader__loaderContainer___ZkHfb",or="-esm-form-builder__loader__loader___YgDLP",oo=()=>{let{t:e}=(0,eX.useTranslation)();return a().createElement("div",{className:oi},a().createElement(h.OuH,{className:or,description:`${e("loading","Loading")} ...`}))},og=["patient","formJson","visit","sessionMode","sessionDate","location","currentProvider","layoutType","processor","formFields","formFieldAdapters","formFieldValidators"];function os(e,n){let D=og.filter(D=>D in n&&n[D]!==e[D]);D.length&&console.warn(`A form processor tried to set the context propert${1===D.length?"y":"ies"} ${D.join(", ")}, which the form engine derives itself. ${1===D.length?"It was":"They were"} ignored. Use the setters passed alongside setContext to update the domain object or custom dependencies.`)}let oa=({formJson:e,isSubForm:n=!1,setIsLoadingFormDependencies:D})=>{let{patient:t,sessionMode:S,formProcessors:i,layoutType:r,location:o,provider:g,sessionDate:l,visit:c}=SP(),{t:u}=(0,eX.useTranslation)(),h=(0,s.useMemo)(()=>{let n,D=i[e.processor];return D?n=new D(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),n=new SC(e)),n.prepareFormSchema(e),n},[i,e.processor]),{formFields:d,conceptReferences:p}=r7(e),{concepts:f,isLoading:m}=r5(Array.from(p)),y=oD(d,f),v=oS(d),b=on(d),w=(0,s.useMemo)(()=>y?.length?y:d??[],[y,d]),[M,L]=(0,s.useState)({}),$=(0,s.useMemo)(()=>({patient:t,formJson:e,sessionMode:S,layoutType:r,location:o,currentProvider:g,processor:h,sessionDate:l,visit:c,formFields:w,formFieldAdapters:v??{},formFieldValidators:b??{}}),[t,e,S,r,o,g,h,l,c,w,v,b]),_=(0,s.useMemo)(()=>({...$,...M}),[$,M]),x=(0,s.useCallback)(e=>{L(n=>{let D={...$,...n},t="function"==typeof e?e(D):e;return"function"==typeof e&&os(D,t),{domainObjectValue:t.domainObjectValue,previousDomainObjectValue:t.previousDomainObjectValue,customDependencies:t.customDependencies}})},[$]),C=(0,s.useMemo)(()=>({setDomainObjectValue:e=>L(n=>({...n,domainObjectValue:e})),setPreviousDomainObjectValue:e=>L(n=>({...n,previousDomainObjectValue:e})),setCustomDependencies:e=>L(n=>({...n,customDependencies:"function"==typeof e?e(n.customDependencies??{}):e}))}),[]),{isLoading:E}=rf(h,_,x,C),k=h.getCustomHooks().useCustomHooks,[A,T]=(0,s.useState)(!!k),{isLoadingInitialValues:O,initialValues:R,error:I}=rm(h,E||A||m,_),j=(0,s.useMemo)(()=>E||A||m||O,[E,A,m,O]);return(0,s.useEffect)(()=>{D(j)},[j,D]),(0,s.useEffect)(()=>{(0,n6.N)(I,u("errorLoadingInitialValues","Error loading initial values"))},[I,u]),(0,s.useEffect)(()=>{v&&rr(v)},[v]),a().createElement(a().Fragment,null,k&&a().createElement(r9,{context:_,setContext:x,setters:C,useCustomHooks:k,setIsLoadingCustomHooks:T}),j&&!n?a().createElement(oo,null):a().createElement(r8,{processorContext:_,initialValues:R,isSubForm:n,setIsLoadingFormDependencies:D}))},ol="-esm-form-builder__patient-banner__patientBannerContainer___KlhJI",oc=({patient:e,hideActionsOverflow:n})=>a().createElement("div",{className:ol},a().createElement(o.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:n}})),ou=({pages:e,defaultPage:n,activePages:D,evaluatedPagesVisibility:t})=>{let[S,i]=(0,s.useState)(null),[r,o]=(0,s.useState)(!1),[g,a]=(0,s.useState)(null),l=(0,s.useRef)(!0);return(0,s.useEffect)(()=>{r||!t||((()=>{let D=e.find(({label:e})=>e===n);if(D&&!D.isHidden)i(D.id),n4(D.id);else{let n=e.find(e=>!e.isHidden);n&&i(n.id)}})(),o(!0))},[e,n,t,r]),(0,s.useEffect)(()=>{let e=null;return r&&(e=setTimeout(()=>{l.current=!1},200)),()=>{e&&clearTimeout(e)}},[r]),(0,s.useEffect)(()=>{if(l.current)return;let n=null;if(g&&D.includes(g)){i(g),n=setTimeout(()=>{a(null)},100);return}return!g&&D.length>0&&i(D.reduce((n,D)=>e.findIndex(e=>e.id===n)<e.findIndex(e=>e.id===D)?n:D)),()=>{n&&clearTimeout(n)}},[D,g,e]),{currentActivePage:S,requestPage:(0,s.useCallback)(e=>{l.current=!1,a(e),i(e),n4(e)},[])}},oh="-esm-form-builder__sidebar__pageLink___Op55o",od="-esm-form-builder__sidebar__pageLinkTablet___cXw5r",op="-esm-form-builder__sidebar__activePage___buqNi",of="-esm-form-builder__sidebar__errorPage___Eu-K9",om="-esm-form-builder__sidebar__activeErrorPage___KHaKn",oy="-esm-form-builder__sidebar__sidebar___vTQvS",ov="-esm-form-builder__sidebar__sideNavActions___dzMCV",ob="-esm-form-builder__sidebar__divider___akCoV",ow="-esm-form-builder__sidebar__closeButton___HiIEp",oM="-esm-form-builder__sidebar__saveButton___6rQj1",oL="-esm-form-builder__sidebar__topMargin___Fh16B";function o$({page:e,currentActivePage:n,pagesWithErrors:D,requestPage:t}){let{t:S}=(0,eX.useTranslation)(),i=e.id===n,r=D.includes(e.id),g="tablet"===(0,o.useLayoutType)();return a().createElement("div",{className:c()(oh,{[op]:i&&!r,[of]:r&&!i,[om]:r&&i,[od]:g})},a().createElement("button",{onClick:n=>{n.preventDefault(),t(e.id)}},a().createElement("span",null,S(e.label))))}let o_=({defaultPage:e,isFormSubmitting:n,sessionMode:D,onCancel:t,handleClose:S,hideFormCollapseToggle:i,hideControls:r})=>{let{t:g}=(0,eX.useTranslation)(),{pages:l,pagesWithErrors:u,activePages:d,evaluatedPagesVisibility:p}=ru(),{currentActivePage:f,requestPage:m}=ou({pages:l,defaultPage:e,activePages:d,evaluatedPagesVisibility:p}),y=(0,o.useLayoutType)(),v=(0,s.useMemo)(()=>"tablet"===y?"lg":"sm",[y]);return a().createElement("div",{className:oy},l.filter(e=>n0(e)).map(e=>a().createElement(o$,{key:e.id,page:e,currentActivePage:f,pagesWithErrors:u,requestPage:m})),"view"!==D&&!r&&a().createElement("hr",{className:ob}),!r&&a().createElement("div",{className:ov},"view"!==D&&a().createElement(h.$nd,{className:oM,disabled:n,type:"submit",size:v},n?a().createElement(h.OuH,{description:g("submitting","Submitting")+"..."}):a().createElement("span",null,`${g("save","Save")}`)),a().createElement(h.$nd,{className:c()(ow,{[oL]:"view"===D}),kind:"tertiary",onClick:()=>{t?.(),S?.(),i()},size:v},"view"===D?g("close","Close"):g("cancel","Cancel"))))},ox="-esm-form-builder__form-engine__form___j8Gb3",oC="-esm-form-builder__form-engine__formContainer___Cvw6g",oE="-esm-form-builder__form-engine__formContent___F7MoF",ok="-esm-form-builder__form-engine__formContentInner___CXTIX",oA="-esm-form-builder__form-engine__formBody___DgyqX",oT="-esm-form-builder__form-engine__minifiedButtons___Ieyml",oO="-esm-form-builder__form-engine__markdownContainer___8OoYZ",oR="-esm-form-builder__form-engine__linearActivity___g2Tl3",oI="-esm-form-builder__form-engine__indeterminate___aYMI1",oj="-esm-form-builder__form-engine__saveButton___CQZOn",oN=({formJson:e,patientUUID:n,formUUID:D,encounterUUID:t,visit:S,formSessionIntent:i,mode:r,onSubmit:g,onCancel:l,handleClose:u,handleConfirmQuestionDeletion:d,markFormAsDirty:p,hideControls:f=!1,hidePatientBanner:m=!1,preFilledQuestions:y})=>{let{t:v}=(0,eX.useTranslation)(),b=(0,o.useSession)(),w=(0,s.useRef)(null),M=(0,s.useRef)(new Date),L=(0,s.useMemo)(()=>no(M.current,S),[S?.startDatetime,S?.stopDatetime]),$=rc(w),{patient:_,isLoadingPatient:x}=rp(n),[C,E]=(0,s.useState)(!1),[k,A]=(0,s.useState)(!1),[T,O]=(0,s.useState)(!1),R=e7(r)?e7(t)?"enter":"edit":r,{isFormExpanded:I,hideFormCollapseToggle:j}=rg(R),{hasMultiplePages:N}=ru(),{formJson:P,isLoading:F,formError:U}=iY(D,e,t,i,y),V=(0,s.useMemo)(()=>!m&&_&&"ultra-wide"===$&&"embedded-view"!==r,[_,r,$,m]),H=(0,s.useMemo)(()=>["narrow"].includes($),[$]),z=(0,s.useMemo)(()=>"embedded-view"!==r&&!C&&null!==N&&(H||!N),[r,H,C,N]),W=(0,s.useMemo)(()=>"embedded-view"!==r&&!C&&null!==N&&!H&&N,[H,C,N]);(0,s.useEffect)(()=>{(0,n6.N)(U,v("errorLoadingFormSchema","Error loading form schema"))},[U]),(0,s.useEffect)(()=>()=>{ro()},[]),(0,s.useEffect)(()=>{p?.(T)},[T]);let B=(0,s.useCallback)(e=>{e.preventDefault(),A(!0)},[]);return a().createElement("form",{ref:w,noValidate:!0,className:c()("cds--form",ox),onSubmit:B},x||F?a().createElement(oo,null):a().createElement(SN,{patient:_,patientUUID:n,sessionMode:R,sessionDate:L,formJson:P,workspaceLayout:"ultra-wide"===$?"maximized":"minimized",location:b?.sessionLocation,provider:b?.currentProvider,visit:S,handleConfirmQuestionDeletion:d,isFormExpanded:I,formSubmissionProps:{isSubmitting:k,setIsSubmitting:A,onSubmit:g,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:j,setIsFormDirty:O},a().createElement("div",{className:oC},C&&a().createElement("div",{className:oR},a().createElement("div",{className:oI})),a().createElement("div",{className:oE},W&&a().createElement(o_,{isFormSubmitting:k,sessionMode:r,defaultPage:P.defaultPage,onCancel:l,handleClose:u,hideFormCollapseToggle:j,hideControls:f}),a().createElement("div",{className:ok},V&&a().createElement(oc,{patient:_,hideActionsOverflow:!0}),P.markdown&&a().createElement("div",{className:oO},a().createElement(D0,{markdown:P.markdown})),a().createElement("div",{className:oA},a().createElement(oa,{formJson:P,setIsLoadingFormDependencies:E})),z&&!f&&a().createElement(h.Te$,{className:oT},a().createElement(h.$nd,{kind:"secondary",onClick:()=>{l&&l(),u&&u(),j()}},"view"===r?v("close","Close"):v("cancel","Cancel")),a().createElement(h.$nd,{className:oj,disabled:C||k||"view"===r,kind:"primary",type:"submit"},k?a().createElement(h.OuH,{description:v("submitting","Submitting")+"..."}):a().createElement("span",null,`${v("save","Save")}`))))))))},oP=function(e){return a().createElement(s.Suspense,{fallback:a().createElement(oo,null)},a().createElement(eX.I18nextProvider,{i18n:window.i18next,defaultNS:Sl.L},a().createElement(oN,e)))}},6232(e,n,D){"use strict";function t(e){return"boolean"==typeof e?e:"string"==typeof e?"true"==e:!!e}function S(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}D.d(n,{H:()=>t,O:()=>S})},10578(e,n,D){"use strict";D.d(n,{N:()=>S,j:()=>i});var t=D(46718);function S(e,n){if(e){let D=i(e).join(", ");console.error(e),(0,t.showSnackbar)({subtitle:D,title:n,kind:"error",isLowContrast:!1})}}function i(e){let n=e?.responseBody?.error?.fieldErrors,D=e?.responseBody?.error?.globalErrors;return n&&0!==Object.keys(n).length||D?D?.length?D.flatMap(e=>e.message):Object.values(n).flatMap(e=>e.map(e=>e.message)):[e?.responseBody?.error?.message??e?.message]}},77541(__unused_rspack_module,__webpack_exports__,__webpack_require__){"use strict";function evaluatePostSubmissionExpression(expression,encounters){let match,encounter=encounters[0],regx=/(?:\w+|'(?:\\'|[^'\n])*')/g,fieldIds=new Set;try{let replacedExpression;for(;match=regx.exec(expression);){let value=match[0].replace(/\\'/g,"'"),isBoolean=/^(true|false)$/i.test(value),isNumber=/^-?\d+$/.test(value),isFloat=/^-?\d+\.\d+$/.test(value);value.startsWith("'")&&value.endsWith("'")||"string"!=typeof value||isBoolean||isNumber||isFloat||fieldIds.add(value)}let fieldToValueMap={};return fieldIds.size&&(fieldToValueMap=getFieldValues(fieldIds,encounter)),replacedExpression=Object.keys(fieldToValueMap).length?expression.replace(/(\w+)/g,e=>Object.prototype.hasOwnProperty.call(fieldToValueMap,e)?fieldToValueMap[e]:e):expression,eval(replacedExpression)}catch(error){throw Error("Error evaluating expression")}}function getFieldValues(e,n){let D={};return e.forEach(e=>{let t=n.obs?.find(n=>n.formFieldPath.includes(e))?.value;"object"==typeof t&&(t=t.uuid),t&&(t=formatValue(t)),D[e]=t}),D}function formatValue(e){if("string"==typeof e&&(!(e.length>=2)||"'"!==e[0]||"'"!==e[e.length-1]))return`'${e}'`;return e}__webpack_require__.d(__webpack_exports__,{g:()=>evaluatePostSubmissionExpression})},80952(e,n,D){e=D.nmd(e),function(){var e="ace",n=function(){return this}();if(!n&&"u">typeof window&&(n=window),e||"u"<typeof requirejs){var D=function(e,n,t){"string"!=typeof e?D.original?D.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(t=n),D.modules[e]||(D.payloads[e]=t,D.modules[e]=null))};D.modules={},D.payloads={};var t=function(e,n,D){if("string"==typeof n){var t=r(e,n);if(void 0!=t)return D&&D(),t}else if("[object Array]"===Object.prototype.toString.call(n)){for(var i=[],o=0,g=n.length;o<g;++o){var s=r(e,n[o]);if(void 0==s&&S.original)return;i.push(s)}return D&&D.apply(null,i)||!0}},S=function(e,n){var D=t("",e,n);return void 0==D&&S.original?S.original.apply(this,arguments):D},i=function(e,n){if(-1!==n.indexOf("!")){var D=n.split("!");return i(e,D[0])+"!"+i(e,D[1])}if("."==n.charAt(0))for(n=e.split("/").slice(0,-1).join("/")+"/"+n;-1!==n.indexOf(".")&&t!=n;){var t=n;n=n.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return n},r=function(e,n){n=i(e,n);var S=D.modules[n];if(!S){if("function"==typeof(S=D.payloads[n])){var r={},o={id:n,uri:"",exports:r,packaged:!0};r=S(function(e,D){return t(n,e,D)},r,o)||o.exports,D.modules[n]=r,delete D.payloads[n]}S=D.modules[n]=r||S}return S};o(e)}function o(e){var t=n;e&&(n[e]||(n[e]={}),t=n[e]),t.define&&t.define.packaged||(D.original=t.define,t.define=D,t.define.packaged=!0),t.require&&t.require.packaged||(S.original=t.require,t.require=S,t.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,n,D){function t(e,n,D){Object.defineProperty(e,n,{value:D,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||t(String.prototype,"startsWith",function(e,n){return n=n||0,this.lastIndexOf(e,n)===n}),String.prototype.endsWith||t(String.prototype,"endsWith",function(e,n){var D=this;(void 0===n||n>D.length)&&(n=D.length),n-=e.length;var t=D.indexOf(e,n);return -1!==t&&t===n}),String.prototype.repeat||t(String.prototype,"repeat",function(e){for(var n="",D=this;e>0;)1&e&&(n+=D),(e>>=1)&&(D+=D);return n}),String.prototype.includes||t(String.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Object.assign||(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");for(var n=Object(e),D=1;D<arguments.length;D++){var t=arguments[D];null!=t&&Object.keys(t).forEach(function(e){n[e]=t[e]})}return n}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(n){return e[n]})}),Array.prototype.find||t(Array.prototype,"find",function(e){for(var n=this.length,D=arguments[1],t=0;t<n;t++){var S=this[t];if(e.call(D,S,t,this))return S}}),Array.prototype.findIndex||t(Array.prototype,"findIndex",function(e){for(var n=this.length,D=arguments[1],t=0;t<n;t++){var S=this[t];if(e.call(D,S,t,this))return t}}),Array.prototype.includes||t(Array.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Array.prototype.fill||t(Array.prototype,"fill",function(e){for(var n=this,D=n.length>>>0,t=arguments[1],S=0|t,i=S<0?Math.max(D+S,0):Math.min(S,D),r=arguments[2],o=void 0===r?D:0|r,g=o<0?Math.max(D+o,0):Math.min(o,D);i<g;)n[i]=e,i++;return n}),Array.of||t(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,n,D){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,n,D){n.deepCopy=function e(n){if("object"!=typeof n||!n)return n;if(Array.isArray(n)){D=[];for(var D,t=0;t<n.length;t++)D[t]=e(n[t]);return D}if("[object Object]"!==Object.prototype.toString.call(n))return n;for(var t in D={},n)D[t]=e(n[t]);return D}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,n,D){"use strict";n.last=function(e){return e[e.length-1]},n.stringReverse=function(e){return e.split("").reverse().join("")},n.stringRepeat=function(e,n){for(var D="";n>0;)1&n&&(D+=e),(n>>=1)&&(e+=e);return D};var t=/^\s\s*/,S=/\s\s*$/;n.stringTrimLeft=function(e){return e.replace(t,"")},n.stringTrimRight=function(e){return e.replace(S,"")},n.copyObject=function(e){var n={};for(var D in e)n[D]=e[D];return n},n.copyArray=function(e){for(var n=[],D=0,t=e.length;D<t;D++)e[D]&&"object"==typeof e[D]?n[D]=this.copyObject(e[D]):n[D]=e[D];return n},n.deepCopy=e("./deep_copy").deepCopy,n.arrayToMap=function(e){for(var n={},D=0;D<e.length;D++)n[e[D]]=1;return n},n.createMap=function(e){var n=Object.create(null);for(var D in e)n[D]=e[D];return n},n.arrayRemove=function(e,n){for(var D=0;D<=e.length;D++)n===e[D]&&e.splice(D,1)},n.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},n.escapeHTML=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},n.getMatchOffsets=function(e,n){var D=[];return e.replace(n,function(e){D.push({offset:arguments[arguments.length-2],length:e.length})}),D},n.deferredCall=function(e){var n=null,D=function(){n=null,e()},t=function(e){return t.cancel(),n=setTimeout(D,e||0),t};return t.schedule=t,t.call=function(){return this.cancel(),e(),t},t.cancel=function(){return clearTimeout(n),n=null,t},t.isPending=function(){return n},t},n.delayedCall=function(e,n){var D=null,t=function(){D=null,e()},S=function(e){null==D&&(D=setTimeout(t,e||n))};return S.delay=function(e){D&&clearTimeout(D),D=setTimeout(t,e||n)},S.schedule=S,S.call=function(){this.cancel(),e()},S.cancel=function(){D&&clearTimeout(D),D=null},S.isPending=function(){return D},S},n.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},n.skipEmptyMatch=function(e,n,D){return D&&e.codePointAt(n)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,n,D){"use strict";n.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},n.getOS=function(){return n.isMac?n.OS.MAC:n.isLinux?n.OS.LINUX:n.OS.WINDOWS};var t="object"==typeof navigator?navigator:{},S=(/mac|win|linux/i.exec(t.platform)||["other"])[0].toLowerCase(),i=t.userAgent||"",r=t.appName||"";n.isWin="win"==S,n.isMac="mac"==S,n.isLinux="linux"==S,n.isIE="Microsoft Internet Explorer"==r||r.indexOf("MSAppHost")>=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),n.isOldIE=n.isIE&&n.isIE<9,n.isGecko=n.isMozilla=i.match(/ Gecko\/\d+/),n.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),n.isWebKit=parseFloat(i.split("WebKit/")[1])||void 0,n.isChrome=parseFloat(i.split(" Chrome/")[1])||void 0,n.isSafari=parseFloat(i.split(" Safari/")[1])&&!n.isChrome||void 0,n.isEdge=parseFloat(i.split(" Edge/")[1])||void 0,n.isAIR=i.indexOf("AdobeAIR")>=0,n.isAndroid=i.indexOf("Android")>=0,n.isChromeOS=i.indexOf(" CrOS ")>=0,n.isIOS=/iPad|iPhone|iPod/.test(i)&&!window.MSStream,n.isIOS&&(n.isMac=!0),n.isMobile=n.isIOS||n.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,n,D){"use strict";var t,S=e("./useragent"),i="http://www.w3.org/1999/xhtml";n.buildDom=function e(n,D,t){if("string"==typeof n&&n){var S=document.createTextNode(n);return D&&D.appendChild(S),S}if(!Array.isArray(n))return n&&n.appendChild&&D&&D.appendChild(n),n;if("string"!=typeof n[0]||!n[0]){for(var i=[],r=0;r<n.length;r++){var o=e(n[r],D,t);o&&i.push(o)}return i}var g=document.createElement(n[0]),s=n[1],a=1;s&&"object"==typeof s&&!Array.isArray(s)&&(a=2);for(var r=a;r<n.length;r++)e(n[r],g,t);return 2==a&&Object.keys(s).forEach(function(e){var n=s[e];"class"===e?g.className=Array.isArray(n)?n.join(" "):n:"function"==typeof n||"value"==e||"$"==e[0]?g[e]=n:"ref"===e?t&&(t[n]=g):"style"===e?"string"==typeof n&&(g.style.cssText=n):null!=n&&g.setAttribute(e,n)}),D&&D.appendChild(g),g},n.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},n.createElement=function(e,n){return document.createElementNS?document.createElementNS(n||i,e):document.createElement(e)},n.removeChildren=function(e){e.innerHTML=""},n.createTextNode=function(e,n){return(n?n.ownerDocument:document).createTextNode(e)},n.createFragment=function(e){return(e?e.ownerDocument:document).createDocumentFragment()},n.hasCssClass=function(e,n){return -1!==(e.className+"").split(/\s+/g).indexOf(n)},n.addCssClass=function(e,D){n.hasCssClass(e,D)||(e.className+=" "+D)},n.removeCssClass=function(e,n){for(var D=e.className.split(/\s+/g);;){var t=D.indexOf(n);if(-1==t)break;D.splice(t,1)}e.className=D.join(" ")},n.toggleCssClass=function(e,n){for(var D=e.className.split(/\s+/g),t=!0;;){var S=D.indexOf(n);if(-1==S)break;t=!1,D.splice(S,1)}return t&&D.push(n),e.className=D.join(" "),t},n.setCssClass=function(e,D,t){t?n.addCssClass(e,D):n.removeCssClass(e,D)},n.hasCssString=function(e,n){var D,t=0;if(D=(n=n||document).querySelectorAll("style")){for(;t<D.length;)if(D[t++].id===e)return!0}},n.removeElementById=function(e,n){(n=n||document).getElementById(e)&&n.getElementById(e).remove()};var r=[];function o(){var e=r;r=null,e&&e.forEach(function(e){g(e[0],e[1])})}function g(e,D,S){if(!("u"<typeof document)){if(r){if(S)o();else if(!1===S)return r.push([e,D])}if(!t){var i=S;S&&S.getRootNode&&(i=S.getRootNode())&&i!=S||(i=document);var g=i.ownerDocument||i;if(D&&n.hasCssString(D,i))return null;D&&(e+="\n/*# sourceURL=ace/css/"+D+" */");var s=n.createElement("style");s.appendChild(g.createTextNode(e)),D&&(s.id=D),i==g&&(i=n.getDocumentHead(g)),i.insertBefore(s,i.firstChild)}}}if(n.useStrictCSP=function(e){t=e,!1==e?o():r||(r=[])},n.importCssString=g,n.importCssStylsheet=function(e,D){n.buildDom(["link",{rel:"stylesheet",href:e}],n.getDocumentHead(D))},n.scrollbarWidth=function(e){var D=n.createElement("ace_inner");D.style.width="100%",D.style.minWidth="0px",D.style.height="200px",D.style.display="block";var t=n.createElement("ace_outer"),S=t.style;S.position="absolute",S.left="-10000px",S.overflow="hidden",S.width="200px",S.minWidth="0px",S.height="150px",S.display="block",t.appendChild(D);var i=e&&e.documentElement||document&&document.documentElement;if(!i)return 0;i.appendChild(t);var r=D.offsetWidth;S.overflow="scroll";var o=D.offsetWidth;return r===o&&(o=t.clientWidth),i.removeChild(t),r-o},n.computedStyle=function(e,n){return window.getComputedStyle(e,"")||{}},n.setStyle=function(e,n,D){e[n]!==D&&(e[n]=D)},n.HAS_CSS_ANIMATION=!1,n.HAS_CSS_TRANSFORMS=!1,n.HI_DPI=!S.isWin||"u">typeof window&&window.devicePixelRatio>=1.5,S.isChromeOS&&(n.HI_DPI=!1),"u">typeof document){var s=document.createElement("div");n.HI_DPI&&void 0!==s.style.transform&&(n.HAS_CSS_TRANSFORMS=!0),S.isEdge||void 0===s.style.animationName||(n.HAS_CSS_ANIMATION=!0),s=null}n.HAS_CSS_TRANSFORMS?n.translate=function(e,n,D){e.style.transform="translate("+Math.round(n)+"px, "+Math.round(D)+"px)"}:n.translate=function(e,n,D){e.style.top=Math.round(D)+"px",e.style.left=Math.round(n)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./dom");n.get=function(e,n){var D=new XMLHttpRequest;D.open("GET",e,!0),D.onreadystatechange=function(){4===D.readyState&&n(D.responseText)},D.send(null)},n.loadScript=function(e,n){var D=t.getDocumentHead(),S=document.createElement("script");S.src=e,D.appendChild(S),S.onload=S.onreadystatechange=function(e,D){(D||!S.readyState||"loaded"==S.readyState||"complete"==S.readyState)&&(S=S.onload=S.onreadystatechange=null,D||n())}},n.qualifyURL=function(e){var n=document.createElement("a");return n.href=e,n.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,n,D){"use strict";n.inherits=function(e,n){e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(e,n){for(var D in n)e[D]=n[D];return e},n.implement=function(e,D){n.mixin(e,D)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,n,D){"use strict";var t={},S=function(){this.propagationStopped=!0},i=function(){this.defaultPrevented=!0};t._emit=t._dispatchEvent=function(e,n){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var D=this._eventRegistry[e]||[],t=this._defaultHandlers[e];if(D.length||t){"object"==typeof n&&n||(n={}),n.type||(n.type=e),n.stopPropagation||(n.stopPropagation=S),n.preventDefault||(n.preventDefault=i),D=D.slice();for(var r=0;r<D.length&&(D[r](n,this),!n.propagationStopped);r++);if(t&&!n.defaultPrevented)return t(n,this)}},t._signal=function(e,n){var D=(this._eventRegistry||{})[e];if(D){D=D.slice();for(var t=0;t<D.length;t++)D[t](n,this)}},t.once=function(e,n){var D=this;if(this.on(e,function t(){D.off(e,t),n.apply(null,arguments)}),!n)return new Promise(function(e){n=e})},t.setDefaultHandler=function(e,n){var D=this._defaultHandlers;if(D||(D=this._defaultHandlers={_disabled_:{}}),D[e]){var t=D[e],S=D._disabled_[e];S||(D._disabled_[e]=S=[]),S.push(t);var i=S.indexOf(n);-1!=i&&S.splice(i,1)}D[e]=n},t.removeDefaultHandler=function(e,n){var D=this._defaultHandlers;if(D){var t=D._disabled_[e];if(D[e]==n)t&&this.setDefaultHandler(e,t.pop());else if(t){var S=t.indexOf(n);-1!=S&&t.splice(S,1)}}},t.on=t.addEventListener=function(e,n,D){this._eventRegistry=this._eventRegistry||{};var t=this._eventRegistry[e];return t||(t=this._eventRegistry[e]=[]),-1==t.indexOf(n)&&t[D?"unshift":"push"](n),n},t.off=t.removeListener=t.removeEventListener=function(e,n){this._eventRegistry=this._eventRegistry||{};var D=this._eventRegistry[e];if(D){var t=D.indexOf(n);-1!==t&&D.splice(t,1)}},t.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},n.EventEmitter=t}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,n,D){n.reportError=function(e,n){var D=Error(e);D.data=n,"object"==typeof console&&console.error&&console.error(D),setTimeout(function(){throw D})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,n,D){n.defaultEnglishMessages={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions"}}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(e,n,D){var t,S,i=e("./oop"),r=e("./event_emitter").EventEmitter,o=e("./report_error").reportError,g=e("./default_english_messages").defaultEnglishMessages,s={setOptions:function(e){Object.keys(e).forEach(function(n){this.setOption(n,e[n])},this)},getOptions:function(e){var n={};if(e)Array.isArray(e)||(e=Object.keys(n=e));else{var D=this.$options;e=Object.keys(D).filter(function(e){return!D[e].hidden})}return e.forEach(function(e){n[e]=this.getOption(e)},this),n},setOption:function(e,n){if(this["$"+e]!==n){var D=this.$options[e];if(!D)return a('misspelled option "'+e+'"');if(D.forwardTo)return this[D.forwardTo]&&this[D.forwardTo].setOption(e,n);D.handlesSet||(this["$"+e]=n),D&&D.set&&D.set.call(this,n)}},getOption:function(e){var n=this.$options[e];return n?n.forwardTo?this[n.forwardTo]&&this[n.forwardTo].getOption(e):n&&n.get?n.get.call(this):this["$"+e]:a('misspelled option "'+e+'"')}};function a(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var l=function(){function e(){this.$defaultOptions={},t=g,S="dollarSigns"}return e.prototype.defineOptions=function(e,n,D){return e.$options||(this.$defaultOptions[n]=e.$options={}),Object.keys(D).forEach(function(n){var t=D[n];"string"==typeof t&&(t={forwardTo:t}),t.name||(t.name=n),e.$options[t.name]=t,"initialValue"in t&&(e["$"+t.name]=t.initialValue)}),i.implement(e,s),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(n){var D=e.$options[n];"value"in D&&e.setOption(n,D.value)})},e.prototype.setDefaultValue=function(e,n,D){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][n])break;if(!this.$defaultOptions[e][n])return!1}var t=this.$defaultOptions[e]||(this.$defaultOptions[e]={});t[n]&&(t.forwardTo?this.setDefaultValue(t.forwardTo,n,D):t[n].value=D)},e.prototype.setDefaultValues=function(e,n){Object.keys(n).forEach(function(D){this.setDefaultValue(e,D,n[D])},this)},e.prototype.setMessages=function(e,n){t=e,n&&n.placeholders&&(S=n.placeholders)},e.prototype.nls=function(e,n,D){!t[e]&&(a("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+n+"'."),t[n]||a("No message found for the default string '"+n+"' in the provided messages. Falling back to the default English message."));var i=t[e]||t[n]||n;return D&&("dollarSigns"===S&&(i=i.replace(/\$(\$|[\d]+)/g,function(e,n){return"$"==n?"$":D[n]})),"curlyBrackets"===S&&(i=i.replace(/\{([^\}]+)\}/g,function(e,n){return D[n]}))),i},e}();l.prototype.warn=a,l.prototype.reportError=o,i.implement(l.prototype,r),n.AppConfig=l}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,n,D){D.exports='.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print-margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm {\n background-color: #FFFFFF;\n color: black;\n}\n\n.ace-tm .ace_cursor {\n color: black;\n}\n \n.ace-tm .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(e,n,D){"use strict";n.isDark=!1,n.cssClass="ace-tm",n.cssText=e("./textmate-css"),n.$id="ace/theme/textmate",e("../lib/dom").importCssString(n.cssText,n.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(e,n,D){var t,S=e("./lib/lang"),i=e("./lib/net"),r=e("./lib/dom");D.exports=n=new(e("./lib/app_config")).AppConfig;var o={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};n.get=function(e){if(!o.hasOwnProperty(e))throw Error("Unknown config key: "+e);return o[e]},n.set=function(e,n){if(o.hasOwnProperty(e))o[e]=n;else if(!1==this.setDefaultValue("",e,n))throw Error("Unknown config key: "+e);"useStrictCSP"==e&&r.useStrictCSP(n)},n.all=function(){return S.copyObject(o)},n.$modes={},n.moduleUrl=function(e,n){if(o.$moduleUrls[e])return o.$moduleUrls[e];var D=e.split("/"),t="snippets"==(n=n||D[D.length-2]||"")?"/":"-",S=D[D.length-1];if("worker"==n&&"-"==t){var i=RegExp("^"+n+"[\\-_]|[\\-_]"+n+"$","g");S=S.replace(i,"")}(!S||S==n)&&D.length>1&&(S=D[D.length-2]);var r=o[n+"Path"];return null==r?r=o.basePath:"/"==t&&(n=t=""),r&&"/"!=r.slice(-1)&&(r+="/"),r+n+t+S+this.get("suffix")},n.setModuleUrl=function(e,n){return o.$moduleUrls[e]=n};var g=function(n,D){return"ace/theme/textmate"===n||"./theme/textmate"===n?D(null,e("./theme/textmate")):t?t(n,D):void console.error("loader is not configured")};n.setLoader=function(e){t=e},n.dynamicModules=Object.create(null),n.$loading={},n.$loaded={},n.loadModule=function(e,D){if(Array.isArray(e))var t,S=e[0],r=e[1];else if("string"==typeof e)var r=e;var o=function(e){if(e&&!n.$loading[r])return D&&D(e);if(n.$loading[r]||(n.$loading[r]=[]),n.$loading[r].push(D),!(n.$loading[r].length>1)){var t=function(){g(r,function(e,D){D&&(n.$loaded[r]=D),n._emit("load.module",{name:r,module:D});var t=n.$loading[r];n.$loading[r]=null,t.forEach(function(e){e&&e(D)})})};if(!n.get("packaged"))return t();i.loadScript(n.moduleUrl(r,S),t),s()}};if(n.dynamicModules[r])n.dynamicModules[r]().then(function(e){e.default?o(e.default):o(e)});else{try{t=this.$require(r)}catch(e){}o(t||n.$loaded[r])}},n.$require=function(e){if("function"==typeof D.require)return D.require(e)},n.setModuleLoader=function(e,D){n.dynamicModules[e]=D};var s=function(){o.basePath||o.workerPath||o.modePath||o.themePath||Object.keys(o.$moduleUrls).length||(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),s=function(){})};n.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,n,D){"use strict";e("./lib/fixoldbrowsers");var t=e("./config");t.setLoader(function(n,D){e([n],function(e){D(null,e)})});var S=function(){return this||"u">typeof window&&window}();function i(n){if(S&&S.document){t.set("packaged",n||e.packaged||D.packaged||S.define&&define.packaged);var i={},o="",g=document.currentScript||document._currentScript,s=g&&g.ownerDocument||document;g&&g.src&&(o=g.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=s.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l],u=c.src||c.getAttribute("src");if(u){for(var h=c.attributes,d=0,p=h.length;d<p;d++){var f=h[d];0===f.name.indexOf("data-ace-")&&(i[r(f.name.replace(/^data-ace-/,""))]=f.value)}var m=u.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);m&&(o=m[1])}}for(var y in o&&(i.base=i.base||o,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base,i)void 0!==i[y]&&t.set(y,i[y])}}function r(e){return e.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}D.exports=function(n){t.init=i,t.$require=e,n.require=e,"function"==typeof define&&(n.define=define)},i(!0)}),ace.define("ace/range",["require","exports","module"],function(e,n,D){"use strict";var t=function(){function e(e,n,D,t){this.start={row:e,column:n},this.end={row:D,column:t}}return e.prototype.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},e.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},e.prototype.contains=function(e,n){return 0==this.compare(e,n)},e.prototype.compareRange=function(e){var n,D=e.end,t=e.start;return 1==(n=this.compare(D.row,D.column))?1==(n=this.compare(t.row,t.column))?2:+(0==n):-1==n?-2:-1==(n=this.compare(t.row,t.column))?-1:42*(1==n)},e.prototype.comparePoint=function(e){return this.compare(e.row,e.column)},e.prototype.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},e.prototype.intersects=function(e){var n=this.compareRange(e);return -1==n||0==n||1==n},e.prototype.isEnd=function(e,n){return this.end.row==e&&this.end.column==n},e.prototype.isStart=function(e,n){return this.start.row==e&&this.start.column==n},e.prototype.setStart=function(e,n){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=n)},e.prototype.setEnd=function(e,n){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=n)},e.prototype.inside=function(e,n){if(0==this.compare(e,n)&&!(this.isEnd(e,n)||this.isStart(e,n)))return!0;return!1},e.prototype.insideStart=function(e,n){if(0==this.compare(e,n)&&!this.isEnd(e,n))return!0;return!1},e.prototype.insideEnd=function(e,n){if(0==this.compare(e,n)&&!this.isStart(e,n))return!0;return!1},e.prototype.compare=function(e,n){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?n>=this.start.column?0:-1:this.end.row===e?n<=this.end.column?0:1:0:n<this.start.column?-1:+(n>this.end.column)},e.prototype.compareStart=function(e,n){return this.start.row==e&&this.start.column==n?-1:this.compare(e,n)},e.prototype.compareEnd=function(e,n){return this.end.row==e&&this.end.column==n?1:this.compare(e,n)},e.prototype.compareInside=function(e,n){return this.end.row==e&&this.end.column==n?1:this.start.row==e&&this.start.column==n?-1:this.compare(e,n)},e.prototype.clipRows=function(n,D){if(this.end.row>D)var t={row:D+1,column:0};else if(this.end.row<n)var t={row:n,column:0};if(this.start.row>D)var S={row:D+1,column:0};else if(this.start.row<n)var S={row:n,column:0};return e.fromPoints(S||this.start,t||this.end)},e.prototype.extend=function(n,D){var t=this.compare(n,D);if(0==t)return this;if(-1==t)var S={row:n,column:D};else var i={row:n,column:D};return e.fromPoints(S||this.start,i||this.end)},e.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},e.prototype.isMultiLine=function(){return this.start.row!==this.end.row},e.prototype.clone=function(){return e.fromPoints(this.start,this.end)},e.prototype.collapseRows=function(){return 0==this.end.column?new e(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new e(this.start.row,0,this.end.row,0)},e.prototype.toScreenRange=function(n){var D=n.documentToScreenPosition(this.start),t=n.documentToScreenPosition(this.end);return new e(D.row,D.column,t.row,t.column)},e.prototype.moveBy=function(e,n){this.start.row+=e,this.start.column+=n,this.end.row+=e,this.end.column+=n},e}();t.fromPoints=function(e,n){return new t(e.row,e.column,n.row,n.column)},t.comparePoints=function(e,n){return e.row-n.row||e.column-n.column},n.Range=t}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,n,D){"use strict";for(var t=e("./oop"),S={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},i={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},r=0;r<10;r++)i["Digit"+r]=48+r,i["Numpad"+r]=96+r,S.PRINTABLE_KEYS[48+r]=""+r,S.FUNCTION_KEYS[96+r]="Numpad"+r;for(var r=65;r<91;r++){var o=String.fromCharCode(r+32);i["Key"+o.toUpperCase()]=r,S.PRINTABLE_KEYS[r]=o}for(var r=1;r<13;r++)i["F"+r]=111+r,S.FUNCTION_KEYS[111+r]="F"+r;var g={Shift:16,Control:17,Alt:18,Meta:224};for(var s in g)i[s]=i[s+"Left"]=i[s+"Right"]=g[s];for(var a in n.$codeToKeyCode=i,S.PRINTABLE_KEYS[173]="-",S.FUNCTION_KEYS){var l=S.FUNCTION_KEYS[a].toLowerCase();S[l]=parseInt(a,10)}for(var a in S.PRINTABLE_KEYS){var l=S.PRINTABLE_KEYS[a].toLowerCase();S[l]=parseInt(a,10)}t.mixin(S,S.MODIFIER_KEYS),t.mixin(S,S.PRINTABLE_KEYS),t.mixin(S,S.FUNCTION_KEYS),S.enter=S.return,S.escape=S.esc,S.del=S.delete,function(){for(var e=["cmd","ctrl","alt","shift"],n=Math.pow(2,e.length);n--;)S.KEY_MODS[n]=e.filter(function(e){return n&S.KEY_MODS[e]}).join("-")+"-"}(),S.KEY_MODS[0]="",S.KEY_MODS[-1]="input-",t.mixin(n,S),n.default=n,n.keyCodeToString=function(e){var n=S[e];return"string"!=typeof n&&(n=String.fromCharCode(e)),n.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,n,D){"use strict";var t,S=e("./keys"),i=e("./useragent"),r=null,o=0;function g(){t=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return t={passive:!1},!0}})}catch(e){}}function s(){return void 0==t&&g(),t}function a(e,n,D){this.elem=e,this.type=n,this.callback=D}a.prototype.destroy=function(){c(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var l=n.addListener=function(e,n,D,t){e.addEventListener(n,D,s()),t&&t.$toDestroy.push(new a(e,n,D))},c=n.removeListener=function(e,n,D){e.removeEventListener(n,D,s())};function u(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function h(e,n,D){var t=u(n);if(!D&&n.code&&(D=S.$codeToKeyCode[n.code]||D),!i.isMac&&r){if(n.getModifierState&&(n.getModifierState("OS")||n.getModifierState("Win"))&&(t|=8),r.altGr)if((3&t)==3)return;else r.altGr=0;if(18===D||17===D){var g=n.location;17===D&&1===g?1==r[D]&&(o=n.timeStamp):18===D&&3===t&&2===g&&n.timeStamp-o<50&&(r.altGr=!0)}}if(D in S.MODIFIER_KEYS&&(D=-1),t||13!==D||3!==n.location||(e(n,t,-D),!n.defaultPrevented)){if(i.isChromeOS&&8&t){if(e(n,t,D),n.defaultPrevented)return;t&=-9}return(!!t||D in S.FUNCTION_KEYS||D in S.PRINTABLE_KEYS)&&e(n,t,D)}}function d(){r=Object.create(null)}if(n.stopEvent=function(e){return n.stopPropagation(e),n.preventDefault(e),!1},n.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},n.preventDefault=function(e){e.preventDefault&&e.preventDefault()},n.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},n.capture=function(e,n,D){var t=e&&e.ownerDocument||document;function S(e){n&&n(e),D&&D(e),c(t,"mousemove",n),c(t,"mouseup",S),c(t,"dragstart",S)}return l(t,"mousemove",n),l(t,"mouseup",S),l(t,"dragstart",S),S},n.addMouseWheelListener=function(e,n,D){l(e,"wheel",function(e){var D=.15,t=e.deltaX||0,S=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=t*D,e.wheelY=S*D;break;case e.DOM_DELTA_LINE:var i=15;e.wheelX=15*t,e.wheelY=S*i;break;case e.DOM_DELTA_PAGE:var r=150;e.wheelX=150*t,e.wheelY=S*r}n(e)},D)},n.addMultiMouseDownListener=function(e,D,t,S,r){var o,g,s,a=0,c={2:"dblclick",3:"tripleclick",4:"quadclick"};function u(e){if(0!==n.getButton(e)?a=0:e.detail>1?++a>4&&(a=1):a=1,i.isIE){var r=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-g)>5;(!s||r)&&(a=1),s&&clearTimeout(s),s=setTimeout(function(){s=null},D[a-1]||600),1==a&&(o=e.clientX,g=e.clientY)}if(e._clicks=a,t[S]("mousedown",e),a>4)a=0;else if(a>1)return t[S](c[a],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){l(e,"mousedown",u,r)})},n.getModifierString=function(e){return S.KEY_MODS[u(e)]},n.addCommandKeyListener=function(e,D,t){var S=null;l(e,"keydown",function(e){r[e.keyCode]=(r[e.keyCode]||0)+1;var n=h(D,e,e.keyCode);return S=e.defaultPrevented,n},t),l(e,"keypress",function(e){S&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(n.stopEvent(e),S=null)},t),l(e,"keyup",function(e){r[e.keyCode]=null},t),r||(d(),l(window,"focus",d))},"object"==typeof window&&window.postMessage&&!i.isOldIE){var p=1;n.nextTick=function(e,D){D=D||window;var t="zero-timeout-message-"+p++,S=function(i){i.data==t&&(n.stopPropagation(i),c(D,"message",S),e())};l(D,"message",S),D.postMessage(t,"*")}}n.$idleBlocked=!1,n.onIdle=function(e,D){return setTimeout(function D(){n.$idleBlocked?setTimeout(D,100):e()},D)},n.$idleBlockId=null,n.blockIdle=function(e){n.$idleBlockId&&clearTimeout(n.$idleBlockId),n.$idleBlocked=!0,n.$idleBlockId=setTimeout(function(){n.$idleBlocked=!1},e||100)},n.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),n.nextFrame?n.nextFrame=n.nextFrame.bind(window):n.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(e,n,D){"use strict";var t;D.exports={lineMode:!1,pasteCancelled:function(){return!!(t&&t>Date.now()-50)||(t=!1)},cancel:function(){t=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../config").nls,i=e("../lib/useragent"),r=e("../lib/dom"),o=e("../lib/lang"),g=e("../clipboard"),s=i.isChrome<18,a=i.isIE,l=i.isChrome>63,c=400,u=e("../lib/keys"),h=u.KEY_MODS,d=i.isIOS,p=d?/\s/:/\n/,f=i.isMobile;n.TextInput=function(e,n){var D,m=r.createElement("textarea");m.className="ace_text-input",m.setAttribute("wrap","off"),m.setAttribute("autocorrect","off"),m.setAttribute("autocapitalize","off"),m.setAttribute("spellcheck","false"),m.style.opacity="0",e.insertBefore(m,e.firstChild);var y=!1,v=!1,b=!1,w=!1,M="";f||(m.style.fontSize="1px");var L=!1,$=!1,_="",x=0,C=0,E=0,k=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER,T=0;try{var O=document.activeElement===m}catch(e){}this.setNumberOfExtraLines=function(e){if(k=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER,e<0){T=0;return}T=e},this.setAriaOptions=function(e){if(e.activeDescendant?(m.setAttribute("aria-haspopup","true"),m.setAttribute("aria-autocomplete",e.inline?"both":"list"),m.setAttribute("aria-activedescendant",e.activeDescendant)):(m.setAttribute("aria-haspopup","false"),m.setAttribute("aria-autocomplete","both"),m.removeAttribute("aria-activedescendant")),e.role&&m.setAttribute("role",e.role),e.setLabel){m.setAttribute("aria-roledescription",S("text-input.aria-roledescription","editor"));var D="";n.$textInputAriaLabel&&(D+="".concat(n.$textInputAriaLabel,", ")),n.session&&(D+=S("text-input.aria-label","Cursor at row $0",[n.session.selection.cursor.row+1])),m.setAttribute("aria-label",D)}},this.setAriaOptions({role:"textbox"}),t.addListener(m,"blur",function(e){$||(n.onBlur(e),O=!1)},n),t.addListener(m,"focus",function(e){if(!$){if(O=!0,i.isEdge)try{if(!document.hasFocus())return}catch(e){}n.onFocus(e),i.isEdge?setTimeout(I):I()}},n),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:n.renderer.enableKeyboardAccessibility}),M||l||"browser"==this.$focusScroll)return m.focus({preventScroll:!0});var e=m.style.top;m.style.position="fixed",m.style.top="0px";try{var D=0!=m.getBoundingClientRect().top}catch(e){return}var t=[];if(D)for(var S=m.parentElement;S&&1==S.nodeType;)t.push(S),S.setAttribute("ace_nocontext","true"),S=!S.parentElement&&S.getRootNode?S.getRootNode().host:S.parentElement;m.focus({preventScroll:!0}),D&&t.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){m.style.position="","0px"==m.style.top&&(m.style.top=e)},0)},this.blur=function(){m.blur()},this.isFocused=function(){return O},n.on("beforeEndOperation",function(){var e=n.curOp,D=e&&e.command&&e.command.name;if("insertstring"!=D){var t=D&&(e.docChanged||e.selectionChanged);b&&t&&(_=m.value="",Y()),I()}});var R=function(e,D){for(var t=D,S=1;S<=e-k&&S<2*T+1;S++)t+=n.session.getLine(e-S).length+1;return t},I=d?function(e){if(O&&(!y||e)&&!w){e||(e="");var D="\n ab"+e+"cde fg\n";D!=m.value&&(m.value=_=D);var t=4,S=4+(e.length||+!n.selection.isEmpty());(x!=t||C!=S)&&m.setSelectionRange(t,S),x=t,C=S}}:function(){if(!b&&!w&&(O||F)){b=!0;var e=0,D=0,t="";if(n.session){var S=n.selection,i=S.getRange(),r=S.cursor.row;r===A+1?A=(k=A+1)+2*T:r===k-1?k=(A=k-1)-2*T:(r<k-1||r>A+1)&&(k=r>T?r-T:0,A=r>T?r+T:2*T);for(var o=[],g=k;g<=A;g++)o.push(n.session.getLine(g));if(t=o.join("\n"),e=R(i.start.row,i.start.column),D=R(i.end.row,i.end.column),i.start.row<k){var s=n.session.getLine(k-1);e=i.start.row<k-1?0:e,D+=s.length+1,t=s+"\n"+t}else if(i.end.row>A){var a=n.session.getLine(A+1);D=(i.end.row>A+1?a.length:i.end.column)+(t.length+1),t=t+"\n"+a}else f&&r>0&&(t="\n"+t,D+=1,e+=1);t.length>c&&(e<c&&D<c?t=t.slice(0,c):(t="\n",e==D?e=D=0:(e=0,D=1)));var l=t+"\n\n";l!=_&&(m.value=_=l,x=C=l.length)}if(F&&(x=m.selectionStart,C=m.selectionEnd),C!=D||x!=e||m.selectionEnd!=C)try{m.setSelectionRange(e,D),x=e,C=D}catch(e){}b=!1}};this.resetSelection=I,O&&n.onFocus();var j=function(e){return 0===e.selectionStart&&e.selectionEnd>=_.length&&e.value===_&&_&&e.selectionEnd!==C},N=function(e){!b&&(y?y=!1:j(m)?(n.selectAll(),I()):f&&m.selectionStart!=x&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,D){if(F&&(F=!1),v)return I(),e&&n.onPaste(e),v=!1,"";for(var t=m.selectionStart,S=m.selectionEnd,r=x,o=_.length-C,g=e,s=e.length-t,a=e.length-S,l=0;r>0&&_[l]==e[l];)l++,r--;for(g=g.slice(l),l=1;o>0&&_.length-l>x-1&&_[_.length-l]==e[e.length-l];)l++,o--;s-=l-1,a-=l-1;var c=g.length-l+1;if(c<0&&(r=-c,c=0),g=g.slice(0,c),!D&&!g&&!s&&!r&&!o&&!a)return"";w=!0;var u=!1;return i.isAndroid&&". "==g&&(g=" ",u=!0),(!g||r||o||s||a)&&!L?n.onTextInput(g,{extendLeft:r,extendRight:o,restoreStart:s,restoreEnd:a}):n.onTextInput(g),w=!1,_=e,x=t,C=S,E=a,u?"\n":g},V=function(e){if(b)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return n.execCommand("undo");if("historyRedo"==e.inputType)return n.execCommand("redo")}var D=m.value,t=U(D,!0);(D.length>c+100||p.test(t)||f&&x<1&&x==C)&&I()},H=function(e,n,D){var t=e.clipboardData||window.clipboardData;if(t&&!s){var S=a||D?"Text":"text/plain";try{if(n)return!1!==t.setData(S,n);return t.getData(S)}catch(e){if(!D)return H(e,n,!0)}}},z=function(e,D){var S=n.getCopyText();if(!S)return t.preventDefault(e);H(e,S)?(d&&(I(S),y=S,setTimeout(function(){y=!1},10)),D?n.onCut():n.onCopy(),t.preventDefault(e)):(y=!0,m.value=S,m.select(),setTimeout(function(){y=!1,I(),D?n.onCut():n.onCopy()}))},W=function(e){z(e,!0)},B=function(e){z(e,!1)},q=function(e){var D=H(e);g.pasteCancelled()||("string"==typeof D?(D&&n.onPaste(D,e),i.isIE&&setTimeout(I),t.preventDefault(e)):(m.value="",v=!0))};t.addCommandKeyListener(m,function(e,D,t){if(!b)return n.onCommandKey(e,D,t)},n),t.addListener(m,"select",N,n),t.addListener(m,"input",V,n),t.addListener(m,"cut",W,n),t.addListener(m,"copy",B,n),t.addListener(m,"paste",q,n),"oncut"in m&&"oncopy"in m&&"onpaste"in m||t.addListener(e,"keydown",function(e){if((!i.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:B(e);break;case 86:q(e);break;case 88:W(e)}},n);var G=function(e){if(!b&&n.onCompositionStart&&!n.$readOnly&&(b={},!L)){e.data&&(b.useTextareaForIME=!1),setTimeout(K,0),n._signal("compositionStart"),n.on("mousedown",Q);var D=n.getSelectionRange();D.end.row=D.start.row,D.end.column=D.start.column,b.markerRange=D,b.selectionStart=x,n.onCompositionStart(b),b.useTextareaForIME?(_=m.value="",x=0,C=0):(m.msGetInputContext&&(b.context=m.msGetInputContext()),m.getInputContext&&(b.context=m.getInputContext()))}},K=function(){if(b&&n.onCompositionUpdate&&!n.$readOnly){if(L)return Q();b.useTextareaForIME?n.onCompositionUpdate(m.value):(U(m.value),b.markerRange&&(b.context&&(b.markerRange.start.column=b.selectionStart=b.context.compositionStartOffset),b.markerRange.end.column=b.markerRange.start.column+C-b.selectionStart+E))}},Y=function(e){n.onCompositionEnd&&!n.$readOnly&&(b=!1,n.onCompositionEnd(),n.off("mousedown",Q),e&&V())};function Q(){$=!0,m.blur(),m.focus(),$=!1}var Z=o.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&m.value.length<m.selectionStart&&(b||(_=m.value),x=C=-1,I()),Z()}function X(){clearTimeout(D),D=setTimeout(function(){M&&(m.style.cssText=M,M=""),n.renderer.$isMousePressed=!1,n.renderer.$keepTextAreaAtCursor&&n.renderer.$moveTextAreaToCursor()},0)}t.addListener(m,"compositionstart",G,n),t.addListener(m,"compositionupdate",K,n),t.addListener(m,"keyup",J,n),t.addListener(m,"keydown",Z,n),t.addListener(m,"compositionend",Y,n),this.getElement=function(){return m},this.setCommandMode=function(e){L=e,m.readOnly=!1},this.setReadOnly=function(e){L||(m.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){F=!0,I(),n._emit("nativecontextmenu",{target:n,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,S){M||(M=m.style.cssText),m.style.cssText=(S?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+C)*n.renderer.characterWidth*.5+"px;";var o=n.container.getBoundingClientRect(),g=r.computedStyle(n.container),s=o.top+(parseInt(g.borderTopWidth)||0),a=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-s-m.clientHeight-2,c=function(e){r.translate(m,e.clientX-a-2,Math.min(e.clientY-s-2,l))};c(e),"mousedown"==e.type&&(n.renderer.$isMousePressed=!0,clearTimeout(D),i.isWin&&t.capture(n.container,c,X))},this.onContextMenuClose=X;var ee=function(e){n.textInput.onContextMenu(e),X()};function en(e,n,D){var t=null,S=!1;D.addEventListener("keydown",function(e){t&&clearTimeout(t),S=!0},!0),D.addEventListener("keyup",function(e){t=setTimeout(function(){S=!1},100)},!0);var i=function(e){if(document.activeElement===D&&!S&&!b&&!n.$mouseHandler.isMousePressed&&!y){var t=D.selectionStart,i=D.selectionEnd,r=null,o=0;if(0==t?r=u.up:1==t?r=u.home:i>C&&"\n"==_[i]?r=u.end:t<x&&" "==_[t-1]?(r=u.left,o=h.option):t<x||t==x&&C!=x&&t==i?r=u.left:i>C&&_.slice(0,i).split("\n").length>2?r=u.down:i>C&&" "==_[i-1]?(r=u.right,o=h.option):(i>C||i==C&&C!=x&&t==i)&&(r=u.right),t!==i&&(o|=h.shift),r){if(!n.onCommandKey({},o,r)&&n.commands){r=u.keyCodeToString(r);var g=n.commands.findKeyCommand(o,r);g&&n.execCommand(g)}x=t,C=i,I("")}}};document.addEventListener("selectionchange",i),n.on("destroy",function(){document.removeEventListener("selectionchange",i)})}t.addListener(m,"mouseup",ee,n),t.addListener(m,"mousedown",function(e){e.preventDefault(),X()},n),t.addListener(n.renderer.scroller,"contextmenu",ee,n),t.addListener(m,"contextmenu",ee,n),d&&en(e,n,m),this.destroy=function(){m.parentElement&&m.parentElement.removeChild(m)}},n.$setUserAgentForTests=function(e,n){f=e,d=n}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/useragent"),S=0,i=550,r=function(){function e(e){e.$clickSelection=null;var n=e.editor;n.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),n.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),n.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),n.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),n.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(n){e[n]=this[n]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}return e.prototype.onMouseDown=function(e){var n=e.inSelection(),D=e.getDocumentPosition();this.mousedownEvent=e;var S=this.editor,i=e.getButton();if(0!==i){(S.getSelectionRange().isEmpty()||1==i)&&S.selection.moveToPosition(D),2==i&&(S.textInput.onContextMenu(e.domEvent),t.isMozilla||e.preventDefault());return}if(this.mousedownEvent.time=Date.now(),n&&!S.isFocused()&&(S.focus(),this.$focusTimeout&&!this.$clickSelection&&!S.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(e);return}return this.captureMouse(e),this.startSelect(D,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,n){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var D=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?D.selection.selectToPosition(e):n||D.selection.moveToPosition(e),n||this.select(),D.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,n=this.editor,D=n.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var t=this.$clickSelection.comparePoint(D);if(-1==t)e=this.$clickSelection.end;else if(1==t)e=this.$clickSelection.start;else{var S=g(this.$clickSelection,D);D=S.cursor,e=S.anchor}n.selection.setSelectionAnchor(e.row,e.column)}n.selection.selectToPosition(D),n.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var n,D=this.editor,t=D.renderer.screenToTextCoordinates(this.x,this.y),S=D.selection[e](t.row,t.column);if(this.$clickSelection){var i=this.$clickSelection.comparePoint(S.start),r=this.$clickSelection.comparePoint(S.end);if(-1==i&&r<=0)n=this.$clickSelection.end,(S.end.row!=t.row||S.end.column!=t.column)&&(t=S.start);else if(1==r&&i>=0)n=this.$clickSelection.start,(S.start.row!=t.row||S.start.column!=t.column)&&(t=S.end);else if(-1==i&&1==r)t=S.end,n=S.start;else{var o=g(this.$clickSelection,t);t=o.cursor,n=o.anchor}D.selection.setSelectionAnchor(n.row,n.column)}D.selection.selectToPosition(t),D.renderer.scrollCursorIntoView()},e.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},e.prototype.focusWait=function(){var e=o(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),n=Date.now();(e>S||n-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},e.prototype.onDoubleClick=function(e){var n=e.getDocumentPosition(),D=this.editor,t=D.session.getBracketRange(n);t?(t.isEmpty()&&(t.start.column--,t.end.column++),this.setState("select")):(t=D.selection.getWordRange(n.row,n.column),this.setState("selectByWords")),this.$clickSelection=t,this.select()},e.prototype.onTripleClick=function(e){var n=e.getDocumentPosition(),D=this.editor;this.setState("selectByLines");var t=D.getSelectionRange();t.isMultiLine()&&t.contains(n.row,n.column)?(this.$clickSelection=D.selection.getLineRange(t.start.row),this.$clickSelection.end=D.selection.getLineRange(t.end.row).end):this.$clickSelection=D.selection.getLineRange(n.row),this.select()},e.prototype.onQuadClick=function(e){var n=this.editor;n.selectAll(),this.$clickSelection=n.getSelectionRange(),this.setState("selectAll")},e.prototype.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var n=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var D=this.$lastScroll,t=e.domEvent.timeStamp,S=t-D.t,r=S?e.wheelX/S:D.vx,o=S?e.wheelY/S:D.vy;S<i&&(r=(r+D.vx)/2,o=(o+D.vy)/2);var g=Math.abs(r/o),s=!1;if(g>=1&&n.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(s=!0),g<=1&&n.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(s=!0),s?D.allowed=t:t-D.allowed<i&&(Math.abs(r)<=1.5*Math.abs(D.vx)&&Math.abs(o)<=1.5*Math.abs(D.vy)?(s=!0,D.allowed=t):D.allowed=0),D.t=t,D.vx=r,D.vy=o,s)return n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function o(e,n,D,t){return Math.sqrt(Math.pow(D-e,2)+Math.pow(t-n,2))}function g(e,n){if(e.start.row==e.end.row)var D=2*n.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var D=2*n.row-e.start.row-e.end.row;else var D=n.column-4;return D<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}r.prototype.selectEnd=r.prototype.selectByLinesEnd,r.prototype.selectAllEnd=r.prototype.selectByLinesEnd,r.prototype.selectByWordsEnd=r.prototype.selectByLinesEnd,n.DefaultHandlers=r}),ace.define("ace/lib/scroll",["require","exports","module"],function(e,n,D){n.preventParentScroll=function(e){e.stopPropagation();var n=e.currentTarget;n.scrollHeight>n.clientHeight||e.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},i=e("./lib/dom");e("./lib/event");var r=e("./range").Range,o=e("./lib/scroll").preventParentScroll,g="ace_tooltip",s=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=i.createElement("div"),this.$element.className=g,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},e.prototype.getElement=function(){return this.$element||this.$init()},e.prototype.setText=function(e){this.getElement().textContent=e},e.prototype.setHtml=function(e){this.getElement().innerHTML=e},e.prototype.setPosition=function(e,n){this.getElement().style.left=e+"px",this.getElement().style.top=n+"px"},e.prototype.setClassName=function(e){i.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=g+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,n,D){null!=e&&this.setText(e),null!=n&&null!=D&&this.setPosition(n,D),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},e.prototype.hide=function(e){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=g,this.isOpen=!1)},e.prototype.getHeight=function(){return this.getElement().offsetHeight},e.prototype.getWidth=function(){return this.getElement().offsetWidth},e.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},e}(),a=new(function(){function e(){this.popups=[]}return e.prototype.addPopup=function(e){this.popups.push(e),this.updatePopups()},e.prototype.removePopup=function(e){var n=this.popups.indexOf(e);-1!==n&&(this.popups.splice(n,1),this.updatePopups())},e.prototype.updatePopups=function(){this.popups.sort(function(e,n){return n.priority-e.priority});var e,n,D,t,i=[];try{for(var r=S(this.popups),o=r.next();!o.done;o=r.next()){var g=o.value,s=!0;try{for(var a=(D=void 0,S(i)),l=a.next();!l.done;l=a.next()){var c=l.value;if(this.doPopupsOverlap(c,g)){s=!1;break}}}catch(e){D={error:e}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(D)throw D.error}}s?i.push(g):g.hide()}}catch(n){e={error:n}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.doPopupsOverlap=function(e,n){var D=e.getElement().getBoundingClientRect(),t=n.getElement().getBoundingClientRect();return D.left<t.right&&D.right>t.left&&D.top<t.bottom&&D.bottom>t.top},e}());n.popupManager=a,n.Tooltip=s,n.HoverTooltip=function(e){function n(n){void 0===n&&(n=document.body);var D=e.call(this,n)||this;D.timeout=void 0,D.lastT=0,D.idleTime=350,D.lastEvent=void 0,D.onMouseOut=D.onMouseOut.bind(D),D.onMouseMove=D.onMouseMove.bind(D),D.waitForHover=D.waitForHover.bind(D),D.hide=D.hide.bind(D);var t=D.getElement();return t.style.whiteSpace="pre-wrap",t.style.pointerEvents="auto",t.addEventListener("mouseout",D.onMouseOut),t.tabIndex=-1,t.addEventListener("blur",(function(){t.contains(document.activeElement)||this.hide()}).bind(D)),t.addEventListener("wheel",o),D}return t(n,e),n.prototype.addToEditor=function(e){e.on("mousemove",this.onMouseMove),e.on("mousedown",this.hide),e.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},n.prototype.removeFromEditor=function(e){e.off("mousemove",this.onMouseMove),e.off("mousedown",this.hide),e.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},n.prototype.onMouseMove=function(e,n){this.lastEvent=e,this.lastT=Date.now();var D=n.$mouseHandler.isMousePressed;if(this.isOpen){var t=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(t.row,t.column)||D||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||D||(this.lastEvent=e,this.timeout=setTimeout(this.waitForHover,this.idleTime))},n.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var e=Date.now()-this.lastT;if(this.idleTime-e>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-e);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},n.prototype.isOutsideOfText=function(e){var n=e.editor,D=e.getDocumentPosition(),t=n.session.getLine(D.row);if(D.column==t.length){var S=n.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),i=n.session.documentToScreenPosition(D.row,D.column);if(i.column!=S.column||i.row!=S.row)return!0}return!1},n.prototype.setDataProvider=function(e){this.$gatherData=e},n.prototype.showForRange=function(e,n,D,t){var S=10;if((!t||t==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var i=e.renderer;this.isOpen||(a.addPopup(this),this.$registerCloseEvents(),this.setTheme(i.theme)),this.isOpen=!0,this.addMarker(n,e.session),this.range=r.fromPoints(n.start,n.end);var o=i.textToScreenCoordinates(n.start.row,n.start.column),g=i.scroller.getBoundingClientRect();o.pageX<g.left&&(o.pageX=g.left);var s=this.getElement();s.innerHTML="",s.appendChild(D),s.style.maxHeight="",s.style.display="block";var l=s.clientHeight,c=s.clientWidth,u=window.innerHeight-o.pageY-i.lineHeight,h=!0;o.pageY-l<0&&o.pageY<u&&(h=!1),s.style.maxHeight=(h?o.pageY:u)-S+"px",s.style.top=h?"":o.pageY+i.lineHeight+"px",s.style.bottom=h?window.innerHeight-o.pageY+"px":"",s.style.left=Math.min(o.pageX,window.innerWidth-c-S)+"px"}},n.prototype.addMarker=function(e,n){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=n,this.marker=n&&n.addMarker(e,"ace_highlight-marker","text")},n.prototype.hide=function(e){(e||document.activeElement!=this.getElement())&&!(e&&e.target&&("keydown"!=e.type||e.ctrlKey||e.metaKey)&&this.$element.contains(e.target))&&(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,a.removePopup(this)))},n.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},n.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},n.prototype.onMouseOut=function(e){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,!this.isOpen||!e.relatedTarget||this.getElement().contains(e.relatedTarget)||!(e&&e.currentTarget.contains(e.relatedTarget))&&(e.relatedTarget.classList.contains("ace_content")||this.hide())},n}(s)}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config","ace/lib/lang"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},i=e("../lib/dom"),r=e("../lib/event"),o=e("../tooltip").Tooltip,g=e("../config").nls;e("../lib/lang"),n.GutterHandler=function(e){var n,D,t=e.editor,S=t.renderer.$gutterLayer,o=new s(t);function g(){var n=D.getDocumentPosition().row;if(n==t.session.getLength()){var i=t.renderer.pixelToScreenCoordinates(0,D.y).row,r=D.$pos;if(i>t.session.documentToScreenRow(r.row,r.column))return a()}if(o.showTooltip(n),o.isOpen)if(t.on("mousewheel",a),e.$tooltipFollowsMouse)l(D);else{var g=D.getGutterRow(),s=S.$lines.get(g);if(s){var c=s.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),u=o.getElement().style;u.left=c.right+"px",u.top=c.bottom+"px"}else l(D)}}function a(){n&&(n=clearTimeout(n)),o.isOpen&&(o.hideTooltip(),t.off("mousewheel",a))}function l(e){o.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(n){if(t.isFocused()&&0==n.getButton()&&"foldWidgets"!=S.getRegion(n)){var D=n.getDocumentPosition().row,i=t.session.selection;if(n.getShiftKey())i.selectTo(D,0);else{if(2==n.domEvent.detail)return t.selectAll(),n.preventDefault();e.$clickSelection=t.selection.getLineRange(D)}return e.setState("selectByLines"),e.captureMouse(n),n.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(t){var S=t.domEvent.target||t.domEvent.srcElement;if(i.hasCssClass(S,"ace_fold-widget"))return a();o.isOpen&&e.$tooltipFollowsMouse&&l(t),D=t,n||(n=setTimeout(function(){n=null,D&&!e.isMousePressed?g():a()},50))}),r.addListener(t.renderer.$gutter,"mouseout",function(e){D=null,o.isOpen&&!n&&(n=setTimeout(function(){n=null,a()},50))},t),t.on("changeSession",a),t.on("input",a)};var s=function(e){function n(n){var D=e.call(this,n.container)||this;return D.editor=n,D}return t(n,e),n.prototype.setPosition=function(e,n){var D=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight,S=this.getWidth(),i=this.getHeight();n+=15,(e+=15)+S>D&&(e-=e+S-D),n+i>t&&(n-=20+i),o.prototype.setPosition.call(this,e,n)},Object.defineProperty(n,"annotationLabels",{get:function(){return{error:{singular:g("gutter-tooltip.aria-label.error.singular","error"),plural:g("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:g("gutter-tooltip.aria-label.security.singular","security finding"),plural:g("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:g("gutter-tooltip.aria-label.warning.singular","warning"),plural:g("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:g("gutter-tooltip.aria-label.info.singular","information message"),plural:g("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:g("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:g("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),n.prototype.showTooltip=function(e){var D=this.editor.renderer.$gutterLayer,t=D.$annotations[e];o=t?{displayText:Array.from(t.displayText),type:Array.from(t.type)}:{displayText:[],type:[]};var S=D.session.getFoldLine(e);if(S&&D.$showFoldedAnnotations){for(var r,o,g,s={error:[],security:[],warning:[],info:[],hint:[]},a={error:1,security:2,warning:3,info:4,hint:5},l=e+1;l<=S.end.row;l++)if(D.$annotations[l])for(var c=0;c<D.$annotations[l].text.length;c++){var u=D.$annotations[l].type[c];s[u].push(D.$annotations[l].text[c]),(!g||a[u]<a[g])&&(g=u)}if(["error","security","warning"].includes(g)){var h="".concat(n.annotationsToSummaryString(s)," in folded code.");o.displayText.push(h),o.type.push(g+"_fold")}}if(0===o.displayText.length)return this.hide();for(var d={error:[],security:[],warning:[],info:[],hint:[]},p=D.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",l=0;l<o.displayText.length;l++){var f=i.createElement("span"),m=i.createElement("span");(r=m.classList).add.apply(r,["ace_".concat(o.type[l]),p]),m.setAttribute("aria-label","".concat(n.annotationLabels[o.type[l].replace("_fold","")].singular)),m.setAttribute("role","img"),m.appendChild(i.createTextNode(" ")),f.appendChild(m),f.appendChild(i.createTextNode(o.displayText[l])),f.appendChild(i.createElement("br")),d[o.type[l].replace("_fold","")].push(f)}var y=this.getElement();i.removeChildren(y),d.error.forEach(function(e){return y.appendChild(e)}),d.security.forEach(function(e){return y.appendChild(e)}),d.warning.forEach(function(e){return y.appendChild(e)}),d.info.forEach(function(e){return y.appendChild(e)}),d.hint.forEach(function(e){return y.appendChild(e)}),y.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.editor._signal("showGutterTooltip",this)},n.prototype.hideTooltip=function(){this.$element.removeAttribute("aria-live"),this.hide(),this.editor._signal("hideGutterTooltip",this)},n.annotationsToSummaryString=function(e){var D,t,i=[],r=["error","security","warning","info","hint"];try{for(var o=S(r),g=o.next();!g.done;g=o.next()){var s=g.value;if(e[s].length){var a=1===e[s].length?n.annotationLabels[s].singular:n.annotationLabels[s].plural;i.push("".concat(e[s].length," ").concat(a))}}}catch(e){D={error:e}}finally{try{g&&!g.done&&(t=o.return)&&t.call(o)}finally{if(D)throw D.error}}return i.join(", ")},n}(o);n.GutterTooltip=s}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../lib/useragent");n.MouseEvent=function(){function e(e,n){this.speed,this.wheelX,this.wheelY,this.domEvent=e,this.editor=n,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return e.prototype.stopPropagation=function(){t.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){t.preventDefault(this.domEvent),this.defaultPrevented=!0},e.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},e.prototype.getDocumentPosition=function(){return this.$pos||(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY)),this.$pos},e.prototype.getGutterRow=function(){var e=this.getDocumentPosition().row;return this.editor.session.documentToScreenRow(e,0)-this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0)},e.prototype.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=e.contains(n.row,n.column)}return this.$inSelection},e.prototype.getButton=function(){return t.getButton(this.domEvent)},e.prototype.getShiftKey=function(){return this.domEvent.shiftKey},e.prototype.getAccelKey=function(){return S.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},e}()}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/event"),i=e("../lib/useragent"),r=200,o=200,g=5;function s(e){var n,D,s,l,c,u=e.editor,h=t.createElement("div");h.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",h.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(n){e[n]=this[n]},this),u.on("mousedown",this.onMouseDown.bind(e));var d,p,f,m,y,v,b=u.container,w=0;function M(e,n){var D=Date.now(),t=!n||e.row!=n.row,S=!n||e.column!=n.column;!l||t||S?(u.moveCursorToPosition(e),l=D,c={x:p,y:f}):a(c.x,c.y,p,f)>g?l=null:D-l>=o&&(u.renderer.scrollCursorIntoView(),l=null)}function L(e,n){var D=Date.now(),t=u.renderer.layerConfig.lineHeight,S=u.renderer.layerConfig.characterWidth,i=u.renderer.scroller.getBoundingClientRect(),o={x:{left:p-i.left,right:i.right-p},y:{top:f-i.top,bottom:i.bottom-f}},g=Math.min(o.x.left,o.x.right),a=Math.min(o.y.top,o.y.bottom),l={row:e.row,column:e.column};g/S<=2&&(l.column+=o.x.left<o.x.right?-3:2),a/t<=1&&(l.row+=o.y.top<o.y.bottom?-1:1);var c=e.row!=l.row,h=e.column!=l.column,d=!n||e.row!=n.row;c||h&&!d?s?D-s>=r&&u.renderer.scrollCursorIntoView(l):s=D:s=null}function $(){var e=v;M(v=u.renderer.screenToTextCoordinates(p,f),e),L(v,e)}function _(){y=u.selection.toOrientedRange(),d=u.session.addMarker(y,"ace_selection",u.getSelectionStyle()),u.clearSelection(),u.isFocused()&&u.renderer.$cursorLayer.setBlinking(!1),clearInterval(m),$(),m=setInterval($,20),w=0,S.addListener(document,"mousemove",E)}function x(){clearInterval(m),u.session.removeMarker(d),d=null,u.selection.fromOrientedRange(y),u.isFocused()&&!D&&u.$resetCursorStyle(),y=null,v=null,w=0,s=null,l=null,S.removeListener(document,"mousemove",E)}this.onDragStart=function(e){if(this.cancelDrag||!b.draggable){var n=this;return setTimeout(function(){n.startSelect(),n.captureMouse(e)},0),e.preventDefault()}y=u.getSelectionRange();var t=e.dataTransfer;t.effectAllowed=u.getReadOnly()?"copy":"copyMove",u.container.appendChild(h),t.setDragImage&&t.setDragImage(h,0,0),setTimeout(function(){u.container.removeChild(h)}),t.clearData(),t.setData("Text",u.session.getTextRange()),D=!0,this.setState("drag")},this.onDragEnd=function(e){if(b.draggable=!1,D=!1,this.setState(null),!u.getReadOnly()){var t=e.dataTransfer.dropEffect;n||"move"!=t||u.session.remove(u.getSelectionRange()),u.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!u.getReadOnly()&&k(e.dataTransfer))return p=e.clientX,f=e.clientY,d||_(),w++,e.dataTransfer.dropEffect=n=A(e),S.preventDefault(e)},this.onDragOver=function(e){if(!u.getReadOnly()&&k(e.dataTransfer))return p=e.clientX,f=e.clientY,!d&&(_(),w++),null!==C&&(C=null),e.dataTransfer.dropEffect=n=A(e),S.preventDefault(e)},this.onDragLeave=function(e){if(--w<=0&&d)return x(),n=null,S.preventDefault(e)},this.onDrop=function(e){if(v){var t=e.dataTransfer;if(D)switch(n){case"move":y=y.contains(v.row,v.column)?{start:v,end:v}:u.moveText(y,v);break;case"copy":y=u.moveText(y,v,!0)}else{var i=t.getData("Text");y={start:v,end:u.session.insert(v,i)},u.focus(),n=null}return x(),S.preventDefault(e)}},S.addListener(b,"dragstart",this.onDragStart.bind(e),u),S.addListener(b,"dragend",this.onDragEnd.bind(e),u),S.addListener(b,"dragenter",this.onDragEnter.bind(e),u),S.addListener(b,"dragover",this.onDragOver.bind(e),u),S.addListener(b,"dragleave",this.onDragLeave.bind(e),u),S.addListener(b,"drop",this.onDrop.bind(e),u);var C=null;function E(){null==C&&(C=setTimeout(function(){null!=C&&d&&x()},20))}function k(e){var n=e.types;return!n||Array.prototype.some.call(n,function(e){return"text/plain"==e||"Text"==e})}function A(e){var n=["copy","copymove","all","uninitialized"],D=["move","copymove","linkmove","all","uninitialized"],t=i.isMac?e.altKey:e.ctrlKey,S="uninitialized";try{S=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return t&&n.indexOf(S)>=0?r="copy":D.indexOf(S)>=0?r="move":n.indexOf(S)>=0&&(r="copy"),r}}function a(e,n,D,t){return Math.sqrt(Math.pow(D-e,2)+Math.pow(t-n,2))}(function(){this.dragWait=function(){Date.now()-this.mousedownEvent.time>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){this.editor.container.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor;e.container.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=i.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var n=this.editor.container;if(i.isIE&&"dragReady"==this.state){var D=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);D>3&&n.dragDrop()}if("dragWait"===this.state){var D=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);D>0&&(n.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var n=this.editor,D=e.inSelection(),t=e.getButton(),S=e.domEvent.detail||1;if(1===S&&0===t&&D){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var r=e.domEvent.target||e.domEvent.srcElement;"unselectable"in r&&(r.unselectable="on"),n.getDragDelay()?(i.isWebKit&&(this.cancelDrag=!0,n.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(s.prototype),n.DragdropHandler=s}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./mouse_event").MouseEvent,S=e("../lib/event"),i=e("../lib/dom");n.addTouchListeners=function(e,n){var D,r,o,g,s,a,l,c,u,h="scroll",d=0,p=0,f=0,m=0;function y(){var e=window.navigator&&window.navigator.clipboard,D=!1,t=function(){var t=n.getCopyText(),r=n.session.getUndoManager().hasUndo();u.replaceChild(i.buildDom(D?["span",!t&&S("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],t&&S("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],t&&S("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],e&&S("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],r&&S("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],S("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],S("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),u.firstChild)},S=function(e){return n.commands.canExecute(e,n)},r=function(S){var i=S.target.getAttribute("action");if("more"==i||!D)return D=!D,t();"paste"==i?e.readText().then(function(e){n.execCommand(i,e)}):i&&(("cut"==i||"copy"==i)&&(e?e.writeText(n.getCopyText()):document.execCommand("copy")),n.execCommand(i)),u.firstChild.style.display="none",D=!1,"openCommandPalette"!=i&&n.focus()};u=i.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){h="menu",e.stopPropagation(),e.preventDefault(),n.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),r(e)},onclick:r},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],n.container)}function v(){if(!n.getOption("enableMobileMenu")){u&&b();return}u||y();var e=n.selection.cursor,D=n.renderer.textToScreenCoordinates(e.row,e.column),t=n.renderer.textToScreenCoordinates(0,0).pageX,S=n.renderer.scrollLeft,i=n.container.getBoundingClientRect();u.style.top=D.pageY-i.top-3+"px",D.pageX-i.left<i.width-70?(u.style.left="",u.style.right="10px"):(u.style.right="",u.style.left=t+S-i.left+"px"),u.style.display="",u.firstChild.style.display="none",n.on("input",b)}function b(e){u&&(u.style.display="none"),n.off("input",b)}function w(){clearTimeout(s=null);var e=n.selection.getRange(),D=e.contains(l.row,l.column);(e.isEmpty()||!D)&&(n.selection.moveToPosition(l),n.selection.selectWord()),h="wait",v()}function M(){clearTimeout(s=null),n.selection.moveToPosition(l);var e=p>=2?n.selection.getLineRange(l.row):n.session.getBracketRange(l);e&&!e.isEmpty()?n.selection.setRange(e):n.selection.selectWord(),h="wait"}function L(){d+=60,a=setInterval(function(){d--<=0&&(clearInterval(a),a=null),.01>Math.abs(f)&&(f=0),.01>Math.abs(m)&&(m=0),d<20&&(f*=.9),d<20&&(m*=.9);var e=n.session.getScrollTop();n.renderer.scrollBy(10*f,10*m),e==n.session.getScrollTop()&&(d=0)},10)}S.addListener(e,"contextmenu",function(e){if(c){var D=n.textInput.getElement();D.focus()}},n),S.addListener(e,"touchstart",function(e){var S=e.touches;if(s||S.length>1){clearTimeout(s),s=null,o=-1,h="zoom";return}c=n.$mouseHandler.isMousePressed=!0;var i=n.renderer.layerConfig.lineHeight,a=n.renderer.layerConfig.lineHeight,u=e.timeStamp;g=u;var y=S[0],v=y.clientX,b=y.clientY;if(Math.abs(D-v)+Math.abs(r-b)>i&&(o=-1),D=e.clientX=v,r=e.clientY=b,f=m=0,l=new t(e,n).getDocumentPosition(),u-o<500&&1==S.length&&!d)p++,e.preventDefault(),e.button=0,M();else{p=0;var L=n.selection.cursor,$=n.selection.isEmpty()?L:n.selection.anchor,_=n.renderer.$cursorLayer.getPixelPosition(L,!0),x=n.renderer.$cursorLayer.getPixelPosition($,!0),C=n.renderer.scroller.getBoundingClientRect(),E=n.renderer.layerConfig.offset,k=n.renderer.scrollLeft,A=function(e,n){return(e/=a)*e+(n=n/i-.75)*n};if(e.clientX<C.left){h="zoom";return}var T=A(e.clientX-C.left-_.left+k,e.clientY-C.top-_.top+E),O=A(e.clientX-C.left-x.left+k,e.clientY-C.top-x.top+E);T<3.5&&O<3.5&&(h=T>O?"cursor":"anchor"),h=O<3.5?"anchor":T<3.5?"cursor":"scroll",s=setTimeout(w,450)}o=u},n),S.addListener(e,"touchend",function(e){c=n.$mouseHandler.isMousePressed=!1,a&&clearInterval(a),"zoom"==h?(h="",d=0):s?(n.selection.moveToPosition(l),d=0,v()):"scroll"==h?(L(),b()):v(),clearTimeout(s),s=null},n),S.addListener(e,"touchmove",function(e){s&&(clearTimeout(s),s=null);var S=e.touches;if(!(S.length>1)&&"zoom"!=h){var i=S[0],o=D-i.clientX,a=r-i.clientY;if("wait"==h)if(!(o*o+a*a>4))return e.preventDefault();else h="cursor";D=i.clientX,r=i.clientY,e.clientX=i.clientX,e.clientY=i.clientY;var l=e.timeStamp,c=l-g;if(g=l,"scroll"==h){var u=new t(e,n);u.speed=1,u.wheelX=o,u.wheelY=a,10*Math.abs(o)<Math.abs(a)&&(o=0),10*Math.abs(a)<Math.abs(o)&&(a=0),0!=c&&(f=o/c,m=a/c),n._emit("mousewheel",u),u.propagationStopped||(f=m=0)}else{var d=new t(e,n).getDocumentPosition();"cursor"==h?n.selection.moveCursorToPosition(d):"anchor"==h&&n.selection.setSelectionAnchor(d.row,d.column),n.renderer.scrollCursorIntoView(d),e.preventDefault()}}},n)}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../lib/useragent"),i=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,o=e("./mouse_event").MouseEvent,g=e("./dragdrop_handler").DragdropHandler,s=e("./touch_handler").addTouchListeners,a=e("../config"),l=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var n=this;this.editor=e,new i(this),new r(this),new g(this);var D=function(n){document.hasFocus&&document.hasFocus()&&(e.isFocused()||document.activeElement!=(e.textInput&&e.textInput.getElement()))||window.focus(),e.focus(),setTimeout(function(){e.isFocused()||e.focus()})},o=e.renderer.getMouseEventTarget();t.addListener(o,"click",this.onMouseEvent.bind(this,"click"),e),t.addListener(o,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),t.addMultiMouseDownListener([o,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),t.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),s(e.container,e);var a=e.renderer.$gutter;t.addListener(a,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),t.addListener(a,"click",this.onMouseEvent.bind(this,"gutterclick"),e),t.addListener(a,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),t.addListener(a,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),t.addListener(o,"mousedown",D,e),t.addListener(a,"mousedown",D,e),S.isIE&&e.renderer.scrollBarV&&(t.addListener(e.renderer.scrollBarV.element,"mousedown",D,e),t.addListener(e.renderer.scrollBarH.element,"mousedown",D,e)),e.on("mousemove",function(D){if(!n.state&&!n.$dragDelay&&n.$dragEnabled){var t=e.renderer.screenToTextCoordinates(D.x,D.y),S=e.session.selection.getRange(),i=e.renderer;!S.isEmpty()&&S.insideStart(t.row,t.column)?i.setCursorStyle("default"):i.setCursorStyle("")}},e)}return e.prototype.onMouseEvent=function(e,n){this.editor.session&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseMove=function(e,n){var D=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;D&&D.length&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseWheel=function(e,n){var D=new o(n,this.editor);D.speed=2*this.$scrollSpeed,D.wheelX=n.wheelX,D.wheelY=n.wheelY,this.editor._emit(e,D)},e.prototype.setState=function(e){this.state=e},e.prototype.captureMouse=function(e,n){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var D=this.editor,i=this.editor.renderer;i.$isMousePressed=!0;var r=this,g=function(e){if(e){if(S.isWebKit&&!e.which&&r.releaseMouse)return r.releaseMouse();r.x=e.clientX,r.y=e.clientY,n&&n(e),r.mouseEvent=new o(e,r.editor),r.$mouseMoved=!0}},s=function(e){D.off("beforeEndOperation",l),clearInterval(c),D.session&&a(),r[r.state+"End"]&&r[r.state+"End"](e),r.state="",r.isMousePressed=i.$isMousePressed=!1,i.$keepTextAreaAtCursor&&i.$moveTextAreaToCursor(),r.$onCaptureMouseMove=r.releaseMouse=null,e&&r.onMouseEvent("mouseup",e),D.endOperation()},a=function(){r[r.state]&&r[r.state](),r.$mouseMoved=!1};if(S.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){s(e)});var l=function(e){r.releaseMouse&&D.curOp.command.name&&D.curOp.selectionChanged&&(r[r.state+"End"]&&r[r.state+"End"](),r.state="",r.releaseMouse())};D.on("beforeEndOperation",l),D.startOperation({command:{name:"mouse"}}),r.$onCaptureMouseMove=g,r.releaseMouse=t.capture(this.editor.container,g,s);var c=setInterval(a,20)},e.prototype.cancelContextMenu=function(){var e=(function(n){(!n||!n.domEvent||"contextmenu"==n.domEvent.type)&&(this.editor.off("nativecontextmenu",e),n&&n.domEvent&&t.stopEvent(n.domEvent))}).bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)},e.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},e}();l.prototype.releaseMouse=null,a.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150*!!S.isMac},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),n.MouseHandler=l}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom");n.FoldHandler=function(){return function(e){e.on("click",function(n){var D=n.getDocumentPosition(),S=e.session,i=S.getFoldAt(D.row,D.column,1);i&&(n.getAccelKey()?S.removeFold(i):S.expandFold(i),n.stop());var r=n.domEvent&&n.domEvent.target;r&&t.hasCssClass(r,"ace_inline_button")&&t.hasCssClass(r,"ace_toggle_wrap")&&(S.setOption("wrap",!S.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var D=n.getDocumentPosition().row,t=e.session;t.foldWidgets&&t.foldWidgets[D]&&e.session.onFoldWidgetClick(D,n),e.isFocused()||e.focus(),n.stop()}}),e.on("gutterdblclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var D=n.getDocumentPosition().row,t=e.session,S=t.getParentFoldRangeData(D,!0),i=S.range||S.firstRange;if(i){D=i.start.row;var r=t.getFoldAt(D,t.getLine(D).length,1);r?t.removeFold(r):(t.addFold("...",i),e.renderer.scrollCursorIntoView({row:i.start.row,column:0}))}n.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,n,D){"use strict";var t=e("../lib/keys"),S=e("../lib/event");n.KeyBinding=function(){function e(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)}return e.prototype.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},e.prototype.setKeyboardHandler=function(e){var n=this.$handlers;if(n[n.length-1]!=e){for(;n[n.length-1]&&n[n.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(n[n.length-1]);this.addKeyboardHandler(e,1)}},e.prototype.addKeyboardHandler=function(e,n){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var D=this.$handlers.indexOf(e);-1!=D&&this.$handlers.splice(D,1),void 0==n?this.$handlers.push(e):this.$handlers.splice(n,0,e),-1==D&&e.attach&&e.attach(this.$editor)}},e.prototype.removeKeyboardHandler=function(e){var n=this.$handlers.indexOf(e);return -1!=n&&(this.$handlers.splice(n,1),e.detach&&e.detach(this.$editor),!0)},e.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},e.prototype.getStatusText=function(){var e=this.$data,n=e.editor;return this.$handlers.map(function(D){return D.getStatusText&&D.getStatusText(n,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,n,D,t){for(var i,r=!1,o=this.$editor.commands,g=this.$handlers.length;g--&&(!(i=this.$handlers[g].handleKeyboard(this.$data,e,n,D,t))||!i.command||((r="null"==i.command||o.exec(i.command,this.$editor,i.args,t))&&t&&-1!=e&&!0!=i.passEvent&&!0!=i.command.passEvent&&S.stopEvent(t),!r)););return r||-1!=e||(i={command:"insertstring"},r=o.exec("insertstring",this.$editor,n)),r&&this.$editor._signal&&this.$editor._signal("keyboardActivity",i),r},e.prototype.onCommandKey=function(e,n,D){var S=t.keyCodeToString(D);return this.$callKeyboardHandlers(n,S,D,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,n,D){"use strict";var t=0,S=0,i=!1,r=!1,o=!1,g=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],s=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],a=0,l=1,c=0,u=1,h=2,d=3,p=4,f=5,m=6,y=7,v=8,b=9,w=10,M=11,L=12,$=13,_=14,x=15,C=16,E=17,k=18,A=[18,18,18,18,18,18,18,18,18,6,5,6,8,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,5,5,5,6,8,4,4,11,11,11,4,4,4,4,4,10,9,10,9,9,2,2,2,2,2,2,2,2,2,2,9,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,18,18,18,18,18,18,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,9,4,11,11,11,11,4,4,4,4,0,4,4,18,4,4,11,11,2,2,4,0,4,4,4,2,0,4,4,4,4,4],T=[8,8,8,8,8,8,8,8,8,8,8,18,18,18,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,5,13,14,15,16,17,9,11,11,11,11,11,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,9,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8];function O(e,n,D,a){var l=t?s:g,c=null,u=null,h=null,d=0,p=null,y=null,b=-1,w=null,M=null,L=[];if(!a)for(w=0,a=[];w<D;w++)a[w]=j(e[w]);for(M=0,S=t,i=!1,r=!1,o=!1;M<D;M++){if(c=d,L[M]=u=I(e,a,L,M),p=240&(d=l[c][u]),d&=15,n[M]=h=l[d][5],p>0)if(16==p){for(w=b;w<M;w++)n[w]=1;b=-1}else b=-1;if(y=l[d][6])-1==b&&(b=M);else if(b>-1){for(w=b;w<M;w++)n[w]=h;b=-1}a[M]==f&&(n[M]=0),S|=h}if(o){for(w=0;w<D;w++)if(a[w]==m){n[w]=t;for(var $=w-1;$>=0;$--)if(a[$]==v)n[$]=t;else break}}}function R(e,n,D){if(!(S<e)){if(1==e&&t==l&&!r)return void D.reverse();for(var i,o,g,s,a=D.length,c=0;c<a;){if(n[c]>=e){for(i=c+1;i<a&&n[i]>=e;)i++;for(o=c,g=i-1;o<g;o++,g--)s=D[o],D[o]=D[g],D[g]=s;c=i}c++}}}function I(e,n,D,S){var g,s,a,l,A=n[S];switch(A){case c:case u:i=!1;case p:case d:return A;case h:return i?d:h;case y:return i=!0,u;case v:return p;case b:if(S<1||S+1>=n.length||(g=D[S-1])!=h&&g!=d||(s=n[S+1])!=h&&s!=d)return p;return i&&(s=d),s==g?s:p;case w:if((g=S>0?D[S-1]:f)==h&&S+1<n.length&&n[S+1]==h)return h;return p;case M:if(S>0&&D[S-1]==h)return h;if(i)return p;for(l=S+1,a=n.length;l<a&&n[l]==M;)l++;if(l<a&&n[l]==h)return h;return p;case L:for(a=n.length,l=S+1;l<a&&n[l]==L;)l++;if(l<a){var T=e[S],O=T>=1425&&T<=2303||64286==T;if(g=n[l],O&&(g==u||g==y))return u}if(S<1||(g=n[S-1])==f)return p;return D[S-1];case f:return i=!1,r=!0,t;case m:return o=!0,p;case $:case _:case C:case E:case x:i=!1;case k:return p}}function j(e){var n=e.charCodeAt(0),D=n>>8;if(0==D)return n>191?c:A[n];if(5==D)return/[\u0591-\u05f4]/.test(e)?u:c;if(6==D)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return L;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return d;else if(1642==n)return M;else if(/[\u06f0-\u06f9]/.test(e))return h;else return y;if(32==D&&n<=8287)return T[255&n];if(254==D)return n>=65136?y:p;return p}n.L=0,n.R=u,n.EN=h,n.ON_R=3,n.AN=4,n.R_H=5,n.B=6,n.RLE=7,n.DOT="\xb7",n.doBidiReorder=function(e,D,S){if(e.length<2)return{};var i=e.split(""),r=Array(i.length),o=Array(i.length),g=[];t=S?l:a,O(i,g,i.length,D);for(var s=0;s<r.length;r[s]=s,s++);R(2,g,r),R(1,g,r);for(var s=0;s<r.length-1;s++)D[s]===d?g[s]=n.AN:g[s]===u&&(D[s]>y&&D[s]<$||D[s]===p||D[s]===k)?g[s]=n.ON_R:s>0&&"ل"===i[s-1]&&/\u0622|\u0623|\u0625|\u0627/.test(i[s])&&(g[s-1]=g[s]=n.R_H,s++);i[i.length-1]===n.DOT&&(g[i.length-1]=n.B),""===i[0]&&(g[0]=n.RLE);for(var s=0;s<r.length;s++)o[s]=g[r[s]];return{logicalFromVisual:r,bidiLevels:o}},n.hasBidiCharacters=function(e,n){for(var D=!1,t=0;t<e.length;t++)n[t]=j(e.charAt(t)),D||n[t]!=u&&n[t]!=y&&n[t]!=d||(D=!0);return D},n.getVisualFromLogicalIdx=function(e,n){for(var D=0;D<n.logicalFromVisual.length;D++)if(n.logicalFromVisual[D]==e)return D;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,n,D){"use strict";var t=e("./lib/bidiutil"),S=e("./lib/lang"),i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;n.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=t,this.charWidths=[],this.EOL="\xac",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="\xb6",this.RLE="",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=i.test(e.getValue())}return e.prototype.isBidiRow=function(e,n,D){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(n,D),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&i.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},e.prototype.getDocumentRow=function(){var e=0,n=this.session.$screenRowCache;if(n.length){var D=this.session.$getRowCacheIndex(n,this.currentRow);D>=0&&(e=this.session.$docRowCache[D])}return e},e.prototype.getSplitIndex=function(){var e=0,n=this.session.$screenRowCache;if(n.length)for(var D,t=this.session.$getRowCacheIndex(n,this.currentRow);this.currentRow-e>0&&(D=this.session.$getRowCacheIndex(n,this.currentRow-e-1))===t;)t=D,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,n){void 0===e&&(e=this.getDocumentRow());var D=e===this.session.getLength()-1?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var i=this.session.$wrapData[e];i&&(void 0===n&&(n=this.getSplitIndex()),n>0&&i.length?(this.wrapIndent=i.indent,this.wrapOffset=this.wrapIndent*this.charWidths[t.L],this.line=n<i.length?this.line.substring(i[n-1],i[n]):this.line.substring(i[i.length-1])):this.line=this.line.substring(0,i[n]),n==i.length&&(this.line+=this.showInvisibles?D:t.DOT))}else this.line+=this.showInvisibles?D:t.DOT;var r,o=this.session,g=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,n){return" "===e||o.isFullWidth(e.charCodeAt(0))?(r=" "===e?o.getScreenTabSize(n+g):2,g+=r-1,S.stringRepeat(t.DOT,r)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==t.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},e.prototype.updateBidiMap=function(){var e=[];t.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=t.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},e.prototype.markAsDirty=function(){this.currentRow=null},e.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var n=this.characterWidth=e.$characterSize.width,D=e.$measureCharWidth("ה");this.charWidths[t.L]=this.charWidths[t.EN]=this.charWidths[t.ON_R]=n,this.charWidths[t.R]=this.charWidths[t.AN]=D,this.charWidths[t.R_H]=.45*D,this.charWidths[t.B]=this.charWidths[t.RLE]=0,this.currentRow=null}},e.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},e.prototype.setEolChar=function(e){this.EOL=e},e.prototype.setContentWidth=function(e){this.contentWidth=e},e.prototype.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},e.prototype.setRtlDirection=function(e,n){for(var D=e.getCursorPosition(),t=e.selection.getSelectionAnchor().row;t<=D.row;t++)n||e.session.getLine(t).charAt(0)!==e.session.$bidiHandler.RLE?n&&e.session.getLine(t).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:t},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(t,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var n=+(this.line.charAt(0)===this.RLE),D=e>n?this.session.getOverwrite()?e:e-1:n,S=t.getVisualFromLogicalIdx(D,this.bidiMap),i=this.bidiMap.bidiLevels,r=0;!this.session.getOverwrite()&&e<=n&&i[S]%2!=0&&S++;for(var o=0;o<S;o++)r+=this.charWidths[i[o]];return!this.session.getOverwrite()&&e>n&&i[S]%2==0&&(r+=this.charWidths[i[S]]),this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(r+=this.rtlLineOffset),r},e.prototype.getSelections=function(e,n){var D,t=this.bidiMap,S=t.bidiLevels,i=[],r=0,o=Math.min(e,n)-this.wrapIndent,g=Math.max(e,n)-this.wrapIndent,s=!1,a=!1,l=0;this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var c,u=0;u<S.length;u++)c=t.logicalFromVisual[u],D=S[u],(s=c>=o&&c<g)&&!a?l=r:!s&&a&&i.push({left:l,width:r-l}),r+=this.charWidths[D],a=s;if(s&&u===S.length&&i.push({left:l,width:r-l}),this.isRtlDir)for(var h=0;h<i.length;h++)i[h].left+=this.rtlLineOffset;return i},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var n=0,e=Math.max(e,0),D=0,t=0,S=this.bidiMap.bidiLevels,i=this.charWidths[S[t]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>D+i/2;){if(D+=i,t===S.length-1){i=0;break}i=this.charWidths[S[++t]]}return t>0&&S[t-1]%2!=0&&S[t]%2==0?(e<D&&t--,n=this.bidiMap.logicalFromVisual[t]):t>0&&S[t-1]%2==0&&S[t]%2!=0?n=1+(e>D?this.bidiMap.logicalFromVisual[t]:this.bidiMap.logicalFromVisual[t-1]):this.isRtlDir&&t===S.length-1&&0===i&&S[t-1]%2==0||!this.isRtlDir&&0===t&&S[t]%2!=0?n=1+this.bidiMap.logicalFromVisual[t]:(t>0&&S[t-1]%2!=0&&0!==i&&t--,n=this.bidiMap.logicalFromVisual[t]),0===n&&this.isRtlDir&&n++,n+this.wrapIndent},e}()}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/lang"),i=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=function(){function e(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var n=this;this.cursor.on("change",function(e){n.$cursorChanged=!0,n.$silent||n._emit("changeCursor"),n.$isEmpty||n.$silent||n._emit("changeSelection"),n.$keepDesiredColumnOnChange||e.old.column==e.value.column||(n.$desiredColumn=null)}),this.anchor.on("change",function(){n.$anchorChanged=!0,n.$isEmpty||n.$silent||n._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(e,n){this.$isEmpty=!1,this.anchor.setPosition(e,n)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var e=this.anchor,n=this.lead;return e.row>n.row||e.row==n.row&&e.column>n.column},e.prototype.getRange=function(){var e=this.anchor,n=this.lead;return this.$isEmpty?r.fromPoints(n,n):this.isBackwards()?r.fromPoints(n,e):r.fromPoints(e,n)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(e,n){var D=n?e.end:e.start,t=n?e.start:e.end;this.$setSelection(D.row,D.column,t.row,t.column)},e.prototype.$setSelection=function(e,n,D,t){if(!this.$silent){var S=this.$isEmpty,i=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,n),this.cursor.setPosition(D,t),this.$isEmpty=!r.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||S!=this.$isEmpty||i)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(e){var n=this.lead;this.$isEmpty&&this.setSelectionAnchor(n.row,n.column),e.call(this)},e.prototype.selectTo=function(e,n){this.$moveSelection(function(){this.moveCursorTo(e,n)})},e.prototype.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},e.prototype.moveTo=function(e,n){this.clearSelection(),this.moveCursorTo(e,n)},e.prototype.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(e,n){if(void 0===n){var D=e||this.lead;e=D.row,n=D.column}return this.session.getWordRange(e,n)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var e=this.getCursor(),n=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(n)},e.prototype.getLineRange=function(e,n){var D,t="number"==typeof e?e:this.lead.row,S=this.session.getFoldLine(t);return(S?(t=S.start.row,D=S.end.row):D=t,!0===n)?new r(t,0,D,this.session.getLine(D).length):new r(t,0,D+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(e,n,D){var t=e.column,S=e.column+n;return D<0&&(t=e.column-n,S=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(t,S).split(" ").length-1==n},e.prototype.moveCursorLeft=function(){var e,n=this.lead.getPosition();if(e=this.session.getFoldAt(n.row,n.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===n.column)n.row>0&&this.moveCursorTo(n.row-1,this.doc.getLine(n.row-1).length);else{var D=this.session.getTabSize();this.wouldMoveIntoSoftTab(n,D,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-D):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var e,n=this.lead.getPosition();if(e=this.session.getFoldAt(n.row,n.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var D=this.session.getTabSize(),n=this.lead;this.wouldMoveIntoSoftTab(n,D,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,D):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,n=this.lead.column,D=this.session.documentToScreenRow(e,n),t=this.session.screenToDocumentPosition(D,0),S=this.session.getDisplayLine(e,null,t.row,t.column).match(/^\s*/);S[0].length==n||this.session.$useEmacsStyleLineStart||(t.column+=S[0].length),this.moveCursorToPosition(t)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,n=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==n.column){var D=this.session.getLine(n.row);if(n.column==D.length){var t=D.search(/\s+$/);t>0&&(n.column=t)}}this.moveCursorTo(n.row,n.column)},e.prototype.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,n=this.doc.getLine(e).length;this.moveCursorTo(e,n)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var e=this.lead.row,n=this.lead.column,D=this.doc.getLine(e),t=D.substring(n);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var S=this.session.getFoldAt(e,n,1);if(S)return void this.moveCursorTo(S.end.row,S.end.column);if(this.session.nonTokenRe.exec(t)&&(n+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,t=D.substring(n)),n>=D.length){this.moveCursorTo(e,D.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(t)&&(n+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,n)},e.prototype.moveCursorLongWordLeft=function(){var e,n=this.lead.row,D=this.lead.column;if(e=this.session.getFoldAt(n,D,-1))return void this.moveCursorTo(e.start.row,e.start.column);var t=this.session.getFoldStringAt(n,D,-1);null==t&&(t=this.doc.getLine(n).substring(0,D));var i=S.stringReverse(t);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(i)&&(D-=this.session.nonTokenRe.lastIndex,i=i.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),D<=0){this.moveCursorTo(n,0),this.moveCursorLeft(),n>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(i)&&(D-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(n,D)},e.prototype.$shortWordEndIndex=function(e){var n,D=0,t=/\s/,S=this.session.tokenRe;if(S.lastIndex=0,this.session.tokenRe.exec(e))D=this.session.tokenRe.lastIndex;else{for(;(n=e[D])&&t.test(n);)D++;if(D<1){for(S.lastIndex=0;(n=e[D])&&!S.test(n);)if(S.lastIndex=0,D++,t.test(n))if(D>2){D--;break}else{for(;(n=e[D])&&t.test(n);)D++;if(D>2)break}}}return S.lastIndex=0,D},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,n=this.lead.column,D=this.doc.getLine(e),t=D.substring(n),S=this.session.getFoldAt(e,n,1);if(S)return this.moveCursorTo(S.end.row,S.end.column);if(n==D.length){var i=this.doc.getLength();do e++,t=this.doc.getLine(e);while(e<i&&/^\s*$/.test(t));/^\s+/.test(t)||(t=""),n=0}var r=this.$shortWordEndIndex(t);this.moveCursorTo(e,n+r)},e.prototype.moveCursorShortWordLeft=function(){var e,n=this.lead.row,D=this.lead.column;if(e=this.session.getFoldAt(n,D,-1))return this.moveCursorTo(e.start.row,e.start.column);var t=this.session.getLine(n).substring(0,D);if(0===D){do n--,t=this.doc.getLine(n);while(n>0&&/^\s*$/.test(t));D=t.length,/\s+$/.test(t)||(t="")}var i=S.stringReverse(t),r=this.$shortWordEndIndex(i);return this.moveCursorTo(n,D-r)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(e,n){var D,t=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===n&&(0!==e&&(this.session.$bidiHandler.isBidiRow(t.row,this.lead.row)?(D=this.session.$bidiHandler.getPosLeft(t.column),t.column=Math.round(D/this.session.$bidiHandler.charWidths[0])):D=t.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?t.column=this.$desiredColumn:this.$desiredColumn=t.column),0!=e&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var S=this.session.lineWidgets[this.lead.row];e<0?e-=S.rowsAbove||0:e>0&&(e+=S.rowCount-(S.rowsAbove||0))}var i=this.session.screenToDocumentPosition(t.row+e,t.column,D);0!==e&&0===n&&i.row===this.lead.row&&(i.column,this.lead.column),this.moveCursorTo(i.row,i.column+n,0===n)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,n,D){var t=this.session.getFoldAt(e,n,1);t&&(e=t.start.row,n=t.start.column),this.$keepDesiredColumnOnChange=!0;var S=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(S.charAt(n))&&S.charAt(n-1)&&(this.lead.row==e&&this.lead.column==n+1?n-=1:n+=1),this.lead.setPosition(e,n),this.$keepDesiredColumnOnChange=!1,D||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,n,D){var t=this.session.screenToDocumentPosition(e,n);this.moveCursorTo(t.row,t.column,D)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(e){var n=this.getRange();return e?(e.start.column=n.start.column,e.start.row=n.start.row,e.end.column=n.end.column,e.end.row=n.end.row):e=n,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},e.prototype.getRangeOfMovements=function(e){var n=this.getCursor();try{e(this);var D=this.getCursor();return r.fromPoints(n,D)}catch(e){return r.fromPoints(n,n)}finally{this.moveCursorToPosition(n)}},e.prototype.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var n=e.clone();return n.isBackwards=e.cursor==e.start,n});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},e.prototype.fromJSON=function(e){if(void 0==e.start)if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var n=e.length;n--;){var D=r.fromPoints(e[n].start,e[n].end);e[n].isBackwards&&(D.cursor=D.start),this.addRange(D,!0)}return}else e=e[0];this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},e.prototype.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var n=this.ranges.length;n--;)if(!this.ranges[n].isEqual(e[n]))return!1;return!0},e}();o.prototype.setSelectionAnchor=o.prototype.setAnchor,o.prototype.getSelectionAnchor=o.prototype.getAnchor,o.prototype.setSelectionRange=o.prototype.setRange,t.implement(o.prototype,i),n.Selection=o}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,n,D){"use strict";var t=e("./lib/report_error").reportError,S=2e3,i=function(){function e(e){for(var n in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var D=this.states[n],t=[],S=0,i=this.matchMappings[n]={defaultToken:"text"},r="g",o=[],g=0;g<D.length;g++){var s=D[g];if(s.defaultToken&&(i.defaultToken=s.defaultToken),s.caseInsensitive&&-1===r.indexOf("i")&&(r+="i"),s.unicode&&-1===r.indexOf("u")&&(r+="u"),null!=s.regex){s.regex instanceof RegExp&&(s.regex=s.regex.toString().slice(1,-1));var a=s.regex,l=RegExp("(?:("+a+")|(.))").exec("a").length-2;Array.isArray(s.token)?1==s.token.length||1==l?s.token=s.token[0]:l-1!=s.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:s,groupCount:l-1}),s.token=s.token[0]):(s.tokenArray=s.token,s.token=null,s.onMatch=this.$arrayTokens):"function"!=typeof s.token||s.onMatch||(l>1?s.onMatch=this.$applyToken:s.onMatch=s.token),l>1&&(/\\\d/.test(s.regex)?a=s.regex.replace(/\\([0-9]+)/g,function(e,n){return"\\"+(parseInt(n,10)+S+1)}):(l=1,a=this.removeCapturingGroups(s.regex)),s.splitRegex||"string"==typeof s.token||o.push(s)),i[S]=g,S+=l,t.push(a),s.onMatch||(s.onMatch=null)}}t.length||(i[0]=0,t.push("$")),o.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,r)},this),this.regExps[n]=RegExp("("+t.join(")|(")+")|($)",r)}}return e.prototype.$setMaxTokenCount=function(e){S=0|e},e.prototype.$applyToken=function(e){var n=this.splitRegex.exec(e).slice(1),D=this.token.apply(this,n);if("string"==typeof D)return[{type:D,value:e}];for(var t=[],S=0,i=D.length;S<i;S++)n[S]&&(t[t.length]={type:D[S],value:n[S]});return t},e.prototype.$arrayTokens=function(e){if(!e)return[];var n=this.splitRegex.exec(e);if(!n)return"text";for(var D=[],t=this.tokenArray,S=0,i=t.length;S<i;S++)n[S+1]&&(D[D.length]={type:t[S],value:n[S+1]});return D},e.prototype.removeCapturingGroups=function(e){return e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(e,n){return n?"(?:":e})},e.prototype.createSplitterRegexp=function(e,n){if(-1!=e.indexOf("(?=")){var D=0,t=!1,S={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,n,i,r,o,g){return t?t="]"!=o:o?t=!0:r?(D==S.stack&&(S.end=g+1,S.stack=-1),D--):i&&(D++,1!=i.length&&(S.stack=D,S.start=g)),e}),null!=S.end&&/^\)*$/.test(e.substr(S.end))&&(e=e.substring(0,S.start)+e.substr(S.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(n||"").replace("g",""))},e.prototype.getLineTokens=function(e,n){if(n&&"string"!=typeof n){var D=n.slice(0);"#tmp"===(n=D[0])&&(D.shift(),n=D.shift())}else var D=[];var t=n||"start",i=this.states[t];i||(t="start",i=this.states[t]);var r=this.matchMappings[t],o=this.regExps[t];o.lastIndex=0;for(var g,s=[],a=0,l=0,c={type:null,value:""};g=o.exec(e);){var u=r.defaultToken,h=null,d=g[0],p=o.lastIndex;if(p-d.length>a){var f=e.substring(a,p-d.length);c.type==u?c.value+=f:(c.type&&s.push(c),c={type:u,value:f})}for(var m=0;m<g.length-2;m++)if(void 0!==g[m+1]){h=i[r[m]],u=h.onMatch?h.onMatch(d,t,D,e):h.token,h.next&&(t="string"==typeof h.next?h.next:h.next(t,D),(i=this.states[t])||(this.reportError("state doesn't exist",t),t="start",i=this.states[t]),r=this.matchMappings[t],a=p,(o=this.regExps[t]).lastIndex=p),h.consumeLineEnd&&(a=p);break}if(d){if("string"==typeof u)h&&!1===h.merge||c.type!==u?(c.type&&s.push(c),c={type:u,value:d}):c.value+=d;else if(u){c.type&&s.push(c),c={type:null,value:""};for(var m=0;m<u.length;m++)s.push(u[m])}}if(a==e.length)break;if(a=p,l++>S){for(l>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:n,line:e});a<e.length;)c.type&&s.push(c),c={value:e.substring(a,a+=500),type:"overflow"};t="start",D=[];break}}return c.type&&s.push(c),D.length>1&&D[0]!==t&&D.unshift("#tmp",t),{tokens:s,state:D.length?D:t}},e}();i.prototype.reportError=t,n.Tokenizer=i}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,n,D){"use strict";var t,S=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,n){if(!n){for(var D in e)this.$rules[D]=e[D];return}for(var D in e){for(var t=e[D],S=0;S<t.length;S++){var i=t[S];(i.next||i.onMatch)&&("string"==typeof i.next&&0!==i.next.indexOf(n)&&(i.next=n+i.next),i.nextState&&0!==i.nextState.indexOf(n)&&(i.nextState=n+i.nextState))}this.$rules[n+D]=t}},this.getRules=function(){return this.$rules},this.embedRules=function(e,n,D,t,i){var r="function"==typeof e?new e().getRules():e;if(t)for(var o=0;o<t.length;o++)t[o]=n+t[o];else for(var g in t=[],r)t.push(n+g);if(this.addRules(r,n),D)for(var s=Array.prototype[i?"push":"unshift"],o=0;o<t.length;o++)s.apply(this.$rules[t[o]],S(D));this.$embeds||(this.$embeds=[]),this.$embeds.push(n)},this.getEmbeds=function(){return this.$embeds};var e=function(e,n){return("start"!=e||n.length)&&n.unshift(this.nextState,e),this.nextState},n=function(e,n){return n.shift(),n.shift()||"start"};this.normalizeRules=function(){var D=0,t=this.$rules;function S(i){var r=t[i];r.processed=!0;for(var o=0;o<r.length;o++){var g=r[o],s=null;Array.isArray(g)&&(s=g,g={}),!g.regex&&g.start&&(g.regex=g.start,g.next||(g.next=[]),g.next.push({defaultToken:g.token},{token:g.token+".end",regex:g.end||g.start,next:"pop"}),g.token=g.token+".start",g.push=!0);var a=g.next||g.push;if(a&&Array.isArray(a)){var l=g.stateName;!l&&("string"!=typeof(l=g.token)&&(l=l[0]||""),t[l]&&(l+=D++)),t[l]=a,g.next=l,S(l)}else"pop"==a&&(g.next=n);if(g.push&&(g.nextState=g.next||g.push,g.next=e,delete g.push),g.rules)for(var c in g.rules)t[c]?t[c].push&&t[c].push.apply(t[c],g.rules[c]):t[c]=g.rules[c];var u="string"==typeof g?g:g.include;if(u&&("$self"===u&&(u="start"),s=Array.isArray(u)?u.map(function(e){return t[e]}):t[u]),s){var h=[o,1].concat(s);g.noEscape&&(h=h.filter(function(e){return!e.next})),r.splice.apply(r,h),o--}g.keywordMap&&(g.token=this.createKeywordMapper(g.keywordMap,g.defaultToken||"text",g.caseInsensitive),delete g.defaultToken)}}Object.keys(t).forEach(S,this)},this.createKeywordMapper=function(e,n,D,t){var S=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(n){for(var i=e[n].split(t||"|"),r=i.length;r--;){var o=i[r];this.$keywordList.push(o),D&&(o=o.toLowerCase()),S[o]=n}},this),e=null,D?function(e){return S[e.toLowerCase()]||n}:function(e){return S[e]||n}},this.getKeywords=function(){return this.$keywords}}).call((t=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),n.TextHighlightRules=t}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,n,D){"use strict";var t;(function(){this.add=function(e,n,D){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][n]=D},this.addBehaviours=function(e){for(var n in e)for(var D in e[n])this.add(n,D,e[n][D])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,n){if("function"==typeof e)var D=new e().getBehaviours(n);else var D=e.getBehaviours(n);this.addBehaviours(D)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var n={},D=0;D<e.length;D++)this.$behaviours[e[D]]&&(n[e[D]]=this.$behaviours[e[D]]);return n}}).call((t=function(){this.$behaviours={}}).prototype),n.Behaviour=t}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("./range").Range;n.TokenIterator=function(){function e(e,n,D){this.$session=e,this.$row=n,this.$rowTokens=e.getTokens(n);var t=e.getTokenAt(n,D);this.$tokenIndex=t?t.index:-1}return e.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},e.prototype.stepForward=function(){var e;for(this.$tokenIndex+=1;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentTokenRow=function(){return this.$row},e.prototype.getCurrentTokenColumn=function(){var e=this.$rowTokens,n=this.$tokenIndex,D=e[n].start;if(void 0!==D)return D;for(D=0;n>0;)n-=1,D+=e[n].value.length;return D},e.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},e.prototype.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],n=this.getCurrentTokenColumn();return new t(this.$row,n,this.$row,n+e.value.length)},e}()}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,n,D){"use strict";var t,S,i=e("../../lib/oop"),r=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,g=e("../../lib/lang"),s=["text","paren.rparen","rparen","paren","punctuation.operator"],a=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],l={},c={'"':'"',"'":"'"},u=function(e){var n=-1;if(e.multiSelect&&(n=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount})),l[n])return t=l[n];t=l[n]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(e,n,D,t){var S=e.end.row-e.start.row;return{text:D+n+t,selection:[0,e.start.column+1,S,e.end.column+ +!S]}};(S=function(e){e=e||{},this.add("braces","insertion",function(n,D,i,r,o){var s=i.getCursorPosition(),a=r.doc.getLine(s.row);if("{"==o){u(i);var l=i.getSelectionRange(),c=r.doc.getTextRange(l),d=r.getTokenAt(s.row,s.column);if(""!==c&&"{"!==c&&i.getWrapBehavioursEnabled())return h(l,c,"{","}");if(d&&/(?:string)\.quasi|\.xml/.test(d.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(d.type)})||/(string)\.quasi/.test(d.type)&&"$"!==d.value[s.column-d.start-1])return;return S.recordAutoInsert(i,r,"}"),{text:"{}",selection:[1,1]}}if(S.isSaneInsertion(i,r))if(/[\]\}\)]/.test(a[s.column])||i.inMultiSelectMode||e.braces)return S.recordAutoInsert(i,r,"}"),{text:"{}",selection:[1,1]};else return S.recordMaybeInsert(i,r,"{"),{text:"{",selection:[1,1]}}else if("}"==o){u(i);var p=a.substring(s.column,s.column+1);if("}"==p&&null!==r.$findOpeningBracket("}",{column:s.column+1,row:s.row})&&S.isAutoInsertedClosing(s,a,o))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==o||"\r\n"==o){u(i);var f="";S.isMaybeInsertedClosing(s,a)&&(f=g.stringRepeat("}",t.maybeInsertedBrackets),S.clearMaybeInsertedClosing());var p=a.substring(s.column,s.column+1);if("}"===p){var m=r.findMatchingBracket({row:s.row,column:s.column+1},"}");if(!m)return null;var y=this.$getIndent(r.getLine(m.row))}else if(!f)return void S.clearMaybeInsertedClosing();else var y=this.$getIndent(a);var v=y+r.getTabString();return{text:"\n"+v+"\n"+y+f,selection:[1,v.length,1,v.length]}}else S.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,n,D,S,i){var r=S.doc.getTextRange(i);if(!i.isMultiLine()&&"{"==r){if(u(D),"}"==S.doc.getLine(i.start.row).substring(i.end.column,i.end.column+1))return i.end.column++,i;t.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,n,D,t,i){if("("==i){u(D);var r=D.getSelectionRange(),o=t.doc.getTextRange(r);if(""!==o&&D.getWrapBehavioursEnabled())return h(r,o,"(",")");if(S.isSaneInsertion(D,t))return S.recordAutoInsert(D,t,")"),{text:"()",selection:[1,1]}}else if(")"==i){u(D);var g=D.getCursorPosition(),s=t.doc.getLine(g.row);if(")"==s.substring(g.column,g.column+1)&&null!==t.$findOpeningBracket(")",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,i))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,n,D,t,S){var i=t.doc.getTextRange(S);if(!S.isMultiLine()&&"("==i&&(u(D),")"==t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)))return S.end.column++,S}),this.add("brackets","insertion",function(e,n,D,t,i){if("["==i){u(D);var r=D.getSelectionRange(),o=t.doc.getTextRange(r);if(""!==o&&D.getWrapBehavioursEnabled())return h(r,o,"[","]");if(S.isSaneInsertion(D,t))return S.recordAutoInsert(D,t,"]"),{text:"[]",selection:[1,1]}}else if("]"==i){u(D);var g=D.getCursorPosition(),s=t.doc.getLine(g.row);if("]"==s.substring(g.column,g.column+1)&&null!==t.$findOpeningBracket("]",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,i))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,n,D,t,S){var i=t.doc.getTextRange(S);if(!S.isMultiLine()&&"["==i&&(u(D),"]"==t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)))return S.end.column++,S}),this.add("string_dquotes","insertion",function(e,n,D,t,S){var i=t.$mode.$quotes||c;if(1==S.length&&i[S]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(S))return;u(D);var r=S,o=D.getSelectionRange(),g=t.doc.getTextRange(o);if(""!==g&&(1!=g.length||!i[g])&&D.getWrapBehavioursEnabled())return h(o,g,r,r);if(!g){var s,a=D.getCursorPosition(),l=t.doc.getLine(a.row),d=l.substring(a.column-1,a.column),p=l.substring(a.column,a.column+1),f=t.getTokenAt(a.row,a.column),m=t.getTokenAt(a.row,a.column+1);if("\\"==d&&f&&/escape/.test(f.type))return null;var y=f&&/string|escape/.test(f.type),v=!m||/string|escape/.test(m.type);if(p==r)(s=y!==v)&&/string\.end/.test(m.type)&&(s=!1);else{if(y&&!v||y&&v)return null;var b=t.$mode.tokenRe;b.lastIndex=0;var w=b.test(d);b.lastIndex=0;var M=b.test(p),L=t.$mode.$pairQuotesAfter;if(!(L&&L[r]&&L[r].test(d))&&w||M||p&&!/[\s;,.})\]\\]/.test(p))return null;var $=l[a.column-2];if(d==r&&($==r||b.test($)))return null;s=!0}return{text:s?r+r:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,n,D,t,S){var i=t.$mode.$quotes||c,r=t.doc.getTextRange(S);if(!S.isMultiLine()&&i.hasOwnProperty(r)&&(u(D),t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)==r))return S.end.column++,S}),!1!==e.closeDocComment&&this.add("doc comment end","insertion",function(e,n,D,t,S){if("doc-start"===e&&("\n"===S||"\r\n"===S)&&D.selection.isEmpty()){var i=D.getCursorPosition();if(0!==i.column){for(var r=t.doc.getLine(i.row),o=t.doc.getLine(i.row+1),g=t.getTokens(i.row),s=0,a=0;a<g.length;a++){s+=g[a].value.length;var l=g[a];if(s>=i.column){if(s===i.column){if(!/\.doc/.test(l.type))return;if(/\*\//.test(l.value)){var c=g[a+1];if(!c||!/\.doc/.test(c.type))return}}var u=i.column-(s-l.value.length),h=l.value.indexOf("*/"),d=l.value.indexOf("/**",h>-1?h+2:0);if(-1!==d&&u>d&&u<d+3||-1!==h&&-1!==d&&u>=h&&u<=d||!/\.doc/.test(l.type))return;break}}var p=this.$getIndent(r);if(/\s*\*/.test(o))if(/^\s*\*/.test(r))return{text:S+p+"* ",selection:[1,2+p.length,1,2+p.length]};else return{text:S+p+" * ",selection:[1,3+p.length,1,3+p.length]};if(/\/\*\*/.test(r.substring(0,i.column)))return{text:S+p+" * "+S+" "+p+"*/",selection:[1,4+p.length,1,4+p.length]}}}})}).isSaneInsertion=function(e,n){var D=e.getCursorPosition(),t=new o(n,D.row,D.column);if(!this.$matchTokenType(t.getCurrentToken()||"text",s)){if(/[)}\]]/.test(e.session.getLine(D.row)[D.column]))return!0;var S=new o(n,D.row,D.column+1);if(!this.$matchTokenType(S.getCurrentToken()||"text",s))return!1}return t.stepForward(),t.getCurrentTokenRow()!==D.row||this.$matchTokenType(t.getCurrentToken()||"text",a)},S.$matchTokenType=function(e,n){return n.indexOf(e.type||e)>-1},S.recordAutoInsert=function(e,n,D){var S=e.getCursorPosition(),i=n.doc.getLine(S.row);this.isAutoInsertedClosing(S,i,t.autoInsertedLineEnd[0])||(t.autoInsertedBrackets=0),t.autoInsertedRow=S.row,t.autoInsertedLineEnd=D+i.substr(S.column),t.autoInsertedBrackets++},S.recordMaybeInsert=function(e,n,D){var S=e.getCursorPosition(),i=n.doc.getLine(S.row);this.isMaybeInsertedClosing(S,i)||(t.maybeInsertedBrackets=0),t.maybeInsertedRow=S.row,t.maybeInsertedLineStart=i.substr(0,S.column)+D,t.maybeInsertedLineEnd=i.substr(S.column),t.maybeInsertedBrackets++},S.isAutoInsertedClosing=function(e,n,D){return t.autoInsertedBrackets>0&&e.row===t.autoInsertedRow&&D===t.autoInsertedLineEnd[0]&&n.substr(e.column)===t.autoInsertedLineEnd},S.isMaybeInsertedClosing=function(e,n){return t.maybeInsertedBrackets>0&&e.row===t.maybeInsertedRow&&n.substr(e.column)===t.maybeInsertedLineEnd&&n.substr(0,e.column)==t.maybeInsertedLineStart},S.popAutoInsertedClosing=function(){t.autoInsertedLineEnd=t.autoInsertedLineEnd.substr(1),t.autoInsertedBrackets--},S.clearMaybeInsertedClosing=function(){t&&(t.maybeInsertedBrackets=0,t.maybeInsertedRow=-1)},i.inherits(S,r),n.CstyleBehaviour=S}),ace.define("ace/unicode",["require","exports","module"],function(e,n,D){"use strict";for(var t=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],S=0,i=[],r=0;r<t.length;r+=2)i.push(S+=t[r]),t[r+1]&&i.push(45,S+=t[r+1]);n.wordChars=String.fromCharCode.apply(null,i)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,n,D){"use strict";var t,S=e("../config"),i=e("../tokenizer").Tokenizer,r=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,g=e("../unicode"),s=e("../lib/lang"),a=e("../token_iterator").TokenIterator,l=e("../range").Range;(function(){this.$defaultBehaviour=new o,this.tokenRe=RegExp("^["+g.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+g.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new i(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,n,D,t){var S=n.doc,i=!0,r=!0,o=1/0,g=n.getTabSize(),a=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var l=this.lineCommentStart.map(s.escapeRegExp).join("|"),c=this.lineCommentStart[0];else var l=s.escapeRegExp(this.lineCommentStart),c=this.lineCommentStart;l=RegExp("^(\\s*)(?:"+l+") ?"),a=n.getUseSoftTabs();var u=function(e,n){var D=e.match(l);if(D){var t=D[1].length,i=D[0].length;!f(e,t,i)&&" "==D[0][i-1]&&i--,S.removeInLine(n,t,i)}},h=c+" ",d=function(e,n){(!i||/\S/.test(e))&&(f(e,o,o)?S.insertInLine({row:n,column:o},h):S.insertInLine({row:n,column:o},c))},p=function(e,n){return l.test(e)},f=function(e,n,D){for(var t=0;n--&&" "==e.charAt(n);)t++;if(t%g!=0)return!1;for(var t=0;" "==e.charAt(D++);)t++;return g>2?t%g!=g-1:t%g==0}}else{if(!this.blockComment)return!1;var c=this.blockComment.start,m=this.blockComment.end,l=RegExp("^(\\s*)(?:"+s.escapeRegExp(c)+")"),y=RegExp("(?:"+s.escapeRegExp(m)+")\\s*$"),d=function(e,n){!p(e,n)&&(!i||/\S/.test(e))&&(S.insertInLine({row:n,column:e.length},m),S.insertInLine({row:n,column:o},c))},u=function(e,n){var D;(D=e.match(y))&&S.removeInLine(n,e.length-D[0].length,e.length),(D=e.match(l))&&S.removeInLine(n,D[1].length,D[0].length)},p=function(e,D){if(l.test(e))return!0;for(var t=n.getTokens(D),S=0;S<t.length;S++)if("comment"===t[S].type)return!0}}function v(e){for(var n=D;n<=t;n++)e(S.getLine(n),n)}var b=1/0;v(function(e,n){var D=e.search(/\S/);-1!==D?(D<o&&(o=D),r&&!p(e,n)&&(r=!1)):b>e.length&&(b=e.length)}),o==1/0&&(o=b,i=!1,r=!1),a&&o%g!=0&&(o=Math.floor(o/g)*g),v(r?u:d)},this.toggleBlockComment=function(e,n,D,t){var S=this.blockComment;if(S){!S.start&&S[0]&&(S=S[0]);var i=new a(n,t.row,t.column),r=i.getCurrentToken();n.selection;var o=n.selection.toOrientedRange();if(r&&/comment/.test(r.type)){for(;r&&/comment/.test(r.type);){var g,s,c,u,h=r.value.indexOf(S.start);if(-1!=h){var d=i.getCurrentTokenRow(),p=i.getCurrentTokenColumn()+h;c=new l(d,p,d,p+S.start.length);break}r=i.stepBackward()}for(var i=new a(n,t.row,t.column),r=i.getCurrentToken();r&&/comment/.test(r.type);){var h=r.value.indexOf(S.end);if(-1!=h){var d=i.getCurrentTokenRow(),p=i.getCurrentTokenColumn()+h;u=new l(d,p,d,p+S.end.length);break}r=i.stepForward()}u&&n.remove(u),c&&(n.remove(c),g=c.start.row,s=-S.start.length)}else s=S.start.length,g=D.start.row,n.insert(D.end,S.end),n.insert(D.start,S.start);o.start.row==g&&(o.start.column+=s),o.end.row==g&&(o.end.column+=s),n.selection.fromOrientedRange(o)}},this.getNextLineIndent=function(e,n,D){return this.$getIndent(n)},this.checkOutdent=function(e,n,D){return!1},this.autoOutdent=function(e,n,D){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var n in this.$embeds=[],this.$modes={},e)if(e[n]){var D=e[n],t=D.prototype.$id,i=S.$modes[t];i||(S.$modes[t]=i=new D),S.$modes[n]||(S.$modes[n]=i),this.$embeds.push(n),this.$modes[n]=i}for(var r=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],o=function(e){!function(n){var D=r[e],t=n[D];n[r[e]]=function(){return this.$delegator(D,arguments,t)}}(g)},g=this,n=0;n<r.length;n++)o(n)},this.$delegator=function(e,n,D){var t=n[0]||"start";if("string"!=typeof t){if(Array.isArray(t[2])){var S=t[2][t[2].length-1],i=this.$modes[S];if(i)return i[e].apply(i,[t[1]].concat([].slice.call(n,1)))}t=t[0]||"start"}for(var r=0;r<this.$embeds.length;r++)if(this.$modes[this.$embeds[r]]){var o=t.split(this.$embeds[r]);if(!o[0]&&o[1]){n[0]=o[1];var i=this.$modes[this.$embeds[r]];return i[e].apply(i,n)}}var g=D.apply(this,n);return D?g:void 0},this.transformAction=function(e,n,D,t,S){if(this.$behaviour){var i=this.$behaviour.getBehaviours();for(var r in i)if(i[r][n]){var o=i[r][n].apply(this,arguments);if(o)return o}}},this.getKeywords=function(e){if(!this.completionKeywords){var n=this.$tokenizer.rules,D=[];for(var t in n)for(var S=n[t],i=0,r=S.length;i<r;i++)if("string"==typeof S[i].token)/keyword|support|storage/.test(S[i].token)&&D.push(S[i].regex);else if("object"==typeof S[i].token){for(var o=0,g=S[i].token.length;o<g;o++)if(/keyword|support|storage/.test(S[i].token[o])){var t=S[i].regex.match(/\(.+?\)/g)[o];D.push(t.substr(1,t.length-2))}}this.completionKeywords=D}return e?D.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,n,D,t){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((t=function(){this.HighlightRules=r}).prototype),n.Mode=t}),ace.define("ace/apply_delta",["require","exports","module"],function(e,n,D){"use strict";n.applyDelta=function(e,n,D){var t=n.start.row,S=n.start.column,i=e[t]||"";switch(n.action){case"insert":if(1===n.lines.length)e[t]=i.substring(0,S)+n.lines[0]+i.substring(S);else{var r=[t,1].concat(n.lines);e.splice.apply(e,r),e[t]=i.substring(0,S)+e[t],e[t+n.lines.length-1]+=i.substring(S)}break;case"remove":var o=n.end.column,g=n.end.row;t===g?e[t]=i.substring(0,S)+i.substring(o):e.splice(t,g-t+1,i.substring(0,S)+e[g].substring(o))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,i=function(){function e(e,n,D){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof n?this.setPosition(n.row,n.column):this.setPosition(n,D)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(e){if((e.start.row!=e.end.row||e.start.row==this.row)&&!(e.start.row>this.row)){var n=o(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)}},e.prototype.setPosition=function(e,n,D){if(t=D?{row:e,column:n}:this.$clipPositionToDocument(e,n),this.row!=t.row||this.column!=t.column){var t,S={row:this.row,column:this.column};this.row=t.row,this.column=t.column,this._signal("change",{old:S,value:t})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(e,n){var D={};return e>=this.document.getLength()?(D.row=Math.max(0,this.document.getLength()-1),D.column=this.document.getLine(D.row).length):e<0?(D.row=0,D.column=0):(D.row=e,D.column=Math.min(this.document.getLine(D.row).length,Math.max(0,n))),n<0&&(D.column=0),D},e}();function r(e,n,D){var t=D?e.column<=n.column:e.column<n.column;return e.row<n.row||e.row==n.row&&t}function o(e,n,D){var t="insert"==e.action,S=(t?1:-1)*(e.end.row-e.start.row),i=(t?1:-1)*(e.end.column-e.start.column),o=e.start,g=t?o:e.end;return r(n,o,D)?{row:n.row,column:n.column}:r(g,n,!D)?{row:n.row+S,column:n.column+(n.row==g.row?i:0)}:{row:o.row,column:o.column}}i.prototype.$insertRight=!1,t.implement(i.prototype,S),n.Anchor=i}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./apply_delta").applyDelta,i=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=e("./anchor").Anchor,g=function(){function e(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return e.prototype.setValue=function(e){var n=this.getLength()-1;this.remove(new r(0,0,n,this.getLine(n).length)),this.insert({row:0,column:0},e||"")},e.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},e.prototype.createAnchor=function(e,n){return new o(this,e,n)},e.prototype.$detectNewLine=function(e){var n=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=n?n[1]:"\n",this._signal("changeNewLineMode")},e.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},e.prototype.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},e.prototype.getNewLineMode=function(){return this.$newLineMode},e.prototype.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},e.prototype.getLine=function(e){return this.$lines[e]||""},e.prototype.getLines=function(e,n){return this.$lines.slice(e,n+1)},e.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},e.prototype.getLength=function(){return this.$lines.length},e.prototype.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},e.prototype.getLinesForRange=function(e){var n;if(e.start.row===e.end.row)n=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(n=this.getLines(e.start.row,e.end.row))[0]=(n[0]||"").substring(e.start.column);var D=n.length-1;e.end.row-e.start.row==D&&(n[D]=n[D].substring(0,e.end.column))}return n},e.prototype.insertLines=function(e,n){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,n)},e.prototype.removeLines=function(e,n){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,n)},e.prototype.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},e.prototype.insert=function(e,n){return 1>=this.getLength()&&this.$detectNewLine(n),this.insertMergedLines(e,this.$split(n))},e.prototype.insertInLine=function(e,n){var D=this.clippedPos(e.row,e.column),t=this.pos(e.row,e.column+n.length);return this.applyDelta({start:D,end:t,action:"insert",lines:[n]},!0),this.clonePos(t)},e.prototype.clippedPos=function(e,n){var D=this.getLength();void 0===e?e=D:e<0?e=0:e>=D&&(e=D-1,n=void 0);var t=this.getLine(e);return void 0==n&&(n=t.length),{row:e,column:n=Math.min(Math.max(n,0),t.length)}},e.prototype.clonePos=function(e){return{row:e.row,column:e.column}},e.prototype.pos=function(e,n){return{row:e,column:n}},e.prototype.$clipPosition=function(e){var n=this.getLength();return e.row>=n?(e.row=Math.max(0,n-1),e.column=this.getLine(n-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},e.prototype.insertFullLines=function(e,n){e=Math.min(Math.max(e,0),this.getLength());var D=0;e<this.getLength()?(n=n.concat([""]),D=0):(n=[""].concat(n),e--,D=this.$lines[e].length),this.insertMergedLines({row:e,column:D},n)},e.prototype.insertMergedLines=function(e,n){var D=this.clippedPos(e.row,e.column),t={row:D.row+n.length-1,column:(1==n.length?D.column:0)+n[n.length-1].length};return this.applyDelta({start:D,end:t,action:"insert",lines:n}),this.clonePos(t)},e.prototype.remove=function(e){var n=this.clippedPos(e.start.row,e.start.column),D=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:n,end:D,action:"remove",lines:this.getLinesForRange({start:n,end:D})}),this.clonePos(n)},e.prototype.removeInLine=function(e,n,D){var t=this.clippedPos(e,n),S=this.clippedPos(e,D);return this.applyDelta({start:t,end:S,action:"remove",lines:this.getLinesForRange({start:t,end:S})},!0),this.clonePos(t)},e.prototype.removeFullLines=function(e,n){e=Math.min(Math.max(0,e),this.getLength()-1);var D=(n=Math.min(Math.max(0,n),this.getLength()-1))==this.getLength()-1&&e>0,t=n<this.getLength()-1,S=D?e-1:e,i=D?this.getLine(S).length:0,o=t?n+1:n,g=t?0:this.getLine(o).length,s=new r(S,i,o,g),a=this.$lines.slice(e,n+1);return this.applyDelta({start:s.start,end:s.end,action:"remove",lines:this.getLinesForRange(s)}),a},e.prototype.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},e.prototype.replace=function(e,n){var D;return(e instanceof r||(e=r.fromPoints(e.start,e.end)),0===n.length&&e.isEmpty())?e.start:n==this.getTextRange(e)?e.end:(this.remove(e),D=n?this.insert(e.start,n):e.start)},e.prototype.applyDeltas=function(e){for(var n=0;n<e.length;n++)this.applyDelta(e[n])},e.prototype.revertDeltas=function(e){for(var n=e.length-1;n>=0;n--)this.revertDelta(e[n])},e.prototype.applyDelta=function(e,n){var D="insert"==e.action;(D?!(e.lines.length<=1)||e.lines[0]:r.comparePoints(e.start,e.end))&&(D&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(S(this.$lines,e,n),this._signal("change",e)))},e.prototype.$safeApplyDelta=function(e){var n=this.$lines.length;("remove"==e.action&&e.start.row<n&&e.end.row<n||"insert"==e.action&&e.start.row<=n)&&this.applyDelta(e)},e.prototype.$splitAndapplyLargeDelta=function(e,n){for(var D=e.lines,t=D.length-n+1,S=e.start.row,i=e.start.column,r=0,o=0;r<t;r=o){o+=n-1;var g=D.slice(r,o);g.push(""),this.applyDelta({start:this.pos(S+r,i),end:this.pos(S+o,i=0),action:e.action,lines:g},!0)}e.lines=D.slice(r),e.start.row=S+r,e.start.column=i,this.applyDelta(e,!0)},e.prototype.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},e.prototype.indexToPosition=function(e,n){for(var D=this.$lines||this.getAllLines(),t=this.getNewLineCharacter().length,S=n||0,i=D.length;S<i;S++)if((e-=D[S].length+t)<0)return{row:S,column:e+D[S].length+t};return{row:i-1,column:e+D[i-1].length+t}},e.prototype.positionToIndex=function(e,n){for(var D=this.$lines||this.getAllLines(),t=this.getNewLineCharacter().length,S=0,i=Math.min(e.row,D.length),r=n||0;r<i;++r)S+=D[r].length+t;return S+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();g.prototype.$autoNewLine="",g.prototype.$newLineMode="auto",t.implement(g.prototype,i),n.Document=g}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,i=function(){function e(e,n){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var D=this;this.$worker=function(){if(D.running){for(var e=new Date,n=D.currentLine,t=-1,S=D.doc,i=n;D.lines[n];)n++;var r=S.getLength(),o=0;for(D.running=!1;n<r;){D.$tokenizeRow(n),t=n;do n++;while(D.lines[n]);if(++o%5==0&&new Date-e>20){D.running=setTimeout(D.$worker,20);break}}D.currentLine=n,-1==t&&(t=n),i<=t&&D.fireUpdateEvent(i,t)}}}return e.prototype.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},e.prototype.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},e.prototype.fireUpdateEvent=function(e,n){var D={first:e,last:n};this._signal("update",{data:D})},e.prototype.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},e.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},e.prototype.$updateOnChange=function(e){var n=e.start.row,D=e.end.row-n;if(0===D)this.lines[n]=null;else if("remove"==e.action)this.lines.splice(n,D+1,null),this.states.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.lines.splice.apply(this.lines,t),this.states.splice.apply(this.states,t)}this.currentLine=Math.min(n,this.currentLine,this.doc.getLength()),this.stop()},e.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},e.prototype.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},e.prototype.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},e.prototype.$tokenizeRow=function(e){var n=this.doc.getLine(e),D=this.states[e-1],t=this.tokenizer.getLineTokens(n,D,e);return this.states[e]+""!=t.state+""?(this.states[e]=t.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=t.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();t.implement(i.prototype,S),n.BackgroundTokenizer=i}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,n,D){"use strict";var t=e("./lib/lang"),S=e("./range").Range,i=function(){function e(e,n,D){void 0===D&&(D="text"),this.setRegexp(e),this.clazz=n,this.type=D}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,n,D,i){if(this.regExp)for(var r=i.firstRow,o=i.lastRow,g={},s=r;s<=o;s++){var a=this.cache[s];null==a&&((a=t.getMatchOffsets(D.getLine(s),this.regExp)).length>this.MAX_RANGES&&(a=a.slice(0,this.MAX_RANGES)),a=a.map(function(e){return new S(s,e.offset,s,e.offset+e.length)}),this.cache[s]=a.length?a:"");for(var l=a.length;l--;){var c=a[l].toScreenRange(D),u=c.toString();g[u]||(g[u]=!0,n.drawSingleLineMarker(e,c,this.clazz,i))}}},e}();i.prototype.MAX_RANGES=500,n.SearchHighlight=i}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=function(){function e(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return e.prototype.addSession=function(e){this.$session=e},e.prototype.add=function(e,n,D){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===n||!this.lastDeltas){this.lastDeltas=[];var t=this.$undoStack.length;t>this.$undoDepth-1&&this.$undoStack.splice(0,t-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev}("remove"==e.action||"insert"==e.action)&&(this.$lastDelta=e),this.lastDeltas.push(e)}},e.prototype.addSelection=function(e,n){this.selections.push({value:e,rev:n||this.$rev})},e.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},e.prototype.markIgnored=function(e,n){null==n&&(n=this.$rev+1);for(var D=this.$undoStack,t=D.length;t--;){var S=D[t][0];if(S.id<=e)break;S.id<n&&(S.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,n){for(var D=this.selections,t=D.length;t--;){var S=D[t];if(S.rev<e)return n&&(S=D[t+1]),S}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,n){null==n&&(n=this.$rev+1);for(var D=this.$undoStack,t=null,S=0,i=D.length;i--;){var r=D[i][0];if(r.id<n&&!t&&(t=i+1),r.id<=e){S=i+1;break}}return D.slice(S,t)},e.prototype.getChangedRanges=function(e,n){null==n&&(n=this.$rev+1)},e.prototype.getChangedLines=function(e,n){null==n&&(n=this.$rev+1)},e.prototype.undo=function(e,n){this.lastDeltas=null;var D=this.$undoStack;if(S(D,D.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var t=D.pop(),i=null;return t&&(i=e.undoChanges(t,n),this.$redoStack.push(t),this.$syncRev()),this.$fromUndo=!1,i}},e.prototype.redo=function(e,n){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var D=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);m(this.$redoStack,D),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var t=this.$redoStack.pop(),S=null;return t&&(S=e.redoChanges(t,n),this.$undoStack.push(t),this.$syncRev()),this.$fromUndo=!1,S},e.prototype.$syncRev=function(){var e=this.$undoStack,n=e[e.length-1],D=n&&n[0].id||0;this.$redoStackBaseRev=D,this.$rev=D},e.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},e.prototype.canUndo=function(){return this.$undoStack.length>0},e.prototype.canRedo=function(){return this.$redoStack.length>0},e.prototype.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},e.prototype.isAtBookmark=function(){return this.$rev===this.mark},e.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},e.prototype.fromJSON=function(e){this.reset(),this.$undoStack=e.$undoStack,this.$redoStack=e.$redoStack},e.prototype.$prettyPrint=function(e){return e?s(e):s(this.$undoStack)+"\n---\n"+s(this.$redoStack)},e}();function S(e,n){for(var D=n;D--;){var t=e[D];if(t&&!t[0].ignore){for(;D<n-1;){var S=c(e[D],e[D+1]);e[D]=S[0],e[D+1]=S[1],D++}return!0}}}t.prototype.hasUndo=t.prototype.canUndo,t.prototype.hasRedo=t.prototype.canRedo,t.prototype.isClean=t.prototype.isAtBookmark,t.prototype.markClean=t.prototype.bookmark;var i=e("./range").Range,r=i.comparePoints;function o(e){return{row:e.row,column:e.column}}function g(e){return{start:o(e.start),end:o(e.end),action:e.action,lines:e.lines.slice()}}function s(e){if(Array.isArray(e=e||this))return e.map(s).join("\n");var n="";return e.action?n=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(n=Array.isArray(e.value)?e.value.map(a).join("\n"):a(e.value)),e.start&&(n+=a(e)),(e.id||e.rev)&&(n+=" ("+(e.id||e.rev)+")"),n}function a(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function l(e,n){var D="insert"==e.action,t="insert"==n.action;if(D&&t)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.start,e.start)))return null;h(e,n,1)}else if(D&&!t)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.end,e.start)))return null;h(e,n,-1)}else if(!D&&t)if(r(n.start,e.start)>=0)h(n,e,1);else{if(!(0>=r(n.start,e.start)))return null;h(e,n,1)}else if(!D&&!t)if(r(n.start,e.start)>=0)h(n,e,1);else{if(!(0>=r(n.end,e.start)))return null;h(e,n,-1)}return[n,e]}function c(e,n){for(var D=e.length;D--;)for(var t=0;t<n.length;t++)if(!l(e[D],n[t])){for(;D<e.length;){for(;t--;)l(n[t],e[D]);t=n.length,D++}return[e,n]}return e.selectionBefore=n.selectionBefore=e.selectionAfter=n.selectionAfter=null,[n,e]}function u(e,n){var D,t,S="insert"==e.action,o="insert"==n.action;if(S&&o)0>r(e.start,n.start)?h(n,e,1):h(e,n,1);else if(S&&!o)r(e.start,n.end)>=0?h(e,n,-1):(0>=r(e.start,n.start)||h(e,i.fromPoints(n.start,e.start),-1),h(n,e,1));else if(!S&&o)r(n.start,e.end)>=0?h(n,e,-1):(0>=r(n.start,e.start)||h(n,i.fromPoints(e.start,n.start),-1),h(e,n,1));else if(!S&&!o)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.end,e.start)))return 0>r(e.start,n.start)&&(D=e,e=p(e,n.start)),r(e.end,n.end)>0&&(t=p(e,n.end)),d(n.end,e.start,e.end,-1),t&&!D&&(e.lines=t.lines,e.start=t.start,e.end=t.end,t=e),[n,D,t].filter(Boolean);h(e,n,-1)}return[n,e]}function h(e,n,D){d(e.start,n.start,n.end,D),d(e.end,n.start,n.end,D)}function d(e,n,D,t){e.row==(1==t?n:D).row&&(e.column+=t*(D.column-n.column)),e.row+=t*(D.row-n.row)}function p(e,n){var D=e.lines,t=e.end;e.end=o(n);var S=e.end.row-e.start.row,i=D.splice(S,D.length),r=S?n.column:n.column-e.start.column;return D.push(i[0].substring(0,r)),i[0]=i[0].substr(r),{start:o(n),end:t,lines:i,action:e.action}}function f(e,n){n=g(n);for(var D=e.length;D--;){for(var t=e[D],S=0;S<t.length;S++){var i=u(t[S],n);n=i[0],2!=i.length&&(i[2]?(t.splice(S+1,1,i[1],i[2]),S++):!i[1]&&(t.splice(S,1),S--))}t.length||e.splice(D,1)}return e}function m(e,n){for(var D=0;D<n.length;D++)for(var t=n[D],S=0;S<t.length;S++)f(e,t[S])}i.comparePoints,n.UndoManager=t}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("../range").Range;n.FoldLine=function(){function e(e,n){this.foldData=e,Array.isArray(n)?this.folds=n:n=this.folds=[n];var D=n[n.length-1];this.range=new t(n[0].start.row,n[0].start.column,D.end.row,D.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}return e.prototype.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(n){n.start.row+=e,n.end.row+=e})},e.prototype.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,n){return-e.range.compareEnd(n.start.row,n.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):0>this.range.compareStart(e.end.row,e.end.column)&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else if(e.end.row==this.start.row)this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column;else throw Error("Trying to add fold to FoldRow that doesn't have a matching row");e.foldLine=this},e.prototype.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},e.prototype.walk=function(e,n,D){var t,S,i,r=0,o=this.folds,g=!0;null==n&&(n=this.end.row,D=this.end.column);for(var s=0;s<o.length;s++){if(-1==(S=(t=o[s]).range.compareStart(n,D)))return void e(null,n,D,r,g);if((i=!(i=e(null,t.start.row,t.start.column,r,g))&&e(t.placeholder,t.start.row,t.start.column,r))||0===S)return;g=!t.sameRow,r=t.end.column}e(null,n,D,r,g)},e.prototype.getNextFoldTo=function(e,n){for(var D,t,S=0;S<this.folds.length;S++){if(-1==(t=(D=this.folds[S]).range.compareEnd(e,n)))return{fold:D,kind:"after"};if(0===t)return{fold:D,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,n,D){var t,S,i=this.getNextFoldTo(e,n);if(i){if(t=i.fold,"inside"==i.kind&&t.start.column!=n&&t.start.row!=e)window.console&&window.console.log(e,n,t);else if(t.start.row==e){var r=(S=this.folds).indexOf(t);for(0===r&&(this.start.column+=D);r<S.length;r++){if(t=S[r],t.start.column+=D,!t.sameRow)return;t.end.column+=D}this.end.column+=D}}},e.prototype.split=function(n,D){var t=this.getNextFoldTo(n,D);if(!t||"inside"==t.kind)return null;var S=t.fold,i=this.folds,r=this.foldData,o=i.indexOf(S),g=i[o-1];this.end.row=g.end.row,this.end.column=g.end.column;var s=new e(r,i=i.splice(o,i.length-o));return r.splice(r.indexOf(this)+1,0,s),s},e.prototype.merge=function(e){for(var n=e.folds,D=0;D<n.length;D++)this.addFold(n[D]);var t=this.foldData;t.splice(t.indexOf(e),1)},e.prototype.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(n){e.push(" "+n.toString())}),e.push("]"),e.join("\n")},e.prototype.idxToPosition=function(e){for(var n=0,D=0;D<this.folds.length;D++){var t=this.folds[D];if((e-=t.start.column-n)<0)return{row:t.start.row,column:t.start.column+e};if((e-=t.placeholder.length)<0)return t.start;n=t.end.column}return{row:this.end.row,column:this.end.column+e}},e}()}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("./range").Range.comparePoints,S=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,n,D){for(var S=this.ranges,i=D||0;i<S.length;i++){var r=S[i],o=t(e,r.end);if(!(o>0)){var g=t(e,r.start);if(0===o)return n&&0!==g?-i-2:i;if(g>0||0===g&&!n)return i;break}}return-i-1},e.prototype.add=function(e){var n=!e.isEmpty(),D=this.pointIndex(e.start,n);D<0&&(D=-D-1);var t=this.pointIndex(e.end,n,D);return t<0?t=-t-1:t++,this.ranges.splice(D,t-D,e)},e.prototype.addList=function(e){for(var n=[],D=e.length;D--;)n.push.apply(n,this.add(e[D]));return n},e.prototype.substractPoint=function(e){var n=this.pointIndex(e);if(n>=0)return this.ranges.splice(n,1)},e.prototype.merge=function(){for(var e,n=[],D=this.ranges,S=(D=D.sort(function(e,n){return t(e.start,n.start)}))[0],i=1;i<D.length;i++){e=S,S=D[i];var r=t(e.end,S.start);!(r<0)&&(0!=r||e.isEmpty()||S.isEmpty())&&(0>t(e.end,S.end)&&(e.end.row=S.end.row,e.end.column=S.end.column),D.splice(i,1),n.push(S),S=e,i--)}return this.ranges=D,n},e.prototype.contains=function(e,n){return this.pointIndex({row:e,column:n})>=0},e.prototype.containsPoint=function(e){return this.pointIndex(e)>=0},e.prototype.rangeAtPoint=function(e){var n=this.pointIndex(e);if(n>=0)return this.ranges[n]},e.prototype.clipRows=function(e,n){var D=this.ranges;if(D[0].start.row>n||D[D.length-1].start.row<e)return[];var t=this.pointIndex({row:e,column:0});t<0&&(t=-t-1);var S=this.pointIndex({row:n,column:0},t);S<0&&(S=-S-1);for(var i=[],r=t;r<S;r++)i.push(D[r]);return i},e.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},e.prototype.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},e.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},e.prototype.$onChange=function(e){for(var n=e.start,D=e.end,t=n.row,S=D.row,i=this.ranges,r=0,o=i.length;r<o;r++){var g=i[r];if(g.end.row>=t)break}if("insert"==e.action)for(var s=S-t,a=-n.column+D.column;r<o;r++){var g=i[r];if(g.start.row>t)break;if(g.start.row==t&&g.start.column>=n.column&&(g.start.column==n.column&&this.$bias<=0||(g.start.column+=a,g.start.row+=s)),g.end.row==t&&g.end.column>=n.column){if(g.end.column==n.column&&this.$bias<0)continue;g.end.column==n.column&&a>0&&r<o-1&&g.end.column>g.start.column&&g.end.column==i[r+1].start.column&&(g.end.column-=a),g.end.column+=a,g.end.row+=s}}else for(var s=t-S,a=n.column-D.column;r<o;r++){var g=i[r];if(g.start.row>S)break;g.end.row<S&&(t<g.end.row||t==g.end.row&&n.column<g.end.column)?(g.end.row=t,g.end.column=n.column):g.end.row==S?g.end.column<=D.column?(s||g.end.column>n.column)&&(g.end.column=n.column,g.end.row=n.row):(g.end.column+=a,g.end.row+=s):g.end.row>S&&(g.end.row+=s),g.start.row<S&&(t<g.start.row||t==g.start.row&&n.column<g.start.column)?(g.start.row=t,g.start.column=n.column):g.start.row==S?g.start.column<=D.column?(s||g.start.column>n.column)&&(g.start.column=n.column,g.start.row=n.row):(g.start.column+=a,g.start.row+=s):g.start.row>S&&(g.start.row+=s)}if(0!=s&&r<o)for(;r<o;r++){var g=i[r];g.start.row+=s,g.end.row+=s}},e}();S.prototype.comparePoints=t,n.RangeList=S}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}();function S(e,n){e.row-=n.row,0==e.row&&(e.column-=n.column)}function i(e,n){S(e.start,n),S(e.end,n)}function r(e,n){0==e.row&&(e.column+=n.column),e.row+=n.row}function o(e,n){r(e.start,n),r(e.end,n)}n.Fold=function(e){function n(n,D){var t=e.call(this)||this;return t.foldLine=null,t.placeholder=D,t.range=n,t.start=n.start,t.end=n.end,t.sameRow=n.start.row==n.end.row,t.subFolds=t.ranges=[],t}return t(n,e),n.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},n.prototype.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(n){n.setFoldLine(e)})},n.prototype.clone=function(){var e=new n(this.range.clone(),this.placeholder);return this.subFolds.forEach(function(n){e.subFolds.push(n.clone())}),e.collapseChildren=this.collapseChildren,e},n.prototype.addSubFold=function(e){if(!this.range.isEqual(e)){i(e,this.start);for(var n=e.start.row,D=e.start.column,t=0,S=-1;t<this.subFolds.length&&1==(S=this.subFolds[t].range.compare(n,D));t++);var r=this.subFolds[t],o=0;if(0==S)if(r.range.containsRange(e))return r.addSubFold(e);else o=1;for(var n=e.range.end.row,D=e.range.end.column,g=t,S=-1;g<this.subFolds.length&&1==(S=this.subFolds[g].range.compare(n,D));g++);0==S&&g++;for(var s=this.subFolds.splice(t,g-t,e),a=0==S?s.length-1:s.length,l=o;l<a;l++)e.addSubFold(s[l]);return e.setFoldLine(this.foldLine),e}},n.prototype.restoreRange=function(e){return o(e,this.start)},n}(e("../range_list").RangeList)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(e,n,D){"use strict";var t=e("../range").Range,S=e("./fold_line").FoldLine,i=e("./fold").Fold,r=e("../token_iterator").TokenIterator,o=e("../mouse/mouse_event").MouseEvent;n.Folding=function(){this.getFoldAt=function(e,n,D){var t=this.getFoldLine(e);if(!t)return null;for(var S=t.folds,i=0;i<S.length;i++){var r=S[i].range;if(r.contains(e,n)){if(1==D&&r.isEnd(e,n)&&!r.isEmpty()||-1==D&&r.isStart(e,n)&&!r.isEmpty())continue;return S[i]}}},this.getFoldsInRange=function(e){var n=e.start,D=e.end,t=this.$foldData,S=[];n.column+=1,D.column-=1;for(var i=0;i<t.length;i++){var r=t[i].range.compareRange(e);if(2!=r){if(-2==r)break;for(var o=t[i].folds,g=0;g<o.length;g++){var s=o[g];if(-2==(r=s.range.compareRange(e)))break;if(2!=r){if(42==r)break;S.push(s)}}}}return n.column-=1,D.column+=1,S},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var n=[];e.forEach(function(e){n=n.concat(this.getFoldsInRange(e))},this)}else var n=this.getFoldsInRange(e);return n},this.getAllFolds=function(){for(var e=[],n=this.$foldData,D=0;D<n.length;D++)for(var t=0;t<n[D].folds.length;t++)e.push(n[D].folds[t]);return e},this.getFoldStringAt=function(e,n,D,t){if(!(t=t||this.getFoldLine(e)))return null;for(var S,i,r={end:{column:0}},o=0;o<t.folds.length;o++){var g=(i=t.folds[o]).range.compareEnd(e,n);if(-1==g){S=this.getLine(i.start.row).substring(r.end.column,i.start.column);break}if(0===g)return null;r=i}return(S||(S=this.getLine(i.start.row).substring(r.end.column)),-1==D)?S.substring(0,n-r.end.column):1==D?S.substring(n-r.end.column):S},this.getFoldLine=function(e,n){var D=this.$foldData,t=0;for(n&&(t=D.indexOf(n)),-1==t&&(t=0);t<D.length;t++){var S=D[t];if(S.start.row<=e&&S.end.row>=e)return S;if(S.end.row>e)break}return null},this.getNextFoldLine=function(e,n){var D=this.$foldData,t=0;for(n&&(t=D.indexOf(n)),-1==t&&(t=0);t<D.length;t++){var S=D[t];if(S.end.row>=e)return S}return null},this.getFoldedRowCount=function(e,n){for(var D=this.$foldData,t=n-e+1,S=0;S<D.length;S++){var i=D[S],r=i.end.row,o=i.start.row;if(r>=n){o<n&&(o>=e?t-=n-o:t=0);break}r>=e&&(o>=e?t-=r-o:t-=r-e+1)}return t},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,n){return e.start.row-n.start.row}),e},this.addFold=function(e,n){var D,t=this.$foldData,r=!1;e instanceof i?D=e:(D=new i(n,e)).collapseChildren=n.collapseChildren,this.$clipRangeToDocument(D.range);var o=D.start.row,g=D.start.column,s=D.end.row,a=D.end.column,l=this.getFoldAt(o,g,1),c=this.getFoldAt(s,a,-1);if(l&&c==l)return l.addSubFold(D);l&&!l.range.isStart(o,g)&&this.removeFold(l),c&&!c.range.isEnd(s,a)&&this.removeFold(c);var u=this.getFoldsInRange(D.range);u.length>0&&(this.removeFolds(u),D.collapseChildren||u.forEach(function(e){D.addSubFold(e)}));for(var h=0;h<t.length;h++){var d=t[h];if(s==d.start.row){d.addFold(D),r=!0;break}if(o==d.end.row){if(d.addFold(D),r=!0,!D.sameRow){var p=t[h+1];p&&p.start.row==s&&d.merge(p)}break}if(s<=d.start.row)break}return r||(d=this.$addFoldLine(new S(this.$foldData,D))),this.$useWrapMode?this.$updateWrapData(d.start.row,d.start.row):this.$updateRowLengthCache(d.start.row,d.start.row),this.$modified=!0,this._signal("changeFold",{data:D,action:"add"}),D},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var n=e.foldLine,D=n.start.row,t=n.end.row,S=this.$foldData,i=n.folds;if(1==i.length)S.splice(S.indexOf(n),1);else if(n.range.isEnd(e.end.row,e.end.column))i.pop(),n.end.row=i[i.length-1].end.row,n.end.column=i[i.length-1].end.column;else if(n.range.isStart(e.start.row,e.start.column))i.shift(),n.start.row=i[0].start.row,n.start.column=i[0].start.column;else if(e.sameRow)i.splice(i.indexOf(e),1);else{var r=n.split(e.start.row,e.start.column);(i=r.folds).shift(),r.start.row=i[0].start.row,r.start.column=i[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(D,t):this.$updateRowLengthCache(D,t)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var n=[],D=0;D<e.length;D++)n.push(e[D]);n.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(n){e.restoreRange(n),this.addFold(n)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,n){if(null==e)D=new t(0,0,this.getLength(),0),null==n&&(n=!0);else if("number"==typeof e)D=new t(e,0,e,this.getLine(e).length);else if("row"in e)D=t.fromPoints(e,e);else{if(Array.isArray(e))return S=[],e.forEach(function(e){S=S.concat(this.unfold(e))},this),S;D=e}for(var D,S=this.getFoldsInRangeList(D),i=S;1==S.length&&0>t.comparePoints(S[0].start,D.start)&&t.comparePoints(S[0].end,D.end)>0;)this.expandFolds(S),S=this.getFoldsInRangeList(D);if(!1!=n?this.removeFolds(S):this.expandFolds(S),i.length)return i},this.isRowFolded=function(e,n){return!!this.getFoldLine(e,n)},this.getRowFoldEnd=function(e,n){var D=this.getFoldLine(e,n);return D?D.end.row:e},this.getRowFoldStart=function(e,n){var D=this.getFoldLine(e,n);return D?D.start.row:e},this.getFoldDisplayLine=function(e,n,D,t,S){null==t&&(t=e.start.row),null==S&&(S=0),null==n&&(n=e.end.row),null==D&&(D=this.getLine(n).length);var i=this.doc,r="";return e.walk(function(e,n,D,o){if(!(n<t)){if(n==t){if(D<S)return;o=Math.max(S,o)}null!=e?r+=e:r+=i.getLine(n).substring(o,D)}},n,D),r},this.getDisplayLine=function(e,n,D,t){var S,i=this.getFoldLine(e);return i?this.getFoldDisplayLine(i,e,n,D,t):(S=this.doc.getLine(e)).substring(t||0,n||S.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(n){var D=n.folds.map(function(e){return e.clone()});return new S(e,D)})},this.toggleFold=function(e){var n,D,t=this.selection.getRange();if(t.isEmpty()){var S=t.start;if(n=this.getFoldAt(S.row,S.column))return void this.expandFold(n);(D=this.findMatchingBracket(S))?1==t.comparePoint(D)?t.end=D:(t.start=D,t.start.column++,t.end.column--):(D=this.findMatchingBracket({row:S.row,column:S.column+1}))?(1==t.comparePoint(D)?t.end=D:t.start=D,t.start.column++):t=this.getCommentFoldRange(S.row,S.column)||t}else{var i=this.getFoldsInRange(t);if(e&&i.length)return void this.expandFolds(i);1==i.length&&(n=i[0])}if(n||(n=this.getFoldAt(t.start.row,t.start.column)),n&&n.range.toString()==t.toString())return void this.expandFold(n);var r="...";if(!t.isMultiLine()){if((r=this.getTextRange(t)).length<4)return;r=r.trim().substring(0,2)+".."}this.addFold(r,t)},this.getCommentFoldRange=function(e,n,D){var S=new r(this,e,n),i=S.getCurrentToken(),o=i&&i.type;if(i&&/^comment|string/.test(o)){"comment"==(o=o.match(/comment|string/)[0])&&(o+="|doc-start|\\.doc");var g=new RegExp(o),s=new t;if(1!=D){do i=S.stepBackward();while(i&&g.test(i.type));i=S.stepForward()}s.start.row=S.getCurrentTokenRow(),s.start.column=S.getCurrentTokenColumn()+i.value.length,S=new r(this,e,n);var a=this.getState(S.$row);if(-1!=D){var l=-1;do if(i=S.stepForward(),-1==l){var c=this.getState(S.$row);a.toString()!==c.toString()&&(l=S.$row)}else if(S.$row>l)break;while(i&&g.test(i.type));i=S.stepBackward()}else i=S.getCurrentToken();return s.end.row=S.getCurrentTokenRow(),s.end.column=S.getCurrentTokenColumn(),s}},this.foldAll=function(e,n,D,t){void 0==D&&(D=1e5);var S=this.foldWidgets;if(S){n=n||this.getLength(),e=e||0;for(var i=e;i<n;i++)if((null==S[i]&&(S[i]=this.getFoldWidget(i)),"start"==S[i])&&(!t||t(i))){var r=this.getFoldWidgetRange(i);r&&r.isMultiLine()&&r.end.row<=n&&r.start.row>=e&&(i=r.end.row,r.collapseChildren=D,this.addFold("...",r))}}},this.foldToLevel=function(e){for(this.foldAll();e-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var e=this;this.foldAll(null,null,null,function(n){for(var D=e.getTokens(n),t=0;t<D.length;t++){var S=D[t];if(!("text"==S.type&&/^\s+$/.test(S.value))){if(/comment/.test(S.type))return!0;return!1}}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var n=this.$foldMode;this.$setFolding(null),this.$setFolding(n)}},this.$setFolding=function(e){if(this.$foldMode!=e){if(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!e||"manual"==this.$foldStyle){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(e,n){var D=this.foldWidgets;if(!D||n&&D[e])return{};for(var t,S=e-1;S>=0;){var i=D[S];if(null==i&&(i=D[S]=this.getFoldWidget(S)),"start"==i){var r=this.getFoldWidgetRange(S);if(t||(t=r),r&&r.end.row>=e)break}S--}return{range:-1!==S&&r,firstRange:t}},this.onFoldWidgetClick=function(e,n){n instanceof o&&(n=n.domEvent);var D={children:n.shiftKey,all:n.ctrlKey||n.metaKey,siblings:n.altKey};if(!this.$toggleFoldWidget(e,D)){var t=n.target||n.srcElement;t&&/ace_fold-widget/.test(t.className)&&(t.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,n){if(this.getFoldWidget){var D=this.getFoldWidget(e),t=this.getLine(e),S="end"===D?-1:1,i=this.getFoldAt(e,-1===S?0:t.length,S);if(i)return n.children||n.all?this.removeFold(i):this.expandFold(i),i;var r=this.getFoldWidgetRange(e,!0);if(r&&!r.isMultiLine()&&(i=this.getFoldAt(r.start.row,r.start.column,1))&&r.isEqual(i.range))return this.removeFold(i),i;if(n.siblings){var o=this.getParentFoldRangeData(e);if(o.range)var g=o.range.start.row+1,s=o.range.end.row;this.foldAll(g,s,1e4*!!n.all)}else n.children?(s=r?r.end.row:this.getLength(),this.foldAll(e+1,s,1e4*!!n.all)):r&&(n.all&&(r.collapseChildren=1e4),this.addFold("...",r));return r}},this.toggleFoldWidget=function(e){var n=this.selection.getCursor().row;n=this.getRowFoldStart(n);var D=this.$toggleFoldWidget(n,{});if(!D){var t=this.getParentFoldRangeData(n,!0);if(D=t.range||t.firstRange){n=D.start.row;var S=this.getFoldAt(n,this.getLine(n).length,1);S?this.removeFold(S):this.addFold("...",D)}}},this.updateFoldWidgets=function(e){var n=e.start.row,D=e.end.row-n;if(0===D)this.foldWidgets[n]=null;else if("remove"==e.action)this.foldWidgets.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,t)}},this.tokenizerUpdateFoldWidgets=function(e){var n=e.data;n.first!=n.last&&this.foldWidgets.length>n.first&&this.foldWidgets.splice(n.first,this.foldWidgets.length)}}}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,n,D){"use strict";var t=e("../token_iterator").TokenIterator,S=e("../range").Range;n.BracketMatch=function(){this.findMatchingBracket=function(e,n){if(0==e.column)return null;var D=n||this.getLine(e.row).charAt(e.column-1);if(""==D)return null;var t=D.match(/([\(\[\{])|([\)\]\}])/);return t?t[1]?this.$findClosingBracket(t[1],e):this.$findOpeningBracket(t[2],e):null},this.getBracketRange=function(e){var n,D=this.getLine(e.row),t=!0,i=D.charAt(e.column-1),r=i&&i.match(/([\(\[\{])|([\)\]\}])/);if(r||(i=D.charAt(e.column),e={row:e.row,column:e.column+1},r=i&&i.match(/([\(\[\{])|([\)\]\}])/),t=!1),!r)return null;if(r[1]){var o=this.$findClosingBracket(r[1],e);if(!o)return null;n=S.fromPoints(e,o),!t&&(n.end.column++,n.start.column--),n.cursor=n.end}else{var o=this.$findOpeningBracket(r[2],e);if(!o)return null;n=S.fromPoints(o,e),!t&&(n.start.column++,n.end.column--),n.cursor=n.start}return n},this.getMatchingBracketRanges=function(e,n){var D=this.getLine(e.row),t=/([\(\[\{])|([\)\]\}])/,i=!n&&D.charAt(e.column-1),r=i&&i.match(t);if(r||(i=(void 0===n||n)&&D.charAt(e.column),e={row:e.row,column:e.column+1},r=i&&i.match(t)),!r)return null;var o=new S(e.row,e.column-1,e.row,e.column),g=r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e);return g?[o,new S(g.row,g.column,g.row,g.column+1)]:[o]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,n,D){var S=this.$brackets[e],i=1,r=new t(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){D||(D=RegExp("(\\.?"+o.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var g=n.column-r.getCurrentTokenColumn()-2,s=o.value;;){for(;g>=0;){var a=s.charAt(g);if(a==S){if(0==(i-=1))return{row:r.getCurrentTokenRow(),column:g+r.getCurrentTokenColumn()}}else a==e&&(i+=1);g-=1}do o=r.stepBackward();while(o&&!D.test(o.type));if(null==o)break;g=(s=o.value).length-1}return null}},this.$findClosingBracket=function(e,n,D){var S=this.$brackets[e],i=1,r=new t(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){D||(D=RegExp("(\\.?"+o.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var g=n.column-r.getCurrentTokenColumn();;){for(var s=o.value,a=s.length;g<a;){var l=s.charAt(g);if(l==S){if(0==(i-=1))return{row:r.getCurrentTokenRow(),column:g+r.getCurrentTokenColumn()}}else l==e&&(i+=1);g+=1}do o=r.stepForward();while(o&&!D.test(o.type));if(null==o)break;g=0}return null}},this.getMatchingTags=function(e){var n=new t(this,e.row,e.column),D=this.$findTagName(n);if(D){var S=n.stepBackward();return"<"===S.value?this.$findClosingTag(n,D):this.$findOpeningTag(n,D)}},this.$findTagName=function(e){var n=e.getCurrentToken(),D=!1,t=!1;if(n&&-1===n.type.indexOf("tag-name"))do(n=t?e.stepBackward():e.stepForward())&&("/>"===n.value?t=!0:-1!==n.type.indexOf("tag-name")&&(D=!0));while(n&&!D);return n},this.$findClosingTag=function(e,n){var D,t=n.value,i=n.value,r=0,o=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);n=e.stepForward();var g=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length),s=!1;do{if(-1!==(D=n).type.indexOf("tag-close")&&!s){var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);s=!0}if(n=e.stepForward()){if(">"===n.value&&!s){var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);s=!0}if(-1!==n.type.indexOf("tag-name")){if(i===(t=n.value)){if("<"===D.value)r++;else if("</"===D.value&&--r<0){e.stepBackward();var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);n=e.stepForward();var c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length);if(-1===n.type.indexOf("tag-close")&&(n=e.stepForward()),!n||">"!==n.value)return;var u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(i===t&&"/>"===n.value&&--r<0)var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),c=l,u=c,a=new S(g.end.row,g.end.column,g.end.row,g.end.column+1)}}while(n&&r>=0);if(o&&a&&l&&u&&g&&c)return{openTag:new S(o.start.row,o.start.column,a.end.row,a.end.column),closeTag:new S(l.start.row,l.start.column,u.end.row,u.end.column),openTagName:g,closeTagName:c}},this.$findOpeningTag=function(e,n){var D=e.getCurrentToken(),t=n.value,i=0,r=e.getCurrentTokenRow(),o=e.getCurrentTokenColumn(),g=o+2,s=new S(r,o,r,g);e.stepForward();var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length);if(-1===n.type.indexOf("tag-close")&&(n=e.stepForward()),n&&">"===n.value){var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);e.stepBackward(),e.stepBackward();do if(n=D,r=e.getCurrentTokenRow(),g=(o=e.getCurrentTokenColumn())+n.value.length,D=e.stepBackward(),n){if(-1!==n.type.indexOf("tag-name")){if(t===n.value)if("<"===D.value){if(++i>0){var c=new S(r,o,r,g),u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do n=e.stepForward();while(n&&">"!==n.value);var h=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===D.value&&i--}else if("/>"===n.value){for(var d=0,p=D;p;){if(-1!==p.type.indexOf("tag-name")&&p.value===t){i--;break}if("<"===p.value)break;p=e.stepBackward(),d++}for(var f=0;f<d;f++)e.stepForward()}}while(D&&i<=0);if(u&&h&&s&&l&&c&&a)return{openTag:new S(u.start.row,u.start.column,h.end.row,h.end.column),closeTag:new S(s.start.row,s.start.column,l.end.row,l.end.column),openTagName:c,closeTagName:a}}}}}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/lang"),i=e("./bidihandler").BidiHandler,r=e("./config"),o=e("./lib/event_emitter").EventEmitter,g=e("./selection").Selection,s=e("./mode/text").Mode,a=e("./range").Range,l=e("./document").Document,c=e("./background_tokenizer").BackgroundTokenizer,u=e("./search_highlight").SearchHighlight,h=e("./undomanager").UndoManager,d=function(){function e(n,D){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.prevOp={},this.$foldData=[],this.id="session"+ ++e.$uid,this.$foldData.toString=function(){return this.join("\n")},this.bgTokenizer=new c(new s().getTokenizer(),this);var t=this;this.bgTokenizer.on("update",function(e){t._signal("tokenizerUpdate",e)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof n&&n.getLine||(n=new l(n)),this.setDocument(n),this.selection=new g(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new i(this),r.resetOptions(this),this.setMode(D),r._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return e.prototype.$initOperationListeners=function(){var e=this;this.curOp=null,this.on("change",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.docChanged=!0},!0),this.on("changeSelection",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.selectionChanged=!0},!0),this.$operationResetTimer=S.delayedCall(this.endOperation.bind(this,!0))},e.prototype.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(e={}),this.$operationResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",e)},e.prototype.endOperation=function(e){if(this.curOp){if(e&&!1===e.returnValue){this.curOp=null,this._signal("endOperation",e);return}if(!0!=e||!this.curOp.command||"mouse"!=this.curOp.command.name){var n=this.selection.toJSON();this.curOp.selectionAfter=n,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(n),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",e)}}},e.prototype.setDocument=function(e){this.doc&&this.doc.off("change",this.$onChange),this.doc=e,e.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},e.prototype.getDocument=function(){return this.doc},e.prototype.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var n=this.$docRowCache.length,D=this.$getRowCacheIndex(this.$docRowCache,e)+1;n>D&&(this.$docRowCache.splice(D,n),this.$screenRowCache.splice(D,n))},e.prototype.$getRowCacheIndex=function(e,n){for(var D=0,t=e.length-1;D<=t;){var S=D+t>>1,i=e[S];if(n>i)D=S+1;else{if(!(n<i))return S;t=S-1}}return D-1},e.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},e.prototype.onChangeFold=function(e){var n=e.data;this.$resetRowCache(n.start.row)},e.prototype.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var n=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(n&&n.length&&(this.$undoManager.add({action:"removeFolds",folds:n},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},e.prototype.onSelectionChange=function(){this._signal("changeSelection")},e.prototype.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},e.fromJSON=function(n){"string"==typeof n&&(n=JSON.parse(n));var D=new h;D.$undoStack=n.history.undo,D.$redoStack=n.history.redo,D.mark=n.history.mark,D.$rev=n.history.rev;var t=new e(n.value);return n.folds.forEach(function(e){t.addFold("...",a.fromPoints(e.start,e.end))}),t.setAnnotations(n.annotations),t.setBreakpoints(n.breakpoints),t.setMode(n.mode),t.setScrollLeft(n.scrollLeft),t.setScrollTop(n.scrollTop),t.setUndoManager(D),t.selection.fromJSON(n.selection),t},e.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(e){return e.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},e.prototype.toString=function(){return this.doc.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.getState=function(e){return this.bgTokenizer.getState(e)},e.prototype.getTokens=function(e){return this.bgTokenizer.getTokens(e)},e.prototype.getTokenAt=function(e,n){var D,t=this.bgTokenizer.getTokens(e),S=0;if(null==n){var i=t.length-1;S=this.getLine(e).length}else for(var i=0;i<t.length&&!((S+=t[i].value.length)>=n);i++);return(D=t[i])?(D.index=i,D.start=S-D.value.length,D):null},e.prototype.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var n=this;e.addSession(this),this.$syncInformUndoManager=function(){n.$informUndoManager.cancel(),n.mergeUndoDeltas=!1},this.$informUndoManager=S.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},e.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},e.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},e.prototype.getTabString=function(){return this.getUseSoftTabs()?S.stringRepeat(" ",this.getTabSize()):" "},e.prototype.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},e.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},e.prototype.setTabSize=function(e){this.setOption("tabSize",e)},e.prototype.getTabSize=function(){return this.$tabSize},e.prototype.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},e.prototype.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},e.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},e.prototype.setOverwrite=function(e){this.setOption("overwrite",e)},e.prototype.getOverwrite=function(){return this.$overwrite},e.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},e.prototype.addGutterDecoration=function(e,n){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+n,this._signal("changeBreakpoint",{})},e.prototype.removeGutterDecoration=function(e,n){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+n,""),this._signal("changeBreakpoint",{})},e.prototype.getBreakpoints=function(){return this.$breakpoints},e.prototype.setBreakpoints=function(e){this.$breakpoints=[];for(var n=0;n<e.length;n++)this.$breakpoints[e[n]]="ace_breakpoint";this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},e.prototype.setBreakpoint=function(e,n){void 0===n&&(n="ace_breakpoint"),n?this.$breakpoints[e]=n:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.addMarker=function(e,n,D,t){var S=this.$markerId++,i={range:e,type:D||"line",renderer:"function"==typeof D?D:null,clazz:n,inFront:!!t,id:S};return t?(this.$frontMarkers[S]=i,this._signal("changeFrontMarker")):(this.$backMarkers[S]=i,this._signal("changeBackMarker")),S},e.prototype.addDynamicMarker=function(e,n){if(e.update){var D=this.$markerId++;return e.id=D,e.inFront=!!n,n?(this.$frontMarkers[D]=e,this._signal("changeFrontMarker")):(this.$backMarkers[D]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var n=this.$frontMarkers[e]||this.$backMarkers[e];if(n){var D=n.inFront?this.$frontMarkers:this.$backMarkers;delete D[e],this._signal(n.inFront?"changeFrontMarker":"changeBackMarker")}},e.prototype.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},e.prototype.highlight=function(e){if(!this.$searchHighlight){var n=new u(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(n)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,n,D,t){"number"!=typeof n&&(D=n,n=e),D||(D="ace_step");var S=new a(e,0,n,1/0);return S.id=this.addMarker(S,D,"fullLine",t),S},e.prototype.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},e.prototype.getAnnotations=function(){return this.$annotations||[]},e.prototype.clearAnnotations=function(){this.setAnnotations([])},e.prototype.$detectNewLine=function(e){var n=e.match(/^.*?(\r?\n)/m);n?this.$autoNewLine=n[1]:this.$autoNewLine="\n"},e.prototype.getWordRange=function(e,n){var D=this.getLine(e),t=!1;if(n>0&&(t=!!D.charAt(n-1).match(this.tokenRe)),t||(t=!!D.charAt(n).match(this.tokenRe)),t)var S=this.tokenRe;else if(/^\s+$/.test(D.slice(n-1,n+1)))var S=/\s/;else var S=this.nonTokenRe;var i=n;if(i>0){do i--;while(i>=0&&D.charAt(i).match(S));i++}for(var r=n;r<D.length&&D.charAt(r).match(S);)r++;return new a(e,i,e,r)},e.prototype.getAWordRange=function(e,n){for(var D=this.getWordRange(e,n),t=this.getLine(D.end.row);t.charAt(D.end.column).match(/[ \t]/);)D.end.column+=1;return D},e.prototype.setNewLineMode=function(e){this.doc.setNewLineMode(e)},e.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},e.prototype.setUseWorker=function(e){this.setOption("useWorker",e)},e.prototype.getUseWorker=function(){return this.$useWorker},e.prototype.onReloadTokenizer=function(e){var n=e.data;this.bgTokenizer.start(n.first),this._signal("tokenizerUpdate",e)},e.prototype.setMode=function(e,n){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var D=e,t=D.path}else t=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new s),this.$modes[t]&&!D){this.$onChangeMode(this.$modes[t]),n&&n();return}this.$modeId=t,r.loadModule(["mode",t],(function(e){if(this.$modeId!==t)return n&&n();this.$modes[t]&&!D?this.$onChangeMode(this.$modes[t]):e&&e.Mode&&(e=new e.Mode(D),D||(this.$modes[t]=e,e.$id=t),this.$onChangeMode(e)),n&&n()}).bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},e.prototype.$onChangeMode=function(e,n){if(n||(this.$modeId=e.$id),this.$mode!==e){var D=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var t=e.getTokenizer();if(void 0!==t.on){var S=this.onReloadTokenizer.bind(this);t.on("update",S)}this.bgTokenizer.setTokenizer(t),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,n||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:D,mode:e}))}},e.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},e.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){r.warn("Could not load worker",e),this.$worker=null}},e.prototype.getMode=function(){return this.$mode},e.prototype.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},e.prototype.getScrollTop=function(){return this.$scrollTop},e.prototype.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},e.prototype.getScrollLeft=function(){return this.$scrollLeft},e.prototype.getScreenWidth=function(){return(this.$computeWidth(),this.lineWidgets)?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},e.prototype.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(n){n&&n.screenWidth>e&&(e=n.screenWidth)}),this.lineWidgetWidth=e},e.prototype.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var n=this.doc.getAllLines(),D=this.$rowLengthCache,t=0,S=0,i=this.$foldData[S],r=i?i.start.row:1/0,o=n.length,g=0;g<o;g++){if(g>r){if((g=i.end.row+1)>=o)break;r=(i=this.$foldData[S++])?i.start.row:1/0}null==D[g]&&(D[g]=this.$getStringScreenWidth(n[g])[0]),D[g]>t&&(t=D[g])}this.screenWidth=t}},e.prototype.getLine=function(e){return this.doc.getLine(e)},e.prototype.getLines=function(e,n){return this.doc.getLines(e,n)},e.prototype.getLength=function(){return this.doc.getLength()},e.prototype.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},e.prototype.insert=function(e,n){return this.doc.insert(e,n)},e.prototype.remove=function(e){return this.doc.remove(e)},e.prototype.removeFullLines=function(e,n){return this.doc.removeFullLines(e,n)},e.prototype.undoChanges=function(e,n){if(e.length){this.$fromUndo=!0;for(var D=e.length-1;-1!=D;D--){var t=e[D];"insert"==t.action||"remove"==t.action?this.doc.revertDelta(t):t.folds&&this.addFolds(t.folds)}!n&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},e.prototype.redoChanges=function(e,n){if(e.length){this.$fromUndo=!0;for(var D=0;D<e.length;D++){var t=e[D];("insert"==t.action||"remove"==t.action)&&this.doc.$safeApplyDelta(t)}!n&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},e.prototype.setUndoSelect=function(e){this.$undoSelect=e},e.prototype.$getUndoSelection=function(e,n){function D(e){return n?"insert"!==e.action:"insert"===e.action}for(var t,S,i=0;i<e.length;i++){var r=e[i];if(r.start){if(!t){t=D(r)?a.fromPoints(r.start,r.end):a.fromPoints(r.start,r.start);continue}D(r)?(S=r.start,-1==t.compare(S.row,S.column)&&t.setStart(S),S=r.end,1==t.compare(S.row,S.column)&&t.setEnd(S)):(S=r.start,-1==t.compare(S.row,S.column)&&(t=a.fromPoints(r.start,r.start)))}}return t},e.prototype.replace=function(e,n){return this.doc.replace(e,n)},e.prototype.moveText=function(e,n,D){var t=this.getTextRange(e),S=this.getFoldsInRange(e),i=a.fromPoints(n,n);if(!D){this.remove(e);var r=e.start.row-e.end.row,o=r?-e.end.column:e.start.column-e.end.column;o&&(i.start.row==e.end.row&&i.start.column>e.end.column&&(i.start.column+=o),i.end.row==e.end.row&&i.end.column>e.end.column&&(i.end.column+=o)),r&&i.start.row>=e.end.row&&(i.start.row+=r,i.end.row+=r)}if(i.end=this.insert(i.start,t),S.length){var g=e.start,s=i.start,r=s.row-g.row,o=s.column-g.column;this.addFolds(S.map(function(e){return(e=e.clone()).start.row==g.row&&(e.start.column+=o),e.end.row==g.row&&(e.end.column+=o),e.start.row+=r,e.end.row+=r,e}))}return i},e.prototype.indentRows=function(e,n,D){D=D.replace(/\t/g,this.getTabString());for(var t=e;t<=n;t++)this.doc.insertInLine({row:t,column:0},D)},e.prototype.outdentRows=function(e){for(var n=e.collapseRows(),D=new a(0,0,0,0),t=this.getTabSize(),S=n.start.row;S<=n.end.row;++S){var i=this.getLine(S);D.start.row=S,D.end.row=S;for(var r=0;r<t&&" "==i.charAt(r);++r);r<t&&" "==i.charAt(r)?(D.start.column=r,D.end.column=r+1):(D.start.column=0,D.end.column=r),this.remove(D)}},e.prototype.$moveLines=function(e,n,D){if(e=this.getRowFoldStart(e),n=this.getRowFoldEnd(n),D<0){var t=this.getRowFoldStart(e+D);if(t<0)return 0;var S=t-e}else if(D>0){var t=this.getRowFoldEnd(n+D);if(t>this.doc.getLength()-1)return 0;var S=t-n}else{e=this.$clipRowToDocument(e);var S=(n=this.$clipRowToDocument(n))-e+1}var i=new a(e,0,n,Number.MAX_VALUE),r=this.getFoldsInRange(i).map(function(e){return e=e.clone(),e.start.row+=S,e.end.row+=S,e}),o=0==D?this.doc.getLines(e,n):this.doc.removeFullLines(e,n);return this.doc.insertFullLines(e+S,o),r.length&&this.addFolds(r),S},e.prototype.moveLinesUp=function(e,n){return this.$moveLines(e,n,-1)},e.prototype.moveLinesDown=function(e,n){return this.$moveLines(e,n,1)},e.prototype.duplicateLines=function(e,n){return this.$moveLines(e,n,0)},e.prototype.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},e.prototype.$clipColumnToRow=function(e,n){return n<0?0:Math.min(this.doc.getLine(e).length,n)},e.prototype.$clipPositionToDocument=function(e,n){if(n=Math.max(0,n),e<0)e=0,n=0;else{var D=this.doc.getLength();e>=D?(e=D-1,n=this.doc.getLine(D-1).length):n=Math.min(this.doc.getLine(e).length,n)}return{row:e,column:n}},e.prototype.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var n=this.doc.getLength()-1;return e.end.row>n?(e.end.row=n,e.end.column=this.doc.getLine(n).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},e.prototype.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var n=this.getLength();this.$wrapData=Array(n),this.$updateWrapData(0,n-1)}this._signal("changeWrapMode")}},e.prototype.getUseWrapMode=function(){return this.$useWrapMode},e.prototype.setWrapLimitRange=function(e,n){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==n)&&(this.$wrapLimitRange={min:e,max:n},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},e.prototype.adjustWrapLimit=function(e,n){var D=this.$wrapLimitRange;D.max<0&&(D={min:n,max:n});var t=this.$constrainWrapLimit(e,D.min,D.max);return t!=this.$wrapLimit&&t>1&&(this.$wrapLimit=t,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,n,D){return n&&(e=Math.max(n,e)),D&&(e=Math.min(D,e)),e},e.prototype.getWrapLimit=function(){return this.$wrapLimit},e.prototype.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},e.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},e.prototype.$updateInternalDataOnChange=function(e){var n=this.$useWrapMode,D=e.action,t=e.start,S=e.end,i=t.row,r=S.row,o=r-i,g=null;if(this.$updating=!0,0!=o)if("remove"===D){this[n?"$wrapData":"$rowLengthCache"].splice(i,o);var s=this.$foldData;g=this.getFoldsInRange(e),this.removeFolds(g);var a=this.getFoldLine(S.row),l=0;if(a){a.addRemoveChars(S.row,S.column,t.column-S.column),a.shiftRow(-o);var c=this.getFoldLine(i);c&&c!==a&&(c.merge(a),a=c),l=s.indexOf(a)+1}for(;l<s.length;l++){var a=s[l];a.start.row>=S.row&&a.shiftRow(-o)}r=i}else{var u=Array(o);u.unshift(i,0);var h=n?this.$wrapData:this.$rowLengthCache;h.splice.apply(h,u);var s=this.$foldData,a=this.getFoldLine(i),l=0;if(a){var d=a.range.compareInside(t.row,t.column);0==d?(a=a.split(t.row,t.column))&&(a.shiftRow(o),a.addRemoveChars(r,0,S.column-t.column)):-1==d&&(a.addRemoveChars(i,0,S.column-t.column),a.shiftRow(o)),l=s.indexOf(a)+1}for(;l<s.length;l++){var a=s[l];a.start.row>=i&&a.shiftRow(o)}}else{o=Math.abs(e.start.column-e.end.column),"remove"===D&&(g=this.getFoldsInRange(e),this.removeFolds(g),o=-o);var a=this.getFoldLine(i);a&&a.addRemoveChars(i,t.column,o)}return n&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,n?this.$updateWrapData(i,r):this.$updateRowLengthCache(i,r),g},e.prototype.$updateRowLengthCache=function(e,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[n]=null},e.prototype.$updateWrapData=function(e,n){var D,t,S=this.doc.getAllLines(),i=this.getTabSize(),r=this.$wrapData,o=this.$wrapLimit,g=e;for(n=Math.min(n,S.length-1);g<=n;)(t=this.getFoldLine(g,t))?(D=[],t.walk((function(e,n,t,i){var r;if(null!=e){(r=this.$getDisplayTokens(e,D.length))[0]=m;for(var o=1;o<r.length;o++)r[o]=y}else r=this.$getDisplayTokens(S[n].substring(i,t),D.length);D=D.concat(r)}).bind(this),t.end.row,S[t.end.row].length+1),r[t.start.row]=this.$computeWrapSplits(D,o,i),g=t.end.row+1):(D=this.$getDisplayTokens(S[g]),r[g]=this.$computeWrapSplits(D,o,i),g++)},e.prototype.$computeWrapSplits=function(e,n,D){if(0==e.length)return[];var t=[],S=e.length,i=0,r=0,o=this.$wrapAsCode,g=this.$indentedSoftWrap,s=n<=Math.max(2*D,8)||!1===g?0:Math.floor(n/2);function a(){var n=0;if(0===s)return n;if(g)for(var t=0;t<e.length;t++){var S=e[t];if(S==b)n+=1;else if(S==w)n+=D;else if(S==M)continue;else break}return o&&!1!==g&&(n+=D),Math.min(n,s)}function l(n){for(var D=n-i,S=i;S<n;S++){var o=e[S];(12===o||2===o)&&(D-=1)}t.length||(t.indent=c=a()),r+=D,t.push(r),i=n}for(var c=0;S-i>n-c;){var u=i+n-c;if(e[u-1]>=b&&e[u]>=b){l(u);continue}if(e[u]==m||e[u]==y){for(;u!=i-1&&e[u]!=m;u--);if(u>i){l(u);continue}for(u=i+n;u<e.length&&e[u]==y;u++);if(u==e.length)break;l(u);continue}for(var h=Math.max(u-(n-(n>>2)),i-1);u>h&&e[u]<m;)u--;if(o){for(;u>h&&e[u]<m;)u--;for(;u>h&&e[u]==v;)u--}else for(;u>h&&e[u]<b;)u--;if(u>h){l(++u);continue}e[u=i+n]==f&&u--,l(u-c)}return t},e.prototype.$getDisplayTokens=function(e,n){var D,t=[];n=n||0;for(var S=0;S<e.length;S++){var i=e.charCodeAt(S);if(9==i){D=this.getScreenTabSize(t.length+n),t.push(w);for(var r=1;r<D;r++)t.push(M)}else 32==i?t.push(b):i>39&&i<48||i>57&&i<64?t.push(v):i>=4352&&L(i)?t.push(p,f):t.push(p)}return t},e.prototype.$getStringScreenWidth=function(e,n,D){var t,S;if(0==n)return[0,0];for(null==n&&(n=1/0),D=D||0,S=0;S<e.length&&(9==(t=e.charCodeAt(S))?D+=this.getScreenTabSize(D):t>=4352&&L(t)?D+=2:D+=1,!(D>n));S++);return[D,S]},e.prototype.getRowLength=function(e){var n=1;return(this.lineWidgets&&(n+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+n:n},e.prototype.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},e.prototype.getRowWrapIndent=function(e){if(!this.$useWrapMode)return 0;var n=this.screenToDocumentPosition(e,Number.MAX_VALUE),D=this.$wrapData[n.row];return D.length&&D[0]<n.column?D.indent:0},e.prototype.getScreenLastRowColumn=function(e){var n=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(n.row,n.column)},e.prototype.getDocumentLastRowColumn=function(e,n){var D=this.documentToScreenRow(e,n);return this.getScreenLastRowColumn(D)},e.prototype.getDocumentLastRowColumnPosition=function(e,n){var D=this.documentToScreenRow(e,n);return this.screenToDocumentPosition(D,Number.MAX_VALUE/10)},e.prototype.getRowSplitData=function(e){if(this.$useWrapMode)return this.$wrapData[e]},e.prototype.getScreenTabSize=function(e){return this.$tabSize-(e%this.$tabSize|0)},e.prototype.screenToDocumentRow=function(e,n){return this.screenToDocumentPosition(e,n).row},e.prototype.screenToDocumentColumn=function(e,n){return this.screenToDocumentPosition(e,n).column},e.prototype.screenToDocumentPosition=function(e,n,D){if(e<0)return{row:0,column:0};var t,S,i=0,r=0,o=0,g=0,s=this.$screenRowCache,a=this.$getRowCacheIndex(s,e),l=s.length;if(l&&a>=0)var o=s[a],i=this.$docRowCache[a],c=e>s[l-1];else var c=!l;for(var u=this.getLength()-1,h=this.getNextFoldLine(i),d=h?h.start.row:1/0;o<=e&&!(o+(g=this.getRowLength(i))>e)&&!(i>=u);)o+=g,++i>d&&(i=h.end.row+1,d=(h=this.getNextFoldLine(i,h))?h.start.row:1/0),c&&(this.$docRowCache.push(i),this.$screenRowCache.push(o));if(h&&h.start.row<=i)t=this.getFoldDisplayLine(h),i=h.start.row;else{if(o+g<=e||i>u)return{row:u,column:this.getLine(u).length};t=this.getLine(i),h=null}var p=0,f=Math.floor(e-o);if(this.$useWrapMode){var m=this.$wrapData[i];m&&(S=m[f],f>0&&m.length&&(p=m.indent,r=m[f-1]||m[m.length-1],t=t.substring(r)))}return(void 0!==D&&this.$bidiHandler.isBidiRow(o+f,i,f)&&(n=this.$bidiHandler.offsetToCol(D)),r+=this.$getStringScreenWidth(t,n-p)[1],this.$useWrapMode&&r>=S&&(r=S-1),h)?h.idxToPosition(r):{row:i,column:r}},e.prototype.documentToScreenPosition=function(e,n){if(void 0===n)var D=this.$clipPositionToDocument(e.row,e.column);else D=this.$clipPositionToDocument(e,n);e=D.row,n=D.column;var t=0,S=null,i=null;(i=this.getFoldAt(e,n,1))&&(e=i.start.row,n=i.start.column);var r,o=0,g=this.$docRowCache,s=this.$getRowCacheIndex(g,e),a=g.length;if(a&&s>=0)var o=g[s],t=this.$screenRowCache[s],l=e>g[a-1];else var l=!a;for(var c=this.getNextFoldLine(o),u=c?c.start.row:1/0;o<e;){if(o>=u){if((r=c.end.row+1)>e)break;u=(c=this.getNextFoldLine(r,c))?c.start.row:1/0}else r=o+1;t+=this.getRowLength(o),o=r,l&&(this.$docRowCache.push(o),this.$screenRowCache.push(t))}var h="";c&&o>=u?(h=this.getFoldDisplayLine(c,e,n),S=c.start.row):(h=this.getLine(e).substring(0,n),S=e);var d=0;if(this.$useWrapMode){var p=this.$wrapData[S];if(p){for(var f=0;h.length>=p[f];)t++,f++;h=h.substring(p[f-1]||0,h.length),d=f>0?p.indent:0}}return this.lineWidgets&&this.lineWidgets[o]&&this.lineWidgets[o].rowsAbove&&(t+=this.lineWidgets[o].rowsAbove),{row:t,column:d+this.$getStringScreenWidth(h)[0]}},e.prototype.documentToScreenColumn=function(e,n){return this.documentToScreenPosition(e,n).column},e.prototype.documentToScreenRow=function(e,n){return this.documentToScreenPosition(e,n).row},e.prototype.getScreenLength=function(){var e=0,n=null;if(this.$useWrapMode)for(var D=this.$wrapData.length,t=0,S=0,n=this.$foldData[S++],i=n?n.start.row:1/0;t<D;){var r=this.$wrapData[t];e+=r?r.length+1:1,++t>i&&(t=n.end.row+1,i=(n=this.$foldData[S++])?n.start.row:1/0)}else{e=this.getLength();for(var o=this.$foldData,S=0;S<o.length;S++)e-=(n=o[S]).end.row-n.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},e.prototype.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(n,D,t){var S,i;if(0===D)return[0,0];for(D||(D=1/0),t=t||0,i=0;i<n.length&&(" "===(S=n.charAt(i))?t+=this.getScreenTabSize(t):t+=e.getCharacterWidth(S),!(t>D));i++);return[t,i]})},e.prototype.getPrecedingCharacter=function(){var e=this.selection.getCursor();return 0===e.column?0===e.row?"":this.doc.getNewLineCharacter():this.getLine(e.row)[e.column-1]},e.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},e}();d.$uid=0,d.prototype.$modes=r.$modes,d.prototype.getValue=d.prototype.toString,d.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},d.prototype.$overwrite=!1,d.prototype.$mode=null,d.prototype.$modeId=null,d.prototype.$scrollTop=0,d.prototype.$scrollLeft=0,d.prototype.$wrapLimit=80,d.prototype.$useWrapMode=!1,d.prototype.$wrapLimitRange={min:null,max:null},d.prototype.lineWidgets=null,d.prototype.isFullWidth=L,t.implement(d.prototype,o);var p=1,f=2,m=3,y=4,v=9,b=10,w=11,M=12;function L(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),r.defineOptions(d.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var n="number"==typeof e?e:null;this.setWrapLimitRange(n,n),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){(e="auto"==e?"text"!=this.$mode.type:"text"!=e)!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){(e=parseInt(e))>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),n.EditSession=d}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,n,D){"use strict";var t=e("./lib/lang"),S=e("./lib/oop"),i=e("./range").Range;function r(e,n){var D=t.supportsLookbehind();function S(e,t){if(void 0===t&&(t=!0),(D&&n.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||n.regExp)return D&&n.$supportsUnicodeFlag?t?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var i=Array.from(e),r=i[0],o=i[i.length-1];return S(r)+e+S(o,!1)}n.Search=function(){function e(){this.$options={}}return e.prototype.set=function(e){return S.mixin(this.$options,e),this},e.prototype.getOptions=function(){return t.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var n=this.$options,D=this.$matchIterator(e,n);if(!D)return!1;var t=null;return D.forEach(function(e,D,S,r){return t=new i(e,D,S,r),!(D==r&&n.start&&n.start.start&&!1!=n.skipCurrent&&t.isEqual(n.start))||(t=null,!1)}),t},e.prototype.findAll=function(e){var n=this.$options;if(!n.needle)return[];this.$assembleRegExp(n);var D=n.range,S=D?e.getLines(D.start.row,D.end.row):e.doc.getAllLines(),r=[],o=n.re;if(n.$isMultiLine){var g,s=o.length,a=S.length-s;e:for(var l=o.offset||0;l<=a;l++){for(var c=0;c<s;c++)if(-1==S[l+c].search(o[c]))continue e;var u=S[l],h=S[l+s-1],d=u.length-u.match(o[0])[0].length,p=h.match(o[s-1])[0].length;g&&g.end.row===l&&g.end.column>d||(r.push(g=new i(l,d,l+s-1,p)),s>2&&(l=l+s-2))}}else for(var f=0;f<S.length;f++)for(var m=t.getMatchOffsets(S[f],o),c=0;c<m.length;c++){var y=m[c];r.push(new i(f,y.offset,f,y.offset+y.length))}if(D){for(var v=D.start.column,b=D.end.column,f=0,c=r.length-1;f<c&&r[f].start.column<v&&0==r[f].start.row;)f++;for(var w=D.end.row-D.start.row;f<c&&r[c].end.column>b&&r[c].end.row==w;)c--;for(r=r.slice(f,c+1),f=0,c=r.length;f<c;f++)r[f].start.row+=D.start.row,r[f].end.row+=D.start.row}return r},e.prototype.replace=function(e,n){var D=this.$options,t=this.$assembleRegExp(D);if(D.$isMultiLine)return n;if(t){var S=t.exec(e);if(!S||S[0].length!=e.length)return null;if(D.regExp||(n=n.replace(/\$/g,"$$$$")),n=e.replace(t,n),D.preserveCase){n=n.split("");for(var i=Math.min(e.length,e.length);i--;){var r=e[i];r&&r.toLowerCase()!=r?n[i]=n[i].toUpperCase():n[i]=n[i].toLowerCase()}n=n.join("")}return n}},e.prototype.$assembleRegExp=function(e,n){if(e.needle instanceof RegExp)return e.re=e.needle;var D=e.needle;if(!e.needle)return e.re=!1;e.regExp||(D=t.escapeRegExp(D));var S=e.caseSensitive?"gm":"gmi";try{RegExp(D,"u"),e.$supportsUnicodeFlag=!0,S+="u"}catch(n){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(D=r(D,e)),e.$isMultiLine=!n&&/[\n\r]/.test(D),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(D,S);try{var i=new RegExp(D,S)}catch(e){i=!1}return e.re=i},e.prototype.$assembleMultilineRegExp=function(e,n){for(var D=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),t=[],S=0;S<D.length;S++)try{t.push(new RegExp(D[S],n))}catch(e){return!1}return t},e.prototype.$matchIterator=function(e,n){var D=this.$assembleRegExp(n);if(!D)return!1;var S=!0==n.backwards,i=!1!=n.skipCurrent,r=D.unicode,o=n.range,g=n.start;g||(g=o?o[S?"end":"start"]:e.selection.getRange()),g.start&&(g=g[i!=S?"end":"start"]);var s=o?o.start.row:0,a=o?o.end.row:e.getLength()-1;if(S)var l=function(e){var D=g.row;if(!u(D,g.column,e)){for(D--;D>=s;D--)if(u(D,Number.MAX_VALUE,e))return;if(!1!=n.wrap){for(D=a,s=g.row;D>=s;D--)if(u(D,Number.MAX_VALUE,e))return}}};else var l=function(e){var D=g.row;if(!u(D,g.column,e)){for(D+=1;D<=a;D++)if(u(D,0,e))return;if(!1!=n.wrap){for(D=s,a=g.row;D<=a;D++)if(u(D,0,e))return}}};if(n.$isMultiLine)var c=D.length,u=function(n,t,i){var r=S?n-c+1:n;if(!(r<0||r+c>e.getLength())){var o=e.getLine(r),g=o.search(D[0]);if((S||!(g<t))&&-1!==g){for(var s=1;s<c;s++)if(-1==(o=e.getLine(r+s)).search(D[s]))return;var a=o.match(D[c-1])[0].length;if((!S||!(a>t))&&i(r,g,r+c-1,a))return!0}}};else if(S)var u=function(n,S,i){var o,g=e.getLine(n),s=[],a=0;for(D.lastIndex=0;o=D.exec(g);){var l=o[0].length;if(a=o.index,!l){if(a>=g.length)break;D.lastIndex=a+=t.skipEmptyMatch(g,a,r)}if(o.index+l>S)break;s.push(o.index,l)}for(var c=s.length-1;c>=0;c-=2){var u=s[c-1],l=s[c];if(i(n,u,n,u+l))return!0}};else var u=function(n,S,i){var o,g,s=e.getLine(n);for(D.lastIndex=S;g=D.exec(s);){var a=g[0].length;if(i(n,o=g.index,n,o+a))return!0;if(!a&&(D.lastIndex=o+=t.skipEmptyMatch(s,o,r),o>=s.length))return!1}};return{forEach:l}},e}()}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("../lib/keys"),i=e("../lib/useragent"),r=S.KEY_MODS,o=function(){function e(e,n){this.$init(e,n,!1)}return e.prototype.$init=function(e,n,D){this.platform=n||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=D},e.prototype.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},e.prototype.removeCommand=function(e,n){var D=e&&("string"==typeof e?e:e.name);e=this.commands[D],n||delete this.commands[D];var t=this.commandKeyBinding;for(var S in t){var i=t[S];if(i==e)delete t[S];else if(Array.isArray(i)){var r=i.indexOf(e);-1!=r&&(i.splice(r,1),1==i.length&&(t[S]=i[0]))}}},e.prototype.bindKey=function(e,n,D){if("object"==typeof e&&e&&(void 0==D&&(D=e.position),e=e[this.platform]),e){if("function"==typeof n)return this.addCommand({exec:n,bindKey:e,name:n.name||e});e.split("|").forEach(function(e){var t="";if(-1!=e.indexOf(" ")){var S=e.split(/\s+/);e=S.pop(),S.forEach(function(e){var n=this.parseKeys(e),D=r[n.hashId]+n.key;t+=(t?" ":"")+D,this._addCommandToBinding(t,"chainKeys")},this),t+=" "}var i=this.parseKeys(e),o=r[i.hashId]+i.key;this._addCommandToBinding(t+o,n,D)},this)}},e.prototype._addCommandToBinding=function(e,n,D){var t,S=this.commandKeyBinding;if(n)if(!S[e]||this.$singleCommand)S[e]=n;else{Array.isArray(S[e])?-1!=(t=S[e].indexOf(n))&&S[e].splice(t,1):S[e]=[S[e]],"number"!=typeof D&&(D=g(n));var i=S[e];for(t=0;t<i.length&&!(g(i[t])>D);t++);i.splice(t,0,n)}else delete S[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(n){var D=e[n];if(D){if("string"==typeof D)return this.bindKey(D,n);"function"==typeof D&&(D={exec:D}),"object"==typeof D&&(D.name||(D.name=n),this.addCommand(D))}},this)},e.prototype.removeCommands=function(e){Object.keys(e).forEach(function(n){this.removeCommand(e[n])},this)},e.prototype.bindKeys=function(e){Object.keys(e).forEach(function(n){this.bindKey(n,e[n])},this)},e.prototype._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},e.prototype.parseKeys=function(e){var n=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),D=n.pop(),t=S[D];if(S.FUNCTION_KEYS[t])D=S.FUNCTION_KEYS[t].toLowerCase();else if(!n.length)return{key:D,hashId:-1};else if(1==n.length&&"shift"==n[0])return{key:D.toUpperCase(),hashId:-1};for(var i=0,r=n.length;r--;){var o=S.KEY_MODS[n[r]];if(null==o)return"u">typeof console&&console.error("invalid modifier "+n[r]+" in "+e),!1;i|=o}return{key:D,hashId:i}},e.prototype.findKeyCommand=function(e,n){var D=r[e]+n;return this.commandKeyBinding[D]},e.prototype.handleKeyboard=function(e,n,D,t){if(!(t<0)){var S=r[n]+D,i=this.commandKeyBinding[S];return(e.$keyChain&&(e.$keyChain+=" "+S,i=this.commandKeyBinding[e.$keyChain]||i),i&&("chainKeys"==i||"chainKeys"==i[i.length-1]))?(e.$keyChain=e.$keyChain||S,{command:"null"}):(e.$keyChain&&(n&&4!=n||1!=D.length?(-1==n||t>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-S.length-1)),{command:i})}},e.prototype.getStatusText=function(e,n){return n.$keyChain||""},e}();function g(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var s=function(e){function n(n,D){var t=e.call(this,n,D)||this;return t.$singleCommand=!0,t}return t(n,e),n}(o);s.call=function(e,n,D){o.prototype.$init.call(e,n,D,!0)},o.call=function(e,n,D){o.prototype.$init.call(e,n,D,!1)},n.HashHandler=s,n.MultiHashHandler=o}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,r=e("../lib/event_emitter").EventEmitter,o=function(e){function n(n,D){var t=e.call(this,D,n)||this;return t.byName=t.commands,t.setDefaultHandler("exec",function(e){return e.args?e.command.exec(e.editor,e.args,e.event,!1):e.command.exec(e.editor,{},e.event,!0)}),t}return t(n,e),n.prototype.exec=function(e,n,D){if(Array.isArray(e)){for(var t=e.length;t--;)if(this.exec(e[t],n,D))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!this.canExecute(e,n))return!1;var S={editor:n,command:e,args:D};return S.returnValue=this._emit("exec",S),this._signal("afterExec",S),!1!==S.returnValue},n.prototype.canExecute=function(e,n){return"string"==typeof e&&(e=this.commands[e]),!!e&&(!n||!n.$readOnly||!!e.readOnly)&&(!1==this.$checkCommandState||!e.isAvailable||!!e.isAvailable(n))},n.prototype.toggleRecording=function(e){if(!this.$inReplay)return(e&&e._emit("changeStatus"),this.recording)?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(e){this.macro.push([e.command,e.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},n.prototype.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(n){"string"==typeof n?this.exec(n,e):this.exec(n[0],e,n[1])},this)}finally{this.$inReplay=!1}}},n.prototype.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})},n}(i);S.implement(o.prototype,r),n.CommandManager=o}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,n,D){"use strict";var t=e("../lib/lang"),S=e("../config"),i=e("../range").Range;function r(e,n){return{win:e,mac:n}}n.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:r("Ctrl-,","Command-,"),exec:function(e){S.loadModule("ace/ext/settings_menu",function(n){n.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:r("Alt-E","F4"),exec:function(e){S.loadModule("ace/ext/error_marker",function(n){n.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:r("Alt-Shift-E","Shift-F4"),exec:function(e){S.loadModule("ace/ext/error_marker",function(n){n.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:r("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:r(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:r("Ctrl-L","Command-L"),exec:function(e,n){"number"!=typeof n||isNaN(n)||e.gotoLine(n),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:r("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:r("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:r("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:r("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:r(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:r(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:r("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:r("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:r("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:r("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:r("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:r("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:r("Ctrl-F","Command-F"),exec:function(e){S.loadModule("ace/ext/searchbox",function(n){n.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:r("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:r("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:r("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:r("Up","Up|Ctrl-P"),exec:function(e,n){e.navigateUp(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:r("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:r("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:r("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:r("Down","Down|Ctrl-N"),exec:function(e,n){e.navigateDown(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:r("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:r("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:r("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:r("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:r("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:r("Left","Left|Ctrl-B"),exec:function(e,n){e.navigateLeft(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:r("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:r("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:r("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:r("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:r("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:r("Right","Right|Ctrl-F"),exec:function(e,n){e.navigateRight(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:r(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:r("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:r(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:r("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:r("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:r("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:r("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:r("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:r("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:r("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:r(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var n=e.$copyWithEmptySelection&&e.selection.isEmpty()?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,n){e.$handlePaste(n)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:r("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:r("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:r("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:r("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:r("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:r("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:r("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:r("Ctrl-H","Command-Option-F"),exec:function(e){S.loadModule("ace/ext/searchbox",function(n){n.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:r("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:r("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:r("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:r("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:r("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:r("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:r("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:r("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:r("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:r("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:r("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:r("Ctrl-Shift-Backspace",null),exec:function(e){var n=e.selection.getRange();n.start.column=0,e.session.remove(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:r("Ctrl-Shift-Delete",null),exec:function(e){var n=e.selection.getRange();n.end.column=Number.MAX_VALUE,e.session.remove(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:r("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:r("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:r("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:r("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:r("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:r("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,n){e.insert(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,n){e.insert(t.stringRepeat(n.text||"",n.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:r(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:r("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:r("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:r("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:r(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:r("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var n=e.selection.getRange();n.start.column=n.end.column=0,n.end.row++,e.selection.setRange(n,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:r("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:r(null,null),exec:function(e){for(var n=e.selection.isBackwards(),D=n?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),S=n?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),r=e.session.doc.getLine(D.row).length,o=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,g=e.session.doc.getLine(D.row),s=D.row+1;s<=S.row+1;s++){var a=t.stringTrimLeft(t.stringTrimRight(e.session.doc.getLine(s)));0!==a.length&&(a=" "+a),g+=a}S.row+1<e.session.doc.getLength()-1&&(g+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new i(D.row,0,S.row+2,0),g),o>0?(e.selection.moveCursorTo(D.row,D.column),e.selection.selectTo(D.row,D.column+o)):(r=e.session.doc.getLine(D.row).length>r?r+1:r,e.selection.moveCursorTo(D.row,r))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:r(null,null),exec:function(e){var n=e.session.doc.getLength()-1,D=e.session.doc.getLine(n).length,t=e.selection.rangeList.ranges,S=[];t.length<1&&(t=[e.selection.getRange()]);for(var r=0;r<t.length;r++)r==t.length-1&&(t[r].end.row!==n||t[r].end.column!==D)&&S.push(new i(t[r].end.row,t[r].end.column,n,D)),0===r?(0!==t[r].start.row||0!==t[r].start.column)&&S.push(new i(0,0,t[r].start.row,t[r].start.column)):S.push(new i(t[r-1].end.row,t[r-1].end.column,t[r].start.row,t[r].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var r=0;r<S.length;r++)e.selection.addRange(S[r],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert("\n")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(e){e.selection.clearSelection();var n=e.getCursorPosition();e.selection.moveTo(n.row-1,Number.MAX_VALUE),e.insert("\n"),0===n.row&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:r("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:r(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var o=1;o<9;o++)n.commands.push({name:"foldToLevel"+o,description:"Fold To Level "+o,level:o,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./lib/dom");n.LineWidgets=function(){function e(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return e.prototype.getRowLength=function(e){var n;return(n=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+1+n:1+n},e.prototype.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(n){n&&n.rowCount&&!n.hidden&&(e+=n.rowCount)}),e},e.prototype.$onChangeEditor=function(e){this.attach(e.editor)},e.prototype.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},e.prototype.detach=function(e){var n=this.editor;if(n){this.editor=null,n.widgetManager=null,n.renderer.off("beforeRender",this.measureWidgets),n.renderer.off("afterRender",this.renderWidgets);var D=this.session.lineWidgets;D&&D.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},e.prototype.updateOnFold=function(e,n){var D=n.lineWidgets;if(D&&e.action){for(var t=e.data,S=t.start.row,i=t.end.row,r="add"==e.action,o=S+1;o<i;o++)D[o]&&(D[o].hidden=r);D[i]&&(r?D[S]?D[i].hidden=r:D[S]=D[i]:(D[S]==D[i]&&(D[S]=void 0),D[i].hidden=r))}},e.prototype.updateOnChange=function(e){var n=this.session.lineWidgets;if(n){var D=e.start.row,t=e.end.row-D;if(0===t);else if("remove"==e.action){var S=n.splice(D+1,t);!n[D]&&S[S.length-1]&&(n[D]=S.pop()),S.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var i=Array(t);n[D]&&null!=n[D].column&&e.start.column>n[D].column&&D++,i.unshift(D,0),n.splice.apply(n,i),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var n=!0;e.forEach(function(e,D){if(e)for(n=!1,e.row=D;e.$oldWidget;)e.$oldWidget.row=D,e=e.$oldWidget}),n&&(this.session.lineWidgets=null)}},e.prototype.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=Array(this.session.getLength()));var n=this.session.lineWidgets[e.row];return n&&(e.$oldWidget=n,n.el&&n.el.parentNode&&(n.el.parentNode.removeChild(n.el),n._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},e.prototype.addLineWidget=function(e){if(this.$registerLineWidget(e),e.session=this.session,!this.editor)return e;var n=this.editor.renderer;e.html&&!e.el&&(e.el=t.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=t.createElement("div"),e.el.textContent=e.text),e.el&&(t.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&t.addCssClass(e.el,e.className),e.el.style.position="absolute",e.el.style.zIndex="5",n.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex="3"),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight)),null==e.rowCount&&(e.rowCount=e.pixelHeight/n.layerConfig.lineHeight);var D=this.session.getFoldAt(e.row,0);if(e.$fold=D,D){var S=this.session.lineWidgets;e.row!=D.end.row||S[D.start.row]?e.hidden=!0:S[D.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,n),this.onWidgetChanged(e),e},e.prototype.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(e){}if(this.session.lineWidgets){var n=this.session.lineWidgets[e.row];if(n==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else for(;n;){if(n.$oldWidget==e){n.$oldWidget=e.$oldWidget;break}n=n.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},e.prototype.getWidgetsAtRow=function(e){for(var n=this.session.lineWidgets,D=n&&n[e],t=[];D;)t.push(D),D=D.$oldWidget;return t},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,n){var D=this.session._changedWidgets,t=n.layerConfig;if(D&&D.length){for(var S=1/0,i=0;i<D.length;i++){var r=D[i];if(r&&r.el&&r.session==this.session){if(!r._inDocument){if(this.session.lineWidgets[r.row]!=r)continue;r._inDocument=!0,n.container.appendChild(r.el)}r.h=r.el.offsetHeight,r.fixedWidth||(r.w=r.el.offsetWidth,r.screenWidth=Math.ceil(r.w/t.characterWidth));var o=r.h/t.lineHeight;r.coverLine&&(o-=this.session.getRowLineCount(r.row))<0&&(o=0),r.rowCount!=o&&(r.rowCount=o,r.row<S&&(S=r.row))}}S!=1/0&&(this.session._emit("changeFold",{data:{start:{row:S}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},e.prototype.renderWidgets=function(e,n){var D=n.layerConfig,t=this.session.lineWidgets;if(t){for(var S=Math.min(this.firstRow,D.firstRow),i=Math.max(this.lastRow,D.lastRow,t.length);S>0&&!t[S];)S--;this.firstRow=D.firstRow,this.lastRow=D.lastRow,n.$cursorLayer.config=D;for(var r=S;r<=i;r++){var o=t[r];if(o&&o.el){if(o.hidden){o.el.style.top=-100-(o.pixelHeight||0)+"px";continue}o._inDocument||(o._inDocument=!0,n.container.appendChild(o.el));var g=n.$cursorLayer.getPixelPosition({row:r,column:0},!0).top;o.coverLine||(g+=D.lineHeight*this.session.getRowLineCount(o.row)),o.el.style.top=g-D.offset+"px";var s=o.coverGutter?0:n.gutterWidth;o.fixedWidth||(s-=n.scrollLeft),o.el.style.left=s+"px",o.fullWidth&&o.screenWidth&&(o.el.style.minWidth=D.width+2*D.padding+"px"),o.fixedWidth?o.el.style.right=n.scrollBar.getWidth()+"px":o.el.style.right=""}}}},e}()}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(e,n,D){"use strict";var t=e("../lib/keys"),S=e("../mouse/default_gutter_handler").GutterTooltip;n.GutterKeyboardHandler=function(){function e(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new S(this.editor)}return e.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},e.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},e.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===t.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=t.enter)return;e.preventDefault();var n=this.editor.getCursorPosition().row;this.editor.isRowVisible(n)||this.editor.scrollToLine(n,!0,!0),setTimeout((function(){var e=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),n=this.$findNearestFoldWidget(e),D=this.$findNearestAnnotation(e);if(null!==n||null!==D){if(null===n&&null!==D){this.activeRowIndex=D,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==n&&null===D){this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(D-e)<Math.abs(n-e)){this.activeRowIndex=D,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}}).bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout((function(){this.editor._signal("gutterkeydown",new i(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===t.tab)return void e.preventDefault();if(e.keyCode===t.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===t.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===t.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===t.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===t.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===t.enter||e.keyCode===t.space){switch(e.preventDefault(),this.activeLane){case"fold":if("start"===this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]){var n=this.$rowIndexToRow(this.activeRowIndex);this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout((function(){this.$rowIndexToRow(this.activeRowIndex)!==n&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(n),this.$focusFoldWidget(this.activeRowIndex))}).bind(this),10);break}this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)];break;case"annotation":var D=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),S=this.annotationTooltip.getElement().style;S.left=D.right+"px",S.top=D.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex))}return}},e.prototype.$blurGutter=function(){if(null!==this.activeRowIndex)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex)}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},e.prototype.$isFoldWidgetVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),D="none"!==this.$getFoldWidget(e).style.display;return n&&D},e.prototype.$isAnnotationVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),D="none"!==this.$getAnnotation(e).style.display;return n&&D},e.prototype.$getFoldWidget=function(e){return this.lines.get(e).element.childNodes[1]},e.prototype.$getAnnotation=function(e){return this.lines.get(e).element.childNodes[2]},e.prototype.$findNearestFoldWidget=function(e){if(this.$isFoldWidgetVisible(e))return e;for(var n=0;e-n>0||e+n<this.lines.getLength()-1;){if(e-++n>=0&&this.$isFoldWidgetVisible(e-n))return e-n;if(e+n<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+n))return e+n}return null},e.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var n=0;e-n>0||e+n<this.lines.getLength()-1;){if(e-++n>=0&&this.$isAnnotationVisible(e-n))return e-n;if(e+n<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+n))return e+n}return null},e.prototype.$focusFoldWidget=function(e){if(null!=e){var n=this.$getFoldWidget(e);n.classList.add(this.editor.renderer.keyboardFocusClassName),n.focus()}},e.prototype.$focusAnnotation=function(e){if(null!=e){var n=this.$getAnnotation(e);n.classList.add(this.editor.renderer.keyboardFocusClassName),n.focus()}},e.prototype.$blurFoldWidget=function(e){var n=this.$getFoldWidget(e);n.classList.remove(this.editor.renderer.keyboardFocusClassName),n.blur()},e.prototype.$blurAnnotation=function(e){var n=this.$getAnnotation(e);n.classList.remove(this.editor.renderer.keyboardFocusClassName),n.blur()},e.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$switchLane=function(e){switch(e){case"annotation":if("annotation"===this.activeLane)break;var n=this.$findNearestAnnotation(this.activeRowIndex);if(null==n)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=n,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if("fold"===this.activeLane)break;var D=this.$findNearestFoldWidget(this.activeRowIndex);if(null==D)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=D,this.$focusFoldWidget(this.activeRowIndex)}},e.prototype.$rowIndexToRow=function(e){var n=this.lines.get(e);return n?n.row:null},e.prototype.$rowToRowIndex=function(e){for(var n=0;n<this.lines.getLength();n++)if(this.lines.get(n).row==e)return n;return null},e}();var i=function(){function e(e,n){this.gutterKeyboardHandler=n,this.domEvent=e}return e.prototype.getKey=function(){return t.keyCodeToString(this.domEvent.keyCode)},e.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},e.prototype.isInAnnotationLane=function(){return"annotation"===this.gutterKeyboardHandler.activeLane},e.prototype.isInFoldLane=function(){return"fold"===this.gutterKeyboardHandler.activeLane},e}();n.GutterKeyboardEvent=i}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/line_widgets","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys"],function(e,n,D){"use strict";var t=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/lang"),o=e("./lib/useragent"),g=e("./keyboard/textinput").TextInput,s=e("./mouse/mouse_handler").MouseHandler,a=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,c=e("./edit_session").EditSession,u=e("./search").Search,h=e("./range").Range,d=e("./lib/event_emitter").EventEmitter,p=e("./commands/command_manager").CommandManager,f=e("./commands/default_commands").commands,m=e("./config"),y=e("./token_iterator").TokenIterator,v=e("./line_widgets").LineWidgets,b=e("./keyboard/gutter_handler").GutterKeyboardHandler,w=e("./config").nls,M=e("./clipboard"),L=e("./lib/keys"),$=function(){function e(n,D,t){this.session,this.$toDestroy=[];var S=n.getContainerElement();this.container=S,this.renderer=n,this.id="editor"+ ++e.$uid,this.commands=new p(o.isMac?"mac":"win",f),"object"==typeof document&&(this.textInput=new g(n.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new s(this),new a(this)),this.keyBinding=new l(this),this.$search=new u().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=r.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(e,n){n._$emitInputEvent.schedule(31)}),this.setSession(D||t&&t.session||new c("")),m.resetOptions(this),t&&this.setOptions(t),m._signal("editor",this)}return e.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},e.prototype.startOperation=function(e){this.session.startOperation(e)},e.prototype.endOperation=function(e){this.session.endOperation(e)},e.prototype.onStartOperation=function(e){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,e||(this.previousCommand=null)},e.prototype.onEndOperation=function(e){if(this.curOp&&this.session){if(e&&!1===e.returnValue){this.curOp=null;return}if(this._signal("beforeEndOperation"),this.curOp){var n=this.curOp.command,D=n&&n.scrollIntoView;if(D){switch(D){case"center-animate":D="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var t=this.selection.getRange(),S=this.renderer.layerConfig;(t.start.row>=S.lastRow||t.end.row<=S.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==D&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}}},e.prototype.$historyTracker=function(e){if(this.$mergeUndoDeltas){var n=this.prevOp,D=this.$mergeableCommands,t=n.command&&e.command.name==n.command.name;if("insertstring"==e.command.name){var S=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),t=t&&this.mergeNextCommand&&(!/\s/.test(S)||/\s/.test(n.args)),this.mergeNextCommand=!0}else t=t&&-1!==D.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(t=!1),t?this.session.mergeUndoDeltas=!0:-1!==D.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},e.prototype.setKeyboardHandler=function(e,n){if(e&&"string"==typeof e&&"ace"!=e){this.$keybindingId=e;var D=this;m.loadModule(["keybinding",e],function(t){D.$keybindingId==e&&D.keyBinding.setKeyboardHandler(t&&t.handler),n&&n()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),n&&n()},e.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},e.prototype.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var n=this.session;if(n){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var D=this.session.getSelection();D.off("changeCursor",this.$onCursorChange),D.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:n}),this.curOp=null,n&&n._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&!e.destroyed&&e.bgTokenizer.scheduleStart()}},e.prototype.getSession=function(){return this.session},e.prototype.setValue=function(e,n){return this.session.doc.setValue(e),n?1==n?this.navigateFileEnd():-1==n&&this.navigateFileStart():this.selectAll(),e},e.prototype.getValue=function(){return this.session.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.resize=function(e){this.renderer.onResize(e)},e.prototype.setTheme=function(e,n){this.renderer.setTheme(e,n)},e.prototype.getTheme=function(){return this.renderer.getTheme()},e.prototype.setStyle=function(e){this.renderer.setStyle(e)},e.prototype.unsetStyle=function(e){this.renderer.unsetStyle(e)},e.prototype.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container).fontSize},e.prototype.setFontSize=function(e){this.setOption("fontSize",e)},e.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var n=e.session;if(n&&!n.destroyed){n.$bracketHighlight&&(n.$bracketHighlight.markerIds.forEach(function(e){n.removeMarker(e)}),n.$bracketHighlight=null);var D=e.getCursorPosition(),t=e.getKeyboardHandler(),S=t&&t.$getDirectionForHighlight&&t.$getDirectionForHighlight(e),i=n.getMatchingBracketRanges(D,S);if(!i){var r=new y(n,D.row,D.column).getCurrentToken();if(r&&/\b(?:tag-open|tag-name)/.test(r.type)){var o=n.getMatchingTags(D);o&&(i=[o.openTagName.isEmpty()?o.openTag:o.openTagName,o.closeTagName.isEmpty()?o.closeTag:o.closeTagName])}}if(!i&&n.$mode.getMatching&&(i=n.$mode.getMatching(e.session)),!i){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var g="ace_bracket";Array.isArray(i)?1==i.length&&(g="ace_error_bracket"):i=[i],2==i.length&&(0==h.comparePoints(i[0].end,i[1].start)?i=[h.fromPoints(i[0].start,i[1].end)]:0==h.comparePoints(i[0].start,i[1].end)&&(i=[h.fromPoints(i[1].start,i[0].end)])),n.$bracketHighlight={ranges:i,markerIds:i.map(function(e){return n.addMarker(e,g,"text")})},e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide()}},50)}},e.prototype.focus=function(){this.textInput.focus()},e.prototype.isFocused=function(){return this.textInput.isFocused()},e.prototype.blur=function(){this.textInput.blur()},e.prototype.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},e.prototype.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},e.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},e.prototype.onDocumentChange=function(e){var n=this.session.$useWrapMode,D=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,D,n),this._signal("change",e),this.$cursorChange()},e.prototype.onTokenizerUpdate=function(e){var n=e.data;this.renderer.updateLines(n.first,n.last)},e.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},e.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},e.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},e.prototype.$updateHighlightActiveLine=function(){var e,n=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),this.renderer.$maxLines&&1===this.session.getLength()&&!(this.renderer.$minLines>1)&&(e=!1)),n.$highlightLineMarker&&!e)n.removeMarker(n.$highlightLineMarker.id),n.$highlightLineMarker=null;else if(!n.$highlightLineMarker&&e){var D=new h(e.row,e.column,e.row,1/0);D.id=n.addMarker(D,"ace_active-line","screenLine"),n.$highlightLineMarker=D}else e&&(n.$highlightLineMarker.start.row=e.row,n.$highlightLineMarker.end.row=e.row,n.$highlightLineMarker.start.column=e.column,n._signal("changeBackMarker"))},e.prototype.onSelectionChange=function(e){var n=this.session;if(n.$selectionMarker&&n.removeMarker(n.$selectionMarker),n.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var D=this.selection.getRange(),t=this.getSelectionStyle();n.$selectionMarker=n.addMarker(D,"ace_selection",t)}var S=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(S),this._signal("changeSelection")},e.prototype.$getSelectionHighLightRegexp=function(){var e=this.session,n=this.getSelectionRange();if(!(n.isEmpty()||n.isMultiLine())){var D=n.start.column,t=n.end.column,S=e.getLine(n.start.row),i=S.substring(D,t);if(!(i.length>5e3)&&/[\w\d]/.test(i)){var r=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:i}),o=S.substring(D-1,t+1);if(r.test(o))return r}}},e.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},e.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},e.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},e.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},e.prototype.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},e.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},e.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},e.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},e.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},e.prototype.getCopyText=function(){var e=this.getSelectedText(),n=this.session.doc.getNewLineCharacter(),D=!1;if(!e&&this.$copyWithEmptySelection){D=!0;for(var t=this.selection.getAllRanges(),S=0;S<t.length;S++){var i=t[S];S&&t[S-1].start.row==i.start.row||(e+=this.session.getLine(i.start.row)+n)}}var r={text:e};return this._signal("copy",r),M.lineMode=!!D&&r.text,r.text},e.prototype.onCopy=function(){this.commands.exec("copy",this)},e.prototype.onCut=function(){this.commands.exec("cut",this)},e.prototype.onPaste=function(e,n){var D={text:e,event:n};this.commands.exec("paste",this,D)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var n=e.text,D=n===M.lineMode,t=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)D?t.insert({row:this.selection.lead.row,column:0},n):this.insert(n);else if(D)this.selection.rangeList.ranges.forEach(function(e){t.insert({row:e.start.row,column:0},n)});else{var S=n.split(/\r\n|\r|\n/),i=this.selection.rangeList.ranges,r=2==S.length&&(!S[0]||!S[1]);if(S.length!=i.length||r)return this.commands.exec("insertstring",this,n);for(var o=i.length;o--;){var g=i[o];g.isEmpty()||t.remove(g),t.insert(g.start,S[o])}}},e.prototype.execCommand=function(e,n){return this.commands.exec(e,this,n)},e.prototype.insert=function(e,n){var D=this.session,t=D.getMode(),S=this.getCursorPosition();if(this.getBehavioursEnabled()&&!n){var i=t.transformAction(D.getState(S.row),"insertion",this,D,e);i&&(e===i.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=i.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var r=h.fromPoints(S,S);r.end.column+=e.length,this.session.remove(r)}}else{var r=this.getSelectionRange();S=this.session.remove(r),this.clearSelection()}if("\n"==e||"\r\n"==e){var o=D.getLine(S.row);if(S.column>o.search(/\S|$/)){var g=o.substr(S.column).search(/\S|$/);D.doc.removeInLine(S.row,S.column,S.column+g)}}this.clearSelection();var s=S.column,a=D.getState(S.row),o=D.getLine(S.row),l=t.checkOutdent(a,o,e);if(D.insert(S,e),i&&i.selection&&(2==i.selection.length?this.selection.setSelectionRange(new h(S.row,s+i.selection[0],S.row,s+i.selection[1])):this.selection.setSelectionRange(new h(S.row+i.selection[0],i.selection[1],S.row+i.selection[2],i.selection[3]))),this.$enableAutoIndent){if(D.getDocument().isNewLine(e)){var c=t.getNextLineIndent(a,o.slice(0,S.column),D.getTabString());D.insert({row:S.row+1,column:0},c)}l&&t.autoOutdent(a,D,S.row)}},e.prototype.autoIndent=function(){for(var e=this.session,n=e.getMode(),D=this.selection.isEmpty()?[new h(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),t="",S="",i="",r=e.getTabString(),o=0;o<D.length;o++)for(var g=D[o].start.row,s=D[o].end.row,a=g;a<=s;a++){a>0&&(t=e.getState(a-1),S=e.getLine(a-1),i=n.getNextLineIndent(t,S,r));var l=e.getLine(a),c=n.$getIndent(l);if(i!==c){if(c.length>0){var u=new h(a,0,a,c.length);e.remove(u)}i.length>0&&e.insert({row:a,column:0},i)}n.autoOutdent(t,e,a)}},e.prototype.onTextInput=function(e,n){if(!n)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var D=this.applyComposition.bind(this,e,n);this.selection.rangeCount?this.forEachSelection(D):D(),this.endOperation()},e.prototype.applyComposition=function(e,n){if(n.extendLeft||n.extendRight){var D=this.selection.getRange();D.start.column-=n.extendLeft,D.end.column+=n.extendRight,D.start.column<0&&(D.start.row--,D.start.column+=this.session.getLine(D.start.row).length+1),this.selection.setRange(D),e||D.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),n.restoreStart||n.restoreEnd){var D=this.selection.getRange();D.start.column-=n.restoreStart,D.end.column-=n.restoreEnd,this.selection.setRange(D)}},e.prototype.onCommandKey=function(e,n,D){return this.keyBinding.onCommandKey(e,n,D)},e.prototype.setOverwrite=function(e){this.session.setOverwrite(e)},e.prototype.getOverwrite=function(){return this.session.getOverwrite()},e.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},e.prototype.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},e.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},e.prototype.setDragDelay=function(e){this.setOption("dragDelay",e)},e.prototype.getDragDelay=function(){return this.getOption("dragDelay")},e.prototype.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},e.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},e.prototype.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},e.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},e.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},e.prototype.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},e.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},e.prototype.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},e.prototype.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},e.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},e.prototype.setHighlightIndentGuides=function(e){this.renderer.setHighlightIndentGuides(e)},e.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},e.prototype.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},e.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},e.prototype.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},e.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},e.prototype.setReadOnly=function(e){this.setOption("readOnly",e)},e.prototype.getReadOnly=function(){return this.getOption("readOnly")},e.prototype.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},e.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},e.prototype.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},e.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},e.prototype.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},e.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var n=this.getSelectionRange();if(this.getBehavioursEnabled()){var D=this.session,t=D.getState(n.start.row),S=D.getMode().transformAction(t,"deletion",this,D,n);if(0===n.end.column){var i=D.getTextRange(n);if("\n"==i[i.length-1]){var r=D.getLine(n.end.row);/^\s+$/.test(r)&&(n.end.column=r.length)}}S&&(n=S)}this.session.remove(n),this.clearSelection()},e.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},e.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},e.prototype.setGhostText=function(e,n){this.session.widgetManager||(this.session.widgetManager=new v(this.session),this.session.widgetManager.attach(this)),this.renderer.setGhostText(e,n)},e.prototype.removeGhostText=function(){this.session.widgetManager&&this.renderer.removeGhostText()},e.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var e,n,D=this.getCursorPosition(),t=D.column;if(0!==t){var S=this.session.getLine(D.row);t<S.length?(e=S.charAt(t)+S.charAt(t-1),n=new h(D.row,t-1,D.row,t+1)):(e=S.charAt(t-1)+S.charAt(t-2),n=new h(D.row,t-2,D.row,t)),this.session.replace(n,e),this.session.selection.moveToPosition(n.end)}}},e.prototype.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),D=this.session.getTextRange(n);this.session.replace(n,D.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),D=this.session.getTextRange(n);this.session.replace(n,D.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,n=this.getSelectionRange();if(n.start.row<n.end.row){var D=this.$getSelectedRows();e.indentRows(D.first,D.last," ");return}if(n.start.column<n.end.column){var t=e.getTextRange(n);if(!/^\s+$/.test(t)){var D=this.$getSelectedRows();e.indentRows(D.first,D.last," ");return}}var S=e.getLine(n.start.row),i=n.start,o=e.getTabSize(),g=e.documentToScreenColumn(i.row,i.column);if(this.session.getUseSoftTabs())var s=o-g%o,a=r.stringRepeat(" ",s);else{for(var s=g%o;" "==S[n.start.column-1]&&s;)n.start.column--,s--;this.selection.setSelectionRange(n),a=" "}return this.insert(a)},e.prototype.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},e.prototype.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},e.prototype.sortLines=function(){for(var e=this.$getSelectedRows(),n=this.session,D=[],t=e.first;t<=e.last;t++)D.push(n.getLine(t));D.sort(function(e,n){return e.toLowerCase()<n.toLowerCase()?-1:+(e.toLowerCase()>n.toLowerCase())});for(var S=new h(0,0,0,0),t=e.first;t<=e.last;t++){var i=n.getLine(t);S.start.row=t,S.end.row=t,S.end.column=i.length,n.replace(S,D[t-e.first])}},e.prototype.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),n=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,n.first,n.last)},e.prototype.toggleBlockComment=function(){var e=this.getCursorPosition(),n=this.session.getState(e.row),D=this.getSelectionRange();this.session.getMode().toggleBlockComment(n,this.session,D,e)},e.prototype.getNumberAt=function(e,n){var D=/[\-]?[0-9]+(?:\.[0-9]+)?/g;D.lastIndex=0;for(var t=this.session.getLine(e);D.lastIndex<n;){var S=D.exec(t);if(S.index<=n&&S.index+S[0].length>=n)return{value:S[0],start:S.index,end:S.index+S[0].length}}return null},e.prototype.modifyNumber=function(e){var n=this.selection.getCursor().row,D=this.selection.getCursor().column,t=new h(n,D-1,n,D),S=this.session.getTextRange(t);if(!isNaN(parseFloat(S))&&isFinite(S)){var i=this.getNumberAt(n,D);if(i){var r=i.value.indexOf(".")>=0?i.start+i.value.indexOf(".")+1:i.end,o=i.start+i.value.length-r,g=parseFloat(i.value);g*=Math.pow(10,o),r!==i.end&&D<r?e*=Math.pow(10,i.end-D-1):e*=Math.pow(10,i.end-D),g+=e;var s=(g/=Math.pow(10,o)).toFixed(o),a=new h(n,i.start,n,i.end);this.session.replace(a,s),this.moveCursorTo(n,Math.max(i.start+1,D+s.length-i.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,n=this.selection.getCursor().row,D=this.selection.getCursor().column;this.selection.selectWord();var t=this.getSelectedText(),S=this.selection.getWordRange().start.column,i=t.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=D-S-1;o<0&&(o=0);var g=0,s=0,a=this;t.match(/[A-Za-z0-9_]+/)&&i.forEach(function(e,D){s=g+e.length,o>=g&&o<=s&&(t=e,a.selection.clearSelection(),a.moveCursorTo(n,g+S),a.selection.selectTo(n,s+S)),g=s});for(var l=this.$toggleWordPairs,c=0;c<l.length;c++)for(var u=l[c],h=0;h<=1;h++){var d=+!h,p=t.match(RegExp("^\\s?_?("+r.escapeRegExp(u[h])+")\\s?$","i"));p&&t.match(RegExp("([_]|^|\\s)("+r.escapeRegExp(p[1])+")($|\\s)","g"))&&(e=t.replace(RegExp(r.escapeRegExp(u[h]),"i"),function(e){var n=u[d];return e.toUpperCase()==e?n=n.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(n=n.substr(0,0)+u[d].charAt(0).toUpperCase()+n.substr(1)),n}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,n){var D=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),S=n;S<0&&(S=0);var i,r,o,g=0,s=0;try{for(var a=t(D),l=a.next();!l.done;l=a.next()){var c=l.value;if(s=g+c.length,S>=g&&S<=s&&c.match(/((?:https?|ftp):\/\/[\S]+)/)){o=c.replace(/[\s:.,'";}\]]+$/,"");break}g=s}}catch(e){i={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},e.prototype.openLink=function(){var e=this.selection.getCursor(),n=this.findLinkAt(e.row,e.column);return n&&window.open(n,"_blank"),null!=n},e.prototype.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},e.prototype.duplicateSelection=function(){var e=this.selection,n=this.session,D=e.getRange(),t=e.isBackwards();if(D.isEmpty()){var S=D.start.row;n.duplicateLines(S,S)}else{var i=t?D.start:D.end,r=n.insert(i,n.getTextRange(D));D.start=i,D.end=r,e.setSelectionRange(D,t)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,n,D){return this.session.moveText(e,n,D)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,n){var D,t,S=this.selection;if(!S.inMultiSelectMode||this.inVirtualSelectionMode){var i=S.toOrientedRange();D=this.$getSelectedRows(i),t=this.session.$moveLines(D.first,D.last,n?0:e),n&&-1==e&&(t=0),i.moveBy(t,0),S.fromOrientedRange(i)}else{var r=S.rangeList.ranges;S.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var o=0,g=0,s=r.length,a=0;a<s;a++){var l=a;r[a].moveBy(o,0);for(var c=(D=this.$getSelectedRows(r[a])).first,u=D.last;++a<s;){g&&r[a].moveBy(g,0);var h=this.$getSelectedRows(r[a]);if(n&&h.first!=u||!n&&h.first>u+1)break;u=h.last}for(a--,o=this.session.$moveLines(c,u,n?0:e),n&&-1==e&&(l=a+1);l<=a;)r[l].moveBy(o,0),l++;n||(o=0),g+=o}S.fromOrientedRange(S.ranges[0]),S.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},e.prototype.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},e.prototype.onCompositionStart=function(e){this.renderer.showComposition(e)},e.prototype.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},e.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},e.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},e.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},e.prototype.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},e.prototype.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},e.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},e.prototype.$moveByPage=function(e,n){var D=this.renderer,t=this.renderer.layerConfig,S=e*Math.floor(t.height/t.lineHeight);!0===n?this.selection.$moveSelection(function(){this.moveCursorBy(S,0)}):!1===n&&(this.selection.moveCursorBy(S,0),this.selection.clearSelection());var i=D.scrollTop;D.scrollBy(0,S*t.lineHeight),null!=n&&D.scrollCursorIntoView(null,.5),D.animateScrolling(i)},e.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},e.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},e.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},e.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},e.prototype.scrollPageDown=function(){this.$moveByPage(1)},e.prototype.scrollPageUp=function(){this.$moveByPage(-1)},e.prototype.scrollToRow=function(e){this.renderer.scrollToRow(e)},e.prototype.scrollToLine=function(e,n,D,t){this.renderer.scrollToLine(e,n,D,t)},e.prototype.centerSelection=function(){var e=this.getSelectionRange(),n={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(n,.5)},e.prototype.getCursorPosition=function(){return this.selection.getCursor()},e.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},e.prototype.getSelectionRange=function(){return this.selection.getRange()},e.prototype.selectAll=function(){this.selection.selectAll()},e.prototype.clearSelection=function(){this.selection.clearSelection()},e.prototype.moveCursorTo=function(e,n){this.selection.moveCursorTo(e,n)},e.prototype.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},e.prototype.jumpToMatching=function(e,n){var D,t,S,i,r=this.getCursorPosition(),o=new y(this.session,r.row,r.column),g=o.getCurrentToken(),s=0;g&&-1!==g.type.indexOf("tag-name")&&(g=o.stepBackward());var a=g||o.stepForward();if(a){var l=!1,c={},u=r.column-a.start,d={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(a.value.match(/[{}()\[\]]/g)){for(;u<a.value.length&&!l;u++)if(d[a.value[u]])switch(isNaN(c[t=d[a.value[u]]+"."+a.type.replace("rparen","lparen")])&&(c[t]=0),a.value[u]){case"(":case"[":case"{":c[t]++;break;case")":case"]":case"}":c[t]--,-1===c[t]&&(D="bracket",l=!0)}}else -1!==a.type.indexOf("tag-name")&&(isNaN(c[a.value])&&(c[a.value]=0),"<"===g.value&&s>1?c[a.value]++:"</"===g.value&&c[a.value]--,-1===c[a.value]&&(D="tag",l=!0));l||(g=a,s++,a=o.stepForward(),u=0)}while(a&&!l);if(D){if("bracket"===D)!(S=this.session.getBracketRange(r))&&(i=(S=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn()+u-1,o.getCurrentTokenRow(),o.getCurrentTokenColumn()+u-1)).start,(n||i.row===r.row&&2>Math.abs(i.column-r.column))&&(S=this.session.getBracketRange(i)));else if("tag"===D){if(!a||-1===a.type.indexOf("tag-name"))return;if(0===(S=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2,o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2)).compare(r.row,r.column)){var p=this.session.getMatchingTags(r);p&&(p.openTag.contains(r.row,r.column)?i=(S=p.closeTag).start:(S=p.openTag,i=p.closeTag.start.row===r.row&&p.closeTag.start.column===r.column?S.end:S.start))}i=i||S.start}i=S&&S.cursor||i,i&&(e?S&&n?this.selection.setRange(S):S&&S.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(i.row,i.column):this.selection.moveTo(i.row,i.column))}}},e.prototype.gotoLine=function(e,n,D){this.selection.clearSelection(),this.session.unfold({row:e-1,column:n||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,n||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,D)},e.prototype.navigateTo=function(e,n){this.selection.moveTo(e,n)},e.prototype.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var n=this.selection.anchor.getPosition();return this.moveCursorToPosition(n)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},e.prototype.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var n=this.selection.anchor.getPosition();return this.moveCursorToPosition(n)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},e.prototype.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var n=this.getSelectionRange().start;this.moveCursorToPosition(n)}this.clearSelection()},e.prototype.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var n=this.getSelectionRange().end;this.moveCursorToPosition(n)}this.clearSelection()},e.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},e.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},e.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},e.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},e.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},e.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},e.prototype.replace=function(e,n){n&&this.$search.set(n);var D=this.$search.find(this.session),t=0;return D&&(this.$tryReplace(D,e)&&(t=1),this.selection.setSelectionRange(D),this.renderer.scrollSelectionIntoView(D.start,D.end)),t},e.prototype.replaceAll=function(e,n){n&&this.$search.set(n);var D=this.$search.findAll(this.session),t=0;if(!D.length)return t;var S=this.getSelectionRange();this.selection.moveTo(0,0);for(var i=D.length-1;i>=0;--i)this.$tryReplace(D[i],e)&&t++;return this.selection.setSelectionRange(S),t},e.prototype.$tryReplace=function(e,n){var D=this.session.getTextRange(e);return null!==(n=this.$search.replace(D,n))?(e.end=this.session.replace(e,n),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,n,D){n||(n={}),"string"==typeof e||e instanceof RegExp?n.needle=e:"object"==typeof e&&S.mixin(n,e);var t=this.selection.getRange();null==n.needle&&((e=this.session.getTextRange(t)||this.$search.$options.needle)||(t=this.session.getWordRange(t.start.row,t.start.column),e=this.session.getTextRange(t)),this.$search.set({needle:e})),this.$search.set(n),n.start||this.$search.set({start:t});var i=this.$search.find(this.session);return n.preventScroll?i:i?(this.revealRange(i,D),i):void(n.backwards?t.start=t.end:t.end=t.start,this.selection.setRange(t))},e.prototype.findNext=function(e,n){this.find({skipCurrent:!0,backwards:!1},e,n)},e.prototype.findPrevious=function(e,n){this.find(e,{skipCurrent:!0,backwards:!0},n)},e.prototype.revealRange=function(e,n){this.session.unfold(e),this.selection.setSelectionRange(e);var D=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==n&&this.renderer.animateScrolling(D)},e.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(e){e.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},e.prototype.setAutoScrollEditorIntoView=function(e){if(e){var n,D=this,t=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var S=this.$scrollAnchor;S.style.cssText="position:absolute",this.container.insertBefore(S,this.container.firstChild);var i=this.on("changeSelection",function(){t=!0}),r=this.renderer.on("beforeRender",function(){t&&(n=D.renderer.container.getBoundingClientRect())}),o=this.renderer.on("afterRender",function(){if(t&&n&&(D.isFocused()||D.searchBox&&D.searchBox.isFocused())){var e=D.renderer,i=e.$cursorLayer.$pixelPos,r=e.layerConfig,o=i.top-r.offset;null!=(t=i.top>=0&&o+n.top<0||(!(i.top<r.height)||!(i.top+n.top+r.lineHeight>window.innerHeight))&&null)&&(S.style.top=o+"px",S.style.left=i.left+"px",S.style.height=r.lineHeight+"px",S.scrollIntoView(t)),t=n=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",i),this.renderer.off("afterRender",o),this.renderer.off("beforeRender",r))}}},e.prototype.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",n=this.renderer.$cursorLayer;n&&(n.setSmoothBlinking(/smooth/.test(e)),n.isBlinking=!this.$readOnly&&"wide"!=e,i.setCssClass(n.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,n,D){var t=this;m.loadModule("ace/ext/prompt",function(S){S.prompt(t,e,n,D)})},e}();$.$uid=0,$.prototype.curOp=null,$.prototype.prevOp={},$.prototype.$mergeableCommands=["backspace","del","insertstring"],$.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],S.implement($.prototype,d),m.defineOptions($.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?_.attach(this):_.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?_.attach(this):_.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var e=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),i.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(e||this.renderer.placeholderNode)!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"");else{this.renderer.on("afterRender",this.$updatePlaceholder),i.addCssClass(this.container,"ace_hasPlaceholder");var n=i.createElement("div");n.className="ace_placeholder",n.textContent=this.$placeholder||"",this.renderer.placeholderNode=n,this.renderer.content.appendChild(this.renderer.placeholderNode)}}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(e){var n,D={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(e){e.blur(),e.renderer.scroller.focus()},readOnly:!0},t=function(e){if(e.target==this.renderer.scroller&&e.keyCode===L.enter){e.preventDefault();var n=this.getCursorPosition().row;this.isRowVisible(n)||this.scrollToLine(n,!0,!0),this.focus()}};e?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(3*!!o.isWin),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",w("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",w("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",t.bind(this)),this.commands.addCommand(D),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",w("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",w("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),n||(n=new b(this)),n.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",t.bind(this)),this.commands.removeCommand(D),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),n&&n.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(e){this.$textInputAriaLabel=e},initialValue:""},enableMobileMenu:{set:function(e){this.$enableMobileMenu=e},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var _={getText:function(e,n){return(Math.abs(e.selection.lead.row-n)||n+1+(n<9?"\xb7":""))+""},getWidth:function(e,n,D){return Math.max(n.toString().length,(D.lastRow+1).toString().length,2)*D.characterWidth},update:function(e,n){n.renderer.$loop.schedule(n.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};n.Editor=$}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom");n.Lines=function(){function e(e,n){this.element=e,this.canvasHeight=n||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return e.prototype.moveContainer=function(e){t.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},e.prototype.pageChanged=function(e,n){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight)},e.prototype.computeLineTop=function(e,n,D){var t=Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight);return D.documentToScreenRow(e,0)*n.lineHeight-t*this.canvasHeight},e.prototype.computeLineHeight=function(e,n,D){return n.lineHeight*D.getRowLineCount(e)},e.prototype.getLength=function(){return this.cells.length},e.prototype.get=function(e){return this.cells[e]},e.prototype.shift=function(){this.$cacheCell(this.cells.shift())},e.prototype.pop=function(){this.$cacheCell(this.cells.pop())},e.prototype.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var n=t.createFragment(this.element),D=0;D<e.length;D++)n.appendChild(e[D].element);this.element.appendChild(n)}else this.cells.push(e),this.element.appendChild(e.element)},e.prototype.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var n=t.createFragment(this.element),D=0;D<e.length;D++)n.appendChild(e[D].element);this.element.firstChild?this.element.insertBefore(n,this.element.firstChild):this.element.appendChild(n)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},e.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},e.prototype.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},e.prototype.createCell=function(e,n,D,S){var i=this.cellCache.pop();if(!i){var r=t.createElement("div");S&&S(r),this.element.appendChild(r),i={element:r,text:"",row:e}}return i.row=e,i},e}()}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/oop"),i=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,o=e("./lines").Lines,g=e("../config").nls,s=function(){function e(e){this.element=t.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new o(this.element),this.$lines.$offsetCoefficient=1}return e.prototype.setSession=function(e){this.session&&this.session.off("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},e.prototype.addGutterDecoration=function(e,n){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,n)},e.prototype.removeGutterDecoration=function(e,n){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,n)},e.prototype.setAnnotations=function(e){this.$annotations=[];for(var n=0;n<e.length;n++){var D=e[n],t=D.row,S=this.$annotations[t];S||(S=this.$annotations[t]={text:[],type:[],displayText:[]});var r=D.text,o=D.text,g=D.type;r=r?i.escapeHTML(r):D.html||"",o=o||D.html||"",-1===S.text.indexOf(r)&&(S.text.push(r),S.type.push(g),S.displayText.push(o));var s=D.className;s?S.className=s:"error"===g?S.className=" ace_error":"security"!==g||/\bace_error\b/.test(S.className)?"warning"!==g||/\bace_(error|security)\b/.test(S.className)?"info"!==g||S.className?"hint"!==g||S.className||(S.className=" ace_hint"):S.className=" ace_info":S.className=" ace_warning":S.className=" ace_security"}},e.prototype.$updateAnnotations=function(e){if(this.$annotations.length){var n=e.start.row,D=e.end.row-n;if(0===D);else if("remove"==e.action)this.$annotations.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.$annotations.splice.apply(this.$annotations,t)}}},e.prototype.update=function(e){this.config=e;var n=this.session,D=e.firstRow,t=Math.min(e.lastRow+e.gutterOffset,n.getLength()-1);this.oldLastRow=t,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var S=n.getNextFoldLine(D),i=S?S.start.row:1/0,r=null,o=-1,g=D;;){if(g>i&&(g=S.end.row+1,i=(S=n.getNextFoldLine(g,S))?S.start.row:1/0),g>t){for(;this.$lines.getLength()>o+1;)this.$lines.pop();break}(r=this.$lines.get(++o))?r.row=g:(r=this.$lines.createCell(g,e,this.session,a),this.$lines.push(r)),this.$renderCell(r,e,S,g),g++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var n=this.session,D=n.gutterRenderer||this.$renderer,t=n.$firstLineNumber,S=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||n.$useWrapMode)&&(S=n.getLength()+t-1);var i=D?D.getWidth(n,S,e):S.toString().length*e.characterWidth,r=this.$padding||this.$computePadding();(i+=r.left+r.right)===this.gutterWidth||isNaN(i)||(this.gutterWidth=i,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",i))},e.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},e.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var n=this.$lines.cells;this.$cursorCell=null;for(var D=0;D<n.length;D++){var t=n[D];if(t.row>=this.$cursorRow){if(t.row>this.$cursorRow){var S=this.session.getFoldLine(this.$cursorRow);if(D>0&&S&&S.start.row==n[D-1].row)t=n[D-1];else break}t.element.className="ace_gutter-active-line "+t.element.className,this.$cursorCell=t;break}}}}},e.prototype.scrollLines=function(e){var n=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(n,e))return this.update(e);this.$lines.moveContainer(e);var D=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),t=this.oldLastRow;if(this.oldLastRow=D,!n||t<e.firstRow||D<n.firstRow)return this.update(e);if(n.firstRow<e.firstRow)for(var S=this.session.getFoldedRowCount(n.firstRow,e.firstRow-1);S>0;S--)this.$lines.shift();if(t>D)for(var S=this.session.getFoldedRowCount(D+1,t);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,n.firstRow-1)),D>t&&this.$lines.push(this.$renderLines(e,t+1,D)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,n,D){for(var t=[],S=n,i=this.session.getNextFoldLine(S),r=i?i.start.row:1/0;S>r&&(S=i.end.row+1,r=(i=this.session.getNextFoldLine(S,i))?i.start.row:1/0),!(S>D);){var o=this.$lines.createCell(S,e,this.session,a);this.$renderCell(o,e,i,S),t.push(o),S++}return t},e.prototype.$renderCell=function(e,n,D,S){var i,r=e.element,o=this.session,s=r.childNodes[0],a=r.childNodes[1],l=r.childNodes[2],c=l.firstChild,u=o.$firstLineNumber,h=o.$breakpoints,d=o.$decorations,p=o.gutterRenderer||this.$renderer,f=this.$showFoldWidgets&&o.foldWidgets,m=D?D.start.row:Number.MAX_VALUE,y=n.lineHeight+"px",v=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",b=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",w=(p?p.getText(o,S):S+u).toString();if(this.$highlightGutterLine&&(S==this.$cursorRow||D&&S<this.$cursorRow&&S>=m&&this.$cursorRow<=D.end.row)&&(v+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),h[S]&&(v+=h[S]),d[S]&&(v+=d[S]),this.$annotations[S]&&S!==m&&(v+=this.$annotations[S].className),f){var M=f[S];null==M&&(M=f[S]=o.getFoldWidget(S))}if(M){var L="ace_fold-widget ace_"+M,$="start"==M&&S==m&&S<D.end.row;if($){L+=" ace_closed";for(var _="",x=!1,C=S+1;C<=D.end.row;C++)if(this.$annotations[C]){if(" ace_error"===this.$annotations[C].className){x=!0,_=" ace_error_fold";break}" ace_security"===this.$annotations[C].className?(x=!0,_=" ace_security_fold"):" ace_warning"===this.$annotations[C].className&&" ace_security_fold"!==_&&(x=!0,_=" ace_warning_fold")}v+=_}else L+=" ace_open";a.className!=L&&(a.className=L),t.setStyle(a.style,"height",y),t.setStyle(a.style,"display","inline-block"),a.setAttribute("role","button"),a.setAttribute("tabindex","-1");var E=o.getFoldWidgetRange(S);E?a.setAttribute("aria-label",g("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[E.start.row+1,E.end.row+1])):D?a.setAttribute("aria-label",g("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[D.start.row+1,D.end.row+1])):a.setAttribute("aria-label",g("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[S+1])),$?(a.setAttribute("aria-expanded","false"),a.setAttribute("title",g("gutter.code-folding.closed.title","Unfold code"))):(a.setAttribute("aria-expanded","true"),a.setAttribute("title",g("gutter.code-folding.open.title","Fold code")))}else a&&(t.setStyle(a.style,"display","none"),a.setAttribute("tabindex","0"),a.removeAttribute("role"),a.removeAttribute("aria-label"));if(x&&this.$showFoldedAnnotations){switch(l.className="ace_gutter_annotation",c.className=b,c.className+=_,t.setStyle(c.style,"height",y),t.setStyle(l.style,"display","block"),t.setStyle(l.style,"height",y),_){case" ace_error_fold":i=g("gutter.annotation.aria-label.error","Error, read annotations row $0",[w]);break;case" ace_security_fold":i=g("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[w]);break;case" ace_warning_fold":i=g("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[w])}l.setAttribute("aria-label",i),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else if(this.$annotations[S]){switch(l.className="ace_gutter_annotation",c.className=b,this.$useSvgGutterIcons?c.className+=this.$annotations[S].className:r.classList.add(this.$annotations[S].className.replace(" ","")),t.setStyle(c.style,"height",y),t.setStyle(l.style,"display","block"),t.setStyle(l.style,"height",y),this.$annotations[S].className){case" ace_error":i=g("gutter.annotation.aria-label.error","Error, read annotations row $0",[w]);break;case" ace_security":i=g("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[w]);break;case" ace_warning":i=g("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[w]);break;case" ace_info":i=g("gutter.annotation.aria-label.info","Info, read annotations row $0",[w]);break;case" ace_hint":i=g("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[w])}l.setAttribute("aria-label",i),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else t.setStyle(l.style,"display","none"),l.removeAttribute("aria-label"),l.removeAttribute("role"),l.setAttribute("tabindex","0");return w!==s.data&&(s.data=w),r.className!=v&&(r.className=v),t.setStyle(e.element.style,"height",this.$lines.computeLineHeight(S,n,o)+"px"),t.setStyle(e.element.style,"top",this.$lines.computeLineTop(S,n,o)+"px"),e.text=w,"none"===l.style.display&&"none"===a.style.display?e.element.setAttribute("aria-hidden",!0):e.element.setAttribute("aria-hidden",!1),e},e.prototype.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},e.prototype.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},e.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},e.prototype.setShowFoldWidgets=function(e){e?t.addCssClass(this.element,"ace_folding-enabled"):t.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},e.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},e.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=t.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},e.prototype.getRegion=function(e){var n=this.$padding||this.$computePadding(),D=this.element.getBoundingClientRect();return e.x<n.left+D.left?"markers":this.$showFoldWidgets&&e.x>D.right-n.right?"foldWidgets":void 0},e}();function a(e){var n=document.createTextNode("");e.appendChild(n);var D=t.createElement("span");e.appendChild(D);var S=t.createElement("span");e.appendChild(S);var i=t.createElement("span");return S.appendChild(i),e}s.prototype.$fixedWidth=!1,s.prototype.$highlightGutterLine=!0,s.prototype.$renderer="",s.prototype.$showLineNumbers=!0,s.prototype.$showFoldWidgets=!0,S.implement(s.prototype,r),n.Gutter=s}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../range").Range,S=e("../lib/dom"),i=function(){function e(e){this.element=S.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setMarkers=function(e){this.markers=e},e.prototype.elt=function(e,n){var D=-1!=this.i&&this.element.childNodes[this.i];D?this.i++:(D=document.createElement("div"),this.element.appendChild(D),this.i=-1),D.style.cssText=n,D.className=e},e.prototype.update=function(e){if(e){for(var n in this.config=e,this.i=0,this.markers){var D,t=this.markers[n];if(!t.range){t.update(D,this,this.session,e);continue}var S=t.range.clipRows(e.firstRow,e.lastRow);if(!S.isEmpty())if(S=S.toScreenRange(this.session),t.renderer){var i=this.$getTop(S.start.row,e),r=this.$padding+S.start.column*e.characterWidth;t.renderer(D,S,r,i,e)}else"fullLine"==t.type?this.drawFullLineMarker(D,S,t.clazz,e):"screenLine"==t.type?this.drawScreenLineMarker(D,S,t.clazz,e):S.isMultiLine()?"text"==t.type?this.drawTextMarker(D,S,t.clazz,e):this.drawMultiLineMarker(D,S,t.clazz,e):this.drawSingleLineMarker(D,S,t.clazz+" ace_start ace_br15",e)}if(-1!=this.i)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},e.prototype.$getTop=function(e,n){return(e-n.firstRowScreen)*n.lineHeight},e.prototype.drawTextMarker=function(e,n,D,S,i){for(var o=this.session,g=n.start.row,s=n.end.row,a=g,l=0,c=0,u=o.getScreenLastRowColumn(a),h=new t(a,n.start.column,a,c);a<=s;a++)h.start.row=h.end.row=a,h.start.column=a==g?n.start.column:o.getRowWrapIndent(a),h.end.column=u,l=c,c=u,u=a+1<s?o.getScreenLastRowColumn(a+1):a==s?0:n.end.column,this.drawSingleLineMarker(e,h,D+(a==g?" ace_start":"")+" ace_br"+r(a==g||a==g+1&&n.start.column,l<c,c>u,a==s),S,+(a!=s),i)},e.prototype.drawMultiLineMarker=function(e,n,D,t,S){var i=this.$padding,r=t.lineHeight,o=this.$getTop(n.start.row,t),g=i+n.start.column*t.characterWidth;if(S=S||"",this.session.$bidiHandler.isBidiRow(n.start.row)){var s=n.clone();s.end.row=s.start.row,s.end.column=this.session.getLine(s.start.row).length,this.drawBidiSingleLineMarker(e,s,D+" ace_br1 ace_start",t,null,S)}else this.elt(D+" ace_br1 ace_start","height:"+r+"px;right:"+i+"px;top:"+o+"px;left:"+g+"px;"+(S||""));if(this.session.$bidiHandler.isBidiRow(n.end.row)){var s=n.clone();s.start.row=s.end.row,s.start.column=0,this.drawBidiSingleLineMarker(e,s,D+" ace_br12",t,null,S)}else{o=this.$getTop(n.end.row,t);var a=n.end.column*t.characterWidth;this.elt(D+" ace_br12","height:"+r+"px;width:"+a+"px;top:"+o+"px;left:"+i+"px;"+(S||""))}if(!((r=(n.end.row-n.start.row-1)*t.lineHeight)<=0)){o=this.$getTop(n.start.row+1,t);var l=!!n.start.column|8*!n.end.column;this.elt(D+(l?" ace_br"+l:""),"height:"+r+"px;right:"+i+"px;top:"+o+"px;left:"+i+"px;"+(S||""))}},e.prototype.drawSingleLineMarker=function(e,n,D,t,S,i){if(this.session.$bidiHandler.isBidiRow(n.start.row))return this.drawBidiSingleLineMarker(e,n,D,t,S,i);var r=t.lineHeight,o=(n.end.column+(S||0)-n.start.column)*t.characterWidth,g=this.$getTop(n.start.row,t),s=this.$padding+n.start.column*t.characterWidth;this.elt(D,"height:"+r+"px;width:"+o+"px;top:"+g+"px;left:"+s+"px;"+(i||""))},e.prototype.drawBidiSingleLineMarker=function(e,n,D,t,S,i){var r=t.lineHeight,o=this.$getTop(n.start.row,t),g=this.$padding;this.session.$bidiHandler.getSelections(n.start.column,n.end.column).forEach(function(e){this.elt(D,"height:"+r+"px;width:"+(e.width+(S||0))+"px;top:"+o+"px;left:"+(g+e.left)+"px;"+(i||""))},this)},e.prototype.drawFullLineMarker=function(e,n,D,t,S){var i=this.$getTop(n.start.row,t),r=t.lineHeight;n.start.row!=n.end.row&&(r+=this.$getTop(n.end.row,t)-i),this.elt(D,"height:"+r+"px;top:"+i+"px;left:0;right:0;"+(S||""))},e.prototype.drawScreenLineMarker=function(e,n,D,t,S){var i=this.$getTop(n.start.row,t),r=t.lineHeight;this.elt(D,"height:"+r+"px;top:"+i+"px;left:0;right:0;"+(S||""))},e}();function r(e,n,D,t){return!!e|2*!!n|4*!!D|8*!!t}i.prototype.$padding=0,n.Marker=i}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,n,D){var t=new Set(["text","rparen","lparen"]);n.isTextToken=function(e){return t.has(e)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(e,n,D){"use strict";var t=e("../lib/oop"),S=e("../lib/dom"),i=e("../lib/lang"),r=e("./lines").Lines,o=e("../lib/event_emitter").EventEmitter,g=e("../config").nls,s=e("./text_util").isTextToken,a=function(){function e(e){this.dom=S,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new r(this.element)}return e.prototype.$updateEolChar=function(){var e=this.session.doc,n="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode()?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=n)return this.EOL_CHAR=n,!0},e.prototype.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},e.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},e.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},e.prototype.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",(function(e){this._signal("changeCharacterSize",e)}).bind(this)),this.$pollSizeChanges()},e.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},e.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},e.prototype.setSession=function(e){this.session=e,e&&this.$computeTabString()},e.prototype.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,"string"==typeof e?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},e.prototype.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},e.prototype.setHighlightIndentGuides=function(e){return this.$highlightIndentGuides!==e&&(this.$highlightIndentGuides=e,e)},e.prototype.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var n=this.$tabStrings=[0],D=1;D<e+1;D++)if(this.showTabs){var t=this.dom.createElement("span");t.className="ace_invisible ace_invisible_tab",t.textContent=i.stringRepeat(this.TAB_CHAR,D),n.push(t)}else n.push(this.dom.createTextNode(i.stringRepeat(" ",D),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var S="ace_indent-guide",r=this.showSpaces?" ace_invisible ace_invisible_space":"",o=this.showSpaces?i.stringRepeat(this.SPACE_CHAR,this.tabSize):i.stringRepeat(" ",this.tabSize),g=this.showTabs?" ace_invisible ace_invisible_tab":"",s=this.showTabs?i.stringRepeat(this.TAB_CHAR,this.tabSize):o,t=this.dom.createElement("span");t.className=S+r,t.textContent=o,this.$tabStrings[" "]=t;var t=this.dom.createElement("span");t.className=S+g,t.textContent=s,this.$tabStrings[" "]=t}},e.prototype.updateLines=function(e,n,D){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var t=Math.max(n,e.firstRow),S=Math.min(D,e.lastRow),i=this.element.childNodes,r=0,o=e.firstRow;o<t;o++){var g=this.session.getFoldLine(o);if(g)if(g.containsRow(t)){t=g.start.row;break}else o=g.end.row;r++}for(var s=!1,o=t,g=this.session.getNextFoldLine(o),a=g?g.start.row:1/0;o>a&&(o=g.end.row+1,a=(g=this.session.getNextFoldLine(o,g))?g.start.row:1/0),!(o>S);){var l=i[r++];if(l){this.dom.removeChildren(l),this.$renderLine(l,o,o==a&&g),s&&(l.style.top=this.$lines.computeLineTop(o,e,this.session)+"px");var c=e.lineHeight*this.session.getRowLength(o)+"px";l.style.height!=c&&(s=!0,l.style.height=c)}o++}if(s)for(;r<this.$lines.cells.length;){var u=this.$lines.cells[r++];u.element.style.top=this.$lines.computeLineTop(u.row,e,this.session)+"px"}},e.prototype.scrollLines=function(e){var n=this.config;if(this.config=e,this.$lines.pageChanged(n,e))return this.update(e);this.$lines.moveContainer(e);var D=e.lastRow,t=n?n.lastRow:-1;if(!n||t<e.firstRow||D<n.firstRow||!n||n.lastRow<e.firstRow||e.lastRow<n.firstRow)return this.update(e);if(n.firstRow<e.firstRow)for(var S=this.session.getFoldedRowCount(n.firstRow,e.firstRow-1);S>0;S--)this.$lines.shift();if(n.lastRow>e.lastRow)for(var S=this.session.getFoldedRowCount(e.lastRow+1,n.lastRow);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,n.firstRow-1)),e.lastRow>n.lastRow&&this.$lines.push(this.$renderLinesFragment(e,n.lastRow+1,e.lastRow)),this.$highlightIndentGuide()},e.prototype.$renderLinesFragment=function(e,n,D){for(var t=[],i=n,r=this.session.getNextFoldLine(i),o=r?r.start.row:1/0;i>o&&(i=r.end.row+1,o=(r=this.session.getNextFoldLine(i,r))?r.start.row:1/0),!(i>D);){var g=this.$lines.createCell(i,e,this.session),s=g.element;this.dom.removeChildren(s),S.setStyle(s.style,"height",this.$lines.computeLineHeight(i,e,this.session)+"px"),S.setStyle(s.style,"top",this.$lines.computeLineTop(i,e,this.session)+"px"),this.$renderLine(s,i,i==o&&r),this.$useLineGroups()?s.className="ace_line_group":s.className="ace_line",t.push(g),i++}return t},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var n=e.firstRow,D=e.lastRow,t=this.$lines;t.getLength();)t.pop();t.push(this.$renderLinesFragment(e,n,D))},e.prototype.$renderToken=function(e,n,D,t){for(var S,r=this,o=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,a=this.dom.createFragment(this.element),l=0;S=o.exec(t);){var c=S[1],u=S[2],h=S[3],d=S[4],p=S[5];if(r.showSpaces||!u){var f=l!=S.index?t.slice(l,S.index):"";if(l=S.index+S[0].length,f&&a.appendChild(this.dom.createTextNode(f,this.element)),c){var m=r.session.getScreenTabSize(n+S.index);a.appendChild(r.$tabStrings[m].cloneNode(!0)),n+=m-1}else if(u)if(r.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=i.stringRepeat(r.SPACE_CHAR,u.length),a.appendChild(y)}else a.appendChild(this.dom.createTextNode(u,this.element));else if(h){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=i.stringRepeat(r.SPACE_CHAR,h.length),a.appendChild(y)}else if(d){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className=r.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",y.textContent=r.showSpaces?r.SPACE_CHAR:d,a.appendChild(y)}else if(p){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className="ace_cjk",y.textContent=p,a.appendChild(y)}}}if(a.appendChild(this.dom.createTextNode(l?t.slice(l):t,this.element)),s(D.type))e.appendChild(a);else{var v="ace_"+D.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==D.type&&(y.style.width=D.value.length*this.config.characterWidth+"px",y.setAttribute("title",g("inline-fold.closed.title","Unfold code"))),y.className=v,y.appendChild(a),e.appendChild(y)}return n+t.length},e.prototype.renderIndentGuide=function(e,n,D){var t=n.search(this.$indentGuideRe);if(t<=0||t>=D)return n;if(" "==n[0]){for(var S=(t-=t%this.tabSize)/this.tabSize,i=0;i<S;i++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(t)}if(" "==n[0]){for(var i=0;i<t;i++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(t)}return this.$highlightIndentGuide(),n},e.prototype.$highlightIndentGuide=function(){if(this.$highlightIndentGuides&&this.displayIndentGuides){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var e=this.session.doc.$lines;if(e){var n=this.session.selection.getCursor(),D=/^\s*/.exec(this.session.doc.getLine(n.row))[0].length,t=Math.floor(D/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:t,start:n.row};var S=this.session.$bracketHighlight;if(S){for(var i=this.session.$bracketHighlight.ranges,r=0;r<i.length;r++)if(n.row!==i[r].start.row){this.$highlightIndentGuideMarker.end=i[r].start.row,n.row>i[r].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&""!==e[n.row]&&n.column===e[n.row].length){this.$highlightIndentGuideMarker.dir=1;for(var r=n.row+1;r<e.length;r++){var o=e[r],g=/^\s*/.exec(o)[0].length;if(""!==o&&(this.$highlightIndentGuideMarker.end=r,g<=D))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,n=0;n<e.length;n++){var D=e[n].element.childNodes;if(D.length>0){for(var t=0;t<D.length;t++)if(D[t].classList&&D[t].classList.contains("ace_indent-guide-active")){D[t].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,n){if(""!==this.session.doc.getLine(e.row)){var D=e.element.childNodes;if(D){var t=D[n-1];t&&t.classList&&t.classList.contains("ace_indent-guide")&&t.classList.add("ace_indent-guide-active")}}},e.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var e=this.$lines.cells;this.$clearActiveIndentGuide();var n=this.$highlightIndentGuideMarker.indentLevel;if(0!==n)if(1===this.$highlightIndentGuideMarker.dir)for(var D=0;D<e.length;D++){var t=e[D];if(this.$highlightIndentGuideMarker.end&&t.row>=this.$highlightIndentGuideMarker.start+1){if(t.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(t,n)}}else for(var D=e.length-1;D>=0;D--){var t=e[D];if(this.$highlightIndentGuideMarker.end&&t.row<this.$highlightIndentGuideMarker.start){if(t.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(t,n)}}}},e.prototype.$createLineElement=function(e){var n=this.dom.createElement("div");return n.className="ace_line",n.style.height=this.config.lineHeight+"px",n},e.prototype.$renderWrappedLine=function(e,n,D){var t=0,S=0,r=D[0],o=0,g=this.$createLineElement();e.appendChild(g);for(var s=0;s<n.length;s++){var a=n[s],l=a.value;if(0==s&&this.displayIndentGuides){if(t=l.length,!(l=this.renderIndentGuide(g,l,r)))continue;t-=l.length}if(t+l.length<r)o=this.$renderToken(g,o,a,l),t+=l.length;else{for(;t+l.length>=r;)o=this.$renderToken(g,o,a,l.substring(0,r-t)),l=l.substring(r-t),t=r,g=this.$createLineElement(),e.appendChild(g),g.appendChild(this.dom.createTextNode(i.stringRepeat("\xa0",D.indent),this.element)),o=0,r=D[++S]||Number.MAX_VALUE;0!=l.length&&(t+=l.length,o=this.$renderToken(g,o,a,l))}}D[D.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(g,o,null,"",!0)},e.prototype.$renderSimpleLine=function(e,n){for(var D=0,t=0;t<n.length;t++){var S=n[t],i=S.value;if(0!=t||!this.displayIndentGuides||(i=this.renderIndentGuide(e,i))){if(D+i.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,D,S,i);D=this.$renderToken(e,D,S,i)}}},e.prototype.$renderOverflowMessage=function(e,n,D,t,S){D&&this.$renderToken(e,n,D,t.slice(0,this.MAX_LINE_LENGTH-n));var i=this.dom.createElement("span");i.className="ace_inline_button ace_keyword ace_toggle_wrap",i.textContent=S?"<hide>":"<click to see more...>",e.appendChild(i)},e.prototype.$renderLine=function(e,n,D){if(D||!1==D||(D=this.session.getFoldLine(n)),D)var t=this.$getFoldLineTokens(n,D);else var t=this.session.getTokens(n);var S=e;if(t.length){var i=this.session.getRowSplitData(n);if(i&&i.length){this.$renderWrappedLine(e,t,i);var S=e.lastChild}else{var S=e;this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S)),this.$renderSimpleLine(S,t)}}else this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S));if(this.showEOL&&S){D&&(n=D.end.row);var r=this.dom.createElement("span");r.className="ace_invisible ace_invisible_eol",r.textContent=n==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,S.appendChild(r)}},e.prototype.$getFoldLineTokens=function(e,n){var D=this.session,t=[];function S(e,n,D){for(var S=0,i=0;i+e[S].value.length<n;)if(i+=e[S].value.length,++S==e.length)return;if(i!=n){var r=e[S].value.substring(n-i);r.length>D-n&&(r=r.substring(0,D-n)),t.push({type:e[S].type,value:r}),i=n+r.length,S+=1}for(;i<D&&S<e.length;){var r=e[S].value;r.length+i>D?t.push({type:e[S].type,value:r.substring(0,D-i)}):t.push(e[S]),i+=r.length,S+=1}}var i=D.getTokens(e);return n.walk(function(e,n,r,o,g){null!=e?t.push({type:"fold",value:e}):(g&&(i=D.getTokens(n)),i.length&&S(i,o,r))},n.end.row,this.session.getLine(n.end.row).length),t},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();a.prototype.EOF_CHAR="\xb6",a.prototype.EOL_CHAR_LF="\xac",a.prototype.EOL_CHAR_CRLF="\xa4",a.prototype.EOL_CHAR=a.prototype.EOL_CHAR_LF,a.prototype.TAB_CHAR="—",a.prototype.SPACE_CHAR="\xb7",a.prototype.$padding=0,a.prototype.MAX_LINE_LENGTH=1e4,a.prototype.showInvisibles=!1,a.prototype.showSpaces=!1,a.prototype.showTabs=!1,a.prototype.showEOL=!1,a.prototype.displayIndentGuides=!0,a.prototype.$highlightIndentGuides=!0,a.prototype.$tabStrings=[],a.prototype.destroy={},a.prototype.onChangeTabSize=a.prototype.$computeTabString,t.implement(a.prototype,o),n.Text=a}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=function(){function e(e){this.element=t.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),t.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var n=this.cursors,D=n.length;D--;)t.setStyle(n[D].style,"opacity",e?"":"0")},e.prototype.$startCssAnimation=function(){for(var e=this.cursors,n=e.length;n--;)e[n].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&t.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,t.removeCssClass(this.element,"ace_animate-blinking")},e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},e.prototype.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},e.prototype.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,t.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=t.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},e.prototype.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},e.prototype.hideCursor=function(){this.isVisible=!1,t.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,t.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,t.removeCssClass(this.element,"ace_smooth-blinking")),e(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible)return void this.$stopCssAnimation();if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&t.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),t.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var n=(function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){e(!0),n()},this.blinkInterval),n()}},e.prototype.getPixelPosition=function(e,n){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var D=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(D.row,e.row)?this.session.$bidiHandler.getPosLeft(D.column):D.column*this.config.characterWidth),top:(D.row-(n?this.config.firstRowScreen:0))*this.config.lineHeight}},e.prototype.isCursorInView=function(e,n){return e.top>=0&&e.top<n.maxHeight},e.prototype.update=function(e){this.config=e;var n=this.session.$selectionMarkers,D=0,S=0;(void 0===n||0===n.length)&&(n=[{cursor:null}]);for(var D=0,i=n.length;D<i;D++){var r=this.getPixelPosition(n[D].cursor,!0);if(!(r.top>e.height+e.offset)&&!(r.top<0)||!(D>1)){var o=this.cursors[S++]||this.addCursor(),g=o.style;this.drawCursor?this.drawCursor(o,r,e,n[D],this.session):this.isCursorInView(r,e)?(t.setStyle(g,"display","block"),t.translate(o,r.left,r.top),t.setStyle(g,"width",Math.round(e.characterWidth)+"px"),t.setStyle(g,"height",e.lineHeight+"px")):t.setStyle(g,"display","none")}}for(;this.cursors.length>S;)this.removeCursor();var s=this.session.getOverwrite();this.$setOverwrite(s),this.$pixelPos=r,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?t.addCssClass(this.element,"ace_overwrite-cursors"):t.removeCssClass(this.element,"ace_overwrite-cursors"))},e.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},e}();S.prototype.$padding=0,S.prototype.drawCursor=null,n.Cursor=S}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,g=32768,s=function(){function e(e,n){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+n,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\xa0",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,r.addListener(this.element,"scroll",this.onScroll.bind(this)),r.addListener(this.element,"mousedown",r.preventDefault)}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();S.implement(s.prototype,o);var a=function(e){function n(n,D){var t=e.call(this,n,"-v")||this;return t.scrollTop=0,t.scrollHeight=0,D.$scrollbarWidth=t.width=i.scrollbarWidth(n.ownerDocument),t.inner.style.width=t.element.style.width=(t.width||15)+5+"px",t.$minWidth=0,t}return t(n,e),n.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},n.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},n.prototype.setHeight=function(e){this.element.style.height=e+"px"},n.prototype.setScrollHeight=function(e){this.scrollHeight=e,e>g?(this.coeff=g/e,e=g):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},n.prototype.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)},n}(s);a.prototype.setInnerHeight=a.prototype.setScrollHeight;var l=function(e){function n(n,D){var t=e.call(this,n,"-h")||this;return t.scrollLeft=0,t.height=D.$scrollbarWidth,t.inner.style.height=t.element.style.height=(t.height||15)+5+"px",t}return t(n,e),n.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},n.prototype.getHeight=function(){return this.isVisible?this.height:0},n.prototype.setWidth=function(e){this.element.style.width=e+"px"},n.prototype.setInnerWidth=function(e){this.inner.style.width=e+"px"},n.prototype.setScrollWidth=function(e){this.inner.style.width=e+"px"},n.prototype.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)},n}(s);n.ScrollBar=a,n.ScrollBarV=a,n.ScrollBarH=l,n.VScrollBar=a,n.HScrollBar=l}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter;i.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n position: absolute;\n background: rgba(128, 128, 128, 0.6);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid #bbb;\n border-radius: 2px;\n z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n position: absolute;\n z-index: 6;\n background: none;\n overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n z-index: 6;\n right: 0;\n top: 0;\n width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n z-index: 8;\n right: 0;\n width: 100%;\n}\n.ace_editor>.ace_sb-h {\n bottom: 0;\n left: 0;\n height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n bottom: 0;\n height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n z-index: 8;\n background: #000;\n}","ace_scrollbar.css",!1);var g=function(){function e(e,n){this.element=i.createElement("div"),this.element.className="ace_sb"+n,this.inner=i.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,r.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();S.implement(g.prototype,o);var s=function(e){function n(n,D){var t=e.call(this,n,"-v")||this;return t.scrollTop=0,t.scrollHeight=0,t.parent=n,t.width=t.VScrollWidth,t.renderer=D,t.inner.style.width=t.element.style.width=(t.width||15)+"px",t.$minWidth=0,t}return t(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var D=this,t=n.clientY,S=function(e){t=e.clientY},i=function(){clearInterval(a)},o=n.clientY,g=this.thumbTop,s=function(){if(void 0!==t){var e=D.scrollTopFromThumbTop(g+t-o);e!==D.scrollTop&&D._emit("scroll",{data:e})}};r.capture(this.inner,S,i);var a=setInterval(s,20);return r.preventDefault(n)}var l=n.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(l)}),r.preventDefault(n)}},n.prototype.getHeight=function(){return this.height},n.prototype.scrollTopFromThumbTop=function(e){var n=e*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return(n|=0)<0?n=0:n>this.pageHeight-this.viewHeight&&(n=this.pageHeight-this.viewHeight),n},n.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},n.prototype.setHeight=function(e){this.height=Math.max(0,e),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},n.prototype.setScrollHeight=function(e,n){(this.pageHeight!==e||n)&&(this.pageHeight=e,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},n.prototype.setScrollTop=function(e){this.scrollTop=e,e<0&&(e=0),this.thumbTop=e*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},n}(g);s.prototype.setInnerHeight=s.prototype.setScrollHeight;var a=function(e){function n(n,D){var t=e.call(this,n,"-h")||this;return t.scrollLeft=0,t.scrollWidth=0,t.height=t.HScrollHeight,t.inner.style.height=t.element.style.height=(t.height||12)+"px",t.renderer=D,t}return t(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var D=this,t=n.clientX,S=function(e){t=e.clientX},i=function(){clearInterval(a)},o=n.clientX,g=this.thumbLeft,s=function(){if(void 0!==t){var e=D.scrollLeftFromThumbLeft(g+t-o);e!==D.scrollLeft&&D._emit("scroll",{data:e})}};r.capture(this.inner,S,i);var a=setInterval(s,20);return r.preventDefault(n)}var l=n.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(l)}),r.preventDefault(n)}},n.prototype.getHeight=function(){return this.isVisible?this.height:0},n.prototype.scrollLeftFromThumbLeft=function(e){var n=e*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return(n|=0)<0?n=0:n>this.pageWidth-this.viewWidth&&(n=this.pageWidth-this.viewWidth),n},n.prototype.setWidth=function(e){this.width=Math.max(0,e),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},n.prototype.setScrollWidth=function(e,n){(this.pageWidth!==e||n)&&(this.pageWidth=e,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},n.prototype.setScrollLeft=function(e){this.scrollLeft=e,e<0&&(e=0),this.thumbLeft=e*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},n}(g);a.prototype.setInnerWidth=a.prototype.setScrollWidth,n.ScrollBar=s,n.ScrollBarV=s,n.ScrollBarH=a,n.VScrollBar=s,n.HScrollBar=a}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,n,D){"use strict";var t=e("./lib/event");n.RenderLoop=function(){function e(e,n){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=n||window;var D=this;this._flush=function(e){D.pending=!1;var n=D.changes;if(n&&(t.blockIdle(100),D.changes=0,D.onRender(n)),D.changes){if(D.$recursionLimit--<0)return;D.schedule()}else D.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(t.nextFrame(this._flush),this.pending=!0)},e.prototype.clear=function(e){var n=this.changes;return this.changes=0,n},e}()}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,n,D){var t=e("../lib/oop"),S=e("../lib/dom"),i=e("../lib/lang"),r=e("../lib/event"),o=e("../lib/useragent"),g=e("../lib/event_emitter").EventEmitter,s=512,a="function"==typeof ResizeObserver,l=200,c=function(){function e(e){this.el=S.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=S.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=S.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=i.stringRepeat("X",s),this.$characterSize={width:0,height:0},a?this.$addObserver():this.checkForSizeChanges()}return e.prototype.$setMeasureNodeStyles=function(e,n){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",o.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=n?"hidden":"visible"},e.prototype.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var n=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=n&&n.width===e.width&&n.height===e.height,this._emit("changeCharacterSize",{data:e})}},e.prototype.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(n){e.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},e.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=r.onIdle(function n(){e.checkForSizeChanges(),r.onIdle(n,500)},500)},e.prototype.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},e.prototype.$measureSizes=function(e){var n={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/s};return 0===n.width||0===n.height?null:n},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=i.stringRepeat(e,s),this.$main.getBoundingClientRect().width/s},e.prototype.getCharacterWidth=function(e){var n=this.charSizes[e];return void 0===n&&(n=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),n},e.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype.$getZoom=function(e){return e&&e.parentElement?(Number(window.getComputedStyle(e).zoom)||1)*this.$getZoom(e.parentElement):1},e.prototype.$initTransformMeasureNodes=function(){var e=function(e,n){return["div",{style:"position: absolute;top:"+e+"px;left:"+n+"px;"}]};this.els=S.buildDom([e(0,0),e(l,0),e(0,l),e(l,l)],this.el)},e.prototype.transformCoordinates=function(e,n){function D(e,n,D){var t=e[1]*n[0]-e[0]*n[1];return[(-n[1]*D[0]+n[0]*D[1])/t,(e[1]*D[0]-e[0]*D[1])/t]}function t(e,n){return[e[0]-n[0],e[1]-n[1]]}function S(e,n){return[e[0]+n[0],e[1]+n[1]]}function i(e,n){return[e*n[0],e*n[1]]}function r(e){var n=e.getBoundingClientRect();return[n.left,n.top]}e&&(e=i(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var o=r(this.els[0]),g=r(this.els[1]),s=r(this.els[2]),a=r(this.els[3]),c=D(t(a,g),t(a,s),t(S(g,s),S(a,o))),u=i(1+c[0],t(g,o)),h=i(1+c[1],t(s,o));if(n){var d=n,p=c[0]*d[0]/l+c[1]*d[1]/l+1,f=S(i(d[0],u),i(d[1],h));return S(i(1/p/l,f),o)}var m=t(e,o),y=D(t(u,i(c[0],m)),t(h,i(c[1],m)),m);return i(l,y)},e}();c.prototype.$characterSize={width:0,height:0},t.implement(c.prototype,g),n.FontMetrics=c}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,n,D){D.exports='\n.ace_br1 {border-top-left-radius : 3px;}\n.ace_br2 {border-top-right-radius : 3px;}\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\n.ace_br4 {border-bottom-right-radius: 3px;}\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\n.ace_br8 {border-bottom-left-radius : 3px;}\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n\n\n.ace_editor {\n position: relative;\n overflow: hidden;\n padding: 0;\n font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'Source Code Pro\', \'source-code-pro\', monospace;\n direction: ltr;\n text-align: left;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n forced-color-adjust: none;\n}\n\n.ace_scroller {\n position: absolute;\n overflow: hidden;\n top: 0;\n bottom: 0;\n background-color: inherit;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n cursor: text;\n}\n\n.ace_content {\n position: absolute;\n box-sizing: border-box;\n min-width: 100%;\n contain: style size layout;\n font-variant-ligatures: no-common-ligatures;\n}\n\n.ace_keyboard-focus:focus {\n box-shadow: inset 0 0 0 2px #5E9ED6;\n outline: none;\n}\n\n.ace_dragging .ace_scroller:before{\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n content: \'\';\n background: rgba(250, 250, 250, 0.01);\n z-index: 1000;\n}\n.ace_dragging.ace_dark .ace_scroller:before{\n background: rgba(0, 0, 0, 0.01);\n}\n\n.ace_gutter {\n position: absolute;\n overflow : hidden;\n width: auto;\n top: 0;\n bottom: 0;\n left: 0;\n cursor: default;\n z-index: 4;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n contain: style size layout;\n}\n\n.ace_gutter-active-line {\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.ace_scroller.ace_scroll-left:after {\n content: "";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n pointer-events: none;\n}\n\n.ace_gutter-cell, .ace_gutter-cell_svg-icons {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-left: 19px;\n padding-right: 6px;\n background-repeat: no-repeat;\n}\n\n.ace_gutter-cell_svg-icons .ace_gutter_annotation {\n margin-left: -14px;\n float: left;\n}\n\n.ace_gutter-cell .ace_gutter_annotation {\n margin-left: -19px;\n float: left;\n}\n\n.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\n}\n\n.ace_icon_svg.ace_error {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: darkorange;\n}\n.ace_icon_svg.ace_info {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: royalblue;\n}\n.ace_icon_svg.ace_hint {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");\n background-color: silver;\n}\n\n.ace_icon_svg.ace_error_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");\n background-color: darkorange;\n}\n\n.ace_scrollbar {\n contain: strict;\n position: absolute;\n right: 0;\n bottom: 0;\n z-index: 6;\n}\n\n.ace_scrollbar-inner {\n position: absolute;\n cursor: text;\n left: 0;\n top: 0;\n}\n\n.ace_scrollbar-v{\n overflow-x: hidden;\n overflow-y: scroll;\n top: 0;\n}\n\n.ace_scrollbar-h {\n overflow-x: scroll;\n overflow-y: hidden;\n left: 0;\n}\n\n.ace_print-margin {\n position: absolute;\n height: 100%;\n}\n\n.ace_text-input {\n position: absolute;\n z-index: 0;\n width: 0.5em;\n height: 1em;\n opacity: 0;\n background: transparent;\n -moz-appearance: none;\n appearance: none;\n border: none;\n resize: none;\n outline: none;\n overflow: hidden;\n font: inherit;\n padding: 0 1px;\n margin: 0 -1px;\n contain: strict;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n user-select: text;\n /*with `pre-line` chrome inserts instead of space*/\n white-space: pre!important;\n}\n.ace_text-input.ace_composition {\n background: transparent;\n color: inherit;\n z-index: 1000;\n opacity: 1;\n}\n.ace_composition_placeholder { color: transparent }\n.ace_composition_marker { \n border-bottom: 1px solid;\n position: absolute;\n border-radius: 0;\n margin-top: 1px;\n}\n\n[ace_nocontext=true] {\n transform: none!important;\n filter: none!important;\n clip-path: none!important;\n mask : none!important;\n contain: none!important;\n perspective: none!important;\n mix-blend-mode: initial!important;\n z-index: auto;\n}\n\n.ace_layer {\n z-index: 1;\n position: absolute;\n overflow: hidden;\n /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/\n word-wrap: normal;\n white-space: pre;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n /* setting pointer-events: auto; on node under the mouse, which changes\n during scroll, will break mouse wheel scrolling in Safari */\n pointer-events: none;\n}\n\n.ace_gutter-layer {\n position: relative;\n width: auto;\n text-align: right;\n pointer-events: auto;\n height: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer {\n font: inherit !important;\n position: absolute;\n height: 1000000px;\n width: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\n contain: style size layout;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ace_hidpi .ace_text-layer,\n.ace_hidpi .ace_gutter-layer,\n.ace_hidpi .ace_content,\n.ace_hidpi .ace_gutter {\n contain: strict;\n}\n.ace_hidpi .ace_text-layer > .ace_line, \n.ace_hidpi .ace_text-layer > .ace_line_group {\n contain: strict;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n box-sizing: border-box;\n border-left: 2px solid;\n /* workaround for smooth cursor repaintng whole screen in chrome */\n transform: translatez(0);\n}\n\n.ace_multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_slim-cursors .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_overwrite-cursors .ace_cursor {\n border-left-width: 0;\n border-bottom: 1px solid;\n}\n\n.ace_hidden-cursors .ace_cursor {\n opacity: 0.2;\n}\n\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\n opacity: 0;\n}\n\n.ace_smooth-blinking .ace_cursor {\n transition: opacity 0.18s;\n}\n\n.ace_animate-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: step-end;\n animation-name: blink-ace-animate;\n animation-iteration-count: infinite;\n}\n\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: ease-in-out;\n animation-name: blink-ace-animate-smooth;\n}\n \n@keyframes blink-ace-animate {\n from, to { opacity: 1; }\n 60% { opacity: 0; }\n}\n\n@keyframes blink-ace-animate-smooth {\n from, to { opacity: 1; }\n 45% { opacity: 1; }\n 60% { opacity: 0; }\n 85% { opacity: 0; }\n}\n\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_error_bracket {\n position: absolute;\n border-bottom: 1px solid #DE5555;\n border-radius: 0;\n}\n\n.ace_marker-layer .ace_active-line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected-word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\n}\n\n.ace_tooltip {\n background-color: #f5f5f5;\n border: 1px solid gray;\n border-radius: 1px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n color: black;\n max-width: 100%;\n padding: 3px 4px;\n position: fixed;\n z-index: 999999;\n box-sizing: border-box;\n cursor: default;\n white-space: pre-wrap;\n word-wrap: break-word;\n line-height: normal;\n font-style: normal;\n font-weight: normal;\n letter-spacing: normal;\n pointer-events: none;\n overflow: auto;\n max-width: min(60em, 66vw);\n overscroll-behavior: contain;\n}\n.ace_tooltip pre {\n white-space: pre-wrap;\n}\n\n.ace_tooltip.ace_dark {\n background-color: #636363;\n color: #fff;\n}\n\n.ace_tooltip:focus {\n outline: 1px solid #5E9ED6;\n}\n\n.ace_icon {\n display: inline-block;\n width: 18px;\n vertical-align: top;\n}\n\n.ace_icon_svg {\n display: inline-block;\n width: 12px;\n vertical-align: top;\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-size: 12px;\n -webkit-mask-position: center;\n}\n\n.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: none;\n width: 11px;\n vertical-align: top;\n\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n cursor: pointer;\n}\n\n.ace_folding-enabled .ace_fold-widget {\n display: inline-block; \n}\n\n.ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\n}\n\n.ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\n}\n.ace_dark .ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n\n.ace_inline_button {\n border: 1px solid lightgray;\n display: inline-block;\n margin: -1px 8px;\n padding: 0 5px;\n pointer-events: auto;\n cursor: pointer;\n}\n.ace_inline_button:hover {\n border-color: gray;\n background: rgba(200,200,200,0.2);\n display: inline-block;\n pointer-events: auto;\n}\n\n.ace_fold-widget.ace_invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_nobold .ace_bold {\n font-weight: normal;\n}\n\n.ace_italic {\n font-style: italic;\n}\n\n\n.ace_error-marker {\n background-color: rgba(255, 0, 0,0.2);\n position: absolute;\n z-index: 9;\n}\n\n.ace_highlight-marker {\n background-color: rgba(255, 255, 0,0.2);\n position: absolute;\n z-index: 8;\n}\n\n.ace_mobile-menu {\n position: absolute;\n line-height: 1.5;\n border-radius: 4px;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n background: white;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #dcdcdc;\n color: black;\n}\n.ace_dark > .ace_mobile-menu {\n background: #333;\n color: #ccc;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #444;\n\n}\n.ace_mobile-button {\n padding: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n.ace_mobile-button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_mobile-button:active {\n background-color: #ddd;\n}\n\n.ace_placeholder {\n position: relative;\n font-family: arial;\n transform: scale(0.9);\n transform-origin: left;\n white-space: pre;\n opacity: 0.7;\n margin: 0 10px;\n z-index: 1;\n}\n\n.ace_ghost_text {\n opacity: 0.5;\n font-style: italic;\n}\n\n.ace_ghost_text_container > div {\n white-space: pre;\n}\n\n.ghost_text_line_wrapped::after {\n content: "↩";\n position: absolute;\n}\n\n.ace_lineWidgetContainer.ace_ghost_text {\n margin: 0px 4px\n}\n\n.ace_screenreader-only {\n position:absolute;\n left:-10000px;\n top:auto;\n width:1px;\n height:1px;\n overflow:hidden;\n}\n\n.ace_hidden_token {\n display: none;\n}'}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/oop"),i=e("../lib/event_emitter").EventEmitter,r=function(){function e(e,n){this.canvas=t.createElement("canvas"),this.renderer=n,this.pixelRatio=1,this.maxHeight=n.layerConfig.maxHeight,this.lineHeight=n.layerConfig.lineHeight,this.canvasHeight=e.parent.scrollHeight,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvasWidth=e.width,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},e.element.appendChild(this.canvas)}return e.prototype.$updateDecorators=function(e){var n=!0===this.renderer.theme.isDark?this.colors.dark:this.colors.light;e&&(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,(e.lastRow+1)*this.lineHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight);var D=this.canvas.getContext("2d");function t(e,n){return e.priority<n.priority?-1:+(e.priority>n.priority)}var S=this.renderer.session.$annotations;if(D.clearRect(0,0,this.canvas.width,this.canvas.height),S){var i={info:1,warning:2,error:3};S.forEach(function(e){e.priority=i[e.type]||null}),S=S.sort(t);for(var r=this.renderer.session.$foldData,o=0;o<S.length;o++){var g=S[o].row,s=this.compensateFoldRows(g,r),a=Math.round((g-s)*this.lineHeight*this.heightRatio),l=Math.round((g-s)*this.lineHeight*this.heightRatio),c=Math.round(((g-s)*this.lineHeight+this.lineHeight)*this.heightRatio);if(c-l<this.minDecorationHeight){var u=(l+c)/2|0;u<this.halfMinDecorationHeight?u=this.halfMinDecorationHeight:u+this.halfMinDecorationHeight>this.canvasHeight&&(u=this.canvasHeight-this.halfMinDecorationHeight),l=Math.round(u-this.halfMinDecorationHeight),c=Math.round(u+this.halfMinDecorationHeight)}D.fillStyle=n[S[o].type]||null,D.fillRect(0,a,this.canvasWidth,c-l)}}var h=this.renderer.session.selection.getCursor();if(h){var s=this.compensateFoldRows(h.row,r),a=Math.round((h.row-s)*this.lineHeight*this.heightRatio);D.fillStyle="rgba(0, 0, 0, 0.5)",D.fillRect(0,a,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,n){var D=0;if(n&&n.length>0)for(var t=0;t<n.length;t++)e>n[t].start.row&&e<n[t].end.row?D+=e-n[t].start.row:e>=n[t].end.row&&(D+=n[t].end.row-n[t].start.row);return D},e}();S.implement(r.prototype,i),n.Decorator=r}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/dom"),i=e("./lib/lang"),r=e("./config"),o=e("./layer/gutter").Gutter,g=e("./layer/marker").Marker,s=e("./layer/text").Text,a=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,c=e("./scrollbar").VScrollBar,u=e("./scrollbar_custom").HScrollBar,h=e("./scrollbar_custom").VScrollBar,d=e("./renderloop").RenderLoop,p=e("./layer/font_metrics").FontMetrics,f=e("./lib/event_emitter").EventEmitter,m=e("./css/editor-css"),y=e("./layer/decorators").Decorator,v=e("./lib/useragent"),b=e("./layer/text_util").isTextToken;S.importCssString(m,"ace_editor.css",!1);var w=function(){function e(e,n){var D=this;this.container=e||S.createElement("div"),S.addCssClass(this.container,"ace_editor"),S.HI_DPI&&S.addCssClass(this.container,"ace_hidpi"),this.setTheme(n),null==r.get("useStrictCSP")&&r.set("useStrictCSP",!1),this.$gutter=S.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=S.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=S.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new g(this.content);var t=this.$textLayer=new s(this.content);this.canvas=t.element,this.$markerFront=new g(this.content),this.$cursorLayer=new a(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(e){D.$scrollAnimation||D.session.setScrollTop(e.data-D.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){D.$scrollAnimation||D.session.setScrollLeft(e.data-D.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new p(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){D.updateCharacterSize(),D.onResize(!0,D.gutterWidth,D.$size.width,D.$size.height),D._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!v.isIOS,this.$loop=new d(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),r.resetOptions(this),r._signal("renderer",this)}return e.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),S.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},e.prototype.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&0>=e.getScrollTop()&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},e.prototype.updateLines=function(e,n,D){if(void 0===n&&(n=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<n&&(this.$changedLines.lastRow=n)):this.$changedLines={firstRow:e,lastRow:n},this.$changedLines.lastRow<this.layerConfig.firstRow)if(!D)return;else this.$changedLines.lastRow=this.layerConfig.lastRow;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},e.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},e.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},e.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},e.prototype.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},e.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},e.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},e.prototype.onResize=function(e,n,D,t){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var S=this.container;t||(t=S.clientHeight||S.scrollHeight),!t&&this.$maxLines&&this.lineHeight>1&&(!S.style.height||"0px"==S.style.height)&&(S.style.height="1px",t=S.clientHeight||S.scrollHeight),D||(D=S.clientWidth||S.scrollWidth);var i=this.$updateCachedSize(e,n,D,t);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!D&&!t)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(i|this.$changes,!0):this.$loop.schedule(i|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},e.prototype.$updateCachedSize=function(e,n,D,t){t-=this.$extraHeight||0;var i=0,r=this.$size,o={width:r.width,height:r.height,scrollerHeight:r.scrollerHeight,scrollerWidth:r.scrollerWidth};if(t&&(e||r.height!=t)&&(r.height=t,i|=this.CHANGE_SIZE,r.scrollerHeight=r.height,this.$horizScroll&&(r.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(r.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",i|=this.CHANGE_SCROLL),D&&(e||r.width!=D)){i|=this.CHANGE_SIZE,r.width=D,null==n&&(n=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=n,S.setStyle(this.scrollBarH.element.style,"left",n+"px"),S.setStyle(this.scroller.style,"left",n+this.margin.left+"px"),r.scrollerWidth=Math.max(0,D-n-this.scrollBarV.getWidth()-this.margin.h),S.setStyle(this.$gutter.style,"left",this.margin.left+"px");var g=this.scrollBarV.getWidth()+"px";S.setStyle(this.scrollBarH.element.style,"right",g),S.setStyle(this.scroller.style,"right",g),S.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(r.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(i|=this.CHANGE_FULL)}return r.$dirty=!D||!t,i&&this._signal("resize",o),i},e.prototype.onGutterResize=function(e){var n=this.$showGutter?e:0;n!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,n,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()||this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},e.prototype.adjustWrapLimit=function(){var e=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth);return this.session.adjustWrapLimit(e,this.$showPrintMargin&&this.$printMarginColumn)},e.prototype.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},e.prototype.getAnimatedScroll=function(){return this.$animatedScroll},e.prototype.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},e.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},e.prototype.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},e.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},e.prototype.setHighlightIndentGuides=function(e){this.setOption("highlightIndentGuides",e)},e.prototype.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},e.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},e.prototype.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},e.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},e.prototype.getShowGutter=function(){return this.getOption("showGutter")},e.prototype.setShowGutter=function(e){return this.setOption("showGutter",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=S.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=S.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var n=this.$printMarginEl.style;n.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",n.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},e.prototype.getContainerElement=function(){return this.container},e.prototype.getMouseEventTarget=function(){return this.scroller},e.prototype.getTextAreaContainer=function(){return this.container},e.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var e=this.textarea.style,n=this.$composition;if(!this.$keepTextAreaAtCursor&&!n)return void S.translate(this.textarea,-100,0);var D=this.$cursorLayer.$pixelPos;if(D){n&&n.markerRange&&(D=this.$cursorLayer.getPixelPosition(n.markerRange.start,!0));var t=this.layerConfig,i=D.top,r=D.left;i-=t.offset;var o=n&&n.useTextareaForIME||v.isMobile?this.lineHeight:1;if(i<0||i>t.height-o)return void S.translate(this.textarea,0,0);var g=1,s=this.$size.height-o;if(n)if(n.useTextareaForIME){var a=this.textarea.value;g=this.characterWidth*this.session.$getStringScreenWidth(a)[0]}else i+=this.lineHeight+2;else i+=this.lineHeight;r-=this.scrollLeft,r>this.$size.scrollerWidth-g&&(r=this.$size.scrollerWidth-g),r+=this.gutterWidth+this.margin.left,S.setStyle(e,"height",o+"px"),S.setStyle(e,"width",g+"px"),S.translate(this.textarea,Math.min(r,this.$size.scrollerWidth-g),Math.min(i,s))}}},e.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},e.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+ +(0!==this.layerConfig.offset)},e.prototype.getLastFullyVisibleRow=function(){var e=this.layerConfig,n=e.lastRow;return this.session.documentToScreenRow(n,0)*e.lineHeight-this.session.getScrollTop()>e.height-e.lineHeight?n-1:n},e.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},e.prototype.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},e.prototype.setScrollMargin=function(e,n,D,t){var S=this.scrollMargin;S.top=0|e,S.bottom=0|n,S.right=0|t,S.left=0|D,S.v=S.top+S.bottom,S.h=S.left+S.right,S.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-S.top),this.updateFull()},e.prototype.setMargin=function(e,n,D,t){var S=this.margin;S.top=0|e,S.bottom=0|n,S.right=0|t,S.left=0|D,S.v=S.top+S.bottom,S.h=S.left+S.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},e.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},e.prototype.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},e.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},e.prototype.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},e.prototype.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,n=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(n-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-n&&(e=this.scrollTop+n,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},e.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},e.prototype.freeze=function(){this.$frozen=!0},e.prototype.unfreeze=function(){this.$frozen=!1},e.prototype.$renderChanges=function(e,n){if(this.$changes&&(e|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!e&&!n){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var D=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),D.firstRow!=this.layerConfig.firstRow&&D.firstRowScreen==this.layerConfig.firstRowScreen){var t=this.scrollTop+(D.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;t>0&&(this.scrollTop=t,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}D=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),S.translate(this.content,-this.scrollLeft,-D.offset);var i=D.width+2*this.$padding+"px",r=D.minHeight+"px";S.setStyle(this.content.style,"width",i),S.setStyle(this.content.style,"height",r)}if(e&this.CHANGE_H_SCROLL&&(S.translate(this.content,-this.scrollLeft,-D.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),e&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(D),this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D),this.$markerBack.update(D),this.$markerFront.update(D),this.$cursorLayer.update(D),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}if(e&this.CHANGE_SCROLL){this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(D):this.$textLayer.scrollLines(D),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(D):this.$gutterLayer.scrollLines(D)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D),this.$markerBack.update(D),this.$markerFront.update(D),this.$cursorLayer.update(D),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(D),this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(D),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(D),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(D),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,n=this.$maxLines*this.lineHeight,D=Math.min(n,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(D+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&D>this.$maxPixelHeight&&(D=this.$maxPixelHeight);var t=!(D<=2*this.lineHeight)&&e>n;if(D!=this.desiredHeight||this.$size.height!=this.desiredHeight||t!=this.$vScroll){t!=this.$vScroll&&(this.$vScroll=t,this.scrollBarV.setVisible(t));var S=this.container.clientWidth;this.container.style.height=D+"px",this.$updateCachedSize(!0,this.$gutterWidth,S,D),this.desiredHeight=D,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,n,D=this.session,t=this.$size,S=t.height<=2*this.lineHeight,i=this.session.getScreenLength()*this.lineHeight,r=this.$getLongestLine(),o=!S&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-r-2*this.$padding<0),g=this.$horizScroll!==o;g&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var s=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var a=t.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=l;var c=this.scrollMargin;this.session.setScrollTop(Math.max(-c.top,Math.min(this.scrollTop,i-t.scrollerHeight+c.bottom))),this.session.setScrollLeft(Math.max(-c.left,Math.min(this.scrollLeft,r+2*this.$padding-t.scrollerWidth+c.right)));var u=!S&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+l<0||this.scrollTop>c.top),h=s!==u;h&&(this.$vScroll=u,this.scrollBarV.setVisible(u));var d=this.scrollTop%this.lineHeight,p=Math.ceil(a/this.lineHeight)-1,f=Math.max(0,Math.round((this.scrollTop-d)/this.lineHeight)),m=f+p,y=this.lineHeight;f=D.screenToDocumentRow(f,0);var v=D.getFoldLine(f);v&&(f=v.start.row),e=D.documentToScreenRow(f,0),n=D.getRowLength(f)*y,m=Math.min(D.screenToDocumentRow(m,0),D.getLength()-1),a=t.scrollerHeight+D.getRowLength(m)*y+n,d=this.scrollTop-e*y;var b=0;return(this.layerConfig.width!=r||g)&&(b=this.CHANGE_H_SCROLL),(g||h)&&(b|=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),h&&(r=this.$getLongestLine())),this.layerConfig={width:r,padding:this.$padding,firstRow:f,firstRowScreen:e,lastRow:m,lineHeight:y,characterWidth:this.characterWidth,minHeight:a,maxHeight:i,offset:d,gutterOffset:y?Math.max(0,Math.ceil((d+t.height-t.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(r-this.$padding),b},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,n=this.$changedLines.lastRow;this.$changedLines=null;var D=this.layerConfig;if(!(e>D.lastRow+1)&&!(n<D.firstRow)){if(n===1/0){this.$showGutter&&this.$gutterLayer.update(D),this.$textLayer.update(D);return}return this.$textLayer.updateLines(D,e,n),!0}}},e.prototype.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},e.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},e.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},e.prototype.addGutterDecoration=function(e,n){this.$gutterLayer.addGutterDecoration(e,n)},e.prototype.removeGutterDecoration=function(e,n){this.$gutterLayer.removeGutterDecoration(e,n)},e.prototype.updateBreakpoints=function(e){this._rows=e,this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},e.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},e.prototype.showCursor=function(){this.$cursorLayer.showCursor()},e.prototype.scrollSelectionIntoView=function(e,n,D){this.scrollCursorIntoView(e,D),this.scrollCursorIntoView(n,D)},e.prototype.scrollCursorIntoView=function(e,n,D){if(0!==this.$size.scrollerHeight){var t=this.$cursorLayer.getPixelPosition(e),S=t.left,i=t.top,r=D&&D.top||0,o=D&&D.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var g=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;g+r>i?(n&&g+r>i+this.lineHeight&&(i-=n*this.$size.scrollerHeight),0===i&&(i=-this.scrollMargin.top),this.session.setScrollTop(i)):g+this.$size.scrollerHeight-o<i+this.lineHeight&&(n&&g+this.$size.scrollerHeight-o<i-this.lineHeight&&(i+=n*this.$size.scrollerHeight),this.session.setScrollTop(i+this.lineHeight+o-this.$size.scrollerHeight));var s=this.scrollLeft,a=2*this.layerConfig.characterWidth;S-a<s?((S-=a)<this.$padding+a&&(S=-this.scrollMargin.left),this.session.setScrollLeft(S)):(S+=a,s+this.$size.scrollerWidth<S+this.characterWidth?this.session.setScrollLeft(Math.round(S+this.characterWidth-this.$size.scrollerWidth)):s<=this.$padding&&S-s<this.characterWidth&&this.session.setScrollLeft(0))}},e.prototype.getScrollTop=function(){return this.session.getScrollTop()},e.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},e.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},e.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},e.prototype.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},e.prototype.alignCursor=function(e,n){"number"==typeof e&&(e={row:e,column:0});var D=this.$cursorLayer.getPixelPosition(e),t=this.$size.scrollerHeight-this.lineHeight,S=D.top-t*(n||0);return this.session.setScrollTop(S),S},e.prototype.$calcSteps=function(e,n){var D=0,t=this.STEPS,S=[],i=function(e,n,D){return D*(Math.pow(e-1,3)+1)+n};for(D=0;D<t;++D)S.push(i(D/this.STEPS,e,n-e));return S},e.prototype.scrollToLine=function(e,n,D,t){var S=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;n&&(S-=this.$size.scrollerHeight/2);var i=this.scrollTop;this.session.setScrollTop(S),!1!==D&&this.animateScrolling(i,t)},e.prototype.animateScrolling=function(e,n){var D=this.scrollTop;if(this.$animatedScroll){var t=this;if(e!=D){if(this.$scrollAnimation){var S=this.$scrollAnimation.steps;if(S.length&&(e=S[0])==D)return}var i=t.$calcSteps(e,D);this.$scrollAnimation={from:e,to:D,steps:i},clearInterval(this.$timer),t.session.setScrollTop(i.shift()),t.session.$scrollTop=D,this.$timer=setInterval(function(){return t.$stopAnimation?void r():t.session?void(i.length?(t.session.setScrollTop(i.shift()),t.session.$scrollTop=D):null!=D?(t.session.$scrollTop=-1,t.session.setScrollTop(D),D=null):r()):clearInterval(t.$timer)},10)}}function r(){t.$timer=clearInterval(t.$timer),t.$scrollAnimation=null,t.$stopAnimation=!1,n&&n()}},e.prototype.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},e.prototype.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},e.prototype.scrollTo=function(e,n){this.session.setScrollTop(n),this.session.setScrollLeft(e)},e.prototype.scrollBy=function(e,n){n&&this.session.setScrollTop(this.session.getScrollTop()+n),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},e.prototype.isScrollableBy=function(e,n){if(n<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||n>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},e.prototype.pixelToScreenCoordinates=function(e,n){if(this.$hasCssTransforms){var D={top:0,left:0},t=this.$fontMetrics.transformCoordinates([e,n]);e=t[1]-this.gutterWidth-this.margin.left,n=t[0]}else D=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-D.left-this.$padding,i=S/this.characterWidth,r=Math.floor((n+this.scrollTop-D.top)/this.lineHeight),o=this.$blockCursor?Math.floor(i):Math.round(i);return{row:r,column:o,side:i-o>0?1:-1,offsetX:S}},e.prototype.screenToTextCoordinates=function(e,n){if(this.$hasCssTransforms){var D={top:0,left:0},t=this.$fontMetrics.transformCoordinates([e,n]);e=t[1]-this.gutterWidth-this.margin.left,n=t[0]}else D=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-D.left-this.$padding,i=S/this.characterWidth,r=this.$blockCursor?Math.floor(i):Math.round(i),o=Math.floor((n+this.scrollTop-D.top)/this.lineHeight);return this.session.screenToDocumentPosition(o,Math.max(r,0),S)},e.prototype.textToScreenCoordinates=function(e,n){var D=this.scroller.getBoundingClientRect(),t=this.session.documentToScreenPosition(e,n),S=this.$padding+(this.session.$bidiHandler.isBidiRow(t.row,e)?this.session.$bidiHandler.getPosLeft(t.column):Math.round(t.column*this.characterWidth)),i=t.row*this.lineHeight;return{pageX:D.left+S-this.scrollLeft,pageY:D.top+i-this.scrollTop}},e.prototype.visualizeFocus=function(){S.addCssClass(this.container,"ace_focus")},e.prototype.visualizeBlur=function(){S.removeCssClass(this.container,"ace_focus")},e.prototype.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),void 0==e.useTextareaForIME&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(S.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},e.prototype.setCompositionText=function(e){var n=this.session.selection.cursor;this.addToken(e,"composition_placeholder",n.row,n.column),this.$moveTextAreaToCursor()},e.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),S.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},e.prototype.setGhostText=function(e,n){var D=this.session.selection.cursor,t=n||{row:D.row,column:D.column};this.removeGhostText();var i=this.$calculateWrappedTextChunks(e,t);this.addToken(i[0].text,"ghost_text",t.row,t.column),this.$ghostText={text:e,position:{row:t.row,column:t.column}};var r=S.createElement("div");if(i.length>1){var o,g=this.hideTokensAfterPosition(t.row,t.column);i.slice(1).forEach(function(e){var n=S.createElement("div"),D=S.createElement("span");D.className="ace_ghost_text",e.wrapped&&(n.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),D.appendChild(S.createTextNode(e.text)),n.appendChild(D),r.appendChild(n),o=n}),g.forEach(function(e){var n=S.createElement("span");b(e.type)||(n.className="ace_"+e.type.replace(/\./g," ace_")),n.appendChild(S.createTextNode(e.value)),o.appendChild(n)}),this.$ghostTextWidget={el:r,row:t.row,column:t.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var s=this.$cursorLayer.getPixelPosition(t,!0),a=this.container.getBoundingClientRect().height,l=i.length*this.lineHeight;if(l<a-s.top)return;l<a?this.scrollBy(0,(i.length-1)*this.lineHeight):this.scrollToRow(t.row)}},e.prototype.$calculateWrappedTextChunks=function(e,n){var D=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;D=D<=0?60:D;for(var t=e.split(/\r?\n/),S=[],i=0;i<t.length;i++){var r=this.session.$getDisplayTokens(t[i],n.column),o=this.session.$computeWrapSplits(r,D,this.session.$tabSize);if(o.length>0){var g=0;o.push(t[i].length);for(var s=0;s<o.length;s++){var a=t[i].slice(g,o[s]);S.push({text:a,wrapped:!0}),g=o[s]}}else S.push({text:t[i],wrapped:!1})}return S},e.prototype.removeGhostText=function(){if(this.$ghostText){var e=this.$ghostText.position;this.removeExtraToken(e.row,e.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},e.prototype.addToken=function(e,n,D,t){var S=this.session;S.bgTokenizer.lines[D]=null;var i={type:n,value:e},r=S.getTokens(D);if(null!=t&&r.length)for(var o=0,g=0;g<r.length;g++){var s=r[g];if(t<=(o+=s.value.length)){var a=s.value.length-(o-t),l=s.value.slice(0,a),c=s.value.slice(a);r.splice(g,1,{type:s.type,value:l},i,{type:s.type,value:c});break}}else r.push(i);this.updateLines(D,D)},e.prototype.hideTokensAfterPosition=function(e,n){for(var D=this.session.getTokens(e),t=0,S=!1,i=[],r=0;r<D.length;r++){var o=D[r];if(t+=o.value.length,"ghost_text"!==o.type){if(S){i.push({type:o.type,value:o.value}),o.type="hidden_token";continue}t===n&&(S=!0)}}return this.updateLines(e,e),i},e.prototype.removeExtraToken=function(e,n){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,n){var D=this;if(this.$themeId=e,D._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)i(e);else{var t=e||this.$options.theme.initialValue;r.loadModule(["theme",t],i)}function i(t){if(D.$themeId!=e)return n&&n();if(!t||!t.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");t.$id&&(D.$themeId=t.$id),S.importCssString(t.cssText,t.cssClass,D.container),D.theme&&S.removeCssClass(D.container,D.theme.cssClass);var i="padding"in t?t.padding:"padding"in(D.theme||{})?4:D.$padding;D.$padding&&i!=D.$padding&&D.setPadding(i),D.$theme=t.cssClass,D.theme=t,S.addCssClass(D.container,t.cssClass),S.setCssClass(D.container,"ace_dark",t.isDark),D.$size&&(D.$size.width=0,D.$updateSizeAsync()),D._dispatchEvent("themeLoaded",{theme:t}),n&&n(),v.isSafari&&D.scroller&&(D.scroller.style.background="red",D.scroller.style.background="")}},e.prototype.getTheme=function(){return this.$themeId},e.prototype.setStyle=function(e,n){S.setCssClass(this.container,e,!1!==n)},e.prototype.unsetStyle=function(e){S.removeCssClass(this.container,e)},e.prototype.setCursorStyle=function(e){S.setStyle(this.scroller.style,"cursor",e)},e.prototype.setMouseCursor=function(e){S.setStyle(this.scroller.style,"cursor",e)},e.prototype.attachToShadowRoot=function(){S.importCssString(m,"ace_editor.css",this.container)},e.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},e.prototype.$updateCustomScrollbar=function(e){var n=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,!0===e?(this.scrollBarV=new h(this.container,this),this.scrollBarH=new u(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.$scrollDecorator=new y(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}))},e.prototype.$addResizeObserver=function(){if(window.ResizeObserver&&!this.$resizeObserver){var e=this;this.$resizeTimer=i.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(n){var D=n[0].contentRect.width,t=n[0].contentRect.height;Math.abs(e.$size.width-D)>1||Math.abs(e.$size.height-t)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();w.prototype.CHANGE_CURSOR=1,w.prototype.CHANGE_MARKER=2,w.prototype.CHANGE_GUTTER=4,w.prototype.CHANGE_SCROLL=8,w.prototype.CHANGE_LINES=16,w.prototype.CHANGE_TEXT=32,w.prototype.CHANGE_SIZE=64,w.prototype.CHANGE_MARKER_BACK=128,w.prototype.CHANGE_MARKER_FRONT=256,w.prototype.CHANGE_FULL=512,w.prototype.CHANGE_H_SCROLL=1024,w.prototype.$changes=0,w.prototype.$padding=null,w.prototype.$frozen=!1,w.prototype.STEPS=8,t.implement(w.prototype,f),r.defineOptions(w.prototype,"renderer",{useResizeObserver:{set:function(e){!e&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):e&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(e){this.$gutterLayer.$useSvgGutterIcons=e},initialValue:!1},showFoldedAnnotations:{set:function(e){this.$gutterLayer.$showFoldedAnnotations=e},initialValue:!1},fadeFoldWidgets:{set:function(e){S.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(e){!0==this.$textLayer.setHighlightIndentGuides(e)?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<0x1ffffffffffff||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(e){this.$updateCustomScrollbar(e)},initialValue:!1},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!v.isMobile&&!v.isIE}}),n.VirtualRenderer=w}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,n,D){"use strict";var t=e("../lib/oop"),S=e("../lib/net"),i=e("../lib/event_emitter").EventEmitter,r=e("../config");function o(e){var n="importScripts('"+S.qualifyURL(e)+"');";try{return new Blob([n],{type:"application/javascript"})}catch(e){var D=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return D.append(n),D.getBlob("application/javascript")}}function g(e){if("u"<typeof Worker)return{postMessage:function(){},terminate:function(){}};if(r.get("loadWorkerFromBlob")){var n=o(e);return new Worker((window.URL||window.webkitURL).createObjectURL(n))}return new Worker(e)}var s=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){t.implement(this,i),this.$createWorkerFromOldConfig=function(n,D,t,S,i){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),r.get("packaged")||!e.toUrl)S=S||r.moduleUrl(D,"worker");else{var o=this.$normalizePath;S=S||o(e.toUrl("ace/worker/worker.js",null,"_"));var s={};n.forEach(function(n){s[n]=o(e.toUrl(n,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=g(S),i&&this.send("importScripts",i),this.$worker.postMessage({init:!0,tlns:s,module:D,classname:t}),this.$worker},this.onMessage=function(e){var n=e.data;switch(n.type){case"event":this._signal(n.name,{data:n.data});break;case"call":var D=this.callbacks[n.id];D&&(D(n.data),delete this.callbacks[n.id]);break;case"error":this.reportError(n.data);break;case"log":window.console&&console.log&&console.log.apply(console,n.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return S.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(e){e.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,n){this.$worker.postMessage({command:e,args:n})},this.call=function(e,n,D){if(D){var t=this.callbackId++;this.callbacks[t]=D,n.push(t)}this.send(e,n)},this.emit=function(e,n){try{n.data&&n.data.err&&(n.data.err={message:n.data.err.message,stack:n.data.err.stack,code:n.data.err.code}),this.$worker&&this.$worker.postMessage({event:e,data:{data:n.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener,!0)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(s.prototype),n.UIWorkerClient=function(e,n,D){var t=null,S=!1,o=Object.create(i),g=[],a=new s({messageBuffer:g,terminate:function(){},postMessage:function(e){g.push(e),t&&(S?setTimeout(l):l())}});a.setEmitSync=function(e){S=e};var l=function(){var e=g.shift();e.command?t[e.command].apply(t,e.args):e.event&&o._signal(e.event,e.data)};return o.postMessage=function(e){a.onMessage({data:e})},o.callback=function(e,n){this.postMessage({type:"call",id:n,data:e})},o.emit=function(e,n){this.postMessage({type:"event",name:e,data:n})},r.loadModule(["worker",n],function(e){for(t=new e[D](o);g.length;)l()}),a},n.WorkerClient=s,n.createWorker=g}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,n,D){"use strict";var t=e("./range").Range,S=e("./lib/event_emitter").EventEmitter,i=e("./lib/oop"),r=function(){function e(e,n,D,t,S,i){var r=this;this.length=n,this.session=e,this.doc=e.getDocument(),this.mainClass=S,this.othersClass=i,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=t,this.$onCursorChange=function(){setTimeout(function(){r.onCursorChange()})},this.$pos=D;var o=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=o.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return e.prototype.setup=function(){var e=this,n=this.doc,D=this.session;this.selectionBefore=D.selection.toJSON(),D.selection.inMultiSelectMode&&D.selection.toSingleRange(),this.pos=n.createAnchor(this.$pos.row,this.$pos.column);var S=this.pos;S.$insertRight=!0,S.detach(),S.markerId=D.addMarker(new t(S.row,S.column,S.row,S.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(D){var t=n.createAnchor(D.row,D.column);t.$insertRight=!0,t.detach(),e.others.push(t)}),D.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,n=this;this.othersActive=!0,this.others.forEach(function(D){D.markerId=e.addMarker(new t(D.row,D.column,D.row,D.column+n.length),n.othersClass,null,!1)})}},e.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},e.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var n=e;if(n.start.row===n.end.row&&n.start.row===this.pos.row){this.$updating=!0;var D="insert"===e.action?n.end.column-n.start.column:n.start.column-n.end.column,S=n.start.column>=this.pos.column&&n.start.column<=this.pos.column+this.length+1,i=n.start.column-this.pos.column;if(this.updateAnchors(e),S&&(this.length+=D),S&&!this.session.$fromUndo){if("insert"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],g={row:o.row,column:o.column+i};this.doc.insertMergedLines(g,e.lines)}else if("remove"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],g={row:o.row,column:o.column+i};this.doc.remove(new t(g.row,g.column,g.row,g.column-D))}}this.$updating=!1,this.updateMarkers()}},e.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var n=this.others.length;n--;)this.others[n].onChange(e);this.updateMarkers()},e.prototype.updateMarkers=function(){if(!this.$updating){var e=this,n=this.session,D=function(D,S){n.removeMarker(D.markerId),D.markerId=n.addMarker(new t(D.row,D.column,D.row,D.column+e.length),S,null,!1)};D(this.pos,this.mainClass);for(var S=this.others.length;S--;)D(this.others[S],this.othersClass)}},e.prototype.onCursorChange=function(e){if(!this.$updating&&this.session){var n=this.session.selection.getCursor();n.row===this.pos.row&&n.column>=this.pos.column&&n.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},e.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},e.prototype.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),n=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,D=0;D<n;D++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();i.implement(r.prototype,S),n.PlaceHolder=r}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,D){var t=e("../lib/event"),S=e("../lib/useragent");function i(e,n){return e.row==n.row&&e.column==n.column}n.onMouseDown=function(e){var n=e.domEvent,D=n.altKey,r=n.shiftKey,o=n.ctrlKey,g=e.getAccelKey(),s=e.getButton();if(o&&S.isMac&&(s=n.button),e.editor.inMultiSelectMode&&2==s)return void e.editor.textInput.onContextMenu(e.domEvent);if(!o&&!D&&!g){0===s&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===s){var a=e.editor,l=a.selection,c=a.inMultiSelectMode,u=e.getDocumentPosition(),h=l.getCursor(),d=e.inSelection()||l.isEmpty()&&i(u,h),p=e.x,f=e.y,m=function(e){p=e.clientX,f=e.clientY},y=a.session,v=a.renderer.pixelToScreenCoordinates(p,f),b=v;if(a.$mouseHandler.$enableJumpToDef)o&&D||g&&D?L=r?"block":"add":D&&a.$blockSelectEnabled&&(L="block");else if(g&&!D){if(L="add",!c&&r)return}else D&&a.$blockSelectEnabled&&(L="block");if(L&&S.isMac&&n.ctrlKey&&a.$mouseHandler.cancelContextMenu(),"add"==L){if(!c&&d)return;if(!c){var w=l.toOrientedRange();a.addSelectionMarker(w)}var M=l.rangeList.rangeAtPoint(u);a.inVirtualSelectionMode=!0,r&&(M=null,w=l.ranges[0]||w,a.removeSelectionMarker(w)),a.once("mouseup",function(){var e=l.toOrientedRange();M&&e.isEmpty()&&i(M.cursor,e.cursor)?l.substractPoint(e.cursor):(r?l.substractPoint(w.cursor):w&&(a.removeSelectionMarker(w),l.addRange(w)),l.addRange(e)),a.inVirtualSelectionMode=!1})}else if("block"==L){e.stop(),a.inVirtualSelectionMode=!0;var L,$,_=[],x=function(){var e=a.renderer.pixelToScreenCoordinates(p,f),n=y.screenToDocumentPosition(e.row,e.column,e.offsetX);i(b,e)&&i(n,l.lead)||(b=e,a.selection.moveToPosition(n),a.renderer.scrollCursorIntoView(),a.removeSelectionMarkers(_),_=l.rectangularRangeBlock(b,v),a.$mouseHandler.$clickSelection&&1==_.length&&_[0].isEmpty()&&(_[0]=a.$mouseHandler.$clickSelection.clone()),_.forEach(a.addSelectionMarker,a),a.updateSelectionMarkers())};c&&!g?l.toSingleRange():!c&&g&&($=l.toOrientedRange(),a.addSelectionMarker($)),r?v=y.documentToScreenPosition(l.lead):l.moveToPosition(u),b={row:-1,column:-1};var C=function(e){x(),clearInterval(k),a.removeSelectionMarkers(_),_.length||(_=[l.toOrientedRange()]),$&&(a.removeSelectionMarker($),l.toSingleRange($));for(var n=0;n<_.length;n++)l.addRange(_[n]);a.inVirtualSelectionMode=!1,a.$mouseHandler.$clickSelection=null},E=x;t.capture(a.container,m,C);var k=setInterval(function(){E()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,n,D){n.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(e){e.multiSelect.rangeCount>1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],n.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}],n.keyboardHandler=new(e("../keyboard/hash_handler")).HashHandler(n.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,n,D){var t=e("./range_list").RangeList,S=e("./range").Range,i=e("./selection").Selection,r=e("./mouse/multi_select_handler").onMouseDown,o=e("./lib/event"),g=e("./lib/lang"),s=e("./commands/multi_select_commands");n.commands=s.defaultCommands.concat(s.multiSelectCommands);var a=new(e("./search")).Search;function l(e,n,D){return a.$options.wrap=!0,a.$options.needle=n,a.$options.backwards=-1==D,a.find(e)}(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(e("./edit_session").EditSession.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,n){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var D=this.toOrientedRange();if(this.rangeList.add(D),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),n||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(D),this.$onAddRange(D)}e.cursor||(e.cursor=e.end);var t=this.rangeList.add(e);return this.$onAddRange(e),t.length&&this.$onRemoveRange(t),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),n||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var n=this.rangeList.removeAll();n.length&&this.$onRemoveRange(n),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var n=this.rangeList.substractPoint(e);if(n)return this.$onRemoveRange(n),n[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var n=this.rangeList.ranges.pop();e.push(n),this.rangeCount=0}for(var D=e.length;D--;){var t=this.ranges.indexOf(e[D]);this.ranges.splice(t,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(n=n||this.ranges[0])&&!n.isEqual(this.getRange())&&this.fromOrientedRange(n)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new t,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var e=this.ranges.length?this.ranges:[this.getRange()],n=[],D=0;D<e.length;D++){var t=e[D],i=t.start.row,r=t.end.row;if(i===r)n.push(t.clone());else{for(n.push(new S(i,t.start.column,i,this.session.getLine(i).length));++i<r;)n.push(this.getLineRange(i,!0));n.push(new S(r,0,r,t.end.column))}0!=D||this.isBackwards()||(n=n.reverse())}this.toSingleRange();for(var D=n.length;D--;)this.addRange(n[D])},this.joinSelections=function(){var e=this.rangeList.ranges,n=e[e.length-1],D=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(D,n.cursor==n.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,n=e[e.length-1],D=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(D,n.cursor==n.start)}else{var t=this.session.documentToScreenPosition(this.cursor),i=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(t,i).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,n,D){var t,i=[],r=e.column<n.column;if(r)var o=e.column,g=n.column,s=e.offsetX,a=n.offsetX;else var o=n.column,g=e.column,s=n.offsetX,a=e.offsetX;var l=e.row<n.row;if(l)var c=e.row,h=n.row;else var c=n.row,h=e.row;o<0&&(o=0),c<0&&(c=0),c==h&&(D=!0);for(var d=c;d<=h;d++){var p=S.fromPoints(this.session.screenToDocumentPosition(d,o,s),this.session.screenToDocumentPosition(d,g,a));if(p.isEmpty()){if(t&&u(p.end,t))break;t=p.end}p.cursor=r?p.start:p.end,i.push(p)}if(l&&i.reverse(),!D){for(var f=i.length-1;i[f].isEmpty()&&f>0;)f--;if(f>0)for(var m=0;i[m].isEmpty();)m++;for(var y=f;y>=m;y--)i[y].isEmpty()&&i.splice(y,1)}return i}}).call(i.prototype);var c=e("./editor").Editor;function u(e,n){return e.row==n.row&&e.column==n.column}function h(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=n.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",r),e.commands.addCommands(s.defaultCommands),d(e))}function d(e){if(e.textInput){var n=e.textInput.getElement(),D=!1;o.addListener(n,"keydown",function(n){var S=18==n.keyCode&&!(n.ctrlKey||n.shiftKey||n.metaKey);e.$blockSelectEnabled&&S?D||(e.renderer.setMouseCursor("crosshair"),D=!0):D&&t()},e),o.addListener(n,"keyup",t,e),o.addListener(n,"blur",t,e)}function t(n){D&&(e.renderer.setMouseCursor(""),D=!1)}}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var n=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",n),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var n=this.session.$selectionMarkers.indexOf(e);-1!=n&&this.session.$selectionMarkers.splice(n,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var n=this.session.$selectionMarkers,D=e.length;D--;){var t=e[D];if(t.marker){this.session.removeMarker(t.marker);var S=n.indexOf(t);-1!=S&&n.splice(S,1)}}this.session.selectionMarkerCount=n.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(s.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(s.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var n=e.command,D=e.editor;if(D.multiSelect){if(n.multiSelectAction)"forEach"==n.multiSelectAction?t=D.forEachSelection(n,e.args):"forEachLine"==n.multiSelectAction?t=D.forEachSelection(n,e.args,!0):"single"==n.multiSelectAction?(D.exitMultiSelectMode(),t=n.exec(D,e.args||{})):t=n.multiSelectAction(D,e.args||{});else{var t=n.exec(D,e.args||{});D.multiSelect.addRange(D.multiSelect.toOrientedRange()),D.multiSelect.mergeOverlappingRanges()}return t}},this.forEachSelection=function(e,n,D){if(!this.inVirtualSelectionMode){var t,S=D&&D.keepOrder,r=!0==D||D&&D.$byLines,o=this.session,g=this.selection,s=g.rangeList,a=(S?g:s).ranges;if(!a.length)return e.exec?e.exec(this,n||{}):e(this,n||{});var l=g._eventRegistry;g._eventRegistry={};var c=new i(o);this.inVirtualSelectionMode=!0;for(var u=a.length;u--;){if(r)for(;u>0&&a[u].start.row==a[u-1].end.row;)u--;c.fromOrientedRange(a[u]),c.index=u,this.selection=o.selection=c;var h=e.exec?e.exec(this,n||{}):e(this,n||{});t||void 0===h||(t=h),c.toOrientedRange(a[u])}c.detach(),this.selection=o.selection=g,this.inVirtualSelectionMode=!1,g._eventRegistry=l,g.mergeOverlappingRanges(),g.ranges[0]&&g.fromOrientedRange(g.ranges[0]);var d=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),d&&d.from==d.to&&this.renderer.animateScrolling(d.from),t}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var n=this.multiSelect.rangeList.ranges,D=[],t=0;t<n.length;t++)D.push(this.session.getTextRange(n[t]));var S=this.session.getDocument().getNewLineCharacter();(e=D.join(S)).length==(D.length-1)*S.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,n){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var D=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||n!=this.multiSelect.anchor){var t=n==this.multiSelect.anchor?D.cursor==D.start?D.end:D.start:D.cursor;t.row!=n.row||this.session.$clipPositionToDocument(t.row,t.column).column!=n.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,n,D){if((n=n||{}).needle=e||n.needle,void 0==n.needle){var t=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();n.needle=this.session.getTextRange(t)}this.$search.set(n);var S=this.$search.findAll(this.session);if(!S.length)return 0;var i=this.multiSelect;D||i.toSingleRange(S[0]);for(var r=S.length;r--;)i.addRange(S[r],!0);return t&&i.rangeList.rangeAtPoint(t.start)&&i.addRange(t,!0),S.length},this.selectMoreLines=function(e,n){var D=this.selection.toOrientedRange(),t=D.cursor==D.end,i=this.session.documentToScreenPosition(D.cursor);this.selection.$desiredColumn&&(i.column=this.selection.$desiredColumn);var r=this.session.screenToDocumentPosition(i.row+e,i.column);if(D.isEmpty())var o=r;else var g=this.session.documentToScreenPosition(t?D.end:D.start),o=this.session.screenToDocumentPosition(g.row+e,g.column);if(t){var s=S.fromPoints(r,o);s.cursor=s.start}else{var s=S.fromPoints(o,r);s.cursor=s.end}if(s.desiredColumn=i.column,this.selection.inMultiSelectMode){if(n)var a=D.cursor}else this.selection.addRange(D);this.selection.addRange(s),a&&this.selection.substractPoint(a)},this.transposeSelections=function(e){for(var n=this.session,D=n.multiSelect,t=D.ranges,S=t.length;S--;){var i=t[S];if(i.isEmpty()){var r=n.getWordRange(i.start.row,i.start.column);i.start.row=r.start.row,i.start.column=r.start.column,i.end.row=r.end.row,i.end.column=r.end.column}}D.mergeOverlappingRanges();for(var o=[],S=t.length;S--;){var i=t[S];o.unshift(n.getTextRange(i))}e<0?o.unshift(o.pop()):o.push(o.shift());for(var S=t.length;S--;){var i=t[S],g=i.clone();n.replace(i,o[S]),i.start.row=g.start.row,i.start.column=g.start.column}D.fromOrientedRange(D.ranges[0])},this.selectMore=function(e,n,D){var t=this.session,S=t.multiSelect.toOrientedRange();if(!S.isEmpty()||((S=t.getWordRange(S.start.row,S.start.column)).cursor=-1==e?S.start:S.end,this.multiSelect.addRange(S),!D)){var i=t.getTextRange(S),r=l(t,i,e);r&&(r.cursor=-1==e?r.start:r.end,this.session.unfold(r),this.multiSelect.addRange(r),this.renderer.scrollCursorIntoView(null,.5)),n&&this.multiSelect.substractPoint(S.cursor)}},this.alignCursors=function(){var e=this.session,n=e.multiSelect,D=n.ranges,t=-1,i=D.filter(function(e){if(e.cursor.row==t)return!0;t=e.cursor.row});if(D.length&&i.length!=D.length-1){i.forEach(function(e){n.substractPoint(e.cursor)});var r=0,o=1/0,s=D.map(function(n){var D=n.cursor,t=e.getLine(D.row).substr(D.column).search(/\S/g);return -1==t&&(t=0),D.column>r&&(r=D.column),t<o&&(o=t),t});D.forEach(function(n,D){var t=n.cursor,i=r-t.column,a=s[D]-o;i>a?e.insert(t,g.stringRepeat(" ",i-a)):e.remove(new S(t.row,t.column,t.row,t.column-i+a)),n.start.column=n.end.column=r,n.start.row=n.end.row=t.row,n.cursor=n.end}),n.fromOrientedRange(D[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var a=this.selection.getRange(),l=a.start.row,c=a.end.row,u=l==c;if(u){var h,d=this.session.getLength();do h=this.session.getLine(c);while(/[=:]/.test(h)&&++c<d);do h=this.session.getLine(l);while(/[=:]/.test(h)&&--l>0);l<0&&(l=0),c>=d&&(c=d-1)}var p=this.session.removeFullLines(l,c);p=this.$reAlignText(p,u),this.session.insert({row:l,column:0},p.join("\n")+"\n"),u||(a.start.column=0,a.end.column=p[p.length-1].length),this.selection.setRange(a)}},this.$reAlignText=function(e,n){var D,t,S,i=!0,r=!0;return e.map(function(e){var n=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return n?(null==D?(D=n[1].length,t=n[2].length,S=n[3].length):(D+t+S!=n[1].length+n[2].length+n[3].length&&(r=!1),D!=n[1].length&&(i=!1),D>n[1].length&&(D=n[1].length),t<n[2].length&&(t=n[2].length),S>n[3].length&&(S=n[3].length)),n):[e]}).map(n?s:i?r?a:s:l);function o(e){return g.stringRepeat(" ",e)}function s(e){return e[2]?o(D)+e[2]+o(t-e[2].length+S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function a(e){return e[2]?o(D+t-e[2].length)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?o(D)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(c.prototype),n.onSessionChange=function(e){var n=e.session;n&&!n.multiSelect&&(n.$selectionMarkers=[],n.selection.$initRangeList(),n.multiSelect=n.selection),this.multiSelect=n&&n.multiSelect;var D=e.oldSession;D&&(D.multiSelect.off("addRange",this.$onAddRange),D.multiSelect.off("removeRange",this.$onRemoveRange),D.multiSelect.off("multiSelect",this.$onMultiSelect),D.multiSelect.off("singleSelect",this.$onSingleSelect),D.multiSelect.lead.off("change",this.$checkMultiselectChange),D.multiSelect.anchor.off("change",this.$checkMultiselectChange)),n&&(n.multiSelect.on("addRange",this.$onAddRange),n.multiSelect.on("removeRange",this.$onRemoveRange),n.multiSelect.on("multiSelect",this.$onMultiSelect),n.multiSelect.on("singleSelect",this.$onSingleSelect),n.multiSelect.lead.on("change",this.$checkMultiselectChange),n.multiSelect.anchor.on("change",this.$checkMultiselectChange)),n&&this.inMultiSelectMode!=n.selection.inMultiSelectMode&&(n.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},n.MultiSelect=h,e("./config").defineOptions(c.prototype,"editor",{enableMultiselect:{set:function(e){h(this),e?this.on("mousedown",r):this.off("mousedown",r)},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,n,D){var t=e.getLine(D);return this.foldingStartMarker.test(t)?"start":"markbeginend"==n&&this.foldingStopMarker&&this.foldingStopMarker.test(t)?"end":""},this.getFoldWidgetRange=function(e,n,D){return null},this.indentationBlock=function(e,n,D){var S=/\S/,i=e.getLine(n),r=i.search(S);if(-1!=r){for(var o=D||i.length,g=e.getLength(),s=n,a=n;++n<g;){var l=e.getLine(n).search(S);if(-1!=l){if(l<=r){var c=e.getTokenAt(n,0);if(!c||"string"!==c.type)break}a=n}}if(a>s){var u=e.getLine(a).length;return new t(s,o,a,u)}}},this.openingBracketBlock=function(e,n,D,S,i){var r={row:D,column:S+1},o=e.$findClosingBracket(n,r,i);if(o){var g=e.foldWidgets[o.row];return null==g&&(g=e.getFoldWidget(o.row)),"start"==g&&o.row>r.row&&(o.row--,o.column=e.getLine(o.row).length),t.fromPoints(r,o)}},this.closingBracketBlock=function(e,n,D,S,i){var r={row:D,column:S},o=e.$findOpeningBracket(n,r);if(o)return o.column++,r.column--,t.fromPoints(o,r)}}).call((n.FoldMode=function(){}).prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range","ace/config"],function(e,n,D){"use strict";var t=e("../line_widgets").LineWidgets,S=e("../lib/dom"),i=e("../range").Range,r=e("../config").nls;function o(e,n,D){for(var t=0,S=e.length-1;t<=S;){var i=t+S>>1,r=D(n,e[i]);if(r>0)t=i+1;else{if(!(r<0))return i;S=i-1}}return-(t+1)}function g(e,n,D){var t=e.getAnnotations().sort(i.comparePoints);if(t.length){var S=o(t,{row:n,column:-1},i.comparePoints);S<0&&(S=-S-1),S>=t.length?S=D>0?0:t.length-1:0===S&&D<0&&(S=t.length-1);var r=t[S];if(r&&D){if(r.row===n){do r=t[S+=D];while(r&&r.row===n);if(!r)return t.slice()}var g=[];n=r.row;do g[D<0?"unshift":"push"](r),r=t[S+=D];while(r&&r.row==n);return g.length&&g}}}n.showErrorMarker=function(e,n){var D,i=e.session;i.widgetManager||(i.widgetManager=new t(i),i.widgetManager.attach(e));var o=e.getCursorPosition(),s=o.row,a=i.widgetManager.getWidgetsAtRow(s).filter(function(e){return"errorMarker"==e.type})[0];a?a.destroy():s-=n;var l=g(i,s,n);if(l){var c=l[0];o.column=(c.pos&&"number"!=typeof c.column?c.pos.sc:c.column)||0,o.row=c.row,D=e.renderer.$gutterLayer.$annotations[o.row]}else{if(a)return;D={displayText:[r("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(o.row),e.selection.moveToPosition(o);var u={row:o.row,fixedWidth:!0,coverGutter:!0,el:S.createElement("div"),type:"errorMarker"},h=u.el.appendChild(S.createElement("div")),d=u.el.appendChild(S.createElement("div"));d.className="error_widget_arrow "+D.className;var p=e.renderer.$cursorLayer.getPixelPosition(o).left;d.style.left=p+e.renderer.gutterWidth-5+"px",u.el.className="error_widget_wrapper",h.className="error_widget "+D.className,D.displayText.forEach(function(e,n){h.appendChild(S.createTextNode(e)),n<D.displayText.length-1&&h.appendChild(S.createElement("br"))}),h.appendChild(S.createElement("div"));var f=function(e,n,D){if(0===n&&("esc"===D||"return"===D))return u.destroy(),{command:"null"}};u.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(f),i.widgetManager.removeLineWidget(u),e.off("changeSelection",u.destroy),e.off("changeSession",u.destroy),e.off("mouseup",u.destroy),e.off("change",u.destroy))},e.keyBinding.addKeyboardHandler(f),e.on("changeSelection",u.destroy),e.on("changeSession",u.destroy),e.on("mouseup",u.destroy),e.on("change",u.destroy),e.session.widgetManager.addLineWidget(u),u.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:u.el.offsetHeight})},S.importCssString("\n .error_widget_wrapper {\n background: inherit;\n color: inherit;\n border:none\n }\n .error_widget {\n border-top: solid 2px;\n border-bottom: solid 2px;\n margin: 5px 0;\n padding: 10px 40px;\n white-space: pre-wrap;\n }\n .error_widget.ace_error, .error_widget_arrow.ace_error{\n border-color: #ff5a5a\n }\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n border-color: #F1D817\n }\n .error_widget.ace_info, .error_widget_arrow.ace_info{\n border-color: #5a5a5a\n }\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n border-color: #5aaa5a\n }\n .error_widget_arrow {\n position: absolute;\n border: solid 5px;\n border-top-color: transparent!important;\n border-right-color: transparent!important;\n border-left-color: transparent!important;\n top: -5px;\n }\n","error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(e,n,D){"use strict";e("./loader_build")(n);var t=e("./lib/dom"),S=e("./range").Range,i=e("./editor").Editor,r=e("./edit_session").EditSession,o=e("./undomanager").UndoManager,g=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),n.config=e("./config"),n.edit=function(e,D){if("string"==typeof e){var S=e;if(!(e=document.getElementById(S)))throw Error("ace.edit can't find div #"+S)}if(e&&e.env&&e.env.editor instanceof i)return e.env.editor;var r="";if(e&&/input|textarea/i.test(e.tagName)){var o=e;r=o.value,e=t.createElement("pre"),o.parentNode.replaceChild(e,o)}else e&&(r=e.textContent,e.innerHTML="");var s=n.createEditSession(r),a=new i(new g(e),s,D),l={document:s,editor:a,onResize:a.resize.bind(a,null)};return o&&(l.textarea=o),a.on("destroy",function(){l.editor.container.env=null}),a.container.env=a.env=l,a},n.createEditSession=function(e,n){var D=new r(e,n);return D.setUndoManager(new o),D},n.Range=S,n.Editor=i,n.EditSession=r,n.UndoManager=o,n.VirtualRenderer=g,n.version=n.config.version}),function(){ace.require(["ace/ace"],function(n){n&&(n.config.init(!0),n.define=ace.define);var D=function(){return this}();for(var t in!D&&"u">typeof window&&(D=window),!D&&"u">typeof self&&(D=self),D.ace||(D.ace=n),n)n.hasOwnProperty(t)&&(D.ace[t]=n[t]);D.ace.default=D.ace,e&&(e.exports=D.ace)})}()},20047(e,n,D){e=D.nmd(e),ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(e,n,D){"use strict";var t=e("./lib/dom"),S=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,r=e("./lib/lang"),o=e("./range").Range,g=e("./range_list").RangeList,s=e("./keyboard/hash_handler").HashHandler,a=e("./tokenizer").Tokenizer,l=e("./clipboard"),c={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,n,D){var t=e.session.getTextRange();return D?t.replace(/\n\r?([ \t]*\S)/g,"\n"+D+"$1"):t},CURRENT_LINE:function(e){return e.session.getLine(e.getCursorPosition().row)},PREV_LINE:function(e){return e.session.getLine(e.getCursorPosition().row-1)},LINE_INDEX:function(e){return e.getCursorPosition().row},LINE_NUMBER:function(e){return e.getCursorPosition().row+1},SOFT_TABS:function(e){return e.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(e){return e.session.getTabSize()},CLIPBOARD:function(e){return l.getText&&l.getText()},FILENAME:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0]},FILENAME_BASE:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(e){return this.FILEPATH(e).replace(/[^/\\]*$/,"")},FILEPATH:function(e){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(e){var n=e.session.$mode||{};return n.blockComment&&n.blockComment.start||""},BLOCK_COMMENT_END:function(e){var n=e.session.$mode||{};return n.blockComment&&n.blockComment.end||""},LINE_COMMENT:function(e){return(e.session.$mode||{}).lineCommentStart||""},CURRENT_YEAR:u.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:u.bind(null,{year:"2-digit"}),CURRENT_MONTH:u.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:u.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:u.bind(null,{month:"short"}),CURRENT_DATE:u.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:u.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:u.bind(null,{weekday:"short"}),CURRENT_HOUR:u.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:u.bind(null,{minute:"2-digit"}),CURRENT_SECOND:u.bind(null,{second:"2-digit"})};function u(e){var n=new Date().toLocaleString("en-us",e);return 1==n.length?"0"+n:n}c.SELECTED_TEXT=c.SELECTION;var h=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=c}return e.prototype.getTokenizer=function(){return e.$tokenizer||this.createTokenizer()},e.prototype.createTokenizer=function(){function n(e){return(e=e.substr(1),/^\d+$/.test(e))?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function D(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var t={regex:"/("+D("/")+"+)/",onMatch:function(e,n,D){var t=D[0];return t.fmtString=!0,t.guard=e.slice(1,-1),t.flag="",""},next:"formatString"};return e.$tokenizer=new a({start:[{regex:/\\./,onMatch:function(e,n,D){var t=e[1];return"}"==t&&D.length?e=t:-1!="`$\\".indexOf(t)&&(e=t),[e]}},{regex:/}/,onMatch:function(e,n,D){return[D.length?D.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:n},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,D,t){var S=n(e.substr(1));return t.unshift(S[0]),S},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+D("\\|")+"*\\|",onMatch:function(e,n,D){var t=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return D[0].choices=t,[t[0]]},next:"start"},t,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,n,D){return D.length&&D[0].expectElse?(D[0].expectElse=!1,D[0].ifEnd={elseEnd:D[0]},[D[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,n,D){var t=e[1];return"}"==t&&D.length||-1!="`$\\".indexOf(t)?e=t:"n"==t?e="\n":"t"==t?e=" ":-1!="ulULE".indexOf(t)&&(e={changeCase:t,local:t>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,n,D){var t=D.shift();return t&&(t.flag=e.slice(1,-1)),this.next=t&&t.tabstopId?"start":"",[t||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,n,D){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,n,D){var t={text:e.slice(2)};return D.unshift(t),[t]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,n,D){var t=D.shift();return this.next=t&&t.tabstopId?"start":"",[t||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,n,D){return D[0].formatFunction=e.slice(2,-1),[D.shift()]},next:"formatString"},t,{regex:/:[\?\-+]?/,onMatch:function(e,n,D){"+"==e[1]&&(D[0].ifEnd=D[0]),"?"==e[1]&&(D[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),e.$tokenizer},e.prototype.tokenizeTmSnippet=function(e,n){return this.getTokenizer().getLineTokens(e,n).tokens.map(function(e){return e.value||e})},e.prototype.getVariableValue=function(e,n,D){if(/^\d+$/.test(n))return(this.variables.__||{})[n]||"";if(/^[A-Z]\d+$/.test(n))return(this.variables[n[0]+"__"]||{})[n.substr(1)]||"";if(n=n.replace(/^TM_/,""),!this.variables.hasOwnProperty(n))return"";var t=this.variables[n];return"function"==typeof t&&(t=this.variables[n](e,n,D)),null==t?"":t},e.prototype.tmStrFormat=function(e,n,D){if(!n.fmt)return e;var t=n.flag||"",S=n.guard;S=new RegExp(S,t.replace(/[^gim]/g,""));var i="string"==typeof n.fmt?this.tokenizeTmSnippet(n.fmt,"formatString"):n.fmt,r=this;return e.replace(S,function(){var e=r.variables.__;r.variables.__=[].slice.call(arguments);for(var n=r.resolveVariables(i,D),t="E",S=0;S<n.length;S++){var o=n[S];if("object"==typeof o)if(n[S]="",o.changeCase&&o.local){var g=n[S+1];g&&"string"==typeof g&&("u"==o.changeCase?n[S]=g[0].toUpperCase():n[S]=g[0].toLowerCase(),n[S+1]=g.substr(1))}else o.changeCase&&(t=o.changeCase);else"U"==t?n[S]=o.toUpperCase():"L"==t&&(n[S]=o.toLowerCase())}return r.variables.__=e,n.join("")})},e.prototype.tmFormatFunction=function(e,n,D){return"upcase"==n.formatFunction?e.toUpperCase():"downcase"==n.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,n){for(var D=[],t="",S=!0,i=0;i<e.length;i++){var r=e[i];if("string"==typeof r){D.push(r),"\n"==r?(S=!0,t=""):S&&(t=/^\t*/.exec(r)[0],S=/\S/.test(r));continue}if(r){if(S=!1,r.fmtString){var o=e.indexOf(r,i+1);-1==o&&(o=e.length),r.fmt=e.slice(i+1,o),i=o}if(r.text){var g=this.getVariableValue(n,r.text,t)+"";r.fmtString&&(g=this.tmStrFormat(g,r,n)),r.formatFunction&&(g=this.tmFormatFunction(g,r,n)),g&&!r.ifEnd?(D.push(g),s(r)):!g&&r.ifEnd&&s(r.ifEnd)}else r.elseEnd?s(r.elseEnd):null!=r.tabstopId?D.push(r):null!=r.changeCase&&D.push(r)}}function s(n){var D=e.indexOf(n,i+1);-1!=D&&(i=D)}return D},e.prototype.getDisplayTextForSnippet=function(e,n){return d.call(this,e,n).text},e.prototype.insertSnippetForSelection=function(e,n,D){void 0===D&&(D={});var t=d.call(this,e,n,D),S=e.getSelectionRange(),i=e.session.replace(S,t.text),r=new p(e),o=e.inVirtualSelectionMode&&e.selection.index;r.addTabstops(t.tabstops,S.start,i,o)},e.prototype.insertSnippet=function(e,n,D){void 0===D&&(D={});var t=this;if(e.inVirtualSelectionMode)return t.insertSnippetForSelection(e,n,D);e.forEachSelection(function(){t.insertSnippetForSelection(e,n,D)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},e.prototype.$getScope=function(e){var n=e.session.$mode.$id||"";if("html"===(n=n.split("/").pop())||"php"===n){"php"!==n||e.session.$mode.inlinePhp||(n="html");var D=e.getCursorPosition(),t=e.session.getState(D.row);"object"==typeof t&&(t=t[0]),t.substring&&("js-"==t.substring(0,3)?n="javascript":"css-"==t.substring(0,4)?n="css":"php-"==t.substring(0,4)&&(n="php"))}return n},e.prototype.getActiveScopes=function(e){var n=this.$getScope(e),D=[n],t=this.snippetMap;return t[n]&&t[n].includeScopes&&D.push.apply(D,t[n].includeScopes),D.push("_"),D},e.prototype.expandWithTab=function(e,n){var D=this,t=e.forEachSelection(function(){return D.expandSnippetForSelection(e,n)},null,{keepOrder:!0});return t&&e.tabstopManager&&e.tabstopManager.tabNext(),t},e.prototype.expandSnippetForSelection=function(e,n){var D,t=e.getCursorPosition(),S=e.session.getLine(t.row),i=S.substring(0,t.column),r=S.substr(t.column),o=this.snippetMap;return this.getActiveScopes(e).some(function(e){var n=o[e];return n&&(D=this.findMatchingSnippet(n,i,r)),!!D},this),!!D&&(!!n&&!!n.dryRun||(e.session.doc.removeInLine(t.row,t.column-D.replaceBefore.length,t.column+D.replaceAfter.length),this.variables.M__=D.matchBefore,this.variables.T__=D.matchAfter,this.insertSnippetForSelection(e,D.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,n,D){for(var t=e.length;t--;){var S=e[t];if((!S.startRe||S.startRe.test(n))&&(!S.endRe||S.endRe.test(D))&&(S.startRe||S.endRe))return S.matchBefore=S.startRe?S.startRe.exec(n):[""],S.matchAfter=S.endRe?S.endRe.exec(D):[""],S.replaceBefore=S.triggerRe?S.triggerRe.exec(n)[0]:"",S.replaceAfter=S.endTriggerRe?S.endTriggerRe.exec(D)[0]:"",S}},e.prototype.register=function(e,n){var D=this.snippetMap,t=this.snippetNameMap,S=this;function i(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function o(e,n,D){return e=i(e),n=i(n),D?(e=n+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=n)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function g(e){e.scope||(e.scope=n||"_"),D[n=e.scope]||(D[n]=[],t[n]={});var i=t[n];if(e.name){var g=i[e.name];g&&S.unregister(g),i[e.name]=e}D[n].push(e),e.prefix&&(e.tabTrigger=e.prefix),!e.content&&e.body&&(e.content=Array.isArray(e.body)?e.body.join("\n"):e.body),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=r.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=o(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger),e.endRe=o(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger))}e||(e=[]),Array.isArray(e)?e.forEach(g):Object.keys(e).forEach(function(n){g(e[n])}),this._signal("registerSnippets",{scope:n})},e.prototype.unregister=function(e,n){var D=this.snippetMap,t=this.snippetNameMap;function S(e){var S=t[e.scope||n];if(S&&S[e.name]){delete S[e.name];var i=D[e.scope||n],r=i&&i.indexOf(e);r>=0&&i.splice(r,1)}}e.content?S(e):Array.isArray(e)&&e.forEach(S)},e.prototype.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var n,D=[],t={},S=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;n=S.exec(e);){if(n[1])try{t=JSON.parse(n[1]),D.push(t)}catch(e){}if(n[4])t.content=n[4].replace(/^\t/gm,""),D.push(t),t={};else{var i=n[2],r=n[3];if("regex"==i){var o=/\/((?:[^\/\\]|\\.)*)|$/g;t.guard=o.exec(r)[1],t.trigger=o.exec(r)[1],t.endTrigger=o.exec(r)[1],t.endGuard=o.exec(r)[1]}else"snippet"==i?(t.tabTrigger=r.match(/^\S*/)[0],t.name||(t.name=r)):i&&(t[i]=r)}}return D},e.prototype.getSnippetByName=function(e,n){var D,t=this.snippetNameMap;return this.getActiveScopes(n).some(function(n){var S=t[n];return S&&(D=S[e]),!!D},this),D},e}();S.implement(h.prototype,i);var d=function(e,n,D){void 0===D&&(D={});var t=e.getCursorPosition(),S=e.session.getLine(t.row),i=e.session.getTabString(),r=S.match(/^\s*/)[0];t.column<r.length&&(r=r.slice(0,t.column)),n=n.replace(/\r/g,"");var o=this.tokenizeTmSnippet(n);o=(o=this.resolveVariables(o,e)).map(function(e){return"\n"!=e||D.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,i):e:e+r});var g=[];o.forEach(function(e,n){if("object"==typeof e){var D=e.tabstopId,t=g[D];if(t||((t=g[D]=[]).index=D,t.value="",t.parents={}),-1===t.indexOf(e)){e.choices&&!t.choices&&(t.choices=e.choices),t.push(e);var S=o.indexOf(e,n+1);if(-1!==S){var i=o.slice(n+1,S),r=i.some(function(e){return"object"==typeof e});r&&!t.value?t.value=i:i.length&&(!t.value||"string"!=typeof t.value)&&(t.value=i.join(""))}}}}),g.forEach(function(e){e.length=0});var s={};function a(e){for(var n=[],D=0;D<e.length;D++){var t=e[D];if("object"==typeof t){if(s[t.tabstopId])continue;t=n[e.lastIndexOf(t,D-1)]||{tabstopId:t.tabstopId}}n[D]=t}return n}for(var l=0;l<o.length;l++){var c=o[l];if("object"==typeof c){var u=c.tabstopId,h=g[u],d=o.indexOf(c,l+1);if(s[u]){s[u]===c&&(delete s[u],Object.keys(s).forEach(function(e){h.parents[e]=!0}));continue}s[u]=c;var p=h.value;"string"!=typeof p?p=a(p):c.fmt&&(p=this.tmStrFormat(p,c,e)),o.splice.apply(o,[l+1,Math.max(0,d-l)].concat(p,c)),-1===h.indexOf(c)&&h.push(c)}}var f=0,m=0,y="";return o.forEach(function(e){if("string"==typeof e){var n=e.split("\n");n.length>1?(m=n[n.length-1].length,f+=n.length-1):m+=e.length,y+=e}else e&&(e.start?e.end={row:f,column:m}:e.start={row:f,column:m})}),{text:y,tabstops:g,tokens:o}},p=function(){function e(e){if(this.index=0,this.ranges=[],this.tabstops=[],e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=r.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)}return e.prototype.attach=function(e){this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.session=e.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},e.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},e.prototype.onChange=function(e){for(var n="r"==e.action[0],D=this.selectedTabstop||{},t=D.parents||{},S=this.tabstops.slice(),i=0;i<S.length;i++){var r=S[i],o=r==D||t[r.index];if(r.rangeList.$bias=+!o,"remove"==e.action&&r!==D){var g=r.parents&&r.parents[D.index],s=r.rangeList.pointIndex(e.start,g);s=s<0?-s-1:s+1;var a=r.rangeList.pointIndex(e.end,g);a=a<0?-a-1:a-1;for(var l=r.rangeList.ranges.slice(s,a),c=0;c<l.length;c++)this.removeRange(l[c])}r.rangeList.$onChange(e)}var u=this.session;this.$inChange||!n||1!=u.getLength()||u.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var D=this.session,t=D.getTextRange(e.firstNonLinked),S=0;S<e.length;S++){var i=e[S];if(i.linked){var r=i.original,o=n.snippetManager.tmStrFormat(t,r,this.editor);D.replace(i,o)}}this.$inChange=!1}},e.prototype.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},e.prototype.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,n=this.editor.selection.anchor,D=this.editor.selection.isEmpty(),t=0;t<this.ranges.length;t++)if(!this.ranges[t].linked){var S=this.ranges[t].contains(e.row,e.column),i=D||this.ranges[t].contains(n.row,n.column);if(S&&i)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var n=this.tabstops.length,D=this.index+(e||1);(D=Math.min(Math.max(D,1),n))==n&&(D=0),this.selectTabstop(D),this.updateTabstopMarkers(),0===D&&this.detach()},e.prototype.selectTabstop=function(e){this.$openTabstops=null;var n=this.tabstops[this.index];if(n&&this.addTabstopMarkers(n),this.index=e,(n=this.tabstops[this.index])&&n.length){this.selectedTabstop=n;var D=n.firstNonLinked||n;if(n.choices&&(D.cursor=D.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(D);else{var t=this.editor.multiSelect;t.toSingleRange(D);for(var S=0;S<n.length;S++)n.hasLinkedRanges&&n[S].linked||t.addRange(n[S].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},e.prototype.addTabstops=function(e,n,D){var t=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var S=o.fromPoints(D,D);m(S.start,n),m(S.end,n),e[0]=[S],e[0].index=0}var i=[this.index+1,0],r=this.ranges,s=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,D){var S=this.$openTabstops[D]||e;S.snippetId=s;for(var a=0;a<e.length;a++){var l=e[a],c=o.fromPoints(l.start,l.end||l.start);f(c.start,n),f(c.end,n),c.original=l,c.tabstop=S,r.push(c),S!=e?S.unshift(c):S[a]=c,l.fmtString||S.firstNonLinked&&t?(c.linked=!0,S.hasLinkedRanges=!0):S.firstNonLinked||(S.firstNonLinked=c)}S.firstNonLinked||(S.hasLinkedRanges=!1),S===e&&(i.push(S),this.$openTabstops[D]=S),this.addTabstopMarkers(S),S.rangeList=S.rangeList||new g,S.rangeList.$bias=0,S.rangeList.addList(S)},this),i.length>2&&(this.tabstops.length&&i.push(i.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,i))},e.prototype.addTabstopMarkers=function(e){var n=this.session;e.forEach(function(e){e.markerId||(e.markerId=n.addMarker(e,"ace_snippet-marker","text"))})},e.prototype.removeTabstopMarkers=function(e){var n=this.session;e.forEach(function(e){n.removeMarker(e.markerId),e.markerId=null})},e.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var e=this.selectedTabstop.snippetId;0===this.selectedTabstop.index&&e--,this.tabstops.forEach(function(n){n.snippetId===e?this.addTabstopMarkers(n):this.removeTabstopMarkers(n)},this)}},e.prototype.removeRange=function(e){var n=e.tabstop.indexOf(e);-1!=n&&e.tabstop.splice(n,1),-1!=(n=this.ranges.indexOf(e))&&this.ranges.splice(n,1),-1!=(n=e.tabstop.rangeList.ranges.indexOf(e))&&e.tabstop.splice(n,1),this.session.removeMarker(e.markerId),!e.tabstop.length&&(-1!=(n=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(n,1),this.tabstops.length||this.detach())},e}();p.prototype.keyboardHandler=new s,p.prototype.keyboardHandler.bindKeys({Tab:function(e){n.snippetManager&&n.snippetManager.expandWithTab(e)||(e.tabstopManager.tabNext(1),e.renderer.scrollCursorIntoView())},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1),e.renderer.scrollCursorIntoView()},Esc:function(e){e.tabstopManager.detach()}});var f=function(e,n){0==e.row&&(e.column+=n.column),e.row+=n.row},m=function(e,n){e.row==n.row&&(e.column-=n.column),e.row-=n.row};t.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}","snippets.css",!1),n.snippetManager=new h,(function(){this.insertSnippet=function(e,D){return n.snippetManager.insertSnippet(this,e,D)},this.expandSnippet=function(e){return n.snippetManager.expandWithTab(this,e)}}).call(e("./editor").Editor.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../virtual_renderer").VirtualRenderer,S=e("../editor").Editor,i=e("../range").Range,r=e("../lib/event"),o=e("../lib/lang"),g=e("../lib/dom"),s=e("../config").nls,a=e("./../lib/useragent"),l=function(e){return"suggest-aria-id:".concat(e)},c=a.isSafari?"menu":"listbox",u=a.isSafari?"menuitem":"option",h=a.isSafari?"aria-current":"aria-selected",d=function(e){var n=new t(e);n.$maxLines=4;var D=new S(n);return D.setHighlightActiveLine(!1),D.setShowPrintMargin(!1),D.renderer.setShowGutter(!1),D.renderer.setHighlightGutterLine(!1),D.$mouseHandler.$focusTimeout=0,D.$highlightTagPending=!0,D},p=function(){return function(e){var n,D=g.createElement("div"),t=d(D);e&&e.appendChild(D),D.style.display="none",t.renderer.content.style.cursor="default",t.renderer.setStyle("ace_autocomplete"),t.renderer.$textLayer.element.setAttribute("role",c),t.renderer.$textLayer.element.setAttribute("aria-roledescription",s("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),t.renderer.$textLayer.element.setAttribute("aria-label",s("autocomplete.popup.aria-label","Autocomplete suggestions")),t.renderer.textarea.setAttribute("aria-hidden","true"),t.setOption("displayIndentGuides",!1),t.setOption("dragDelay",150);var S=function(){};t.focus=S,t.$isFocused=!0,t.renderer.$cursorLayer.restartTimer=S,t.renderer.$cursorLayer.element.style.opacity="0",t.renderer.$maxLines=8,t.renderer.$keepTextAreaAtCursor=!1,t.setHighlightActiveLine(!1),t.session.highlight(""),t.session.$searchHighlight.clazz="ace_highlight-marker",t.on("mousedown",function(e){var n=e.getDocumentPosition();t.selection.moveToPosition(n),p.start.row=p.end.row=n.row,e.stop()});var a=new i(-1,0,-1,1/0),p=new i(-1,0,-1,1/0);p.id=t.session.addMarker(p,"ace_active-line","fullLine"),t.setSelectOnHover=function(e){e?a.id&&(t.session.removeMarker(a.id),a.id=null):a.id=t.session.addMarker(a,"ace_line-hover","fullLine")},t.setSelectOnHover(!1),t.on("mousemove",function(e){if(!n){n=e;return}if(n.x!=e.x||n.y!=e.y){n=e,n.scrollTop=t.renderer.scrollTop,t.isMouseOver=!0;var D=n.getDocumentPosition().row;a.start.row!=D&&(a.id||t.setRow(D),m(D))}}),t.renderer.on("beforeRender",function(){if(n&&-1!=a.start.row){n.$pos=null;var e=n.getDocumentPosition().row;a.id||t.setRow(e),m(e,!0)}}),t.renderer.on("afterRender",function(){var e=t.getRow(),n=t.renderer.$textLayer,D=n.element.childNodes[e-n.config.firstRow],S=document.activeElement;if(D!==t.selectedNode&&t.selectedNode&&(g.removeCssClass(t.selectedNode,"ace_selected"),S.removeAttribute("aria-activedescendant"),t.selectedNode.removeAttribute(h),t.selectedNode.removeAttribute("id")),t.selectedNode=D,D){g.addCssClass(D,"ace_selected");var i=l(e);D.id=i,n.element.setAttribute("aria-activedescendant",i),S.setAttribute("aria-activedescendant",i),D.setAttribute("role",u),D.setAttribute("aria-roledescription",s("autocomplete.popup.item.aria-roledescription","item")),D.setAttribute("aria-label",t.getData(e).caption||t.getData(e).value),D.setAttribute("aria-setsize",t.data.length),D.setAttribute("aria-posinset",e+1),D.setAttribute("aria-describedby","doc-tooltip"),D.setAttribute(h,"true")}});var f=function(){m(-1)},m=function(e,n){e!==a.start.row&&(a.start.row=a.end.row=e,n||t.session._emit("changeBackMarker"),t._emit("changeHoverMarker"))};t.getHoveredRow=function(){return a.start.row},r.addListener(t.container,"mouseout",function(){t.isMouseOver=!1,f()}),t.on("hide",f),t.on("changeSelection",f),t.session.doc.getLength=function(){return t.data.length},t.session.doc.getLine=function(e){var n=t.data[e];return"string"==typeof n?n:n&&n.value||""};var y=t.session.bgTokenizer;return y.$tokenizeRow=function(e){var n=t.data[e],D=[];if(!n)return D;"string"==typeof n&&(n={value:n});var S=n.caption||n.value||n.name;function i(e,t){e&&D.push({type:(n.className||"")+(t||""),value:e})}for(var r=S.toLowerCase(),o=(t.filterText||"").toLowerCase(),g=0,s=0,a=0;a<=o.length;a++)if(a!=s&&(n.matchMask&1<<a||a==o.length)){var l=o.slice(s,a);s=a;var c=r.indexOf(l,g);if(-1==c)continue;i(S.slice(g,c),""),g=c+l.length,i(S.slice(c,g),"completion-highlight")}return i(S.slice(g,S.length),""),D.push({type:"completion-spacer",value:" "}),n.meta&&D.push({type:"completion-meta",value:n.meta}),n.message&&D.push({type:"completion-message",value:n.message}),D},y.$updateOnChange=S,y.start=S,t.session.$computeWidth=function(){return this.screenWidth=0},t.isOpen=!1,t.isTopdown=!1,t.autoSelect=!0,t.filterText="",t.isMouseOver=!1,t.data=[],t.setData=function(e,n){t.filterText=n||"",t.setValue(o.stringRepeat("\n",e.length),-1),t.data=e||[],t.setRow(0)},t.getData=function(e){return t.data[e]},t.getRow=function(){return p.start.row},t.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),p.start.row!=e&&(t.selection.clearSelection(),p.start.row=p.end.row=e||0,t.session._emit("changeBackMarker"),t.moveCursorTo(e||0,0),t.isOpen&&t._signal("select"))},t.on("changeSelection",function(){t.isOpen&&t.setRow(t.selection.lead.row),t.renderer.scrollCursorIntoView()}),t.hide=function(){this.container.style.display="none",t.anchorPos=null,t.anchor=null,t.isOpen&&(t.isOpen=!1,this._signal("hide"))},t.tryShow=function(e,D,S,i){if(!i&&t.isOpen&&t.anchorPos&&t.anchor&&t.anchorPos.top===e.top&&t.anchorPos.left===e.left&&t.anchor===S)return!0;var r=this.container,o=window.innerHeight,g=window.innerWidth,s=this.renderer,a=s.$maxLines*D*1.4,l={top:0,bottom:0},c=o-e.top-3*this.$borderSize-D,u=e.top-3*this.$borderSize;S||(S=u<=c||c>=a?"bottom":"top"),"top"===S?(l.bottom=e.top-this.$borderSize,l.top=l.bottom-a):"bottom"===S&&(l.top=e.top+D+this.$borderSize,l.bottom=l.top+a);var h=l.top>=0&&l.bottom<=o;if(!i&&!h)return!1;h?s.$maxPixelHeight=null:"top"===S?s.$maxPixelHeight=u:s.$maxPixelHeight=c,"top"===S?(r.style.top="",r.style.bottom=o-l.bottom+"px",t.isTopdown=!1):(r.style.top=l.top+"px",r.style.bottom="",t.isTopdown=!0),r.style.display="";var d=e.left;return d+r.offsetWidth>g&&(d=g-r.offsetWidth),r.style.left=d+"px",r.style.right="",t.isOpen||(t.isOpen=!0,this._signal("show"),n=null),t.anchorPos=e,t.anchor=S,!0},t.show=function(e,n,D){this.tryShow(e,n,D?"bottom":void 0,!0)},t.goTo=function(e){var n=this.getRow(),D=this.session.getLength()-1;switch(e){case"up":n=n<=0?D:n-1;break;case"down":n=n>=D?-1:n+1;break;case"start":n=0;break;case"end":n=D}this.setRow(n)},t.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},t.$imageSize=0,t.$borderSize=1,t}}();g.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: "";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n',"autocompletion.css",!1),n.AcePopup=p,n.$singleLineEditor=d,n.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,n,D){"use strict";n.AceInlineScreenReader=function(){function e(e){this.editor=e,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return e.prototype.setScreenReaderContent=function(e){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",(function(){var e=this.popup.getRow(),n=this.popup.renderer.$textLayer,D=n.element.childNodes[e-n.config.firstRow];if(D){for(var t="doc-tooltip ",S=0;S<this._lines.length;S++)t+="ace-inline-screenreader-line-".concat(S," ");D.setAttribute("aria-describedby",t)}}).bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=e.split(/\r\n|\r|\n/);var n=this.createCodeBlock();this.screenReaderDiv.appendChild(n)},e.prototype.destroy=function(){this.screenReaderDiv.remove()},e.prototype.createCodeBlock=function(){var e=document.createElement("pre");e.setAttribute("id","ace-inline-screenreader");for(var n=0;n<this._lines.length;n++){var D=document.createElement("code");D.setAttribute("id","ace-inline-screenreader-line-".concat(n));var t=document.createTextNode(this._lines[n]);D.appendChild(t),e.appendChild(D)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,n,D){"use strict";var t=e("../snippets").snippetManager,S=e("./inline_screenreader").AceInlineScreenReader;n.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,n,D){if(D=D||"",e&&this.editor&&this.editor!==e&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!e||!n)return!1;this.inlineScreenReader||(this.inlineScreenReader=new S(e));var i=n.snippet?t.getDisplayTextForSnippet(e,n.snippet):n.value;return!n.hideInlinePreview&&!!i&&!!i.startsWith(D)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(i),""===(i=i.slice(D.length))?e.removeGhostText():e.setGhostText(i),!0)},e.prototype.isOpen=function(){return!!this.editor&&!!this.editor.renderer.$ghostText},e.prototype.hide=function(){return!!this.editor&&(this.editor.removeGhostText(),!0)},e.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},e}()}),ace.define("ace/autocomplete/util",["require","exports","module"],function(e,n,D){"use strict";n.parForEach=function(e,n,D){var t=0,S=e.length;0===S&&D();for(var i=0;i<S;i++)n(e[i],function(e,n){++t===S&&D(e,n)})};var t=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(e,n,D){D=D||t;for(var S=[],i=n-1;i>=0;i--)if(D.test(e[i]))S.push(e[i]);else break;return S.reverse().join("")},n.retrieveFollowingIdentifier=function(e,n,D){D=D||t;for(var S=[],i=n;i<e.length;i++)if(D.test(e[i]))S.push(e[i]);else break;return S},n.getCompletionPrefix=function(e){var n,D=e.getCursorPosition(),t=e.session.getLine(D.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!n&&e&&(n=this.retrievePrecedingIdentifier(t,D.column,e))}).bind(this))}).bind(this)),n||this.retrievePrecedingIdentifier(t,D.column)},n.triggerAutocomplete=function(e,n){var n=null==n?e.session.getPrecedingCharacter():n;return e.completers.some(function(e){if(e.triggerCharacters&&Array.isArray(e.triggerCharacters))return e.triggerCharacters.includes(n)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(e,n,D){"use strict";var t=e("./keyboard/hash_handler").HashHandler,S=e("./autocomplete/popup").AcePopup,i=e("./autocomplete/inline").AceInline,r=e("./autocomplete/popup").getAriaId,o=e("./autocomplete/util"),g=e("./lib/lang"),s=e("./lib/dom"),a=e("./snippets").snippetManager,l=e("./config"),c=e("./lib/event"),u=e("./lib/scroll").preventParentScroll,h=function(e,n){n.completer&&n.completer.destroy()},d=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new t,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=g.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=g.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=g.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=g.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=g.delayedCall((function(){var n=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!n||0===this.editor.completers.length||(this.completions=new f(e.completionsForLoading),this.openPopup(this.editor,n.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}).bind(this),this.stickySelectionDelay)}return Object.defineProperty(e,"completionsForLoading",{get:function(){return[{caption:l.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),e.prototype.$init=function(){return this.popup=new S(this.parentNode||document.body||document.documentElement),this.popup.on("click",(function(e){this.insertMatch(),e.stop()}).bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),c.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},e.prototype.$initInline=function(){if(this.inlineEnabled&&!this.inlineRenderer)return this.inlineRenderer=new i,this.inlineRenderer},e.prototype.getPopup=function(){return this.popup||this.$init()},e.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},e.prototype.$seen=function(e){!this.hasSeen.has(e)&&e&&e.completer&&e.completer.onSeen&&"function"==typeof e.completer.onSeen&&(e.completer.onSeen(this.editor,e),this.hasSeen.add(e))},e.prototype.$onPopupChange=function(e){if(this.inlineRenderer&&this.inlineEnabled){var n=e?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(n),this.popup.isMouseOver&&this.setSelectOnHover)return void this.tooltipTimer.call(null,null);this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},e.prototype.$updateGhostText=function(e){var n=this.base.row,D=this.base.column,t=this.editor.getCursorPosition().column,S=this.editor.session.getLine(n).slice(D,t);this.inlineRenderer.show(this.editor,e,S)?this.$seen(e):this.inlineRenderer.hide()},e.prototype.$onPopupRender=function(){var e=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var n=this.popup.getFirstVisibleRow();n<=this.popup.getLastVisibleRow();n++){var D=this.popup.getData(n);D&&(!e||D.hideInlinePreview)&&this.$seen(D)}},e.prototype.$onPopupShow=function(e){this.$onPopupChange(e),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},e.prototype.observeLayoutChanges=function(){if(!this.$elements&&this.editor){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var e=this.editor.container.parentNode,n=[];e;)n.push(e),e.addEventListener("scroll",this.onLayoutChange,{passive:!0}),e=e.parentNode;this.$elements=n}},e.prototype.unObserveLayoutChanges=function(){var e=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(n){n.removeEventListener("scroll",e.onLayoutChange,{passive:!0})}),this.$elements=null},e.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},e.prototype.$updatePopupPosition=function(){var e=this.editor,n=e.renderer,D=n.layerConfig.lineHeight,t=n.$cursorLayer.getPixelPosition(this.base,!0);t.left-=this.popup.getTextLeftOffset();var S=e.container.getBoundingClientRect();t.top+=S.top-n.layerConfig.offset,t.left+=S.left-e.renderer.scrollLeft,t.left+=n.gutterWidth;var i={top:t.top,left:t.left};n.$ghostText&&n.$ghostTextWidget&&this.base.row===n.$ghostText.position.row&&(i.top+=n.$ghostTextWidget.el.offsetHeight);var r=e.container.getBoundingClientRect().bottom-D,o=r<i.top?{top:r,left:i.left}:i;this.popup.tryShow(o,D,"bottom")||this.popup.tryShow(t,D,"top")||this.popup.show(t,D)},e.prototype.openPopup=function(e,n,D){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var t,S=this.popup.getRow(),i=this.popup.data[S];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:r(this.popup.getRow()),inline:this.inlineEnabled}),e.keyBinding.addKeyboardHandler(this.keyboardHandler),this.stickySelection&&(t=this.popup.data.indexOf(i)),t&&-1!==t||(t=0),this.popup.setRow(this.autoSelect?t:-1),t===S&&i!==this.completions.filtered[t]&&this.$onPopupChange();var o=this.inlineRenderer&&this.inlineEnabled;if(t===S&&o){var g=this.popup.getData(this.popup.getRow());this.$updateGhostText(g)}!D&&(this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},e.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},e.prototype.changeListener=function(e){var n=this.editor.selection.lead;(n.row!=this.base.row||n.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},e.prototype.blurListener=function(e){var n=document.activeElement,D=this.editor.textInput.getElement(),t=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),S=this.popup&&this.popup.container;n==D||n.parentNode==S||t||n==this.tooltipNode||e.relatedTarget==D||this.detach()},e.prototype.mousedownListener=function(e){this.detach()},e.prototype.mousewheelListener=function(e){this.popup&&!this.popup.isMouseOver&&this.detach()},e.prototype.mouseOutListener=function(e){this.popup.isOpen&&this.$updatePopupPosition()},e.prototype.goTo=function(e){this.popup.goTo(e)},e.prototype.insertMatch=function(e,n){if(e||(e=this.popup.getData(this.popup.getRow())),!e)return!1;if(""===e.value)return this.detach();var D=this.completions,t=this.getCompletionProvider().insertMatch(this.editor,e,D.filterText,n);return this.completions==D&&this.detach(),t},e.prototype.showPopup=function(e,n){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,n)},e.prototype.getCompletionProvider=function(e){return this.completionProvider||(this.completionProvider=new p(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,n){return this.getCompletionProvider().gatherCompletions(e,n)},e.prototype.updateCompletions=function(n,D){if(n&&this.base&&this.completions){var t=this.editor.getCursorPosition(),S=this.editor.session.getTextRange({start:this.base,end:t});return S==this.completions.filterText?void 0:(this.completions.setFilter(S),this.completions.filtered.length&&(1!=this.completions.filtered.length||this.completions.filtered[0].value!=S||this.completions.filtered[0].snippet))?void this.openPopup(this.editor,S,n):this.detach()}if(D&&D.matches){var t=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(t.row,t.column),this.base.$insertRight=!0,this.completions=new f(D.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",n)}var i=this.editor.getSession(),t=this.editor.getCursorPosition(),S=o.getCompletionPrefix(this.editor);this.base=i.doc.createAnchor(t.row,t.column-S.length),this.base.$insertRight=!0;var r={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:S,pos:t}).provideCompletions(this.editor,r,(function(D,t,S){var i=t.filtered,r=o.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),S){if(!i.length){var g=!this.autoShown&&this.emptyMessage;if("function"==typeof g&&(g=this.emptyMessage(r)),g){var s=[{caption:g,value:""}];this.completions=new f(s),this.openPopup(this.editor,r,n),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(1==i.length&&i[0].value==r&&!i[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==i.length)return this.insertMatch(i[0])}this.completions=!S&&this.showLoadingState?new f(e.completionsForLoading.concat(i),t.filterText):t,this.openPopup(this.editor,r,n),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!S)}).bind(this)),!this.showLoadingState||this.autoShown||this.popup&&this.popup.isOpen||this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},e.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},e.prototype.updateDocTooltip=function(){var e=this.popup,n=this.completions.filtered,D=n&&(n[e.getHoveredRow()]||n[e.getRow()]),t=null;if(!D||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var S=this.editor.completers.length,i=0;i<S;i++){var r=this.editor.completers[i];if(r.getDocTooltip&&D.completerId===r.id){t=r.getDocTooltip(D);break}}if(t||"string"==typeof D||(t=D),"string"==typeof t&&(t={docText:t}),!t||!(t.docHTML||t.docText))return this.hideDocTooltip();this.showDocTooltip(t)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=s.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",u));var n=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(n.isDark?"ace_dark ":"")+(n.cssClass||"");var D=this.tooltipNode;e.docHTML?D.innerHTML=e.docHTML:e.docText&&(D.textContent=e.docText),D.parentNode||this.popup.container.appendChild(this.tooltipNode);var t=this.popup,S=t.container.getBoundingClientRect();D.style.top=t.container.style.top,D.style.bottom=t.container.style.bottom,D.style.display="block",window.innerWidth-S.right<320?S.left<320?(t.isTopdown?D.style.top=S.bottom+"px":D.style.top=t.container.offsetTop-D.offsetHeight+"px",D.style.left=S.left+"px",D.style.right="",D.style.bottom=""):(D.style.right=window.innerWidth-S.left+"px",D.style.left=""):(D.style.left=S.right+1+"px",D.style.right="")},e.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),this.tooltipNode){var e=this.tooltipNode;this.editor.isFocused()||document.activeElement!=e||this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}},e.prototype.onTooltipClick=function(e){for(var n=e.target;n&&n!=this.tooltipNode;){if("A"==n.nodeName&&n.href){n.rel="noreferrer",n.target="_blank";break}n=n.parentNode}},e.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var e=this.popup.container;e&&e.parentNode&&e.parentNode.removeChild(e)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",h),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();d.prototype.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var n=e.completer.insertMatch();if(n||e.tabstopManager)return n;e.completer.goTo("down")},Backspace:function(e){e.execCommand("backspace"),!o.getCompletionPrefix(e)&&e.completer&&e.completer.detach()},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},d.for=function(e){return e.completer instanceof d||(e.completer&&(e.completer.destroy(),e.completer=null),l.get("sharedPopups")?(d.$sharedInstance||(d.$sharedInstance=new d),e.completer=d.$sharedInstance):(e.completer=new d,e.once("destroy",h))),e.completer},d.startCommand={name:"startAutocomplete",exec:function(e,n){var D=d.for(e);D.autoInsert=!1,D.autoSelect=!0,D.autoShown=!1,D.showPopup(e,n),D.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var p=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,n,D){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[n],D)},e.prototype.insertMatch=function(e,n,D){if(!n)return!1;if(e.startOperation({command:{name:"insertMatch"}}),n.completer&&n.completer.insertMatch)n.completer.insertMatch(e,n);else{if(!this.completions)return!1;var t=this.completions.filterText.length,S=0;if(n.range&&n.range.start.row===n.range.end.row&&(t-=this.initialPosition.prefix.length,t+=this.initialPosition.pos.column-n.range.start.column,S+=n.range.end.column-this.initialPosition.pos.column),t||S){i=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var i,r,o=0;r=i[o];o++)r.start.column-=t,r.end.column+=S,e.session.remove(r)}n.snippet?a.insertSnippet(e,n.snippet):this.$insertString(e,n),n.completer&&n.completer.onInsert&&"function"==typeof n.completer.onInsert&&n.completer.onInsert(e,n),n.command&&"startAutocomplete"===n.command&&e.execCommand(n.command)}return e.endOperation(),!0},e.prototype.$insertString=function(e,n){var D=n.value||n;e.execCommand("insertstring",D)},e.prototype.gatherCompletions=function(e,n){var D=e.getSession(),t=e.getCursorPosition(),S=o.getCompletionPrefix(e),i=[];this.completers=e.completers;var r=e.completers.length;return e.completers.forEach(function(g,s){g.getCompletions(e,D,t,S,function(D,t){g.hideInlinePreview&&(t=t.map(function(e){return Object.assign(e,{hideInlinePreview:g.hideInlinePreview})})),!D&&t&&(i=i.concat(t)),n(null,{prefix:o.getCompletionPrefix(e),matches:i,finished:0==--r})})}),!0},e.prototype.provideCompletions=function(e,n,D){var t=(function(e){var t=e.prefix,S=e.matches;this.completions=new f(S),n.exactMatch&&(this.completions.exactMatch=!0),n.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(t),(e.finished||this.completions.filtered.length)&&D(null,this.completions,e.finished)}).bind(this),S=!0,i=null;if(this.gatherCompletions(e,(function(e,n){if(this.active&&(e&&(D(e,[],!0),this.detach()),0===n.prefix.indexOf(n.prefix))){if(S){i=n;return}t(n)}}).bind(this)),S=!1,i){var r=i;i=null,t(r)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),f=function(){function e(e,n){this.all=e,this.filtered=e,this.filterText=n||"",this.exactMatch=!1,this.ignoreCaption=!1}return e.prototype.setFilter=function(e){if(e.length>this.filterText&&0===e.lastIndexOf(this.filterText,0))var n=this.filtered;else var n=this.all;this.filterText=e;var D=null;n=(n=(n=this.filterCompletions(n,this.filterText)).sort(function(e,n){return n.exactMatch-e.exactMatch||n.$score-e.$score||(e.caption||e.value).localeCompare(n.caption||n.value)})).filter(function(e){var n=e.snippet||e.caption||e.value;return n!==D&&(D=n,!0)}),this.filtered=n},e.prototype.filterCompletions=function(e,n){var D=[],t=n.toUpperCase(),S=n.toLowerCase();n:for(var i,r=0;i=e[r];r++){var o,g,s=!this.ignoreCaption&&i.caption||i.value||i.snippet;if(s){var a=-1,l=0,c=0;if(this.exactMatch){if(n!==s.substr(0,n.length))continue}else{var u=s.toLowerCase().indexOf(S);if(u>-1)c=u;else for(var h=0;h<n.length;h++){var d=s.indexOf(S[h],a+1),p=s.indexOf(t[h],a+1);if((o=d>=0&&(p<0||d<p)?d:p)<0)continue n;(g=o-a-1)>0&&(-1===a&&(c+=10),c+=g,l|=1<<h),a=o}}i.matchMask=l,i.exactMatch=+!c,i.$score=(i.score||0)-c,D.push(i)}}return D},e}();n.Autocomplete=d,n.CompletionProvider=p,n.FilteredList=f}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,n,D){var t=e("../range").Range,S=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function i(e,n){return e.getTextRange(t.fromPoints({row:0,column:0},n)).split(S).length-1}function r(e,n){var D=i(e,n),t=e.getValue().split(S),r=Object.create(null),o=t[D];return t.forEach(function(e,n){if(e&&e!==o){var S=Math.abs(D-n),i=t.length-S;r[e]?r[e]=Math.max(i,r[e]):r[e]=i}}),r}n.getCompletions=function(e,n,D,t,S){var i=r(n,D);S(null,Object.keys(i).map(function(e){return{caption:e,value:e,score:i[e],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(e,n,D){"use strict";var t,S=e("../snippets").snippetManager,i=e("../autocomplete").Autocomplete,r=e("../config"),o=e("../lib/lang"),g=e("../autocomplete/util"),s=e("../autocomplete/text_completer"),a={getCompletions:function(e,n,D,t,S){if(n.$mode.completer)return n.$mode.completer.getCompletions(e,n,D,t,S);var i=e.session.getState(D.row),r=n.$mode.getCompletions(i,n,D,t);S(null,r=r.map(function(e){return e.completerId=a.id,e}))},id:"keywordCompleter"},l=function(e){var n={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,D,t,S){return n[D]=S||""}).replace(/\$(\d+?)/g,function(e,D){return n[D]})},c={getCompletions:function(e,n,D,t,i){var r=[],o=n.getTokenAt(D.row,D.column);o&&o.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?r.push("html-tag"):r=S.getActiveScopes(e);var g=S.snippetMap,s=[];r.forEach(function(e){for(var n=g[e]||[],D=n.length;D--;){var t=n[D],S=t.name||t.tabTrigger;S&&s.push({caption:S,snippet:t.content,meta:t.tabTrigger&&!t.name?t.tabTrigger+"⇥ ":"snippet",completerId:c.id})}},this),i(null,s)},getDocTooltip:function(e){e.snippet&&!e.docHTML&&(e.docHTML=["<b>",o.escapeHTML(e.caption),"</b>","<hr></hr>",o.escapeHTML(l(e.snippet))].join(""))},id:"snippetCompleter"},u=[c,s,a];n.setCompleters=function(e){u.length=0,e&&u.push.apply(u,e)},n.addCompleter=function(e){u.push(e)},n.textCompleter=s,n.keyWordCompleter=a,n.snippetCompleter=c;var h={name:"expandSnippet",exec:function(e){return S.expandWithTab(e)},bindKey:"Tab"},d=function(e,n){p(n.session.$mode)},p=function(e){"string"==typeof e&&(e=r.$modes[e]),e&&(S.files||(S.files={}),f(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(p))},f=function(e,n){n&&e&&!S.files[e]&&(S.files[e]={},r.loadModule(n,function(n){n&&(S.files[e]=n,!n.snippets&&n.snippetText&&(n.snippets=S.parseSnippetFile(n.snippetText)),S.register(n.snippets||[],n.scope),n.includeScopes&&(S.snippetMap[n.scope].includeScopes=n.includeScopes,n.includeScopes.forEach(function(e){p("ace/mode/"+e)})))}))},m=function(e){var n=e.editor,D=n.completer&&n.completer.activated;if("backspace"===e.command.name)D&&!g.getCompletionPrefix(n)&&n.completer.detach();else if("insertstring"===e.command.name&&!D){t=e;var S=e.editor.$liveAutocompletionDelay;S?y.delay(S):v(e)}},y=o.delayedCall(function(){v(t)},0),v=function(e){var n=e.editor,D=g.getCompletionPrefix(n),t=e.args,S=g.triggerAutocomplete(n,t);if(D&&D.length>=n.$liveAutocompletionThreshold||S){var r=i.for(n);r.autoShown=!0,r.showPopup(n)}},b=e("../editor").Editor;e("../config").defineOptions(b.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.on("afterExec",m)):this.commands.off("afterExec",m)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(e){e?(this.commands.addCommand(h),this.on("changeMode",d),d(null,this)):(this.commands.removeCommand(h),this.off("changeMode",d))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(n){e&&(e.exports=n)})}()},20009(e,n,D){e=D.nmd(e),ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,n,D){"use strict";var t,S=e("./lib/oop");e("./lib/lang");var i=e("./lib/event_emitter").EventEmitter,r=e("./editor").Editor,o=e("./virtual_renderer").VirtualRenderer,g=e("./edit_session").EditSession;(function(){S.implement(this,i),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var n=new r(new o(e,this.$theme));return n.on("focus",(function(){this._emit("focus",n)}).bind(this)),this.$editors.push(n),n.setFontSize(this.$fontSize),n},this.setSplits=function(e){var n;if(e<1)throw"The number of splits have to be > 0!";if(e!=this.$splits){if(e>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<e;)n=this.$editors[this.$splits],this.$container.appendChild(n.container),n.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<e;)this.$createEditor(),this.$splits++}else for(;this.$splits>e;)n=this.$editors[this.$splits-1],this.$container.removeChild(n.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(n){n.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(n){n.setKeyboardHandler(e)})},this.forEach=function(e,n){this.$editors.forEach(e,n)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(n){n.setFontSize(e)})},this.$cloneSession=function(e){var n=new g(e.getDocument(),e.getMode()),D=e.getUndoManager();return n.setUndoManager(D),n.setTabSize(e.getTabSize()),n.setUseSoftTabs(e.getUseSoftTabs()),n.setOverwrite(e.getOverwrite()),n.setBreakpoints(e.getBreakpoints()),n.setUseWrapMode(e.getUseWrapMode()),n.setUseWorker(e.getUseWorker()),n.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),n.$foldData=e.$cloneFoldData(),n},this.setSession=function(e,n){var D=null==n?this.$cEditor:this.$editors[n];return this.$editors.some(function(n){return n.session===e})&&(e=this.$cloneSession(e)),D.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){this.$orientation!=e&&(this.$orientation=e,this.resize())},this.resize=function(){var e,n=this.$container.clientWidth,D=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var t=n/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=t+"px",e.container.style.top="0px",e.container.style.left=S*t+"px",e.container.style.height=D+"px",e.resize();else for(var i=D/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=n+"px",e.container.style.top=S*i+"px",e.container.style.left="0px",e.container.style.height=i+"px",e.resize()}}).call((t=function(e,n,D){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=n,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(D||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),n.Split=t}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,n,D){"use strict";D.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(n){e&&(e.exports=n)})}()},62432(e,n,D){ace.config.setModuleUrl("ace/ext/beautify",D(1853)),ace.config.setModuleUrl("ace/ext/code_lens",D(42836)),ace.config.setModuleUrl("ace/ext/command_bar",D(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",D(40275)),ace.config.setModuleUrl("ace/ext/emmet",D(25962)),ace.config.setModuleUrl("ace/ext/error_marker",D(377)),ace.config.setModuleUrl("ace/ext/hardwrap",D(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",D(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",D(97188)),ace.config.setModuleUrl("ace/ext/language_tools",D(10194)),ace.config.setModuleUrl("ace/ext/linking",D(43794)),ace.config.setModuleUrl("ace/ext/modelist",D(71739)),ace.config.setModuleUrl("ace/ext/options",D(43804)),ace.config.setModuleUrl("ace/ext/prompt",D(20706)),ace.config.setModuleUrl("ace/ext/rtl",D(27480)),ace.config.setModuleUrl("ace/ext/searchbox",D(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",D(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",D(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",D(51834)),ace.config.setModuleUrl("ace/ext/split",D(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",D(99729)),ace.config.setModuleUrl("ace/ext/statusbar",D(86397)),ace.config.setModuleUrl("ace/ext/textarea",D(36454)),ace.config.setModuleUrl("ace/ext/themelist",D(85107)),ace.config.setModuleUrl("ace/ext/whitespace",D(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",D(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",D(1832)),ace.config.setModuleUrl("ace/keyboard/vim",D(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",D(98557)),ace.config.setModuleUrl("ace/mode/abap",D(48208)),ace.config.setModuleUrl("ace/mode/abc",D(22128)),ace.config.setModuleUrl("ace/mode/actionscript",D(3871)),ace.config.setModuleUrl("ace/mode/ada",D(87272)),ace.config.setModuleUrl("ace/mode/alda",D(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",D(70029)),ace.config.setModuleUrl("ace/mode/apex",D(24266)),ace.config.setModuleUrl("ace/mode/applescript",D(78831)),ace.config.setModuleUrl("ace/mode/aql",D(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",D(36417)),ace.config.setModuleUrl("ace/mode/asl",D(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",D(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",D(9319)),ace.config.setModuleUrl("ace/mode/astro",D(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",D(5215)),ace.config.setModuleUrl("ace/mode/batchfile",D(182)),ace.config.setModuleUrl("ace/mode/bibtex",D(54316)),ace.config.setModuleUrl("ace/mode/c9search",D(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",D(69563)),ace.config.setModuleUrl("ace/mode/cirru",D(25995)),ace.config.setModuleUrl("ace/mode/clojure",D(81384)),ace.config.setModuleUrl("ace/mode/cobol",D(12307)),ace.config.setModuleUrl("ace/mode/coffee",D(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",D(82540)),ace.config.setModuleUrl("ace/mode/crystal",D(70162)),ace.config.setModuleUrl("ace/mode/csharp",D(86173)),ace.config.setModuleUrl("ace/mode/csound_document",D(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",D(54722)),ace.config.setModuleUrl("ace/mode/csound_score",D(48055)),ace.config.setModuleUrl("ace/mode/csp",D(61634)),ace.config.setModuleUrl("ace/mode/css",D(59119)),ace.config.setModuleUrl("ace/mode/curly",D(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",D(34379)),ace.config.setModuleUrl("ace/mode/d",D(48656)),ace.config.setModuleUrl("ace/mode/dart",D(1647)),ace.config.setModuleUrl("ace/mode/diff",D(30365)),ace.config.setModuleUrl("ace/mode/django",D(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",D(62136)),ace.config.setModuleUrl("ace/mode/dot",D(40631)),ace.config.setModuleUrl("ace/mode/drools",D(36363)),ace.config.setModuleUrl("ace/mode/edifact",D(19906)),ace.config.setModuleUrl("ace/mode/eiffel",D(61933)),ace.config.setModuleUrl("ace/mode/ejs",D(78924)),ace.config.setModuleUrl("ace/mode/elixir",D(91429)),ace.config.setModuleUrl("ace/mode/elm",D(98664)),ace.config.setModuleUrl("ace/mode/erlang",D(18885)),ace.config.setModuleUrl("ace/mode/flix",D(98513)),ace.config.setModuleUrl("ace/mode/forth",D(50379)),ace.config.setModuleUrl("ace/mode/fortran",D(87166)),ace.config.setModuleUrl("ace/mode/fsharp",D(55288)),ace.config.setModuleUrl("ace/mode/fsl",D(96369)),ace.config.setModuleUrl("ace/mode/ftl",D(5474)),ace.config.setModuleUrl("ace/mode/gcode",D(39264)),ace.config.setModuleUrl("ace/mode/gherkin",D(67942)),ace.config.setModuleUrl("ace/mode/gitignore",D(37898)),ace.config.setModuleUrl("ace/mode/glsl",D(2474)),ace.config.setModuleUrl("ace/mode/gobstones",D(70154)),ace.config.setModuleUrl("ace/mode/golang",D(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",D(75542)),ace.config.setModuleUrl("ace/mode/groovy",D(50436)),ace.config.setModuleUrl("ace/mode/haml",D(63920)),ace.config.setModuleUrl("ace/mode/handlebars",D(51526)),ace.config.setModuleUrl("ace/mode/haskell",D(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",D(67784)),ace.config.setModuleUrl("ace/mode/haxe",D(81690)),ace.config.setModuleUrl("ace/mode/hjson",D(44406)),ace.config.setModuleUrl("ace/mode/html",D(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",D(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",D(76542)),ace.config.setModuleUrl("ace/mode/ini",D(88110)),ace.config.setModuleUrl("ace/mode/io",D(91930)),ace.config.setModuleUrl("ace/mode/ion",D(24958)),ace.config.setModuleUrl("ace/mode/jack",D(42901)),ace.config.setModuleUrl("ace/mode/jade",D(55300)),ace.config.setModuleUrl("ace/mode/java",D(29750)),ace.config.setModuleUrl("ace/mode/javascript",D(80437)),ace.config.setModuleUrl("ace/mode/jexl",D(62115)),ace.config.setModuleUrl("ace/mode/json",D(46544)),ace.config.setModuleUrl("ace/mode/json5",D(17965)),ace.config.setModuleUrl("ace/mode/jsoniq",D(78118)),ace.config.setModuleUrl("ace/mode/jsp",D(41705)),ace.config.setModuleUrl("ace/mode/jssm",D(22901)),ace.config.setModuleUrl("ace/mode/jsx",D(73937)),ace.config.setModuleUrl("ace/mode/julia",D(941)),ace.config.setModuleUrl("ace/mode/kotlin",D(86571)),ace.config.setModuleUrl("ace/mode/latex",D(30808)),ace.config.setModuleUrl("ace/mode/latte",D(2986)),ace.config.setModuleUrl("ace/mode/less",D(72799)),ace.config.setModuleUrl("ace/mode/liquid",D(95630)),ace.config.setModuleUrl("ace/mode/lisp",D(85950)),ace.config.setModuleUrl("ace/mode/livescript",D(74703)),ace.config.setModuleUrl("ace/mode/logiql",D(72094)),ace.config.setModuleUrl("ace/mode/logtalk",D(39512)),ace.config.setModuleUrl("ace/mode/lsl",D(94275)),ace.config.setModuleUrl("ace/mode/lua",D(46890)),ace.config.setModuleUrl("ace/mode/luapage",D(81029)),ace.config.setModuleUrl("ace/mode/lucene",D(7616)),ace.config.setModuleUrl("ace/mode/makefile",D(77882)),ace.config.setModuleUrl("ace/mode/markdown",D(21459)),ace.config.setModuleUrl("ace/mode/mask",D(54050)),ace.config.setModuleUrl("ace/mode/matlab",D(35907)),ace.config.setModuleUrl("ace/mode/maze",D(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",D(72268)),ace.config.setModuleUrl("ace/mode/mel",D(66018)),ace.config.setModuleUrl("ace/mode/mips",D(20617)),ace.config.setModuleUrl("ace/mode/mixal",D(98667)),ace.config.setModuleUrl("ace/mode/mushcode",D(61026)),ace.config.setModuleUrl("ace/mode/mysql",D(21630)),ace.config.setModuleUrl("ace/mode/nasal",D(23523)),ace.config.setModuleUrl("ace/mode/nginx",D(16788)),ace.config.setModuleUrl("ace/mode/nim",D(31900)),ace.config.setModuleUrl("ace/mode/nix",D(6135)),ace.config.setModuleUrl("ace/mode/nsis",D(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",D(51481)),ace.config.setModuleUrl("ace/mode/objectivec",D(75466)),ace.config.setModuleUrl("ace/mode/ocaml",D(49088)),ace.config.setModuleUrl("ace/mode/odin",D(5610)),ace.config.setModuleUrl("ace/mode/partiql",D(76557)),ace.config.setModuleUrl("ace/mode/pascal",D(80694)),ace.config.setModuleUrl("ace/mode/perl",D(7135)),ace.config.setModuleUrl("ace/mode/pgsql",D(55707)),ace.config.setModuleUrl("ace/mode/php",D(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",D(49935)),ace.config.setModuleUrl("ace/mode/pig",D(7124)),ace.config.setModuleUrl("ace/mode/plain_text",D(92868)),ace.config.setModuleUrl("ace/mode/plsql",D(24808)),ace.config.setModuleUrl("ace/mode/powershell",D(77823)),ace.config.setModuleUrl("ace/mode/praat",D(46124)),ace.config.setModuleUrl("ace/mode/prisma",D(18114)),ace.config.setModuleUrl("ace/mode/prolog",D(35061)),ace.config.setModuleUrl("ace/mode/properties",D(56059)),ace.config.setModuleUrl("ace/mode/protobuf",D(86305)),ace.config.setModuleUrl("ace/mode/prql",D(58317)),ace.config.setModuleUrl("ace/mode/puppet",D(85804)),ace.config.setModuleUrl("ace/mode/python",D(51652)),ace.config.setModuleUrl("ace/mode/qml",D(11038)),ace.config.setModuleUrl("ace/mode/r",D(438)),ace.config.setModuleUrl("ace/mode/raku",D(4847)),ace.config.setModuleUrl("ace/mode/razor",D(67300)),ace.config.setModuleUrl("ace/mode/rdoc",D(6430)),ace.config.setModuleUrl("ace/mode/red",D(85347)),ace.config.setModuleUrl("ace/mode/redshift",D(36975)),ace.config.setModuleUrl("ace/mode/rhtml",D(7047)),ace.config.setModuleUrl("ace/mode/robot",D(66276)),ace.config.setModuleUrl("ace/mode/rst",D(8781)),ace.config.setModuleUrl("ace/mode/ruby",D(334)),ace.config.setModuleUrl("ace/mode/rust",D(43292)),ace.config.setModuleUrl("ace/mode/sac",D(26329)),ace.config.setModuleUrl("ace/mode/sass",D(52748)),ace.config.setModuleUrl("ace/mode/scad",D(46193)),ace.config.setModuleUrl("ace/mode/scala",D(19366)),ace.config.setModuleUrl("ace/mode/scheme",D(81413)),ace.config.setModuleUrl("ace/mode/scrypt",D(70877)),ace.config.setModuleUrl("ace/mode/scss",D(55146)),ace.config.setModuleUrl("ace/mode/sh",D(77105)),ace.config.setModuleUrl("ace/mode/sjs",D(16042)),ace.config.setModuleUrl("ace/mode/slim",D(58715)),ace.config.setModuleUrl("ace/mode/smarty",D(48146)),ace.config.setModuleUrl("ace/mode/smithy",D(75144)),ace.config.setModuleUrl("ace/mode/snippets",D(33124)),ace.config.setModuleUrl("ace/mode/soy_template",D(23446)),ace.config.setModuleUrl("ace/mode/space",D(29582)),ace.config.setModuleUrl("ace/mode/sparql",D(4911)),ace.config.setModuleUrl("ace/mode/sql",D(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",D(19771)),ace.config.setModuleUrl("ace/mode/stylus",D(60940)),ace.config.setModuleUrl("ace/mode/svg",D(68506)),ace.config.setModuleUrl("ace/mode/swift",D(39215)),ace.config.setModuleUrl("ace/mode/tcl",D(54987)),ace.config.setModuleUrl("ace/mode/terraform",D(31372)),ace.config.setModuleUrl("ace/mode/tex",D(63609)),ace.config.setModuleUrl("ace/mode/text",D(12585)),ace.config.setModuleUrl("ace/mode/textile",D(29541)),ace.config.setModuleUrl("ace/mode/toml",D(69774)),ace.config.setModuleUrl("ace/mode/tsx",D(53135)),ace.config.setModuleUrl("ace/mode/turtle",D(12476)),ace.config.setModuleUrl("ace/mode/twig",D(71255)),ace.config.setModuleUrl("ace/mode/typescript",D(5397)),ace.config.setModuleUrl("ace/mode/vala",D(98124)),ace.config.setModuleUrl("ace/mode/vbscript",D(70801)),ace.config.setModuleUrl("ace/mode/velocity",D(33189)),ace.config.setModuleUrl("ace/mode/verilog",D(36982)),ace.config.setModuleUrl("ace/mode/vhdl",D(98256)),ace.config.setModuleUrl("ace/mode/visualforce",D(7335)),ace.config.setModuleUrl("ace/mode/vue",D(2256)),ace.config.setModuleUrl("ace/mode/wollok",D(29446)),ace.config.setModuleUrl("ace/mode/xml",D(93489)),ace.config.setModuleUrl("ace/mode/xquery",D(27174)),ace.config.setModuleUrl("ace/mode/yaml",D(32113)),ace.config.setModuleUrl("ace/mode/zeek",D(38035)),ace.config.setModuleUrl("ace/mode/zig",D(86882)),ace.config.setModuleUrl("ace/theme/ambiance",D(7890)),ace.config.setModuleUrl("ace/theme/chaos",D(40156)),ace.config.setModuleUrl("ace/theme/chrome",D(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",D(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",D(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",D(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",D(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",D(93008)),ace.config.setModuleUrl("ace/theme/clouds",D(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",D(54131)),ace.config.setModuleUrl("ace/theme/cobalt",D(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",D(63553)),ace.config.setModuleUrl("ace/theme/dawn",D(58732)),ace.config.setModuleUrl("ace/theme/dracula",D(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",D(71791)),ace.config.setModuleUrl("ace/theme/eclipse",D(28409)),ace.config.setModuleUrl("ace/theme/github",D(28573)),ace.config.setModuleUrl("ace/theme/github_dark",D(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",D(50836)),ace.config.setModuleUrl("ace/theme/gob",D(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",D(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",D(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",D(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",D(46925)),ace.config.setModuleUrl("ace/theme/iplastic",D(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",D(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",D(67773)),ace.config.setModuleUrl("ace/theme/kuroir",D(78990)),ace.config.setModuleUrl("ace/theme/merbivore",D(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",D(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",D(61343)),ace.config.setModuleUrl("ace/theme/monokai",D(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",D(63554)),ace.config.setModuleUrl("ace/theme/one_dark",D(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",D(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",D(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",D(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",D(14995)),ace.config.setModuleUrl("ace/theme/terminal",D(91493)),ace.config.setModuleUrl("ace/theme/textmate",D(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",D(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",D(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",D(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",D(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",D(59069)),ace.config.setModuleUrl("ace/theme/twilight",D(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",D(26689)),ace.config.setModuleUrl("ace/theme/xcode",D(26433)),ace.config.setModuleUrl("ace/mode/base_worker",D(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",D(74901)),ace.config.setModuleUrl("ace/mode/css_worker",D(88494)),ace.config.setModuleUrl("ace/mode/html_worker",D(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",D(7182)),ace.config.setModuleUrl("ace/mode/json_worker",D(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",D(55639)),ace.config.setModuleUrl("ace/mode/php_worker",D(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",D(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",D(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",D(67782)),ace.config.setModuleUrl("ace/snippets/abap",D(57909)),ace.config.setModuleUrl("ace/snippets/abc",D(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",D(63178)),ace.config.setModuleUrl("ace/snippets/ada",D(70563)),ace.config.setModuleUrl("ace/snippets/alda",D(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",D(53290)),ace.config.setModuleUrl("ace/snippets/apex",D(64691)),ace.config.setModuleUrl("ace/snippets/applescript",D(86568)),ace.config.setModuleUrl("ace/snippets/aql",D(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",D(64428)),ace.config.setModuleUrl("ace/snippets/asl",D(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",D(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",D(54726)),ace.config.setModuleUrl("ace/snippets/astro",D(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",D(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",D(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",D(34929)),ace.config.setModuleUrl("ace/snippets/c9search",D(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",D(51824)),ace.config.setModuleUrl("ace/snippets/cirru",D(90368)),ace.config.setModuleUrl("ace/snippets/clojure",D(70819)),ace.config.setModuleUrl("ace/snippets/cobol",D(10232)),ace.config.setModuleUrl("ace/snippets/coffee",D(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",D(71241)),ace.config.setModuleUrl("ace/snippets/crystal",D(94925)),ace.config.setModuleUrl("ace/snippets/csharp",D(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",D(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",D(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",D(46326)),ace.config.setModuleUrl("ace/snippets/csp",D(3029)),ace.config.setModuleUrl("ace/snippets/css",D(21452)),ace.config.setModuleUrl("ace/snippets/curly",D(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",D(46790)),ace.config.setModuleUrl("ace/snippets/d",D(32803)),ace.config.setModuleUrl("ace/snippets/dart",D(48138)),ace.config.setModuleUrl("ace/snippets/diff",D(54060)),ace.config.setModuleUrl("ace/snippets/django",D(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",D(58661)),ace.config.setModuleUrl("ace/snippets/dot",D(38180)),ace.config.setModuleUrl("ace/snippets/drools",D(53542)),ace.config.setModuleUrl("ace/snippets/edifact",D(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",D(71020)),ace.config.setModuleUrl("ace/snippets/ejs",D(78027)),ace.config.setModuleUrl("ace/snippets/elixir",D(81672)),ace.config.setModuleUrl("ace/snippets/elm",D(20259)),ace.config.setModuleUrl("ace/snippets/erlang",D(80564)),ace.config.setModuleUrl("ace/snippets/flix",D(38984)),ace.config.setModuleUrl("ace/snippets/forth",D(50528)),ace.config.setModuleUrl("ace/snippets/fortran",D(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",D(60317)),ace.config.setModuleUrl("ace/snippets/fsl",D(60470)),ace.config.setModuleUrl("ace/snippets/ftl",D(64093)),ace.config.setModuleUrl("ace/snippets/gcode",D(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",D(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",D(51069)),ace.config.setModuleUrl("ace/snippets/glsl",D(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",D(19433)),ace.config.setModuleUrl("ace/snippets/golang",D(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",D(90933)),ace.config.setModuleUrl("ace/snippets/groovy",D(28101)),ace.config.setModuleUrl("ace/snippets/haml",D(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",D(63083)),ace.config.setModuleUrl("ace/snippets/haskell",D(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",D(11831)),ace.config.setModuleUrl("ace/snippets/haxe",D(71443)),ace.config.setModuleUrl("ace/snippets/hjson",D(70389)),ace.config.setModuleUrl("ace/snippets/html",D(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",D(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",D(42201)),ace.config.setModuleUrl("ace/snippets/ini",D(36453)),ace.config.setModuleUrl("ace/snippets/io",D(93307)),ace.config.setModuleUrl("ace/snippets/ion",D(4345)),ace.config.setModuleUrl("ace/snippets/jack",D(37832)),ace.config.setModuleUrl("ace/snippets/jade",D(17469)),ace.config.setModuleUrl("ace/snippets/java",D(44967)),ace.config.setModuleUrl("ace/snippets/javascript",D(64472)),ace.config.setModuleUrl("ace/snippets/jexl",D(63542)),ace.config.setModuleUrl("ace/snippets/json",D(50165)),ace.config.setModuleUrl("ace/snippets/json5",D(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",D(60927)),ace.config.setModuleUrl("ace/snippets/jsp",D(36142)),ace.config.setModuleUrl("ace/snippets/jssm",D(44592)),ace.config.setModuleUrl("ace/snippets/jsx",D(33158)),ace.config.setModuleUrl("ace/snippets/julia",D(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",D(94158)),ace.config.setModuleUrl("ace/snippets/latex",D(1075)),ace.config.setModuleUrl("ace/snippets/latte",D(46769)),ace.config.setModuleUrl("ace/snippets/less",D(52466)),ace.config.setModuleUrl("ace/snippets/liquid",D(27191)),ace.config.setModuleUrl("ace/snippets/lisp",D(63635)),ace.config.setModuleUrl("ace/snippets/livescript",D(41122)),ace.config.setModuleUrl("ace/snippets/logiql",D(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",D(27299)),ace.config.setModuleUrl("ace/snippets/lsl",D(38552)),ace.config.setModuleUrl("ace/snippets/lua",D(67401)),ace.config.setModuleUrl("ace/snippets/luapage",D(57030)),ace.config.setModuleUrl("ace/snippets/lucene",D(95437)),ace.config.setModuleUrl("ace/snippets/makefile",D(63275)),ace.config.setModuleUrl("ace/snippets/markdown",D(81586)),ace.config.setModuleUrl("ace/snippets/mask",D(49087)),ace.config.setModuleUrl("ace/snippets/matlab",D(65946)),ace.config.setModuleUrl("ace/snippets/maze",D(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",D(29999)),ace.config.setModuleUrl("ace/snippets/mel",D(17417)),ace.config.setModuleUrl("ace/snippets/mips",D(74332)),ace.config.setModuleUrl("ace/snippets/mixal",D(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",D(31539)),ace.config.setModuleUrl("ace/snippets/mysql",D(59577)),ace.config.setModuleUrl("ace/snippets/nasal",D(49224)),ace.config.setModuleUrl("ace/snippets/nginx",D(82227)),ace.config.setModuleUrl("ace/snippets/nim",D(93243)),ace.config.setModuleUrl("ace/snippets/nix",D(72152)),ace.config.setModuleUrl("ace/snippets/nsis",D(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",D(58755)),ace.config.setModuleUrl("ace/snippets/objectivec",D(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",D(96183)),ace.config.setModuleUrl("ace/snippets/odin",D(91983)),ace.config.setModuleUrl("ace/snippets/partiql",D(78106)),ace.config.setModuleUrl("ace/snippets/pascal",D(79323)),ace.config.setModuleUrl("ace/snippets/perl",D(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",D(98692)),ace.config.setModuleUrl("ace/snippets/php",D(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",D(43416)),ace.config.setModuleUrl("ace/snippets/pig",D(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",D(91365)),ace.config.setModuleUrl("ace/snippets/plsql",D(18423)),ace.config.setModuleUrl("ace/snippets/powershell",D(41273)),ace.config.setModuleUrl("ace/snippets/praat",D(8711)),ace.config.setModuleUrl("ace/snippets/prisma",D(87915)),ace.config.setModuleUrl("ace/snippets/prolog",D(58432)),ace.config.setModuleUrl("ace/snippets/properties",D(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",D(93932)),ace.config.setModuleUrl("ace/snippets/prql",D(79240)),ace.config.setModuleUrl("ace/snippets/puppet",D(35129)),ace.config.setModuleUrl("ace/snippets/python",D(54309)),ace.config.setModuleUrl("ace/snippets/qml",D(31005)),ace.config.setModuleUrl("ace/snippets/r",D(55961)),ace.config.setModuleUrl("ace/snippets/raku",D(42950)),ace.config.setModuleUrl("ace/snippets/razor",D(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",D(62535)),ace.config.setModuleUrl("ace/snippets/red",D(13500)),ace.config.setModuleUrl("ace/snippets/redshift",D(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",D(84064)),ace.config.setModuleUrl("ace/snippets/robot",D(61111)),ace.config.setModuleUrl("ace/snippets/rst",D(43530)),ace.config.setModuleUrl("ace/snippets/ruby",D(35148)),ace.config.setModuleUrl("ace/snippets/rust",D(36729)),ace.config.setModuleUrl("ace/snippets/sac",D(37506)),ace.config.setModuleUrl("ace/snippets/sass",D(82737)),ace.config.setModuleUrl("ace/snippets/scad",D(35400)),ace.config.setModuleUrl("ace/snippets/scala",D(92945)),ace.config.setModuleUrl("ace/snippets/scheme",D(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",D(64128)),ace.config.setModuleUrl("ace/snippets/scss",D(48387)),ace.config.setModuleUrl("ace/snippets/sh",D(13176)),ace.config.setModuleUrl("ace/snippets/sjs",D(68801)),ace.config.setModuleUrl("ace/snippets/slim",D(93390)),ace.config.setModuleUrl("ace/snippets/smarty",D(67831)),ace.config.setModuleUrl("ace/snippets/smithy",D(34577)),ace.config.setModuleUrl("ace/snippets/snippets",D(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",D(93779)),ace.config.setModuleUrl("ace/snippets/space",D(50673)),ace.config.setModuleUrl("ace/snippets/sparql",D(38842)),ace.config.setModuleUrl("ace/snippets/sql",D(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",D(56420)),ace.config.setModuleUrl("ace/snippets/stylus",D(3309)),ace.config.setModuleUrl("ace/snippets/svg",D(82161)),ace.config.setModuleUrl("ace/snippets/swift",D(41200)),ace.config.setModuleUrl("ace/snippets/tcl",D(32384)),ace.config.setModuleUrl("ace/snippets/terraform",D(75607)),ace.config.setModuleUrl("ace/snippets/tex",D(6874)),ace.config.setModuleUrl("ace/snippets/text",D(54012)),ace.config.setModuleUrl("ace/snippets/textile",D(93878)),ace.config.setModuleUrl("ace/snippets/toml",D(49599)),ace.config.setModuleUrl("ace/snippets/tsx",D(22028)),ace.config.setModuleUrl("ace/snippets/turtle",D(86333)),ace.config.setModuleUrl("ace/snippets/twig",D(11078)),ace.config.setModuleUrl("ace/snippets/typescript",D(40344)),ace.config.setModuleUrl("ace/snippets/vala",D(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",D(5368)),ace.config.setModuleUrl("ace/snippets/velocity",D(4896)),ace.config.setModuleUrl("ace/snippets/verilog",D(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",D(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",D(82036)),ace.config.setModuleUrl("ace/snippets/vue",D(36751)),ace.config.setModuleUrl("ace/snippets/wollok",D(12463)),ace.config.setModuleUrl("ace/snippets/xml",D(65690)),ace.config.setModuleUrl("ace/snippets/xquery",D(84835)),ace.config.setModuleUrl("ace/snippets/yaml",D(46716)),ace.config.setModuleUrl("ace/snippets/zeek",D(51174)),ace.config.setModuleUrl("ace/snippets/zig",D(64865))},63282(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv=void 0;let t=D(4042),S=D(86144),i=D(36653),r=D(72079),o=["/properties"],g="http://json-schema.org/draft-07/schema";class s extends t.default{_addVocabularies(){super._addVocabularies(),S.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(r,o):r;this.addMetaSchema(e,g,!1),this.refs["http://json-schema.org/schema"]=g}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(g)?g:void 0)}}n.Ajv=s,e.exports=n=s,e.exports.Ajv=s,Object.defineProperty(n,"__esModule",{value:!0}),n.default=s;var a=D(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var l=D(99029);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(n,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var c=D(13558);Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return c.default}});var u=D(34551);Object.defineProperty(n,"MissingRefError",{enumerable:!0,get:function(){return u.default}})},41520(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class D{}n._CodeOrName=D,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class t extends D{constructor(e){if(super(),!n.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}n.Name=t;class S extends D{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,n)=>`${e}${n}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,n)=>(n instanceof t&&(e[n.str]=(e[n.str]||0)+1),e),{})}}function i(e,...n){let D=[e[0]],t=0;for(;t<n.length;)g(D,n[t]),D.push(e[++t]);return new S(D)}n._Code=S,n.nil=new S(""),n._=i;let r=new S("+");function o(e,...n){let D=[c(e[0])],t=0;for(;t<n.length;)D.push(r),g(D,n[t]),D.push(r,c(e[++t]));return s(D),new S(D)}function g(e,n){n instanceof S?e.push(...n._items):n instanceof t?e.push(n):e.push(l(n))}function s(e){let n=1;for(;n<e.length-1;){if(e[n]===r){let D=a(e[n-1],e[n+1]);if(void 0!==D){e.splice(n-1,3,D);continue}e[n++]="+"}n++}}function a(e,n){return'""'===n?e:'""'===e?n:"string"==typeof e?n instanceof t||'"'!==e[e.length-1]?void 0:"string"!=typeof n?`${e.slice(0,-1)}${n}"`:'"'===n[0]?e.slice(0,-1)+n.slice(1):void 0:"string"!=typeof n||'"'!==n[0]||e instanceof t?void 0:`"${e}${n.slice(1)}`}function l(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:c(Array.isArray(e)?e.join(","):e)}function c(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function u(e){return"string"==typeof e&&n.IDENTIFIER.test(e)?new S(`.${e}`):i`[${e}]`}function h(e){if("string"==typeof e&&n.IDENTIFIER.test(e))return new S(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}n.str=o,n.addCodeArg=g,n.strConcat=function(e,n){return n.emptyStr()?e:e.emptyStr()?n:o`${e}${n}`},n.stringify=function(e){return new S(c(e))},n.safeStringify=c,n.getProperty=u,n.getEsmExportName=h,n.regexpCode=function(e){return new S(e.toString())}},99029(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;let t=D(41520),S=D(57845);var i=D(41520);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(n,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(n,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(n,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return i.Name}});var r=D(57845);Object.defineProperty(n,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(n,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(n,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(n,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),n.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,n){return this}}class g extends o{constructor(e,n,D){super(),this.varKind=e,this.name=n,this.rhs=D}render({es5:e,_n:n}){let D=e?S.varKinds.var:this.varKind,t=void 0===this.rhs?"":` = ${this.rhs}`;return`${D} ${this.name}${t};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=T(this.rhs,e,n)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(e,n,D){super(),this.lhs=e,this.rhs=n,this.sideEffects=D}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=T(this.rhs,e,n),this}get names(){return A(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(e,n,D,t){super(e,D,t),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class c extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let n=this.label?` ${this.label}`:"";return`break${n};`+e}}class u extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=T(this.code,e,n),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class d extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,D)=>n+D.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let D=e[n].optimizeNodes();Array.isArray(D)?e.splice(n,1,...D):D?e[n]=D:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:D}=this,t=D.length;for(;t--;){let S=D[t];S.optimizeNames(e,n)||(O(e,S.names),D.splice(t,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>k(e,n.names),{})}}class p extends d{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class f extends d{}class m extends p{}m.kind="else";class y extends p{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new m(e):e}return n?!1===e?n instanceof y?n:n.nodes:this.nodes.length?this:new y(R(e),n instanceof y?[n]:n.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,n){var D;if(this.else=null==(D=this.else)?void 0:D.optimizeNames(e,n),super.optimizeNames(e,n)||this.else)return this.condition=T(this.condition,e,n),this}get names(){let e=super.names;return A(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class v extends p{}v.kind="for";class b extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=T(this.iteration,e,n),this}get names(){return k(super.names,this.iteration.names)}}class w extends v{constructor(e,n,D,t){super(),this.varKind=e,this.name=n,this.from=D,this.to=t}render(e){let n=e.es5?S.varKinds.var:this.varKind,{name:D,from:t,to:i}=this;return`for(${n} ${D}=${t}; ${D}<${i}; ${D}++)`+super.render(e)}get names(){let e=A(super.names,this.from);return A(e,this.to)}}class M extends v{constructor(e,n,D,t){super(),this.loop=e,this.varKind=n,this.name=D,this.iterable=t}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=T(this.iterable,e,n),this}get names(){return k(super.names,this.iterable.names)}}class L extends p{constructor(e,n,D){super(),this.name=e,this.args=n,this.async=D}render(e){let n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(e)}}L.kind="func";class $ extends d{render(e){return"return "+super.render(e)}}$.kind="return";class _ extends p{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(n=this.finally)||n.optimizeNodes(),this}optimizeNames(e,n){var D,t;return super.optimizeNames(e,n),null==(D=this.catch)||D.optimizeNames(e,n),null==(t=this.finally)||t.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class x extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class C extends p{render(e){return"finally"+super.render(e)}}C.kind="finally";class E{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?"\n":""},this._extScope=e,this._scope=new S.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let D=this._extScope.value(e,n);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,D,t){let S=this._scope.toName(n);return void 0!==D&&t&&(this._constants[S.str]=D),this._leafNode(new g(e,S,D)),S}const(e,n,D){return this._def(S.varKinds.const,e,n,D)}let(e,n,D){return this._def(S.varKinds.let,e,n,D)}var(e,n,D){return this._def(S.varKinds.var,e,n,D)}assign(e,n,D){return this._leafNode(new s(e,n,D))}add(e,D){return this._leafNode(new a(e,n.operators.ADD,D))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){let n=["{"];for(let[D,S]of e)n.length>1&&n.push(","),n.push(D),(D!==S||this.opts.es5)&&(n.push(":"),(0,t.addCodeArg)(n,S));return n.push("}"),new t._Code(n)}if(e,n,D){if(this._blockNode(new y(e)),n&&D)this.code(n).else().code(D).endIf();else if(n)this.code(n).endIf();else if(D)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(y,m)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new b(e),n)}forRange(e,n,D,t,i=this.opts.es5?S.varKinds.var:S.varKinds.let){let r=this._scope.toName(e);return this._for(new w(i,r,n,D),()=>t(r))}forOf(e,n,D,i=S.varKinds.const){let r=this._scope.toName(e);if(this.opts.es5){let e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,t._)`${e}.length`,n=>{this.var(r,(0,t._)`${e}[${n}]`),D(r)})}return this._for(new M("of",i,r,n),()=>D(r))}forIn(e,n,D,i=this.opts.es5?S.varKinds.var:S.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${n})`,D);let r=this._scope.toName(e);return this._for(new M("in",i,r,n),()=>D(r))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new c(e))}return(e){let n=new $;if(this._blockNode(n),this.code(e),1!==n.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode($)}try(e,n,D){if(!n&&!D)throw Error('CodeGen: "try" without "catch" and "finally"');let t=new _;if(this._blockNode(t),this.code(e),n){let e=this.name("e");this._currNode=t.catch=new x(e),n(e)}return D&&(this._currNode=t.finally=new C,this.code(D)),this._endBlockNode(x,C)}throw(e){return this._leafNode(new u(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(void 0===n)throw Error("CodeGen: not in self-balancing block");let D=this._nodes.length-n;if(D<0||void 0!==e&&D!==e)throw Error(`CodeGen: wrong number of nodes: ${D} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=t.nil,D,S){return this._blockNode(new L(e,n,D)),S&&this.code(S).endFunc(),this}endFunc(){return this._endBlockNode(L)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,n){let D=this._currNode;if(D instanceof e||n&&D instanceof n)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}}function k(e,n){for(let D in n)e[D]=(e[D]||0)+(n[D]||0);return e}function A(e,n){return n instanceof t._CodeOrName?k(e,n.names):e}function T(e,n,D){if(e instanceof t.Name)return S(e);if(!i(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=S(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function S(e){let t=D[e.str];return void 0===t||1!==n[e.str]?e:(delete n[e.str],t)}function i(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&1===n[e.str]&&void 0!==D[e.str])}}function O(e,n){for(let D in n)e[D]=(e[D]||0)-(n[D]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${P(e)}`}n.CodeGen=E,n.not=R;let I=N(n.operators.AND);n.and=function(...e){return e.reduce(I)};let j=N(n.operators.OR);function N(e){return(n,D)=>n===t.nil?D:D===t.nil?n:(0,t._)`${P(n)} ${e} ${P(D)}`}function P(e){return e instanceof t.Name?e:(0,t._)`(${e})`}n.or=function(...e){return e.reduce(j)}},57845(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;let S=D(41520);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(t||(n.UsedValueState=t={})),n.varKinds={const:new S.Name("const"),let:new S.Name("let"),var:new S.Name("var")};class r{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof S.Name?e:this.name(e)}name(e){return new S.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,D;if((null==(D=null==(n=this._parent)?void 0:n._prefixes)?void 0:D.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}n.Scope=r;class o extends S.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:D}){this.value=e,this.scopePath=(0,S._)`.${new S.Name(n)}[${D}]`}}n.ValueScopeName=o;let g=(0,S._)`\n`;class s extends r{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?g:S.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,n){var D;if(void 0===n.ref)throw Error("CodeGen: ref must be passed in value");let t=this.toName(e),{prefix:S}=t,i=null!=(D=n.key)?D:n.ref,r=this._values[S];if(r){let e=r.get(i);if(e)return e}else r=this._values[S]=new Map;r.set(i,t);let o=this._scope[S]||(this._scope[S]=[]),g=o.length;return o[g]=n.ref,t.setValue(n,{property:S,itemIndex:g}),t}getValue(e,n){let D=this._values[e];if(D)return D.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(void 0===n.scopePath)throw Error(`CodeGen: name "${n}" has no value`);return(0,S._)`${e}${n.scopePath}`})}scopeCode(e=this._values,n,D){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},n,D)}_reduceValues(e,D,r={},o){let g=S.nil;for(let s in e){let a=e[s];if(!a)continue;let l=r[s]=r[s]||new Map;a.forEach(e=>{if(l.has(e))return;l.set(e,t.Started);let r=D(e);if(r){let D=this.opts.es5?n.varKinds.var:n.varKinds.const;g=(0,S._)`${g}${D} ${e} = ${r};${this.opts._n}`}else if(r=null==o?void 0:o(e))g=(0,S._)`${g}${r}${this.opts._n}`;else throw new i(e);l.set(e,t.Completed)})}return g}}n.ValueScope=s},48708(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;let t=D(99029),S=D(94227),i=D(42023);function r(e,D=n.keywordError,S,i){let{it:o}=e,{gen:a,compositeRule:c,allErrors:u}=o,h=l(e,D,S);(null!=i?i:c||u)?g(a,h):s(o,(0,t._)`[${h}]`)}function o(e,D=n.keywordError,t){let{it:S}=e,{gen:r,compositeRule:a,allErrors:c}=S;g(r,l(e,D,t)),a||c||s(S,i.default.vErrors)}function g(e,n){let D=e.const("err",n);e.if((0,t._)`${i.default.vErrors} === null`,()=>e.assign(i.default.vErrors,(0,t._)`[${D}]`),(0,t._)`${i.default.vErrors}.push(${D})`),e.code((0,t._)`${i.default.errors}++`)}function s(e,n){let{gen:D,validateName:S,schemaEnv:i}=e;i.$async?D.throw((0,t._)`new ${e.ValidationError}(${n})`):(D.assign((0,t._)`${S}.errors`,n),D.return(!1))}n.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},n.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},n.reportError=r,n.reportExtraError=o,n.resetErrorsCount=function(e,n){e.assign(i.default.errors,n),e.if((0,t._)`${i.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${i.default.vErrors}.length`,n),()=>e.assign(i.default.vErrors,null)))},n.extendErrors=function({gen:e,keyword:n,schemaValue:D,data:S,errsCount:r,it:o}){if(void 0===r)throw Error("ajv implementation error");let g=e.name("err");e.forRange("i",r,i.default.errors,r=>{e.const(g,(0,t._)`${i.default.vErrors}[${r}]`),e.if((0,t._)`${g}.instancePath === undefined`,()=>e.assign((0,t._)`${g}.instancePath`,(0,t.strConcat)(i.default.instancePath,o.errorPath))),e.assign((0,t._)`${g}.schemaPath`,(0,t.str)`${o.errSchemaPath}/${n}`),o.opts.verbose&&(e.assign((0,t._)`${g}.schema`,D),e.assign((0,t._)`${g}.data`,S))})};let a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function l(e,n,D){let{createErrors:S}=e.it;return!1===S?(0,t._)`{}`:c(e,n,D)}function c(e,n,D={}){let{gen:t,it:S}=e,i=[u(S,D),h(e,D)];return d(e,n,i),t.object(...i)}function u({errorPath:e},{instancePath:n}){let D=n?(0,t.str)`${e}${(0,S.getErrorPath)(n,S.Type.Str)}`:e;return[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,D)]}function h({keyword:e,it:{errSchemaPath:n}},{schemaPath:D,parentSchema:i}){let r=i?n:(0,t.str)`${n}/${e}`;return D&&(r=(0,t.str)`${r}${(0,S.getErrorPath)(D,S.Type.Str)}`),[a.schemaPath,r]}function d(e,{params:n,message:D},S){let{keyword:r,data:o,schemaValue:g,it:s}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:h}=s;S.push([a.keyword,r],[a.params,"function"==typeof n?n(e):n||(0,t._)`{}`]),l.messages&&S.push([a.message,"function"==typeof D?D(e):D]),l.verbose&&S.push([a.schema,g],[a.parentSchema,(0,t._)`${u}${h}`],[i.default.data,o]),c&&S.push([a.propertyName,c])}},73835(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;let t=D(99029),S=D(13558),i=D(42023),r=D(66939),o=D(94227),g=D(62586);class s{constructor(e){var n;let D;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(D=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(n=e.baseId)?n:(0,r.normalizeId)(null==D?void 0:D[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==D?void 0:D.$async,this.refs={}}}function a(e){let n,D,o=c.call(this,e);if(o)return o;let s=(0,r.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:l}=this.opts.code,{ownProperties:u}=this.opts,h=new t.CodeGen(this.scope,{es5:a,lines:l,ownProperties:u});e.$async&&(n=h.scopeValue("Error",{ref:S.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let d=h.scopeName("validate");e.validateName=d;let p={gen:h,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,g.validateFunctionCode)(p),h.optimize(this.opts.code.optimize);let n=h.toString();D=`${h.scopeRefs(i.default.scope)}return ${n}`,this.opts.code.process&&(D=this.opts.code.process(D,e));let S=Function(`${i.default.self}`,`${i.default.scope}`,D)(this,this.scope.get());if(this.scope.value(d,{ref:S}),S.errors=null,S.schema=e.schema,S.schemaEnv=e,e.$async&&(S.$async=!0),!0===this.opts.code.source&&(S.source={validateName:d,validateCode:n,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:n}=p;S.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},S.source&&(S.source.evaluated=(0,t.stringify)(S.evaluated))}return e.validate=S,e}catch(n){throw delete e.validate,delete e.validateName,D&&this.logger.error("Error compiling schema, function code:",D),n}finally{this._compilations.delete(e)}}function l(e){return(0,r.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:a.call(this,e)}function c(e){for(let n of this._compilations)if(u(n,e))return n}function u(e,n){return e.schema===n.schema&&e.root===n.root&&e.baseId===n.baseId}function h(e,n){let D;for(;"string"==typeof(D=this.refs[n]);)n=D;return D||this.schemas[n]||d.call(this,e,n)}function d(e,n){let D=this.opts.uriResolver.parse(n),t=(0,r._getFullPath)(this.opts.uriResolver,D),S=(0,r.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&t===S)return f.call(this,D,e);let i=(0,r.normalizeId)(t),o=this.refs[i]||this.schemas[i];if("string"==typeof o){let n=d.call(this,e,o);if("object"!=typeof(null==n?void 0:n.schema))return;return f.call(this,D,n)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||a.call(this,o),i===(0,r.normalizeId)(n)){let{schema:n}=o,{schemaId:D}=this.opts,t=n[D];return t&&(S=(0,r.resolveUrl)(this.opts.uriResolver,S,t)),new s({schema:n,schemaId:D,root:e,baseId:S})}return f.call(this,D,o)}}n.SchemaEnv=s,n.compileSchema=a,n.resolveRef=function(e,n,D){var t;D=(0,r.resolveUrl)(this.opts.uriResolver,n,D);let S=e.refs[D];if(S)return S;let i=h.call(this,e,D);if(void 0===i){let S=null==(t=e.localRefs)?void 0:t[D],{schemaId:r}=this.opts;S&&(i=new s({schema:S,schemaId:r,root:e,baseId:n}))}if(void 0!==i)return e.refs[D]=l.call(this,i)},n.getCompilingSchema=c,n.resolveSchema=d;let p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(e,{baseId:n,schema:D,root:t}){var S;let i;if((null==(S=e.fragment)?void 0:S[0])!=="/")return;for(let t of e.fragment.slice(1).split("/")){if("boolean"==typeof D)return;let e=D[(0,o.unescapeFragment)(t)];if(void 0===e)return;let S="object"==typeof(D=e)&&D[this.opts.schemaId];!p.has(t)&&S&&(n=(0,r.resolveUrl)(this.opts.uriResolver,n,S))}if("boolean"!=typeof D&&D.$ref&&!(0,o.schemaHasRulesButRef)(D,this.RULES)){let e=(0,r.resolveUrl)(this.opts.uriResolver,n,D.$ref);i=d.call(this,t,e)}let{schemaId:g}=this.opts;if((i=i||new s({schema:D,schemaId:g,root:t,baseId:n})).schema!==i.root.schema)return i}},42023(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(99029);n.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}},34551(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(66939);class S extends Error{constructor(e,n,D,S){super(S||`can't resolve reference ${D} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,D),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}n.default=S},66939(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;let t=D(94227),S=D(32017),i=D(7106),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);n.inlineRef=function(e,n=!0){return"boolean"==typeof e||(!0===n?!g(e):!!n&&s(e)<=n)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function g(e){for(let n in e){if(o.has(n))return!0;let D=e[n];if(Array.isArray(D)&&D.some(g)||"object"==typeof D&&g(D))return!0}return!1}function s(e){let n=0;for(let D in e)if("$ref"===D||(n++,!r.has(D)&&("object"==typeof e[D]&&(0,t.eachItem)(e[D],e=>n+=s(e)),n===1/0)))return 1/0;return n}function a(e,n="",D){!1!==D&&(n=u(n));let t=e.parse(n);return l(e,t)}function l(e,n){return e.serialize(n).split("#")[0]+"#"}n.getFullPath=a,n._getFullPath=l;let c=/#\/?$/;function u(e){return e?e.replace(c,""):""}n.normalizeId=u,n.resolveUrl=function(e,n,D){return D=u(D),e.resolve(n,D)};let h=/^[a-z_][-a-z0-9._]*$/i;n.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};let{schemaId:D,uriResolver:t}=this.opts,r=u(e[D]||n),o={"":r},g=a(t,r,!1),s={},l=new Set;return i(e,{allKeys:!0},(e,n,t,S)=>{if(void 0===S)return;let i=g+n,r=o[S];function a(n){let D=this.opts.uriResolver.resolve;if(n=u(r?D(r,n):n),l.has(n))throw d(n);l.add(n);let t=this.refs[n];return"string"==typeof t&&(t=this.refs[t]),"object"==typeof t?c(e,t.schema,n):n!==u(i)&&("#"===n[0]?(c(e,s[n],n),s[n]=e):this.refs[n]=i),n}function p(e){if("string"==typeof e){if(!h.test(e))throw Error(`invalid anchor "${e}"`);a.call(this,`#${e}`)}}"string"==typeof e[D]&&(r=a.call(this,e[D])),p.call(this,e.$anchor),p.call(this,e.$dynamicAnchor),o[n]=r}),s;function c(e,n,D){if(void 0!==n&&!S(e,n))throw d(D)}function d(e){return Error(`reference "${e}" resolves to more than one schema`)}}},10396(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getRules=n.isJSONType=void 0;let D=new Set(["string","number","integer","boolean","null","object","array"]);n.isJSONType=function(e){return"string"==typeof e&&D.has(e)},n.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},94227(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.checkStrictMode=n.getErrorPath=n.Type=n.useFunc=n.setEvaluated=n.evaluatedPropsToName=n.mergeEvaluated=n.eachItem=n.unescapeJsonPointer=n.escapeJsonPointer=n.escapeFragment=n.unescapeFragment=n.schemaRefOrVal=n.schemaHasRulesButRef=n.schemaHasRules=n.checkUnknownRules=n.alwaysValidSchema=n.toHash=void 0;let S=D(99029),i=D(41520);function r(e,n=e.schema){let{opts:D,self:t}=e;if(!D.strictSchema||"boolean"==typeof n)return;let S=t.RULES.keywords;for(let D in n)S[D]||h(e,`unknown keyword: "${D}"`)}function o(e,n){if("boolean"==typeof e)return!e;for(let D in e)if(n[D])return!0;return!1}function g(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:e,mergeToName:n,mergeValues:D,resultToName:t}){return(i,r,o,g)=>{let s=void 0===o?r:o instanceof S.Name?(r instanceof S.Name?e(i,r,o):n(i,r,o),o):r instanceof S.Name?(n(i,o,r),r):D(r,o);return g!==S.Name||s instanceof S.Name?s:t(i,s)}}function l(e,n){if(!0===n)return e.var("props",!0);let D=e.var("props",(0,S._)`{}`);return void 0!==n&&c(e,D,n),D}function c(e,n,D){Object.keys(D).forEach(D=>e.assign((0,S._)`${n}${(0,S.getProperty)(D)}`,!0))}n.toHash=function(e){let n={};for(let D of e)n[D]=!0;return n},n.alwaysValidSchema=function(e,n){return"boolean"==typeof n?n:0===Object.keys(n).length||(r(e,n),!o(n,e.self.RULES.all))},n.checkUnknownRules=r,n.schemaHasRules=o,n.schemaHasRulesButRef=function(e,n){if("boolean"==typeof e)return!e;for(let D in e)if("$ref"!==D&&n.all[D])return!0;return!1},n.schemaRefOrVal=function({topSchemaRef:e,schemaPath:n},D,t,i){if(!i){if("number"==typeof D||"boolean"==typeof D)return D;if("string"==typeof D)return(0,S._)`${D}`}return(0,S._)`${e}${n}${(0,S.getProperty)(t)}`},n.unescapeFragment=function(e){return s(decodeURIComponent(e))},n.escapeFragment=function(e){return encodeURIComponent(g(e))},n.escapeJsonPointer=g,n.unescapeJsonPointer=s,n.eachItem=function(e,n){if(Array.isArray(e))for(let D of e)n(D);else n(e)},n.mergeEvaluated={props:a({mergeNames:(e,n,D)=>e.if((0,S._)`${D} !== true && ${n} !== undefined`,()=>{e.if((0,S._)`${n} === true`,()=>e.assign(D,!0),()=>e.assign(D,(0,S._)`${D} || {}`).code((0,S._)`Object.assign(${D}, ${n})`))}),mergeToName:(e,n,D)=>e.if((0,S._)`${D} !== true`,()=>{!0===n?e.assign(D,!0):(e.assign(D,(0,S._)`${D} || {}`),c(e,D,n))}),mergeValues:(e,n)=>!0===e||{...e,...n},resultToName:l}),items:a({mergeNames:(e,n,D)=>e.if((0,S._)`${D} !== true && ${n} !== undefined`,()=>e.assign(D,(0,S._)`${n} === true ? true : ${D} > ${n} ? ${D} : ${n}`)),mergeToName:(e,n,D)=>e.if((0,S._)`${D} !== true`,()=>e.assign(D,!0===n||(0,S._)`${D} > ${n} ? ${D} : ${n}`)),mergeValues:(e,n)=>!0===e||Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})},n.evaluatedPropsToName=l,n.setEvaluated=c;let u={};function h(e,n,D=e.opts.strictSchema){if(D){if(n=`strict mode: ${n}`,!0===D)throw Error(n);e.self.logger.warn(n)}}n.useFunc=function(e,n){return e.scopeValue("func",{ref:n,code:u[n.code]||(u[n.code]=new i._Code(n.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(t||(n.Type=t={})),n.getErrorPath=function(e,n,D){if(e instanceof S.Name){let i=n===t.Num;return D?i?(0,S._)`"[" + ${e} + "]"`:(0,S._)`"['" + ${e} + "']"`:i?(0,S._)`"/" + ${e}`:(0,S._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,S.getProperty)(e).toString():"/"+g(e)},n.checkStrictMode=h},7887(e,n){"use strict";function D(e,n){return n.rules.some(n=>t(e,n))}function t(e,n){var D;return void 0!==e[n.keyword]||(null==(D=n.definition.implements)?void 0:D.some(n=>void 0!==e[n]))}Object.defineProperty(n,"__esModule",{value:!0}),n.shouldUseRule=n.shouldUseGroup=n.schemaHasRulesForType=void 0,n.schemaHasRulesForType=function({schema:e,self:n},t){let S=n.RULES.types[t];return S&&!0!==S&&D(e,S)},n.shouldUseGroup=D,n.shouldUseRule=t},28727(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;let t=D(48708),S=D(99029),i=D(42023),r={message:"boolean schema is false"};function o(e,n){let{gen:D,data:S}=e,i={gen:D,keyword:"false schema",data:S,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(i,r,void 0,n)}n.topBoolOrEmptySchema=function(e){let{gen:n,schema:D,validateName:t}=e;!1===D?o(e,!1):"object"==typeof D&&!0===D.$async?n.return(i.default.data):(n.assign((0,S._)`${t}.errors`,null),n.return(!0))},n.boolOrEmptySchema=function(e,n){let{gen:D,schema:t}=e;!1===t?(D.var(n,!1),o(e)):D.var(n,!0)}},10208(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;let S=D(10396),i=D(7887),r=D(48708),o=D(99029),g=D(94227);function s(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(S.isJSONType))return n;throw Error("type must be JSONType or JSONType[]: "+n.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(t||(n.DataType=t={})),n.getSchemaTypes=function(e){let n=s(e.type);if(n.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!n.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&n.push("null")}return n},n.getJSONTypes=s,n.coerceAndCheckDataType=function(e,n){let{gen:D,data:S,opts:r}=e,o=l(n,r.coerceTypes),g=n.length>0&&!(0===o.length&&1===n.length&&(0,i.schemaHasRulesForType)(e,n[0]));if(g){let i=d(n,S,r.strictNumbers,t.Wrong);D.if(i,()=>{o.length?c(e,n,o):f(e)})}return g};let a=new Set(["string","number","integer","boolean","null"]);function l(e,n){return n?e.filter(e=>a.has(e)||"array"===n&&"array"===e):[]}function c(e,n,D){let{gen:t,data:S,opts:i}=e,r=t.let("dataType",(0,o._)`typeof ${S}`),g=t.let("coerced",(0,o._)`undefined`);for(let e of("array"===i.coerceTypes&&t.if((0,o._)`${r} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>t.assign(S,(0,o._)`${S}[0]`).assign(r,(0,o._)`typeof ${S}`).if(d(n,S,i.strictNumbers),()=>t.assign(g,S))),t.if((0,o._)`${g} !== undefined`),D))(a.has(e)||"array"===e&&"array"===i.coerceTypes)&&s(e);function s(e){switch(e){case"string":t.elseIf((0,o._)`${r} == "number" || ${r} == "boolean"`).assign(g,(0,o._)`"" + ${S}`).elseIf((0,o._)`${S} === null`).assign(g,(0,o._)`""`);return;case"number":t.elseIf((0,o._)`${r} == "boolean" || ${S} === null
|
|
5
|
+
failing expression: ${e}`)}return null}function nq(e,n,D,t){let{myValue:S,patient:i}=t,{sex:r,age:o}=i??{};"field"===e.type&&void 0===S&&e.value&&(S=D[e.value.id]);let g=new nV;g.putObject("prevEnc",{value:t.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(n=>n.concept.uuid==e)}});let s=t?.visit??{},a=s?.visitType||{uuid:""},l=a.uuid??"",c={isEmpty:nl.A};return{...new nN(e,i,n,D),...iq(),...t,...D,patient:i,myValue:S,sex:r,age:o,HD:g,visit:s,visitType:a,visitTypeUuid:l,_:c}}function nG(e){let n=nP(e);if(nH.has(n))return nH.get(n);let D=(0,o.compile)(e);return nH.set(n,D),D}function nK(e,n,D){for(let t of(0,o.extractVariableNames)(e)){let e=D.find(e=>e.id===t);e&&nF(n,e)}}function nY(e,n,D,t){return"embedded-view"==t||("automatic"==e?"maximized"==D&&n.endsWith("desktop"):"single-line"==e)}function nQ(e,n){let D=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,t=n.find(e=>e.id==D);t&&(t.fieldDependents||(t.fieldDependents=new Set)).add(e.id)}function nZ(e,n,D){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:t,referenceQuestionId:S}=e.required,i=n.find(e=>e.id==S);return!!i&&((i.fieldDependents||(i.fieldDependents=new Set)).add(e.id),t?.includes(D[S]))}function nJ(e,n,D,t,S,i){let{value:r}=e;return i(r.disabled?.disableWhenExpression,e,n,D,{mode:t,patient:S})}function nX(e,n,D,t,S,i,r){let{value:o,type:g}=e,s=i(o.hide?.hideWhenExpression,e,n,D,{mode:t,patient:S});e.value.isHidden=s,"field"==g&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=s}),"page"==g&&o.sections.forEach(e=>{e.isParentHidden=s,n1(s,e,n,r)}),"section"==g&&n1(s,o,n,r)}function n1(e,n,D,t){let S=n.questions.map(e=>e.id);D.filter(e=>S.includes(e.id)).forEach(n=>{n.isParentHidden=e,"group"==n.questionOptions.rendering&&n.questions.forEach(n=>{n.isParentHidden=e}),t?.(n)})}function n2(e,n){if(!e?.includes(":"))return n?.find(n=>n.uuid===e);{let[D,t]=e.split(":");return n?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===D.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===t.toUpperCase()))}}function n4(e,n=!1){let D=document.getElementById(e);D?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),n&&D?.focus()}let n3=(e,n)=>{let D=e.questionOptions.rendering;if("object"!=typeof n)return{value:n,display:n};let t="Observation"===n.resourceType?n8(n,D):n;if(!t)return{value:null,display:null};if("string"==typeof t.value||"number"==typeof t.value){if("date"===D||"datetime"===D){let e=nr(`${t.value}`);return{value:e,display:e4()(e).format("YYYY-MM-DD HH:mm")}}return{value:t.value,display:t.value}}return["toggle","checkbox"].includes(D)?{value:t.value?.uuid,display:t.value?.name?.name}:{value:t.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===t.value?.uuid)?.label}};function n0(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function n8(e,n){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:n9(e,n)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function n9(e,n){switch(n){case"toggle":return e.valueBoolean?{uuid:g.t$}:{uuid:g.Mi};case"date":case"datetime":return e.valueDateTime;case"number":return e.valueQuantity?.value??null;case"radio":case"checkbox":case"select":case"content-switcher":return e.valueCodeableConcept?.coding[0]?{uuid:e.valueCodeableConcept?.coding[0].code,name:{name:e.valueCodeableConcept?.coding[0].display}}:null;default:return e.valueString}}function n7(e,n){return e.pages.find(e=>n.meta.pageId===e.id).sections.find(e=>e.questions.find(e=>e.id===n.id))}var n6=D(10578);function n5(e,n){let{methods:{getValues:D}}=n,t=D();g.FU.includes(e.questionOptions.rendering)&&De(e,t,n),Dn(e,t,n)}function De(e,n,D){let{sessionMode:t,formFields:S,patient:i,visit:r}=D;e.questionOptions.answers.forEach(D=>{let o=D.disable?.disableWhenExpression;o&&o.includes("myValue")&&(D.disable.isDisabled=nW(D.disable?.disableWhenExpression,{value:e,type:"field"},S,n,{mode:t,patient:i,visit:r}))})}function Dn(e,n,D){let{sessionMode:t,formFields:S,patient:i,formFieldValidators:r,formJson:o,methods:{setValue:g},updateFormField:s,setForm:a,visit:l}=D,c=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let a=S.find(n=>n.id==e);if(a.questionOptions.calculate?.calculateExpression&&nB(a.questionOptions.calculate.calculateExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l}).then(e=>{g(a.id,e);let{errors:r,warnings:o}=DD(a,e,D.formFieldValidators,{formFields:S,values:n,expressionContext:{patient:i,mode:t}});a.meta.submission||(a.meta.submission={}),a.meta.submission.errors=r,a.meta.submission.warnings=o,r.length||D.formFieldAdapters[a.type].transformFieldValue(a,e,D),s(a)}).catch(e=>{(0,n6.N)(e,"Error evaluating calculate expression")}),a.hide){let e=n7(o,a),D=e?.questions.some(e=>!e.isHidden);if(nX({value:a,type:"field"},S,n,t,i,nW,s),e){e.questions=e?.questions.map(e=>e.id===a.id?a:e);let n=a.isHidden,t=[...e.questions,a].some(e=>!e.isHidden);D||n?D&&!t&&(e.isHidden=!0,c=!0):(e.isHidden=!1,c=!0)}}if("object"==typeof a.disabled&&a.disabled.disableWhenExpression&&(a.isDisabled=nJ({value:a,type:"field"},S,n,t,i,nW)),"object"==typeof a.required&&a.required?.type==="conditionalRequired"&&(a.isRequired=nZ(a,S,n)),a.validators?.some(e=>"conditionalAnswered"===e.type)){let e=a.validators?.find(e=>"conditionalAnswered"===e.type),D=r.conditionalAnswered.validate(a,a.meta.submission?.newValue,{...e,expressionContext:{patient:i,mode:t},values:n,formFields:S});a.meta.submission={...a.meta.submission,errors:D}}a?.questionOptions.answers?.filter(e=>!e7(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=nW(e.hide?.hideWhenExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})}),a?.questionOptions.answers?.filter(e=>!e7(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=nW(e.disable?.disableWhenExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})}),!a.isHidden&&a.meta.readonlyExpression&&(a.readonly=nW(a.meta.readonlyExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})),nn(a,"repeating")&&!e7(a.questionOptions.repeatOptions?.limitExpression)&&(a.questionOptions.repeatOptions.limit=nW(a.questionOptions.repeatOptions?.limitExpression,{value:a,type:"field"},S,n,{mode:t,patient:i,visit:l})),s(a)}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let D=0;D<o.pages.length;D++){let r=o.pages[D].sections.find(n=>n.label==e);if(r){nX({value:r,type:"section"},S,n,t,i,nW,s),c=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{nX({value:o.pages.find(n=>n.label==e),type:"page"},S,n,t,i,nW,s),c=!0}),c&&a(o)}function DD(e,n,D,t){let S=[],i=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(r=>{let o=D[r.type]?.validate?.(e,n,{...r,...t});o&&o.forEach(e=>{"error"===e.resultType?S.push(e):"warning"===e.resultType&&i.push(e)})})}catch(e){console.error(e)}return{errors:S,warnings:i}}var Dt=D(6232);let DS=a().createContext(void 0),Di=({methods:e,children:n,...D})=>a().createElement(DS.Provider,{value:{...D,methods:e}},n),Dr=()=>{let e=a().useContext(DS);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e},Do="-esm-form-builder__value__value___GMGmn",Dg="-esm-form-builder__value__item___U1v45",Ds="-esm-form-builder__value__empty___sor36",Da=()=>{let{t:e}=(0,eX.useTranslation)();return a().createElement("div",null,a().createElement("span",{className:Ds},"(",e("blank","Blank"),")"))},Dl=({value:e})=>Array.isArray(e)?a().createElement(Dc,{valueArray:e}):a().createElement("div",{className:Do},e),Dc=({valueArray:e})=>a().createElement("ul",null,e.map(e=>a().createElement("li",{className:Dg},e))),Du="-esm-form-builder__previous-value-review__formField___vrMDb",Dh="-esm-form-builder__previous-value-review__row___XRir3",Dd="-esm-form-builder__previous-value-review__value___OZCed",Dp="-esm-form-builder__previous-value-review__reuseButton___mtoQ-",Df=({previousValue:e,displayText:n,field:D,hideHeader:t,onAfterChange:S})=>{let{t:i}=(0,eX.useTranslation)(),{methods:{setValue:r}}=Dr(),o=n=>{n.preventDefault(),r(D.id,e),S(e)};return a().createElement("div",{className:Du},a().createElement("div",{className:Dh},!t&&a().createElement("div",null,i("previousValue","Previous value:")),a().createElement("div",{className:Dd},a().createElement(Dl,{value:n}))),a().createElement("div",{className:Dp,role:"button",tabIndex:0,onClick:o},i("reuseValue","Reuse value")))},Dm="-esm-form-builder__unspecified__unspecified___suBpN",Dy=({field:e,fieldValue:n,setFieldValue:D,onAfterChange:t})=>{let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)(!1),{sessionMode:o,updateFormField:g}=Dr();(0,s.useEffect)(()=>{e7(n)&&"edit"===o&&(r(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,s.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!e7(n))&&(r(!1),e.meta.submission.unspecified=!1,g(e))},[e.meta?.submission,n]);let l=(0,s.useCallback)(n=>{let S=e.questionOptions.rendering;if(n.target.checked){r(!0);let n="checkbox"===S?[]:"";nD(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],g(e),D(n),t(n)}else r(!1),e.meta.submission.unspecified=!1,g(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,Dt.H)(e.readonly)&&!ni(o)&&a().createElement("div",{className:Dm},a().createElement(h.Sc0,{id:`${e.id}-unspecified`,labelText:S("unspecified","Unspecified"),value:S("unspecified","Unspecified"),onChange:l,checked:i,disabled:e.isDisabled}))};function Dv(e,n,D,t){return!("embedded-view"===e&&D&&(n||t))}let Db="-esm-form-builder__form-field-renderer__unspecifiedContainer___Z9L4T",Dw=({fieldId:e,valueAdapter:n,repeatOptions:D})=>{let[t,S]=(0,s.useState)(null),[i,r]=(0,s.useState)([]),[g,l]=(0,s.useState)([]),[c,u]=(0,s.useState)(null),h=Dr(),d=!1;try{let e=(0,o.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});d=e?.hideUnansweredQuestionsInReadonlyForms??!1}catch(e){console.warn("Failed to load @openmrs/esm-form engine-app config - using hideUnansweredQuestionsInReadonlyForms=false (empty fields will be visible in readonly mode): ",e)}let{methods:{control:p,getValues:f,getFieldState:m},patient:y,sessionMode:v,formFields:b,formFieldValidators:w,addInvalidField:M,removeInvalidField:L,updateFormField:$}=h,_=ei({control:p,name:e,exact:!0}),x=()=>{},C=(0,s.useMemo)(()=>b.find(n=>n.id===e),[e,b]);(0,s.useEffect)(()=>{if(nn(C,"repeating")&&D?.targetRendering?iF(D.targetRendering).then(e=>{e&&S({value:e})}):iU(C).then(e=>{e&&S({value:e})}),"enter"===v&&(C.historicalExpression||h.previousDomainObjectValue))try{h.processor.getHistoricalValue(C,h).then(e=>{u(e)})}catch(e){console.error(e)}},[]),(0,s.useEffect)(()=>{let{isDirty:e,isTouched:D}=m(C.id),{submission:t,unspecified:S}=C.meta,{calculate:i,defaultValue:r}=C.questionOptions;!e7(_)&&!t?.newValue&&!e&&!S&&(i?.calculateExpression||r)&&n.transformFieldValue(C,_,h),(e||D)&&E(_)},[_]),(0,s.useEffect)(()=>{C.meta.submission?.errors&&r(C.meta.submission.errors),C.meta.submission?.warnings&&l(C.meta.submission.warnings),C.meta.submission?.unspecified&&(r([]),L(C.id))},[C.meta.submission]);let E=e=>{let{errors:D,warnings:t}=DD(C,e,w,{formFields:b,values:f(),expressionContext:{patient:y,mode:v}});if(C.meta.submission&&(C.meta.submission.errors=void 0,C.meta.submission.warnings=void 0),i.length&&!D.length?(L(C.id),r([])):D.length&&(r(D),M(C)),D.length||n.transformFieldValue(C,e,h),l(t),n5(C,h),C.meta.groupId){let e=b.find(e=>e.id===C.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===C.id?C:e),$(e))}};if(!t)return null;let k=t.value;return!D?.targetRendering&&D$(C.questionOptions.rendering)?a().createElement(k,{key:C.id,field:C,value:null,errors:i,warnings:g,setFieldValue:null}):Dv(v,!!C.questionOptions.isTransient,e7(_),d)?a().createElement(e1.tH,{FallbackComponent:DM,onReset:x},a().createElement(eo,{control:p,name:C.id,render:({field:{value:e,onChange:n,onBlur:D}})=>a().createElement("div",null,a().createElement(k,{key:`${C.id}-input-component`,field:C,value:e,errors:i,warnings:g,setFieldValue:e=>{n(e),E(e),D()}}),DL(C)&&a().createElement("div",{className:Db},C.unspecified&&a().createElement(Dy,{key:`${C.id}-unspecified`,field:C,setFieldValue:n,onAfterChange:E,fieldValue:e})),c?.value&&a().createElement("div",null,a().createElement(Df,{key:`${C.id}-previous-value-review`,previousValue:c.value,displayText:c.display,onAfterChange:E,field:C})))})):null};function DM({error:e}){let{t:n}=(0,eX.useTranslation)();return a().createElement(h.HYS,{"aria-label":n("closesNotification","Closes notification"),caption:"",hideCloseButton:!0,lowContrast:!0,onClose:function(){},onCloseButtonClick:function(){},statusIconDescription:n("notification","Notification"),subtitle:e.message,title:n("errorRenderingField","Error rendering field")})}function DL(e){let{rendering:n}=e.questionOptions;return(0,Dt.H)(e.unspecified)&&"toggle"!=n&&"group"!=n&&"repeating"!=n&&"markdown"!=n&&"extension-widget"!=n&&"workspace-launcher"!=n}function D$(e){return"group"===e||"repeating"===e}let D_=({field:e,...n})=>{let{t:D}=(0,eX.useTranslation)(),{formFieldAdapters:t,formFields:S}=Dr(),i=(0,s.useMemo)(()=>e.questions.map(e=>S.find(n=>n.id===e.id)).filter(e=>!e.isHidden).map((D,S)=>{let i=`${D.id}_${S}`;return D.id===e.id?a().createElement(DM,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===D.type&&D$(D.questionOptions.rendering)?a().createElement("div",{key:i,className:u.nestedGroupContainer},a().createElement(D_,{field:D,...n})):t[D.type]?a().createElement("div",{className:c()(u.flexColumn),key:i},a().createElement("div",{className:u.groupContainer},a().createElement(Dw,{fieldId:D.id,valueAdapter:t[D.type]}))):void 0}),[e,S]);return a().createElement("div",{className:u.groupContainer},i.length>1?a().createElement(h.gE_,{legendText:D(e.label),className:u.boldLegend},i):i)},Dx=D_,DC="-esm-form-builder__label__label___hCNId",DE=({value:e,tooltipText:n})=>a().createElement("div",{className:DC},a().createElement(h.lrh,{autoAlign:!0,tabIndex:0,definition:n??""},a().createElement("span",{className:"cds--label"},`${e}:`))),Dk="-esm-form-builder__field-value-view__formField___03eTm",DA="-esm-form-builder__field-value-view__readonly___EsDxp",DT="-esm-form-builder__field-value-view__value___Uo2uV",DO="-esm-form-builder__field-value-view__inlineFlexRow___b4Ii6",DR="-esm-form-builder__field-value-view__inlineFlexColumn___9opmW",DI=({label:e,conceptName:n,value:D,isInline:t})=>a().createElement(a().Fragment,null,t?a().createElement("div",{className:DO},a().createElement("div",{className:DR},a().createElement(DE,{value:e,tooltipText:n})),a().createElement("div",{className:DR},e7(D)?a().createElement(Da,null):a().createElement(Dl,{value:D}))):a().createElement("div",{className:DA},a().createElement("div",{className:Dk},a().createElement(DE,{value:e,tooltipText:n}),a().createElement("div",{className:DT},e7(D)?a().createElement(Da,null):a().createElement(Dl,{value:D}))))),Dj="-esm-form-builder__content-switcher__formField___7p+cd",DN="-esm-form-builder__content-switcher__errorLegend___Wo7IC",DP="-esm-form-builder__content-switcher__boldedLegend___ocVuA",DF="-esm-form-builder__content-switcher__selectedOption___Nhf+y";var DU=D(31362);let DV="-esm-form-builder__field-label__required___v5kNF",DH="-esm-form-builder__field-label__questionLabel___iTCWA",Dz="-esm-form-builder__field-label__tooltipIcon___i1hW9",DW=({field:e,children:n})=>{let{t:D}=(0,eX.useTranslation)();return e.questionInfo?a().createElement(h.m_M,{autoAlign:!0,label:D(e.questionInfo)},a().createElement("div",null,n)):a().createElement(a().Fragment,null,n)},DB=({field:e,customLabel:n})=>{let{t:D}=(0,eX.useTranslation)(),t=!!e.questionInfo,S=n||D(e.label);return a().createElement(DW,{field:e},a().createElement("div",{className:DH,"data-testid":`${e.id}-label`},a().createElement("span",null,S),e.isRequired&&a().createElement("span",{title:D("required","Required"),className:DV},"*"),t&&a().createElement(DU.$$,{size:16,"aria-hidden":"true",className:Dz,"data-testid":`${e.id}-information-icon`})))},Dq=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),u=(0,s.useCallback)(e=>{S(e.name)},[S]),d=(0,s.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),p=(0,s.useMemo)(()=>d.findIndex(e=>e.concept==n),[n,d]),f=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o||(0,Dt.H)(e.readonly)?a().createElement("div",{className:Dj},a().createElement(DI,{label:i(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:f})):!e.isHidden&&a().createElement(h.gE_,{legendText:a().createElement("div",{className:DP},a().createElement(DB,{field:e})),className:c()({[DN]:D.length>0,[DP]:0===D.length})},a().createElement(h.Tps,{onChange:u,selectedIndex:p,className:DF,size:"md"},d.map((n,D)=>a().createElement(h.dOG,{name:n.concept||n.value,text:i(n.label),key:D,disabled:e.isDisabled}))))},DG="-esm-form-builder__date__datePickerWarn___kHnXv",DK="-esm-form-builder__date__datePickerLabel___jB51j",DY="-esm-form-builder__date__boldedLabel___iRLd7",DQ="-esm-form-builder__date__datetime___Vcy8S",DZ="-esm-form-builder__date__datePickerSpacing___qjcEN",DJ="-esm-form-builder__date__timeInput___LsT4x",DX=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),[r,g]=(0,s.useState)(""),{layoutType:l,sessionMode:u,workspaceLayout:d}=Dr(),p=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(u)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,l,d,u),[u,e.readonly,e.inlineRendering,l,d]),f=(0,s.useCallback)(e=>{m(e,r),S(e)},[S,r]),m=(0,s.useCallback)((e,n)=>{if(!e7(n)){let[D,t]=n.split(":").map(Number);e.setHours(D??0,t??0)}},[]),y=(0,s.useCallback)(D=>{let t=D.target.value;g(t);let i="timer"===e.datePickerFormat?new Date:new Date(n);m(i,t),S(i)},[S,m,n]);(0,s.useEffect)(()=>{n&&n instanceof Date&&g([10>n.getHours()?`0${n.getHours()}`:`${n.getHours()}`,10>n.getMinutes()?`0${n.getMinutes()}`:`${n.getMinutes()}`].join(":"))},[n]);let v=(0,s.useMemo)(()=>"timer"===e.datePickerFormat?a().createElement(DB,{field:e}):a().createElement(DB,{field:e,customLabel:i("time","Time")}),[e.datePickerFormat,e.label,i]);return"view"==u||"embedded-view"==u||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:i(e.label),value:n instanceof Date?ng(e,n):n,conceptName:e.meta?.concept?.display,isInline:p}):!e.isHidden&&a().createElement("div",{className:DQ},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&a().createElement("div",{className:DZ},a().createElement(h.Wdr,null,a().createElement(o.OpenmrsDatePicker,{id:e.id,onChange:f,labelText:a().createElement("span",{className:DK},a().createElement(DB,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,Dt.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:D.length>0,invalidText:D[0]?.message,value:n})),t.length>0?a().createElement("div",{className:DG},t[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?a().createElement("div",null,a().createElement(h.Wdr,null,a().createElement(h.AG,{className:c()(DY,DJ),id:e.id,labelText:v,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!n,invalid:D.length>0,invalidText:D[0]?.message,readOnly:(0,Dt.H)(e.readonly),warning:t.length>0,warningText:t[0]?.message,value:r||(n instanceof Date?n.toLocaleDateString(window.navigator.language):n),onChange:y}))):null)},D1=({field:e,setFieldValue:n})=>{let D=Dr();return(0,s.useEffect)(()=>{e.meta?.initialValue?.omrsObject||e7(e.meta.fixedValue)||(n(e.meta.fixedValue),D.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,D))},[]),a().createElement(a().Fragment,null)};var D2=D(29012);let D4="-esm-form-builder__markdown-wrapper__markdownWrapper___l1Syp",D3={a:({node:e,...n})=>a().createElement("a",{...n,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},D0=({markdown:e})=>a().createElement("div",{className:D4},a().createElement(D2.o,{children:e,unwrapDisallowed:!0,allowedElements:["h1","h2","h3","h4","h5","h6","p","strong","em","code","pre","ul","ol","li","a","blockquote","hr","br"],components:D3})),D8=({field:e})=>{let{t:n}=(0,eX.useTranslation)(),D=e=>Array.isArray(e)?e.map(e=>n(e,{defaultValue:e,interpolation:{escapeValue:!1}})).join("\n\n"):"string"==typeof e?n(e,{defaultValue:e,interpolation:{escapeValue:!1}}):e;return!e.isHidden&&a().createElement(D0,{markdown:D(e.value)})},D9={boldedLabel:"-esm-form-builder__multi-select__boldedLabel___S2peR",errorLabel:"-esm-form-builder__multi-select__errorLabel___E6HgK",selectionDisplay:"-esm-form-builder__multi-select__selectionDisplay___ToQER",tagContainer:"-esm-form-builder__multi-select__tagContainer___rt9TQ",checkbox:"-esm-form-builder__multi-select__checkbox___+3cXj"},D7=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),[c,u]=(0,s.useState)(0),[d,p]=(0,s.useState)([]),f=(0,s.useRef)(!0),m=e.questionOptions.answers.filter(e=>!e.isHidden).map((n,D)=>({id:`${e.id}-${n.concept}`,concept:n.concept,label:i(n.label),key:D,disabled:n.disable?.isDisabled,readonly:(0,Dt.H)(e.readonly)})),y=(0,s.useMemo)(()=>n?.length&&c<1?(u(c+1),m.filter(e=>n?.includes(e.concept))):[],[n]),v=({selectedItems:e})=>{S(e.map(e=>e.concept))},b=(0,s.useMemo)(()=>(0,Dt.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,s.useEffect)(()=>{f.current&&1===c&&(p(y.map(e=>e.concept)),f.current=!1)},[y,f]);let w=e=>{let n,D=e.concept;p(n=d.some(e=>e===D)?d.filter(e=>e!==D):d.some(e=>e===D)?d.filter(e=>e!==D):[...d,D]),S(n)},M=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o?a().createElement("div",{className:D9.formField},a().createElement(DI,{label:i(e.label),value:n?l[e.type]?.getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:M})):!e.isHidden&&a().createElement(a().Fragment,null,a().createElement("div",{className:D9.boldedLabel},a().createElement(h.Wdr,null,b?a().createElement(h.Qp5,{disabled:e.isDisabled,id:e.id,initialSelectedItems:y,invalid:D.length>0,invalidText:D[0]?.message,items:m,itemToString:e=>e?i(e.label):" ",key:e.id,onChange:v,placeholder:i("search","Search")+"...",readOnly:(0,Dt.H)(e.readonly),titleText:a().createElement(DB,{field:e}),warn:t.length>0,warnText:t[0]?.message}):a().createElement(h.$QX,{legendText:a().createElement(DB,{field:e}),readOnly:(0,Dt.H)(e.readonly)},m?.map((n,D)=>a().createElement(h.Sc0,{className:D9.checkbox,checked:d.some(e=>e===n.concept),disabled:n.disabled,id:`${e.id}-${n.concept}`,key:`${e.id}-${n.concept}-${D}`,labelText:i(n.label),name:n.concept,onChange:()=>w(n),readOnly:(0,Dt.H)(e.readonly)}))))),b&&a().createElement("div",{className:D9.selectionDisplay},n?.length?a().createElement("div",{className:D9.tagContainer},l[e.type]?.getDisplayValue(e,n)?.map((e,n)=>a().createElement(h.vwO,{key:n,type:"cool-gray"},i(e)))):a().createElement(Da,null)))},D6={boldedLabel:"-esm-form-builder__number__boldedLabel___knlll",errorLabel:"-esm-form-builder__number__errorLabel___nt7Zx",controlWidthConstrained:"-esm-form-builder__number__controlWidthConstrained___dJyLz"},D5=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g}=Dr(),l=(0,s.useMemo)(()=>isNaN(n)?"":n??"",[n]),u=(0,s.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),d=(0,s.useCallback)((e,{value:n})=>{let D=u(n);S(isNaN(D)?void 0:D)},[S,u]),p=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]),f=u(e.questionOptions.max),m=u(e.questionOptions.min);return"view"==o||"embedded-view"==o?a().createElement("div",{className:D6.formField},a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:p})):!e.isHidden&&a().createElement(h.Wdr,null,a().createElement(h.Q7x,{id:e.id,invalid:D.length>0,invalidText:D[0]?.message,label:a().createElement(DB,{field:e}),max:f,min:m,name:e.id,value:l,onChange:d,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),className:c()(D6.controlWidthConstrained,D6.boldedLabel),warn:t.length>0,warnText:t[0]?.message,step:e.questionOptions.step??.01}))},te="-esm-form-builder__radio__boldedLegend___MaNSB",tn="-esm-form-builder__radio__errorMessage___oqROk",tD=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g,formFieldAdapters:l}=Dr(),c=e=>{S(e)},u=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:i(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&a().createElement(h.gE_,{legendText:a().createElement(DB,{field:e}),className:te,disabled:e.isDisabled,invalid:D?.length>0},a().createElement(h.zWQ,{name:e.id,valueSelected:n,onChange:c,readOnly:(0,Dt.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((D,t)=>a().createElement(h.aaP,{id:`${e.id}-${D.label}`,labelText:i(D.label)??"",value:D.concept,key:t,onClick:e=>{n&&e.target.checked?(e.target.checked=!1,e.preventDefault(),c(null)):c(D.concept)}}))),(D?.length>0||t?.length>0)&&a().createElement("div",null,a().createElement("div",{className:tn},D.length>0?D[0].message:t.length>0?t[0].message:null)))},tt="-esm-form-builder__dropdown__boldedLabel___y7U7P",tS=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:l,formFieldAdapters:c}=Dr(),u=(0,s.useCallback)(({selectedItem:e})=>{S(e===g.ZA?null:e)},[S]),d=(0,s.useCallback)(n=>{let D=e.questionOptions.answers.find(e=>e.value?e.value==n:e.concept==n);return D?i(D.label):""},[e.questionOptions.answers,i]),p=(0,s.useMemo)(()=>{let n=e.questionOptions.answers;return n.some(e=>e.value===g.ZA)||n.unshift({value:g.ZA,label:i("chooseAnOption","Choose an option")}),n.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),f=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,l,o),[o,e.readonly,e.inlineRendering,r,l]);return"view"==o||"embedded-view"==o?a().createElement(DI,{label:i(e.label),value:n?c[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&a().createElement("div",{className:tt},a().createElement(h.Wdr,null,a().createElement(h.msM,{"aria-label":i(e.label),disabled:e.isDisabled,id:e.id,invalid:D.length>0,invalidText:D[0]?.message,items:p,itemToString:d,label:"",onChange:u,readOnly:(0,Dt.H)(e.readonly),selectedItem:e7(n)?g.ZA:n,titleText:a().createElement(DB,{field:e}),warn:t.length>0,warnText:t[0]?.message})))},ti="-esm-form-builder__text-area__boldedLabel___SSRKf",tr=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),[r,o]=(0,s.useState)(n),{layoutType:g,sessionMode:l,workspaceLayout:c}=Dr(),u=e=>{e.preventDefault(),r!==n&&o(n)},d=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(l)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,g,c,l),[l,e.readonly,e.inlineRendering,g,c]);return"view"==l||"embedded-view"==l?a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:d}):!e.isHidden&&a().createElement("div",{className:ti},a().createElement(h.Wdr,null,a().createElement(h.fs1,{id:e.id,labelText:a().createElement(DB,{field:e}),name:e.id,onChange:S,onBlur:u,value:n||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),invalid:D.length>0,invalidText:D[0]?.message,warn:t.length>0,warnText:t[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))},to="-esm-form-builder__text__boldedLabel___LG-wl",tg=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:g}=Dr(),[l,c]=(0,s.useState)(null),u=e=>{e.preventDefault(),l!==n&&c(n)},d=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r,g,o),[o,e.readonly,e.inlineRendering,r,g]);return"view"==o||"embedded-view"==o?a().createElement(DI,{label:i(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:d}):!e.isHidden&&a().createElement("div",{className:to},a().createElement(h.Wdr,null,a().createElement(h.ksK,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:D.length>0,invalidText:D[0]?.message,labelText:a().createElement(DB,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:u,onChange:e=>{S(e.target.value)},readOnly:(0,Dt.H)(e.readonly),value:n??"",warn:t.length>0,warnText:t.length>0?t[0].message:void 0})))},ts="-esm-form-builder__toggle__boldedLabel___mj4Gi",ta=({field:e,value:n,errors:D,warnings:t,setFieldValue:S})=>{let{t:i}=(0,eX.useTranslation)(),r=Dr(),o=e=>{S(e)};(0,s.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=r.sessionMode||r.formFieldAdapters[e.type].transformFieldValue(e,n??!1,r)},[]);let g=(0,s.useMemo)(()=>!!(["view","embedded-view"].includes(r.sessionMode)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,r.layoutType,r.workspaceLayout,r.sessionMode),[r.sessionMode,e.readonly,e.inlineRendering,r.layoutType,r.workspaceLayout]);return"view"==r.sessionMode||"embedded-view"==r.sessionMode?a().createElement(DI,{label:i(e.label),value:e7(n)?n:r.formFieldAdapters[e.type].getDisplayValue(e,n),conceptName:e.meta?.concept?.display,isInline:g}):!e.isHidden&&a().createElement("div",{className:ts},a().createElement(h.lMk,{labelText:i(e.label),className:ts,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:o,toggled:!!n,disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly)}))};var tl=D(44861);let tc=[{name:"drug",datasource:{name:"drug_datasource",config:{class:"8d490dfc-c2cc-11de-8d13-0010c6dffd0f"}}},{name:"select-concept-answers",datasource:{name:"select_concept_answers_datasource",config:{concept:""}}},{name:"encounter-provider",datasource:{name:"provider_datasource"}},{name:"encounter-role",datasource:{name:"encounter_role_datasource"}},{name:"encounter-location",datasource:{name:"location_datasource"}},{name:"problem",datasource:{name:"problem_datasource",config:{class:["8d4918b0-c2cc-11de-8d13-0010c6dffd0f","8d492954-c2cc-11de-8d13-0010c6dffd0f","8d492b2a-c2cc-11de-8d13-0010c6dffd0f"]}}}],tu=e=>tc.find(n=>n.name===e),th=e=>{let n=e.questionOptions.config?.referencedField,{methods:{control:D}}=Dr();return ei({control:D,name:n,exact:!0,disabled:!n})},td="-esm-form-builder__ui-select-extended__boldedLabel___nE2bK",tp="-esm-form-builder__ui-select-extended__loader___F1lqE",tf="-esm-form-builder__ui-select-extended__item___1+q74",tm="-esm-form-builder__ui-select-extended__code___Cd2IH",ty="-esm-form-builder__ui-select-extended__label___GOcHS",tv=({field:e,errors:n,warnings:D,setFieldValue:t})=>{let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)([]),[o,g]=(0,s.useState)(!1),[l,c]=(0,s.useState)(!1),[u,d]=(0,s.useState)(""),p=(0,s.useRef)(!1),[f,m]=(0,s.useState)(null),[y,v]=(0,s.useState)({}),b=th(e),w=(0,Dt.H)(e.questionOptions.isSearchable),{layoutType:M,sessionMode:L,workspaceLayout:$,methods:{control:_,getFieldState:x}}=Dr(),C=ei({control:_,name:e.id,exact:!0}),{isDirty:E}=x(e.id),k=(0,s.useMemo)(()=>!!(ni(L)||(0,Dt.H)(e.readonly))&&nY(e.inlineRendering,M,$,L),[L,e.readonly,e.inlineRendering,M,$]),A=(0,s.useMemo)(()=>i.find(e=>e.uuid==C)||null,[i,C]),T=(0,tl.A)((e,n)=>{c(!0),n.fetchData(e,y).then(e=>{if(e.length){let D=i.find(e=>e.uuid==C),t=e.map(e=>n.toUuidAndDisplay(e,y));D&&!t.some(e=>e.uuid==D.uuid)&&t.unshift(D),r(t)}c(!1)}).catch(e=>{console.error(e),c(!1)})},300),O=(0,s.useCallback)(e=>i.some(n=>n.display?.toLowerCase().includes(e.toLowerCase())),[i]);return((0,s.useEffect)(()=>{let n=e.questionOptions?.datasource?.name;v(n?e.questionOptions.datasource?.config:tu(e.questionOptions.rendering)?.datasource?.config),iB(n||e.questionOptions.rendering).then(e=>m(e))},[e.questionOptions?.datasource]),(0,s.useEffect)(()=>{let n=!1;return f&&!(0,Dt.H)(e.questionOptions.isSearchable)&&(r([]),g(!0),f.fetchData(null,{...y,referencedValue:b}).then(e=>{n||(r(e.map(e=>f.toUuidAndDisplay(e,y))),g(!1))}).catch(e=>{n||(console.error(e),g(!1),r([]))})),()=>{n=!0}},[f,y,b]),(0,s.useEffect)(()=>{f&&w&&!e7(u)&&!O(u)&&T(u,f)},[f,u,y]),(0,s.useEffect)(()=>{let e=!1;return C&&!E&&f&&w&&!i.length&&(g(!0),f.fetchSingleItem(C,y).then(n=>{e||(r([f.toUuidAndDisplay(n,y)]),g(!1))}).catch(n=>{e||(console.error(n),g(!1))})),()=>{e=!0}},[C,E,f,w,i,y]),o)?a().createElement(h.dF7,null):ni(L)||(0,Dt.H)(e.readonly)?a().createElement(DI,{label:S(e.label),value:C?tb(i.find(e=>e.uuid==C)):C,conceptName:e.meta?.concept?.display,isInline:k}):!e.isHidden&&a().createElement("div",{className:td},a().createElement(h.Wdr,null,a().createElement(h.a32,{id:e.id,titleText:a().createElement(DB,{field:e}),items:i,itemToElement:e=>a().createElement("span",{className:tf},e?.code&&a().createElement("span",{className:tm},e.code),a().createElement("span",{className:ty},e?.display)),itemToString:tb,selectedItem:A,placeholder:w?S("search","Search")+"...":null,onChange:({selectedItem:e})=>{p.current=!0,t(e?.uuid)},disabled:e.isDisabled,readOnly:(0,Dt.H)(e.readonly),invalid:n.length>0,invalidText:n.length&&n[0].message,onInputChange:n=>{if(p.current){p.current=!1;return}e.questionOptions.isSearchable&&d(n)},onBlur:e=>{e.target.value||t(null)}}),l&&a().createElement(h.OuH,{className:tp,description:S("searching","Searching")+"..."})))};function tb(e){return e?.code?`${e.code} ${e.display}`:e?.display??""}let tw="-esm-form-builder__workspace-launcher__label___E9RiP",tM="-esm-form-builder__workspace-launcher__workspaceButton___MlMFr",tL="-esm-form-builder__workspace-launcher__noPatientNotification___28OZv",t$=({field:e})=>{let{t:n}=(0,eX.useTranslation)(),{sessionMode:D,patient:t,visit:S}=Dr(),i=async()=>{let D=e.questionOptions?.workspaceName;if(!D)return void(0,o.showSnackbar)({title:n("invalidWorkspaceName","Invalid workspace name."),subtitle:n("invalidWorkspaceNameSubtitle","Please provide a valid workspace name."),kind:"error",isLowContrast:!0});let i=e.questionOptions?.workspaceProps??{},r={patient:t,patientUuid:t?.id,visitContext:S};try{await (0,o.launchWorkspace2)(D,i,r)}catch(e){(0,o.showSnackbar)({title:n("errorLaunchingWorkspace","Error launching workspace"),subtitle:e?.message??n("errorLaunchingWorkspaceSubtitle","An unexpected error occurred while launching the workspace."),kind:"error",isLowContrast:!0})}};return e.isHidden||ni(D)?null:a().createElement("div",null,a().createElement("div",{className:tw},a().createElement(DB,{field:e})),a().createElement("div",{className:tM},a().createElement(h.$nd,{disabled:(0,Dt.H)(e.readonly??!1)||!t,onClick:i},e.questionOptions.buttonLabel?n(e.questionOptions.buttonLabel):n("launchWorkspace","Launch Workspace")),!t&&a().createElement(h.jeF,{className:tL,kind:"info",lowContrast:!0,hideCloseButton:!0,title:n("noPatientContext","No patient selected"),subtitle:n("noPatientContextSubtitle","This button is only active when a patient chart is open.")})))};var t_=D(20903);function tx(e,n,D){let t=[],S=(0,t_.A)(e);return S.questionOptions.repeatOptions={...S.questionOptions.repeatOptions??{}},S.meta={repeat:{...S.meta??{},isClone:!0},initialValue:{omrsObject:n}},S.id=`${S.id}_${D}`,S.questions?.forEach(e=>{t.push(e.id),e.id=`${e.id}_${D}`,e.meta.groupId=S.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,nD(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=tC(e.hide.hideWhenExpression,D,t)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=tC(e.failsWhenExpression,D,t))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=tC(e.questionOptions.calculate?.calculateExpression,D,t))}),S}function tC(e,n,D){let t=[...new Set(D)];if(!t.length)return e;let S=t.slice().sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return e.replace(RegExp(`\\b(?:${S})\\b`,"g"),e=>`${e}_${n}`)}function tE(e,n){let D=Number(e);return!(e7(e)||isNaN(D))&&n>=D}let tk=[],tA={async getInitialValue(e,n,D){let t=tU(ne((n??D.domainObjectValue).obs),tk,e);return nn(e,"file")&&t?.length?tV(e,t):tT(e,t,!0)},async getPreviousValue(e,n,D){let t=n??D.previousDomainObjectValue;if(t){let n=tT(e,tU(ne(t.obs),tk,e),!0);if(!e7(n))return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:(e,n)=>{let D=e.questionOptions.rendering;return e7(n)?n:n instanceof Date?ng(e,n):"checkbox"===D?n.map(n=>e.questionOptions.answers?.find(e=>e.concept==n)?.label):"toggle"===D?n?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:g.FU.includes(D)?e.questionOptions.answers?.find(e=>e.concept==n)?.label:n},transformFieldValue:(e,n,D)=>(nD(e),!e.meta.initialValue?.omrsObject&&e7(n))?null:nn(e,"checkbox")?tP(e,Array.isArray(n)?n:[n]):nn(e,"file")?tF(e,n):!e7(n)&&tN(e,n)?nt(e,tI(e,n),void 0):e.meta.initialValue?.omrsObject&&e7(n)?nt(e,void 0,tR(e.meta.initialValue.omrsObject)):e7(n)?null:nt(e,tO(e,n),void 0),tearDown:function(){tk=[]}};function tT(e,n=[],D=!1){let t=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),n.length){if("checkbox"==t)return tk.push(...n.map(e=>e.uuid)),e.meta.initialValue.omrsObject=D?n:null,n.map(e=>e.value.uuid);let S=n[0];if(D&&(e.meta.initialValue.omrsObject={...S}),tk.push(S.uuid),"string"==typeof S.value||"number"==typeof S.value){if(t.startsWith("date")){let n=nr(S.value);return D&&(e.meta.initialValue.omrsObject.value=e4()(n).format("YYYY-MM-DD HH:mm")),n}return S.value}return"toggle"==t?S.value.uuid===g.t$:"fixed-value"==t?e.fixedValue:S.value?.uuid}return""}function tO(e,n){return e7(n)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?tj(e,n):n},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function tR(e){return{uuid:e.uuid,voided:!0}}function tI(e,n){let D=e.meta.initialValue?.omrsObject,t=e.questionOptions.rendering.startsWith("date")?tj(e,n):n;return{uuid:D.uuid,value:t,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function tj(e,n){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return e4()(n).format("YYYY-MM-DD");case"timer":return e4()(n).format("HH:mm");case"both":return e4()(n).format("YYYY-MM-DD HH:mm")}return n}function tN(e,n){let D=e.meta.initialValue?.omrsObject;return!e7(D)&&(g.FU.includes(e.questionOptions.rendering)?D.value.uuid!==n:nn(e,"date")?0!==e4()(n).diff(e4()(D.value),"D"):nn(e,"datetime")||"both"===e.datePickerFormat?0!==e4()(n).diff(e4()(D.value),"minute"):nn(e,"toggle")?D.value.uuid===g.t$!==n:D.value!==n)}function tP(e,n=[]){let D=e.meta.initialValue?.omrsObject;if(D?.length&&e7(n))return nt(e,null,D.map(e=>tR(e)));if(D?.length&&!e7(n)){let t=D.filter(e=>!n.includes(e.value.uuid));return nt(e,n.filter(e=>!D.some(n=>n.value.uuid===e)).map(n=>tO(e,n)),t.map(e=>tR(e)))}return nt(e,n.map(n=>tO(e,n)),void 0)}function tF(e,n=[]){let D=n.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),t=e.meta.submission.newValue=n.filter(e=>!e.uuid).map(n=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...n}));return nt(e,t,D)}function tU(e,n,D){let t=e.filter(e=>!!nn(D,"file")&&e.formFieldPath==`rfe-forms-${D.id}`||e.formFieldPath==`rfe-forms-${D.id}`&&e.concept.uuid==D.questionOptions.concept);if(!t?.length){let t=e.filter(e=>e.concept.uuid==D.questionOptions.concept);return n?.length?t.filter(e=>!n.includes(e.uuid)):t}return t}async function tV(e,n){let D=new AbortController,t=await Promise.all(n.map(e=>(0,o.getAttachmentByUuid)(e.uuid,D).then(e=>e.data).catch(n=>(console.error(`Failed to fetch attachment ${e.uuid}:`,n),null))));return e.meta.initialValue={omrsObject:n},t.filter(Boolean).map(e=>({uuid:e.uuid,base64Content:`${window.openmrsBase}${o.attachmentUrl}/${e.uuid}/bytes`,fileName:e.filename,fileDescription:e.comment,fileType:e.bytesContentFamily?.toLowerCase()}))}let tH={validate:(e,n)=>!e7(n)&&g.FU.includes(e.questionOptions.rendering)&&!(Array.isArray(n)?n:[n]).every(n=>e.questionOptions.answers?.find(e=>e.concept===n||e.value===n))?[{resultType:"error",errCode:"invalid.defaultValue",message:"Value not found in coded answers list"}]:e7(n)||"date"!=e.questionOptions.rendering||e4()(n).isValid()?!e7(n)&&"number"==e.questionOptions.rendering&&isNaN(n)?[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid numerical value: '${n}'`}]:[]:[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid date value: '${n}'`}]},tz=[],tW="testorder",tB="6f0c9a92-6f24-11e3-af88-005056821db0",tq={transformFieldValue:function(e,n,D){if("edit"==D.sessionMode&&e.meta.initialValue?.omrsObject)return tK(n,e,D.currentProvider.uuid);let t=tG(n,e,D.currentProvider.uuid);return nt(e,t,null),t},getInitialValue:function(e,n,D){let t=e.questionOptions.answers?.map(e=>e.concept)||[],S=n?.orders.filter(e=>!tz.includes(e.uuid)&&!e.voided).find(e=>t.includes(e.concept.uuid));return S?(e.meta={...e.meta||{},initialValue:{omrsObject:S,refinedValue:S.concept.uuid}},tz.push(S.uuid),S.concept.uuid):null},getPreviousValue:function(e,n,D){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){tz=[]}};function tG(e,n,D){return e?{action:"NEW",concept:e,type:n?.questionOptions?.orderType||tW,careSetting:n?.questionOptions?.orderSettingUuid||tB,orderer:D}:null}function tK(e,n,D){let t=n.meta.initialValue?.omrsObject;if(e===t?.concept?.uuid)return nD(n),null;let S={uuid:t?.uuid,voided:!0};return nt(n,tG(e,n,D),S),n.meta.submission.newValue||null}let tY=[],tQ={transformFieldValue:function(e,n,D){if(e.meta.initialValue?.omrsObject&&e7(n))return nt(e,void 0,t1(e.meta.initialValue.omrsObject));if(!e7(n)){let t=e.meta.initialValue?.omrsObject;if(tX(t,n))return nt(e,tJ(n,e,t,D.patient.id),void 0)}let t=tZ(n,e,D.patient.id);return nt(e,t,null),t},getInitialValue:function(e,n,D){let t=(n??D.domainObjectValue).diagnoses.find(n=>n.formFieldPath===`rfe-forms-${e.id}`);return t?(e.meta={...e.meta||{},initialValue:{omrsObject:t,refinedValue:t.diagnosis?.coded.uuid}},tY.includes(t.diagnosis?.coded?.uuid)||tY.push(t.diagnosis?.coded?.uuid),t.diagnosis?.coded.uuid):null},getPreviousValue:function(e,n,D){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){tY=[]}},tZ=(e,n,D)=>e?{patient:D,condition:null,diagnosis:{coded:e},certainty:(0,Dt.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms"}:null;function tJ(e,n,D,t){return{patient:t,condition:null,diagnosis:{coded:e},certainty:(0,Dt.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms",uuid:D.uuid}}function tX(e,n){return!e7(e)&&e.value!==n}function t1(e){return{uuid:e.uuid,voided:!0}}function t2(e,n,D,t,S){let{patient:i,formJson:r,domainObjectValue:o,formFields:g,visit:s,deletedFields:a}=e,l=[...g,...a],c=[];Se(c,l);let u=St(l),h=Sg(l),d={};return o?(Object.assign(d,o),-1===d.encounterProviders.findIndex(e=>e.provider.uuid==t)&&(d.encounterProviders=[...d.encounterProviders,{provider:t,encounterRole:D}]),n&&(d.encounterDatetime=n),d.location=S,d.form={uuid:r.uuid},s&&(d.visit=s.uuid),d.obs=c,d.orders=u,d.diagnoses=h):(d={patient:i.id,location:S,encounterType:r.encounterType,encounterProviders:[{provider:t,encounterRole:D}],obs:c,form:{uuid:r.uuid},visit:s?.uuid,orders:u,diagnoses:h},n&&(d.encounterDatetime=n)),d}function t4(e,n){return e.filter(e=>"patientIdentifier"===e.type&&nS(e)).map(e=>e.meta.submission.newValue)}function t3(e,n){return n.map(n=>(0,nL.savePatientIdentifier)(n,e.id))}function t0(e){return e.filter(e=>"personAttribute"===e.type&&nS(e)).map(e=>e.meta.submission.newValue)}function t8(e,n){return n.map(n=>(0,nL.savePersonAttribute)(n,e.id))}function t9(e,n,D){let t=e.filter(e=>"programState"===e.type&&nS(e)),S=new Map;return t.forEach(e=>{let t=e.questionOptions.programUuid,i=e.meta.submission.newValue,r=D.find(e=>e.program.uuid===t);r?S.has(t)?S.get(t).states.push(i):S.set(t,{uuid:r.uuid,states:[i]}):S.has(t)?S.get(t).states.push(i):S.set(t,{patient:n.id,program:t,states:[i],dateEnrolled:e4()().format()})}),Array.from(S.values())}function t7(e){let n=new AbortController;return Promise.all(e.map(e=>(0,nL.saveProgramEnrollment)(e,n)))}function t6(e,n,D){let t=e?.filter(e=>e?.questionOptions.rendering==="file"&&nS(e));return t?.length?Promise.all(t.flatMap(e=>{let D="string"==typeof n?.patient?n?.patient:n?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,nL.createAttachment)(D,n.uuid,e))})):[]}function t5(e){let{formFields:n,location:D,currentProvider:t,customDependencies:S,sessionDate:i,domainObjectValue:r,visit:o}=e,{defaultEncounterRole:g}=S,s=n.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||g?.uuid,a=n.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||t.uuid,l=n.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,c=o?.stopDatetime?i:void 0;return{encounterRole:s,encounterProvider:a,encounterDate:l??(r?.encounterDatetime?new Date(r.encounterDatetime):c),encounterLocation:n.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||r?.location?.uuid||D.uuid}}function Se(e,n){n.filter(e=>Si(e)).forEach(n=>Sn(e,n))}function Sn(e,n){(n.isHidden||n.isParentHidden)&&n.meta.initialValue.omrsObject?SS(e,(Array.isArray(n.meta.initialValue.omrsObject)?n.meta.initialValue.omrsObject:[n.meta.initialValue.omrsObject]).map(e=>tR(e))):"obsGroup"===n.type?SD(e,n):(nn(n,"file")||SS(e,n.meta.submission.newValue),SS(e,n.meta.submission.voidedValue))}function SD(e,n){if(n.meta.submission?.voidedValue)return void SS(e,n.meta.submission.voidedValue);let D=tO(n,null);n.meta.initialValue?.omrsObject&&(D.uuid=n.meta.initialValue.omrsObject.uuid),n.questions.forEach(e=>{if("obsGroup"===e.type){let n=[];SD(n,e),SS(D.groupMembers,n)}else nS(e)&&(SS(D.groupMembers,e.meta.submission.newValue),SS(D.groupMembers,e.meta.submission.voidedValue))}),(D.groupMembers?.length||D.voided)&&SS(e,D)}function St(e){return e.filter(e=>"testOrder"===e.type&&nS(e)).flatMap(e=>[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function SS(e,n){n&&(Array.isArray(n)?e.push(...n):e.push(n))}function Si(e){let{questionOptions:{isTransient:n},type:D}=e;return!n&&!!["obs","obsGroup"].includes(D)&&!e.meta.groupId&&(!!((e.isHidden||e.isParentHidden)&&e.meta.initialValue?.omrsObject)||!e.isHidden&&!e.isParentHidden&&("obsGroup"===D||nS(e)))}function Sr(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==g.t$;let n=tH.validate(e,e.questionOptions.defaultValue);return n.length?(console.error(`Default value validation errors for field "${e.id}" with value "${e.questionOptions.defaultValue}":`,n),null):e.questionOptions.defaultValue}async function So(e,n,D,t){let S=1,{formFieldAdapters:i}=t,r=n.obs.filter(n=>n.concept.uuid===e.questionOptions.concept&&n.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!tk.includes(n.uuid)),o=n.orders.filter(n=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(n.concept?.uuid)&&!tz.includes(n.uuid));if("testOrder"===e.type)return Promise.all(o.filter(e=>!e.voided).map(async n=>{let r=tx(e,n,S++);return D[r.id]=await i[e.type].getInitialValue(r,{orders:[n]},t),r}));let g=n.diagnoses.filter(n=>!n.voided&&!tY.includes(n?.diagnosis?.coded.uuid)&&n.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(g.map(async n=>{let S=parseInt(n.formFieldPath.split("_")[1]),r=tx(e,n,S);return D[r.id]=await i[e.type].getInitialValue(r,{diagnoses:[n]},t),tY.includes(n.diagnosis.coded.uuid)||tY.push(n.diagnosis.coded.uuid),r})):Promise.all(r.map(async n=>{let r=tx(e,n,S++);return await Promise.all(r.questions.map(async S=>{D[S.id]=await i[e.type].getInitialValue(S,{obs:[n]},t)})),tk.push(n.uuid),[r,...r.questions]})).then(e=>e.flat())}function Sg(e){return e.filter(e=>"diagnosis"===e.type&&nS(e)).map(e=>e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function Ss(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class Sa{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,n,D){return Promise.resolve({})}constructor(e){Ss(this,"formJson",void 0),Ss(this,"domainObjectValue",void 0),this.formJson=e}}var Sl=D(45278),Sc=D(18348),Su=D(92049),Sh=D(53098),Sd="[object String]";let Sp=function(e){return"string"==typeof e||!(0,Su.A)(e)&&(0,Sh.A)(e)&&(0,Sc.A)(e)==Sd};function Sf(e){let[n,D]=(0,s.useState)(null),[t,S]=(0,s.useState)(!0),[i,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let n=new AbortController;return!e7(e.encounter)&&Sp(e.encounter)?(0,o.openmrsFetch)(`${o.restBaseUrl}/encounter/${e.encounter}?v=${g.RZ}`,{signal:n.signal}).then(e=>{D(e.data),S(!1)}).catch(e=>{r(e)}):(e7(e.encounter)||D(e.encounter),S(!1)),()=>{n.abort()}},[e.encounter]),{encounter:n,error:i,isLoading:t}}var Sm=D(66148),Sy=D.n(Sm);function Sv(){let{data:e,error:n,isLoading:D}=Sy()(`${o.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,o.openmrsFetch),t=e?.data.results.find(e=>"Clinician"===e.name);return t?{encounterRole:t,error:n,isLoading:D}:{encounterRole:e?.data.results[0],error:n,isLoading:D}}var Sb=D(73391),Sw=D.n(Sb);let SM=e=>{let n="custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,state:(uuid,name,retired,concept:(uuid),programWorkflow:(uuid)))",D=`${o.restBaseUrl}/programenrollment?patient=${e}&v=${n}`,{data:t,error:S,isLoading:i}=Sw()(e?D:null,o.openmrsFetch),r=t?.data?.results.length>0?t?.data.results.sort((e,n)=>n.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:r?.filter(e=>!e.dateCompleted),error:S,isLoading:i}},SL=(e,n)=>{let{activePrograms:D,error:t,isLoading:S}=SM(n.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:D,errorFetchingPatientPrograms:t,isLoadingPatientPrograms:S}};function S$(e){let[n,D]=(0,s.useState)(!0),{encounter:t,isLoading:S}=Sf(e.formJson),{encounterRole:i,isLoading:r}=Sv(),{isLoadingPatientPrograms:o,patientPrograms:g}=SL(e.patient?.id,e.formJson);return(0,s.useEffect)(()=>{D(o||S||r)},[o,S,r]),{data:{encounter:t,patientPrograms:g,encounterRole:i},isLoading:n,error:null,updateContext:(n,{setDomainObjectValue:D,setCustomDependencies:S})=>{e.processor.domainObjectValue=t,D(t),S(e=>({...e,patientPrograms:g,defaultEncounterRole:i}))}}}let S_={checkbox:[],toggle:!1,text:""},Sx=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class SC extends Sa{prepareFormSchema(e){let n=new Set;function D(e,t,S,i){e.id&&n.add(e.id),e.inlineRendering=e.inlineRendering??t.inlineRendering??S.inlineRendering??i.inlineRendering,e.readonly=e.readonly??t.readonly??S.readonly??i.readonly,e.questionOptions?.rendering!="fixed-value"||e.meta.fixedValue||(e.meta.fixedValue=e.value,delete e.value),(e.questionOptions?.rendering=="group"||"obsGroup"===e.type)&&e.questions?.forEach(n=>(n.readonly=n.readonly??e.readonly,D(n,t,S,i)))}return e.pages.forEach(n=>{n.sections.forEach(t=>{t.questions.forEach(S=>{D(S,t,n,e)})})}),Sk(e,n),e}async processSubmission(e,n){let{encounterRole:D,encounterProvider:t,encounterDate:S,encounterLocation:i}=t5(e),r=(e,n,D)=>(0,o.translateFrom)(Sl.L,e,n,D),g=t4(e.formFields,i),s=t2(e,S,D,t,i);try{await Promise.all(t3(e.patient,g)),g?.length&&(0,o.showSnackbar)({title:r("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let n=t0(e.formFields);await Promise.all(t8(e.patient,n)),n?.length&&(0,o.showSnackbar)({title:r("personAttributesSaved","Person attribute(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let n=t9(e.formFields,e.patient,e.customDependencies.patientPrograms),D=await await t7(n);D?.length&&(0,o.showSnackbar)({title:r("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:D}=await (0,nL.saveEncounter)(n,s,s.uuid),t=D.orders.map(e=>e.orderNumber),S=D.diagnoses.map(e=>e.display);t.length&&(0,o.showSnackbar)({title:r("ordersSaved","Order(s) saved successfully"),subtitle:t.join(", "),kind:"success",isLowContrast:!0}),S.length&&(0,o.showSnackbar)({title:r("diagnosisSaved","Diagnosis(es) saved successfully"),subtitle:S.join(", "),kind:"success",isLowContrast:!0});try{let t=await t6(e.formFields,D,n);t?.length&&(0,o.showSnackbar)({title:r("attachmentsSaved","Attachment(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){console.error("Error saving attachments",n);let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return D}catch(n){console.error("Error saving encounter",n);let e=(0,n6.j)(n);return Promise.reject({title:r("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:S$}}async getInitialValues(e){let{domainObjectValue:n,formFields:D,formFieldAdapters:t}=e,S={},i=[];if(n){await Promise.all(D.map(async D=>{let r=t[D.type];if(D.meta.initialValue?.omrsObject&&!e7(D.meta.initialValue.refinedValue)){S[D.id]=D.meta.initialValue.refinedValue;return}if(r){nn(D,"repeating")&&!D.meta?.repeat?.isClone&&i.push(D);let t=null;try{t=await r.getInitialValue(D,n,e),D.meta.initialValue.refinedValue=t}catch(e){console.error(e)}if("obsGroup"===D.type)return;if(e7(t)?e7(D.questionOptions.defaultValue)?S[D.id]=S_[D.questionOptions.rendering]??"":S[D.id]=Sr(D):S[D.id]=t,D.questionOptions.calculate?.calculateExpression)try{await SE(D,S,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${D.type}`)}));let r=await Promise.all(i.flatMap(D=>So(D,n,S,e))).then(e=>e.flat());D.push(...r)}else{let n=D.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),i=[];await Promise.all(n.map(async n=>{let D=t[n.type];if(S[n.id]=S_[n.questionOptions.rendering]??null,e7(S[n.id])&&Sx.includes(n.type))try{S[n.id]=await D.getInitialValue(n,null,e)}catch(e){console.error(e)}n.questionOptions.defaultValue&&(S[n.id]=Sr(n)),n.questionOptions.calculate?.calculateExpression&&i.push(n)})),await Promise.all(i.map(async n=>{try{await SE(n,S,e)}catch(e){console.error(e)}}))}return S}async loadDependencies(e,n,{setPreviousDomainObjectValue:D}){let{patient:t,formJson:S}=e;return D(await (0,nL.getPreviousEncounter)(t?.id,S.encounterType)),e}async getHistoricalValue(e,n){let{formFields:D,sessionMode:t,patient:S,methods:{getValues:i},formFieldAdapters:r,previousDomainObjectValue:o,visit:g}=n,s={value:e,type:"field"},a=r[e.type];if(e.historicalExpression){let n=await nB(e.historicalExpression,s,D,i(),{mode:t,patient:S,previousEncounter:o,visit:g});return n?n3(e,n):null}return o&&e.questionOptions.enablePreviousValue?await a.getPreviousValue(e,o,n):null}}async function SE(e,n,D){let{formFields:t,sessionMode:S,patient:i,visit:r}=D,o=e.questionOptions.calculate.calculateExpression,g={value:e,type:"field"},s={mode:S,patient:i,visit:r},a=await nB(o,g,t,n,s);e7(a)||(n[e.id]=a)}function Sk(e,n){let D=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function t(e,t){for(let S of e.matchAll(D)){let e=S[2];n.has(e)&&console.error(`The calculateExpression for the field '${t}' incorrectly quotes the field ID '${e}' as a string. Field IDs must be referenced as variables without quotes to access their values. Remove the quotes: use ${e} instead of '${e}'.`)}}function S(e){e.questionOptions?.calculate?.calculateExpression&&t(e.questionOptions.calculate.calculateExpression,e.id),e.questions&&e.questions.forEach(S)}e.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(S)})})}var SA=D(77541);function ST(e){let{formFields:n,formFieldValidators:D,patient:t,sessionMode:S,addInvalidField:i,updateFormField:r,methods:{getValues:o,trigger:g}}=e,s=o();return 0===n.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(o=>{let g=D[o.type];if(g){let D=g.validate(e,s[e.id],{formFields:n,values:s,expressionContext:{patient:t,mode:S},...o}).filter(e=>"error"===e.resultType);return D.length&&(e.meta.submission={...e.meta.submission,errors:D},r(e),i(e)),D}})).filter(e=>!!e).length}async function SO(e,n,D,t,S){return Promise.all(e.map(async({postAction:e,config:i,actionId:r,enabled:g})=>{try{let S=[];if(n)if(n.forEach(e=>{e?.data&&S.push(e.data),e?.uuid&&S.push(e)}),S.length)(!g||(0,SA.g)(g,S))&&await e.applyAction({patient:D,sessionMode:t,encounters:S},i);else throw Error("No encounter data to process post submission action");else throw Error("No handlers available to process post submission action")}catch(n){let e=(0,n6.j)(n);(0,o.showSnackbar)({title:String(S("errorDescriptionTitle",r?r.replace(/([a-z])([A-Z])/g,"$1 $2"):"Post Submission Error")),subtitle:String(S("errorDescription","{{errors}}",{errors:e.join(", ")})),kind:"error",isLowContrast:!1})}}))}function SR({patientUuid:e,formUuid:n,setIsSubmitting:D,setIsValidating:t}){let{t:S}=(0,eX.useTranslation)();(0,s.useEffect)(()=>{let i=i=>{let{formUuid:r,patientUuid:o,action:g}=i.detail;if(!g||!r||!o)return void(0,n6.N)(Error("The form action event is missing required details (formUuid, patientUuid, or action)."),S("formActionFailed","Form action failed"));if(r===n&&o===e)switch(g){case"onSubmit":D(!0);break;case"validateForm":t(!0);break;default:(0,n6.N)(Error(`Unsupported form action: "${g}"`),S("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",i),()=>{window.removeEventListener("ampath-form-action",i)}},[D,t,n,e])}function SI(e){let[n,D]=(0,s.useState)([]);return(0,s.useEffect)(()=>{let n=[];e?.length&&e.map(e=>{let D="string"==typeof e?e:e.actionId;iz(D)?.then(t=>n.push({postAction:t,config:e.config,actionId:D,enabled:e.enabled}))}),D(n)},[e]),n}let Sj=(0,s.createContext)(void 0),SN=({patient:e,patientUUID:n,sessionMode:D,sessionDate:t,formJson:S,workspaceLayout:i,location:r,provider:g,visit:l,isFormExpanded:c=!0,children:u,formSubmissionProps:h,hideFormCollapseToggle:d,handleConfirmQuestionDeletion:p,setIsFormDirty:f})=>{let{t:m}=(0,eX.useTranslation)(),y=(0,s.useRef)(void 0),v=(0,s.useRef)({}),b=(0,o.useLayoutType)(),{isSubmitting:w,setIsSubmitting:M,onSubmit:L,onError:$,handleClose:_}=h,[x,C]=(0,s.useState)(!1),E=SI(S.postSubmissionActions),k=new AbortController,A=(0,s.useCallback)((e,n,D)=>{n?v.current[e]=D:y.current=D},[]),T=(0,s.useRef)({EncounterFormProcessor:SC}),O=(0,s.useCallback)(()=>{let e=[y.current,...Object.values(v.current)],n=e.every(e=>ST(e));return{forms:e,isValid:n}},[]);return SR({patientUuid:n,formUuid:S?.uuid,setIsSubmitting:M,setIsValidating:C}),(0,s.useEffect)(()=>{x&&(O(),C(!1))},[x,O]),(0,s.useEffect)(()=>{if(w){let{forms:n,isValid:t}=O();t?Promise.all(n.map(e=>e.processor.processSubmission(e,k))).then(async n=>{h.setIsSubmitting(!1),"edit"===D?(0,o.showSnackbar)({title:m("updatedRecord","Record updated"),subtitle:m("updatedRecordDescription","The patient encounter was updated"),kind:"success",isLowContrast:!0}):(0,o.showSnackbar)({title:m("submittedForm","Form submitted"),subtitle:m("submittedFormDescription","Form submitted successfully"),kind:"success",isLowContrast:!0}),E&&await SO(E,n,e,D,m),d(),L?L(n):_()}).catch(e=>{M(!1),e instanceof Error?(0,o.showSnackbar)({title:m("errorProcessingFormSubmission","Error processing form submission"),kind:"error",subtitle:e.message,isLowContrast:!1}):(0,o.showSnackbar)(e)}):M(!1)}return()=>{k.abort()}},[w,O]),a().createElement(Sj.Provider,{value:{patient:e,sessionMode:D,sessionDate:t,formJson:S,formProcessors:T.current,layoutType:b,workspaceLayout:i,visit:l,location:r,provider:g,isFormExpanded:c,registerForm:A,handleConfirmQuestionDeletion:p,setIsFormDirty:f}},T.current&&u)},SP=()=>{let e=(0,s.useContext)(Sj);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e},SF={actionButtons:"-esm-form-builder__repeat-controls__actionButtons___LgvQb"},SU=function({question:e,rows:n,handleDelete:D,handleAdd:t,questionIndex:S}){let{t:i}=(0,eX.useTranslation)();return a().createElement("div",{className:SF.actionButtons},S>0&&a().createElement(h.$nd,{className:SF.button,kind:"danger",onClick:D},a().createElement("span",null,i("remove","Remove"))),S===n.length-1&&a().createElement(h.$nd,{className:SF.button,iconDescription:i("add","Add"),kind:"primary",disabled:tE(e.questionOptions.repeatOptions?.limit,n.length),onClick:t},a().createElement("span",null,e.questionOptions.repeatOptions?.addText||i("add","Add"))))},SV="-esm-form-builder__repeat__nodeContainer___APyxV",SH="-esm-form-builder__repeat__divider___h9XcK",Sz={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function SW(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function SB(e){return{...e,questionOptions:{...e.questionOptions,rendering:Sz[e.type]||null}}}let Sq=({field:e})=>{let[n,D]=(0,s.useState)([]),t=Dr(),{handleConfirmQuestionDeletion:S}=SP(),{patient:i,sessionMode:r,formFieldAdapters:g,formFields:l,methods:{getValues:c,setValue:u,unregister:h},addFormField:d,removeFormField:p,deletedFields:f,setDeletedFields:m,visit:y}=t;(0,s.useEffect)(()=>{D(l.filter(n=>n.questionOptions.concept===e.questionOptions.concept&&n.id.startsWith(e.id)&&!n.meta?.repeat?.wasDeleted))},[l,e]);let v=(0,s.useCallback)(S=>{let o=[];function s(e){e.hide?.hideWhenExpression&&(e.isHidden=nW(e.hide.hideWhenExpression,{value:e,type:"field"},[...l,...o],c(),{mode:r,patient:i,visit:y})),e.questionOptions.calculate?.calculateExpression&&nB(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...l,...o],c(),{mode:r,patient:i,visit:y}).then(n=>{e7(n)||(u(e.id,n),g[e.type]?.transformFieldValue(e,n,t))})}let a=tx(e,null,S);o.push(a),"obsGroup"===a.type&&a.questions?.forEach(e=>{o.push(e)}),o.forEach(e=>{s(e),d(e)}),D([...n,a])},[l,e,n,t]),b=e=>{e.meta.initialValue?.omrsObject?(g[e.type]?.transformFieldValue(e,null,t),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(n=>{n.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},g[n.type]?.transformFieldValue(n,null,t)})):(nD(e),h(e.id),e.questions?.forEach(e=>h(e.id))),D(n.filter(n=>n.id!==e.id)),m([...f,e]),p(e.id)},w=e=>{if(S&&"function"==typeof S){let n=S(e);n&&"function"==typeof n.then&&"function"==typeof n.catch?n.then(()=>b(e)).catch(()=>(0,o.createErrorHandler)()):"boolean"==typeof n?n&&b(e):b(e)}else b(e)},M=(0,s.useMemo)(()=>n.map((D,t)=>{let S=a().createElement(Dw,{fieldId:D.id,valueAdapter:g[D.type],repeatOptions:{targetRendering:SB(D).questionOptions.rendering}});return a().createElement("div",{key:D.id+"_wrapper"},0!==t&&a().createElement("div",null,a().createElement("hr",{className:SH})),a().createElement("div",{className:SV},S),!ni(r)&&a().createElement(SU,{question:D,rows:n,questionIndex:t,handleDelete:()=>{w(D)},handleAdd:()=>{v(n.reduce((n,D)=>{let t=Number(D.id.slice(e.id.length+1));return Number.isFinite(t)?Math.max(n,t):n},0)+1)}}))}),[n]);return!e.isHidden&&M&&SW(e)?a().createElement(a().Fragment,null,a().createElement("div",null,M)):null};var SG=D(92137);let SK={label:"-esm-form-builder__file__label___ltBsg",thumbnailGrid:"-esm-form-builder__file__thumbnailGrid___rstZS",thumbnailContainer:"-esm-form-builder__file__thumbnailContainer___Z0tS3"},SY="-esm-form-builder__file-thumbnail__thumbnail___WlgwA",SQ="-esm-form-builder__file-thumbnail__imageThumbnail___gZWBB",SZ="-esm-form-builder__file-thumbnail__pdfThumbnail___49Zd9",SJ="-esm-form-builder__file-thumbnail__removeButton___y2WED",SX="-esm-form-builder__file-thumbnail__closeIcon___2MzVN";var S1=D(59184),S2=D(63654);function S4({bytesContentFamily:e,removeFileCb:n,...D}){let t=(0,s.useMemo)(()=>{switch(e){case"image":return S3;case"pdf":return S0;default:return S8}},[]);return a().createElement("div",{className:SY},a().createElement(t,D),a().createElement(h.$nd,{kind:"ghost",className:SJ,onClick:n},a().createElement(S1.R9,{size:16,className:SX})))}function S3(e){return a().createElement("img",{className:SQ,src:e.src,alt:e.title})}function S0(e){return a().createElement("div",{className:SZ,role:"button",tabIndex:0},a().createElement(S2.aD,{size:24}))}function S8(e){return a().createElement("div",{className:SZ,role:"button",tabIndex:0},a().createElement(S2.WZ,{size:24}))}let S9=[{name:"drug",baseControlComponent:tv},{name:"problem",baseControlComponent:tv},{name:"encounter-provider",baseControlComponent:tv},{name:"encounter-location",baseControlComponent:tv},{name:"select-concept-answers",baseControlComponent:tv},{name:"encounter-role",baseControlComponent:tv}],S7=[{name:"text",component:tg},{name:"textarea",component:tr},{name:"select",component:tS},{name:"checkbox",component:D7},{name:"radio",component:tD},{name:"date",component:DX},{name:"datetime",component:DX},{name:"number",component:D5},{name:"content-switcher",component:Dq},{name:"toggle",component:ta},{name:"workspace-launcher",component:t$},{name:"group",component:Dx},{name:"repeating",component:Sq},{name:"markdown",component:D8},{name:"fixed-value",component:D1},{name:"ui-select-extended",component:tv},{name:"file",component:({field:e,value:n,setFieldValue:D})=>{let{t}=(0,eX.useTranslation)(),{sessionMode:S}=Dr(),i="tablet"===(0,o.useLayoutType)(),r=(0,s.useCallback)(()=>{let t=(0,o.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),D([...n||[],e]),t(),Promise.resolve()),closeModal:()=>{t()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[n,e]),g=(0,s.useCallback)(e=>{let t=[...n],S=t[e];S.uuid?t[e]={...S,voided:!0}:t.splice(e,1),D(t)},[n]);return ni(S)&&!n?a().createElement(DI,{label:t(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):a().createElement("div",null,a().createElement("div",{className:c()(SK.label,"cds--label")},a().createElement(DB,{field:e})),!ni(S)&&a().createElement("div",null,a().createElement(h.$nd,{className:SK.uploadButton,kind:i?"ghost":"tertiary",onClick:r,renderIcon:e=>a().createElement(SG.OM,{size:16,...e})},e.questionOptions.buttonLabel?t(e.questionOptions.buttonLabel):t("addFile","Add file"))),a().createElement("div",{className:SK.thumbnailGrid},n&&n.filter(e=>!e.voided).map((e,n)=>a().createElement("div",{className:SK.thumbnailContainer},a().createElement(S4,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>g(n)})))))}},...tc.map(e=>({name:e.name,component:S9.find(n=>n.name===e.name).baseControlComponent}))],S6={validate:(e,n,D)=>{let t=new Date,S=n?[]:e8.validate(e,n);return S.length?S:n&&!(0,Dt.H)(D?.allowFutureDates)&&n.getTime&&n.getTime()>t.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},S5=[{name:"default_value",component:tH},{name:"form_field",component:e8},{name:"date",component:S6},{name:"js_expression",component:{validate:function(e,n,D){let t="value.invalid",S="Invalid value",i="Field has warnings";return D.expressionContext.myValue=n,Object.keys(D).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(r=>{let o="failsWhenExpression"===r;return nW(D[r],{value:e,type:"field"},D.formFields,{...D.values,[e.id]:n},D.expressionContext)?[{resultType:o?"error":"warning",errCode:o?t:null,message:D.message?D.message:o?S:i}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,n,D){let{referenceQuestionId:t,referenceQuestionAnswers:S,values:i,formFields:r,message:o}=D,g=i[r.find(e=>e.id===t).id];return e7(n)||S.includes(g)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:o}]}}}];function ie(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class iD{fetchData(e){return(0,o.openmrsFetch)(e?`${this.url}&q=${e}`:this.url).then(({data:e})=>e.results)}fetchSingleItem(e){let n=this.url;if(n.includes("?")){let D=n.split("?");n=`${D[0]}/${e}?${D[1]}`}else n=`${n}/${e}`;return(0,o.openmrsFetch)(n).then(({data:e})=>e)}toUuidAndDisplay(e){if(void 0===e.uuid||void 0===e.display)throw Error("'uuid' or 'display' not found in the OpenMRS object.");return e}constructor(e){ie(this,"url",void 0),this.url=e}}let it="custom:(uuid,display,conceptClass:(uuid,display))",iS="custom:(uuid,display,conceptClass:(uuid,display),mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid))))",ii="35543629-7d8c-11e1-909d-c80aa9edcf4e";class ir extends iD{fetchData(e,n){if(e7(n?.class)&&e7(n?.concept)&&!n?.useSetMembersByConcept&&e7(e))return Promise.resolve([]);let D=n?.conceptSourceUuid?iS:it,t=`${o.restBaseUrl}/concept?name=&searchType=fuzzy&v=${D}`;if(n?.class)if("string"!=typeof n.class)return(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results.filter(e=>e.conceptClass&&n.class.includes(e.conceptClass.uuid)));else{let e=t.split("searchType=fuzzy");t=`${e[0]}searchType=fuzzy&class=${n.class}&${e[1]}`}if(n?.concept&&n?.useSetMembersByConcept){let D=t.split("?name=&searchType=fuzzy&v="),S=n?.conceptSourceUuid?"custom:(uuid,setMembers:(uuid,display,mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid)))))":"custom:(uuid,setMembers:(uuid,display))";return t=`${D[0]}/${n.concept}?v=${S}`,(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.setMembers)}return(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results)}fetchSingleItem(e,n){let D=n?.conceptSourceUuid?iS:it;return(0,o.openmrsFetch)(`${o.restBaseUrl}/concept/${e}?v=${D}`).then(({data:e})=>e)}toUuidAndDisplay(e,n){let D=super.toUuidAndDisplay(e),t=this.getConceptSourceMapping(e,n?.conceptSourceUuid)?.conceptReferenceTerm?.code;return t?{...D,code:t}:D}getConceptSourceMapping(e,n){if(!n)return;let D=e.mappings?.filter(e=>e.conceptReferenceTerm?.conceptSource?.uuid===n)??[];return D.find(e=>e.conceptMapType?.uuid===ii||e.conceptMapType?.display?.toUpperCase()==="SAME-AS")??D[0]}constructor(){super(`${o.restBaseUrl}/concept?v=${it}`)}}class io extends iD{fetchData(e,n,D){let t=this.url,S=t.split("?");return n?.tag&&(t=`${S[0]}?tag=${n.tag}&${S[1]}`),D&&(t=`${S[0]}/${D}?${S[1]}`),(0,o.openmrsFetch)(e?`${t}&q=${e}`:t).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${o.restBaseUrl}/location?v=custom:(uuid,display)`)}}class ig extends iD{async fetchData(e,n){let D="v=custom:(uuid,display)",t=`${o.restBaseUrl}/provider?${D}`,{data:S}=await (0,o.openmrsFetch)(e?`${t}&q=${e}`:t);return S?.results}async fetchSingleItem(e){let{data:n}=await (0,o.openmrsFetch)(`${o.restBaseUrl}/provider/${e}?v=custom:(uuid,display)`);return n}constructor(){super(null)}}class is extends iD{fetchSingleItem(e){return(0,o.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,n){let D=this.buildUrl(n.referencedValue||n.concept);return(0,o.openmrsFetch)(D).then(({data:e})=>e.setMembers.length?e.setMembers:e.answers)}buildUrl(e){return this.url.replace(":conceptUuid",e)}constructor(){super(`${o.restBaseUrl}/concept/:conceptUuid?v=custom:(uuid,display,setMembers:(uuid,display),answers:(uuid,display))`)}}class ia extends iD{async fetchData(e,n){let D="v=custom:(uuid,display,name)",t=`${o.restBaseUrl}/encounterrole?${D}`,{data:S}=await (0,o.openmrsFetch)(e?`${t}&q=${e}`:t);return S?.results}constructor(){super(null)}}let il=[{name:"location_datasource",component:new io},{name:"drug_datasource",component:new ir},{name:"problem_datasource",component:new ir},{name:"select_concept_answers_datasource",component:new is},{name:"provider_datasource",component:new ig},{name:"encounter_role_datasource",component:new ia}],ic=[{name:"ProgramEnrollmentSubmissionAction",load:()=>D.e("4831").then(D.bind(D,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>D.e("7484").then(D.bind(D,26679))}];function iu(e,n,D){if("programState"===e.type){let e=D.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},D.meta=e}try{id(e),im(e),iy(e),iv(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>iu(e,n,D)):e.questions.forEach(e=>iu(e,n,D))),e.meta.pageId=n.id}catch(e){console.error(e)}}function ih(e){let n=[];return e?.forEach(e=>{if(n.push(e),"inlineDate"!==e.type&&(0,Dt.H)(e.questionOptions?.showDate)){let D={id:`${e.id}_inline_date`,label:`Date for ${e.label}`,type:"inlineDate",questionOptions:{rendering:"date",isTransient:!0},validators:e.questionOptions.shownDateOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownDateOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.obsDatetime}}};n.push(D)}}),n}function id(e){ip(e,"readonly"),ip(e,"required"),ip(e,"unspecified"),ip(e.questionOptions,"disallowDecimals"),ip(e.questionOptions,"isSearchable"),ip(e.questionOptions,"isTransient"),ip(e.questionOptions,"enablePreviousValue"),ip(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function ip(e,n){if(e&&"string"==typeof e[n]){let D=e[n].trim().toLowerCase();("true"===D||"false"===D)&&(e[n]="true"===D)}return e}function im(e){!nn(e,"group")&&(e.validators=e.validators||[],0>e.validators.findIndex(e=>"form_field"===e.type)&&e.validators.push({type:"form_field"}),0>e.validators.findIndex(e=>"default_value"===e.type)&&e.validators.push({type:"default_value"}))}function iy(e){switch(e.type){case"encounterProvider":e.questionOptions.rendering="encounter-provider";break;case"encounterLocation":e.questionOptions.rendering="encounter-location";break;case"encounterRole":e.questionOptions.rendering="encounter-role";break;case"encounterDatetime":e.questionOptions.rendering=nn(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":i_(e)}}function iv(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":ib(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":iM(e);break;case"repeating":case"group":iw(e);break;case"date":e.datePickerFormat=e.datePickerFormat??"calendar";break;case"datetime":e.datePickerFormat=e.datePickerFormat??"both";break;case"workspace-launcher":case"markdown":e.type="control";break;case"drug":case"problem":e.questionOptions.isSearchable=!0}return e}function ib(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,Dt.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),nn(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function iw(e){nn(e,"group")&&e.questions?.length&&e.questions.forEach(iw),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function iM(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function iL(e){if(e.meta.programs.isEnrollment||e.meta.programs.discontinuationDateQuestionId){let n={programUuid:e.meta.programs.uuid};e.meta.programs.isEnrollment?n.enrollmentDate="":n.completionDate=e.meta.programs.discontinuationDateQuestionId,e.postSubmissionActions=[{actionId:"ProgramEnrollmentSubmissionAction",enabled:"true",config:n}]}}function i$(e){let n=[];return e?.forEach(e=>{if(n.push(e),"obsComment"!==e.type&&(0,Dt.H)(e.questionOptions?.showComment)){let D={id:`${e.id}_obs_comment`,label:`Comment for ${e.label}`,type:"obsComment",questionOptions:{rendering:"text",isTransient:!0},validators:e.questionOptions.shownCommentOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownCommentOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.comment}}};n.push(D)}}),n}function i_(e){if("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type){let n=e.questionOptions.datasource?.config;e.questionOptions.datasource={name:"problem_datasource",config:{...n,class:e.questionOptions.diagnosis?.conceptClasses??n?.class}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{...n,concept:e.questionOptions.diagnosis.conceptSet,useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource}}function ix(e,n){Object.entries(n).forEach(([n,D])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===n?e.questionOptions.defaultValue=D:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===n&&(e.questionOptions.defaultValue=D)})})})})})}let iC=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,n)=>(ip(e,"readonly"),e.pages.forEach((n,D)=>{let t=n.label??"";n.id=`page-${t.replace(/\s/g,"")}-${D}`,ip(n,"readonly"),n.sections&&n.sections.forEach(D=>{D.questions=ih(D.questions),D.questions=i$(D.questions),ip(D,"readonly"),ip(D,"isExpanded"),D?.questions?.forEach((D,t)=>iu(D,n,e))})}),n&&"object"==typeof n&&ix(e,n),e.meta?.programs&&iL(e),e)}}];function iE(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].provider}return null}function ik(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].encounterRole}return null}function iA(e,n){return tN(e,n)||!e7(e.meta.submission.newValue.obsDatetime)}let iT=[{type:"obs",component:tA},{type:"control",component:{getDisplayValue:(e,n)=>n,transformFieldValue:function(e,n,D){return null},getInitialValue:function(e,n,D){return null},getPreviousValue:function(e,n,D){return null},tearDown:function(){}}},{type:"obsGroup",component:tA},{type:"testOrder",component:tq},{type:"programState",component:{transformFieldValue:function(e,n,D){if(nD(e),e.meta?.initialValue?.omrsObject?.uuid===n||e7(n))return null;e.meta.submission.newValue={state:n,startDate:e4()().format()}},getInitialValue:function(e,n,D){let t=D.customDependencies.patientPrograms?.find(n=>n.program.uuid===e.questionOptions.programUuid);if(t?.states?.length>0){let n=t.states.filter(e=>!e.endDate).find(n=>n.state.programWorkflow?.uuid===e.questionOptions.workflowUuid)?.state;return e.meta={...e.meta||{},initialValue:{omrsObject:n}},n?.uuid}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){return n&&n.location?.uuid?n.location.uuid:D.location.uuid},getPreviousValue:function(e,n,D){let t=n??D.previousDomainObjectValue;return{value:t?.location?.uuid,display:t?.location?.name}},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){let t=iE(n);return t?.uuid?t.uuid:D.currentProvider?.uuid},getPreviousValue:function(e,n,D){let t=iE(n??D.previousDomainObjectValue);return{value:t?.uuid,display:t?.name}},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){let t=n??D.domainObjectValue;return t?ik(t)?.uuid:D.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,n,D){let t=n??D.previousDomainObjectValue;if(t){let e=ik(t);return{value:e?.uuid,display:e?.name}}return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"obsComment",component:{transformFieldValue:function(e,n,D){let t=D.getFormField(e.meta.targetField),S=D.methods.getValues(t.id),i=t.meta.initialValue?.omrsObject;if(t.meta.submission?.newValue)e7(n)&&!iA(t,S)?t.meta.submission.newValue=null:t.meta.submission.newValue.comment=n;else if(!nS(t)&&i){if(e7(n)&&e7(i.comment))return null;let e=tI(t,S);t.meta.submission={newValue:{...e,comment:n}}}return null},getInitialValue:function(e,n,D){if(n??D.domainObjectValue){let n=e.id.split("_obs_comment")[0],t=D.formFields.find(e=>e.id===n);return t?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,n,D){nt(e,n,null)},getInitialValue:function(e,n,D){return n?.encounterDatetime?new Date(n.encounterDatetime):D.sessionDate},getPreviousValue:function(e,n,D){if(n?.encounterDatetime){let D=new Date(n.encounterDatetime);return{value:D,display:this.getDisplayValue(e,D)}}return null},getDisplayValue:function(e,n){return(0,o.formatDate)(n)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,n,D){let t=D.getFormField(e.meta.targetField),S=D.methods.getValues(t.id),i=n instanceof Date?(0,o.toOmrsIsoString)(n):n;if(t.meta.submission?.newValue)e7(i)&&!iA(t,S)?t.meta.submission.newValue=null:t.meta.submission.newValue.obsDatetime=i;else if(!nS(t)&&t.meta.initialValue?.omrsObject){if(e7(n)&&e7(t.meta.initialValue.omrsObject?.obsDatetime))return null;let e=tI(t,S);t.meta.submission={newValue:{...e,obsDatetime:i}}}},getInitialValue:function(e,n,D){if(n??D.domainObjectValue){let n=e.id.split("_inline_date")[0],t=D.formFields.find(e=>e.id===n),S=t?.meta.initialValue?.omrsObject;if(S?.obsDatetime)return(0,o.parseDate)(S.obsDatetime)}return null},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?(0,o.formatDate)(n):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,n,D){return(nD(e),e.meta.initialValue?.refinedValue===n||e7(n))?null:(e.meta.submission.newValue={identifier:n,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:D.location},e.meta.submission.newValue)},getInitialValue:function(e,n,D){let t=D.patient?.identifier?.find(n=>n.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:t,refinedValue:t?.value}},t?.value},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,n,D){return(nD(e),e.meta.initialValue?.refinedValue===n||e7(n))?null:(e.meta.submission.newValue={value:n,attributeType:e.questionOptions.attributeType,uuid:e.meta.initialValue?.omrsObject?.uuid},e.meta.submission.newValue)},getInitialValue:function(e,n,D){let t=D.patient?.extension?.find(n=>n.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:t,refinedValue:t?.valueString||t?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,n,D){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"diagnosis",component:tQ}],iO={},iR={},iI={},ij={},iN={},iP={};async function iF(e){if(iR[e])return iR[e];let n=S7.find(n=>n.name===e||n?.alias===e)?.component;if(!n){let D=await iG().controls.find(n=>n.name===e||n?.alias===e)?.load?.();n=D?.default}return iR[e]=n,n}function iU(e){return iK(e)&&!nn(e,"file")?(e.disabled=!0,e.isDisabled=!0,iF("text")):iF(e.questionOptions.rendering)}async function iV(e){if(iI[e])return iI[e];let n=iT.find(n=>n.type===e)?.component;if(!n){let D=await iG().fieldValueAdapters.find(n=>n.type===e)?.load?.();n=D?.default}return iI[e]=n,n}async function iH(){let e=[],n=iP;if(Object.keys(n).length)return Object.values(n);let D=iG().formSchemaTransformers||[];return e.push(...(await Promise.all(D.map(async e=>{let n=await e.load?.();return n?.default}))).filter(e=>void 0!==e)),e.push(...iC.map(e=>e.component)),e.forEach(e=>{iP[iC.find(n=>n.component===e).name]=e}),e}async function iz(e){let n=ij[e];if(n)return n;let D=ic.find(n=>n.name===e);if(D){let n=D.load,t=await n();return ij[e]=t.default,t.default}let t=iG().postSubmissionActions.find(n=>n.name===e);if(t){let n=t.load,D=await n();return ij[e]=D.default,D.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function iW(e){if(iO[e])return iO[e];let n=S5.find(n=>n.name===e)?.component;if(!n){let D=await iG().fieldValidators.find(n=>n.name===e)?.load?.();n=D?.default}return iO[e]=n,n}async function iB(e){if(iN[e])return iN[e];let n=il.find(n=>n.name===e)?.component;if(!n){let D=tu(e);if(D)n=il.find(e=>e.name===D.datasource.name)?.component;else{let D=await iG().dataSources.find(n=>n.name===e)?.load?.();if(!D)throw Error("Datasource not found");n=D.default}}return iN[e]=n,n}function iq(){return iG().expressionHelpers}function iG(){return(0,o.getGlobalStore)(g.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function iK(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function iY(e,n,D,t,S){let[i,r]=(0,s.useState)(null),[o,g]=(0,s.useState)(i1(e,n));return(0,s.useEffect)(()=>{let i=new AbortController,o=e=>{if(e?.translations){let n=window.i18next.language;window.i18next.addResourceBundle(n,Sl.L,e.translations,!0,!0)}r(e)};return iQ(e,n,t,S).then(e=>{o({...e,encounter:D})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),g(Error("Error loading form JSON: "+e.message)))}),()=>{i.abort()}},[t,e,n,D]),{formJson:i,isLoading:!i&&!o,formError:o}}async function iQ(e,n,D,t){let S=await (0,nL.fetchOpenMRSForm)(e),i=await (0,nL.fetchClobData)(S),r=await iH(),o=i?{...i,uuid:S.uuid}:i4(n),g=iZ(o);iX(o,await iJ(g,D));let s=i8(o),a=await i9(s),l=s.reduce((e,n)=>(e[n.formName]=n.alias,e),{});return i6(o,i7(a),l),i2(o,r,D,t)}function iZ(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function iJ(e,n){return Promise.all(e.map(e=>iQ(e,null,n)))}function iX(e,n){n.forEach(n=>{let D=e.pages.find(e=>e.subform?.name===n.name);D&&(D.subform.form=n)})}function i1(e,n){return e||n?e&&n?Error("InvalidArgumentsErr: Both formUuid and formJson cannot be provided at the same time."):void 0:Error("InvalidArgumentsErr: Neither formUuid nor formJson was provided")}function i2(e,n=[],D,S){return i3(e,D),n.reduce((e,n)=>n.transform(e,S),e),i0(e),t(D,e)}function i4(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function i3(e,n){for(let D=e.pages.length-1;D>=0;D--){let t=e.pages[D];(0,Dt.H)(t.isSubform)&&!(0,Dt.H)(t.isHidden)&&t.subform?.form?.encounterType===e.encounterType&&(t.subform.form.pages.filter(e=>!(0,Dt.H)(e.isSubform)),e.pages.splice(D,1,...i2(t.subform.form,[],n).pages))}}function i0(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function i8(e){let n=e?.referencedForms;return n||[]}async function i9(e){return Promise.all(e.map(e=>iQ(e.formName,null,null)))}function i7(e){let n=new Map;return e.forEach(e=>{n.set(e.name,e)}),n}function i6(e,n,D){n.forEach((n,t)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===t||e.reference.form===D[t])){let D=i5(e,n);Object.assign(e,D)}})})})}function i5(e,n){let D,t=n.pages.filter(n=>n.label===e.reference.page);if(t.length>0){let n=t[0].sections.filter(n=>n.label===e.reference.section);n.length>0&&(D=n[0])}return re(D,e.reference)}function re(e,n){if(n?.excludeQuestions){let D=n.excludeQuestions;e.questions=e.questions.filter(e=>!D.includes(e.id))}return e}var rn=D(76922);function rD(e,n,D){return n in e?Object.defineProperty(e,n,{value:D,enumerable:!0,configurable:!0,writable:!0}):e[n]=D,e}class rt{setEvaluatedPagesVisibility(e){this.evaluatedPagesVisibilitySubject.next(e)}updateScrollablePages(e){this.scrollablePagesSubject.next(e)}updatePagesWithErrors(e){this.pagesWithErrorsSubject.next(new Set(e))}addActivePage(e){let n=this.activePagesSubject.value;n.add(e),this.activePagesSubject.next(n)}removeInactivePage(e){let n=this.activePagesSubject.value;n.delete(e),this.activePagesSubject.next(n)}getActivePagesObservable(){return this.activePagesSubject.asObservable()}getScrollablePagesObservable(){return this.scrollablePagesSubject.asObservable()}getPagesWithErrorsObservable(){return this.pagesWithErrorsSubject.asObservable()}getEvaluatedPagesVisibilityObservable(){return this.evaluatedPagesVisibilitySubject.asObservable()}clear(){this.scrollablePagesSubject.next([]),this.pagesWithErrorsSubject.next(new Set),this.activePagesSubject.next(new Set),this.evaluatedPagesVisibilitySubject.next(!1)}constructor(){rD(this,"scrollablePagesSubject",new rn.BehaviorSubject([])),rD(this,"pagesWithErrorsSubject",new rn.BehaviorSubject(new Set)),rD(this,"activePagesSubject",new rn.BehaviorSubject(new Set)),rD(this,"evaluatedPagesVisibilitySubject",new rn.BehaviorSubject(null))}}let rS=new rt,ri=new Set;function rr(e){e&&Object.values(e).forEach(e=>{ri.add(e)})}function ro(){ri.forEach(e=>{try{e.tearDown()}catch(e){}}),ri.clear(),rS.clear()}function rg(e){let[n,D]=(0,s.useState)(void 0),t=(0,s.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),S=(0,s.useCallback)(e=>{D(e.detail.value)},[]);return(0,s.useEffect)(()=>{let n=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(n)},[e]),(0,s.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",S),()=>{window.removeEventListener("openmrs:form-collapse-toggle",S)}),[]),{isFormExpanded:n,hideFormCollapseToggle:t}}let rs=26.25,ra=32.25,rl=48.25;function rc(e){let[n,D]=(0,s.useState)(0),t=(0,s.useMemo)(()=>n<=rs?"narrow":n<=ra?"wider":n<=rl?"extra-wide":"ultra-wide",[n]);return(0,s.useLayoutEffect)(()=>{let n=()=>{let n=e.current?.parentElement?.offsetWidth,t=parseInt(getComputedStyle(document.documentElement).fontSize);n&&D(na(n,t))};n();let t=new ResizeObserver(e=>{n()});return e.current?.parentElement&&t.observe(e.current?.parentElement),()=>{t.disconnect()}},[e]),t}let ru=()=>{let[e,n]=(0,s.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,s.useEffect)(()=>{let e=[rS.getScrollablePagesObservable().subscribe(e=>{n(n=>({...n,pages:e,hasMultiplePages:e.length>1}))}),rS.getPagesWithErrorsObservable().subscribe(e=>{n(n=>({...n,pagesWithErrors:Array.from(e)}))}),rS.getActivePagesObservable().subscribe(e=>{n(n=>({...n,activePages:Array.from(e)}))}),rS.getEvaluatedPagesVisibilityObservable().subscribe(e=>{n(n=>({...n,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function rh(e){let n=new Date,D=n.getFullYear()-e.getFullYear();return n.getMonth()<e.getMonth()||n.getMonth()===e.getMonth()&&n.getDate()<e.getDate()?D-1:D}let rd={female:"F",male:"M",other:"O",unknown:"U"},rp=e=>{let{patient:n,isLoading:D,error:t}=(0,o.usePatient)(e);return n&&!D&&(n.age=rh(new Date(n?.birthDate)),n.sex=rd[n.gender]??"U"),{patient:n,isLoadingPatient:D,patientError:t}},rf=(e,n,D,t)=>{let[S,i]=(0,s.useState)(!1),[r,o]=(0,s.useState)(""),{loadDependencies:g}=e;return(0,s.useEffect)(()=>{let e=!1;return g&&(i(!0),g(n,D,t).then(()=>{e||i(!1)}).catch(n=>{e||(o(n),(0,n6.N)(n,"Encountered error while loading dependencies"))})),()=>{e=!0}},[g]),{isLoading:S,error:r}},rm=(e,n,D)=>{let[t,S]=(0,s.useState)(!0),[i,r]=(0,s.useState)({}),[o,g]=(0,s.useState)(null),a=(0,s.useRef)(D);a.current=D;let l=(0,s.useRef)(!1),c=D.formFields?.length>0,u=Object.keys(D.formFieldAdapters??{}).length>0;return(0,s.useEffect)(()=>{if(e&&!n&&c&&u&&!l.current){l.current=!0;let n=a.current;e.getInitialValues(n).then(e=>{r(e),S(!1)}).catch(e=>{console.error(e),g(e),S(!1)})}},[e,n,c,u]),{isLoadingInitialValues:t,initialValues:i,error:o}},ry="-esm-form-builder__section-renderer__section___+aK-S",rv="-esm-form-builder__section-renderer__sectionBody___0kmuN",rb=({section:e})=>{let{formFieldAdapters:n}=Dr(),D=(0,s.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return a().createElement("div",{className:ry},e.questions.map(e=>n[e.type]?a().createElement("div",{key:`${D}-${e.id}`,className:rv},a().createElement(Dw,{key:e.id,fieldId:e.id,valueAdapter:n[e.type]})):null))};var rw=D(20594),rM=!!("u">typeof window&&window.document&&window.document.createElement);function rL(){if(!rM||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),D=function(){};window.addEventListener("testPassiveEventSupport",D,n),window.removeEventListener("testPassiveEventSupport",D,n)}catch(e){}return e}var r$=void 0;function r_(){return void 0===r$&&(r$=rL()),r$}function rx(e){if(e)return r_()?e:!!e.capture}function rC(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function rE(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function rk(e){this.target=e,this.events={}}rk.prototype.getEventHandlers=function(){return function(e,n){var D=String(e)+" "+String(rC(n));return this.events[D]||(this.events[D]={handlers:[],handleEvent:void 0},this.events[D].nextHandlers=this.events[D].handlers),this.events[D]}}(),rk.prototype.handleEvent=function(){return function(e,n,D){var t=this.getEventHandlers(e,n);t.handlers=t.nextHandlers,t.handlers.forEach(function(e){e&&e(D)})}}(),rk.prototype.add=function(){return function(e,n,D){var t=this,S=this.getEventHandlers(e,D);rE(S),0===S.nextHandlers.length&&(S.handleEvent=this.handleEvent.bind(this,e,D),this.target.addEventListener(e,S.handleEvent,D)),S.nextHandlers.push(n);var i=!0;return function(){return function(){if(i){i=!1,rE(S);var r=S.nextHandlers.indexOf(n);S.nextHandlers.splice(r,1),0===S.nextHandlers.length&&(t.target&&t.target.removeEventListener(e,S.handleEvent,D),S.handleEvent=void 0)}}}()}}();var rA="__consolidated_events_handlers__";function rT(e,n,D,t){e[rA]||(e[rA]=new rk(e));var S=rx(t);return e[rA].add(n,D,S)}var rO=D(23286);function rR(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function rI(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function rj(e,n){var D=rI(e);if("number"==typeof D)return D;var t=rR(e);if("number"==typeof t)return t*n}var rN="above",rP="inside",rF="below",rU="invisible";function rV(e){return"string"==typeof e.type}var rH="<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n\nSee https://goo.gl/LrBNgw for more info.";function rz(e,n){if(e&&!rV(e)&&!n)throw Error(rH)}function rW(e){return e.viewportBottom-e.viewportTop==0?rU:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?rP:e.viewportBottom<e.waypointTop?rF:e.waypointTop<e.viewportTop?rN:rU}var rB=[];function rq(e){rB.push(e),r||(r=setTimeout(function(){var e;for(r=null;e=rB.shift();)e()},0));var n=!0;return function(){if(n){n=!1;var D=rB.indexOf(e);-1!==D&&(rB.splice(D,1),!rB.length&&r&&(clearTimeout(r),r=null))}}}function rG(e){return"window"===e?D.g.window:e}var rK="u">typeof window,rY={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},rQ=function(e){function n(n){var D;return(D=e.call(this,n)||this).refElement=function(e){D._ref=e},D}(0,rw.A)(n,e);var D=n.prototype;return D.componentDidMount=function(){var e=this;rK&&(this.cancelOnNextTick=rq(function(){e.cancelOnNextTick=null;var n=e.props,D=n.children;n.debug,rz(D,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=rT(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=rT(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},D.componentDidUpdate=function(){var e=this;rK&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=rq(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},D.componentWillUnmount=function(){rK&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},D._findScrollableAncestor=function(){var e=this.props,n=e.horizontal,D=e.scrollableAncestor;if(D)return rG(D);for(var t=this._ref;t.parentNode&&(t=t.parentNode)!==document.body;){var S=window.getComputedStyle(t),i=(n?S.getPropertyValue("overflow-x"):S.getPropertyValue("overflow-y"))||S.getPropertyValue("overflow");if("auto"===i||"scroll"===i||"overlay"===i)return t}return window},D._handleScroll=function(e){if(this._ref){var n=this._getBounds(),D=rW(n),t=this._previousPosition,S=this.props,i=(S.debug,S.onPositionChange),r=S.onEnter,o=S.onLeave,g=S.fireOnRapidScroll;if(this._previousPosition=D,t!==D){var s={currentPosition:D,previousPosition:t,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom};i.call(this,s),D===rP?r.call(this,s):t===rP&&o.call(this,s);var a=t===rF&&D===rN,l=t===rN&&D===rF;g&&(a||l)&&(r.call(this,{currentPosition:rP,previousPosition:t,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}),o.call(this,{currentPosition:D,previousPosition:rP,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}))}}},D._getBounds=function(){var e,n,D=this.props,t=D.horizontal;D.debug;var S=this._ref.getBoundingClientRect(),i=S.left,r=S.top,o=S.right,g=S.bottom,s=t?i:r,a=t?o:g;this.scrollableAncestor===window?(e=t?window.innerWidth:window.innerHeight,n=0):(e=t?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,n=t?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var l=this.props,c=l.bottomOffset,u=rj(l.topOffset,e),h=rj(c,e),d=n+e;return{waypointTop:s,waypointBottom:a,viewportTop:n+u,viewportBottom:d-h}},D.render=function(){var e=this,n=this.props.children;if(!n)return a().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(rV(n)||(0,rO.isForwardRef)(n)){var D=function(D){e.refElement(D),n.ref&&("function"==typeof n.ref?n.ref(D):n.ref.current=D)};return a().cloneElement(n,{ref:D})}return a().cloneElement(n,{innerRef:this.refElement})},n}(a().PureComponent);rQ.above=rN,rQ.below=rF,rQ.inside=rP,rQ.invisible=rU,rQ.defaultProps=rY,rQ.displayName="Waypoint";let rZ={pageContent:"-esm-form-builder__page-renderer__pageContent___1sqJE",pageHeader:"-esm-form-builder__page-renderer__pageHeader___5xq2Z",pageTitle:"-esm-form-builder__page-renderer__pageTitle___L0LWE",collapseIcon:"-esm-form-builder__page-renderer__collapseIcon___FAxsi",sectionContainer:"-esm-form-builder__page-renderer__sectionContainer___GuKLn",accordionContainer:"-esm-form-builder__page-renderer__accordionContainer___S5AuC",firstSection:"-esm-form-builder__page-renderer__firstSection___cvqEr",lastSection:"-esm-form-builder__page-renderer__lastSection___FcNvF",formSection:"-esm-form-builder__page-renderer__formSection___2sNJr",hiddenAccordion:"-esm-form-builder__page-renderer__hiddenAccordion___ldAud"};function rJ({section:e,sectionIndex:n,visibleSections:D,isFormExpanded:t}){let{t:S}=(0,eX.useTranslation)(),[i,r]=(0,s.useState)(t);return(0,s.useEffect)(()=>{r(t)},[t]),a().createElement(h.AsP,{title:S(e.label),open:i,className:c()(rZ.sectionContainer,{[rZ.firstSection]:0===n,[rZ.lastSection]:n===D.length-1})},a().createElement("div",{className:rZ.formSection},a().createElement(rb,{section:e})))}let rX=function({page:e,isFormExpanded:n}){let{t:D}=(0,eX.useTranslation)(),[t,S]=(0,s.useState)(!1),i=(0,s.useMemo)(()=>e.sections.filter(e=>{let n=e.questions.some(e=>!(0,Dt.H)(e.isHidden));return!(0,Dt.H)(e.isHidden)&&n}),[e.sections]),r=()=>S(!t);return(0,s.useEffect)(()=>(S(!n),()=>{rS.removeInactivePage(e.id)}),[n]),a().createElement("div",null,a().createElement(rQ,{key:e.id,onEnter:()=>rS.addActivePage(e.id),onLeave:()=>rS.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},a().createElement("div",{id:e.id,className:rZ.pageContent},a().createElement("div",{className:rZ.pageHeader,onClick:r},a().createElement("p",{className:rZ.pageTitle},D(e.label),a().createElement("span",{className:rZ.collapseIconWrapper},t?a().createElement(o.ChevronDownIcon,{className:rZ.collapseIcon,"aria-label":"Expand"}):a().createElement(o.ChevronUpIcon,{className:rZ.collapseIcon,"aria-label":"Collapse"})))),a().createElement("div",{className:c()({[rZ.hiddenAccordion]:t,[rZ.accordionContainer]:!t})},a().createElement(h.nD3,null,i.map((e,D)=>a().createElement(rJ,{key:`section-${e.label}`,section:e,sectionIndex:D,visibleSections:i,isFormExpanded:n})))))))},r1={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},r2=(e,n)=>{switch(n.type){case"SET_FORM_FIELDS":return{...e,formFields:n.value};case"ADD_FORM_FIELD":return{...e,formFields:[...e.formFields,n.value]};case"UPDATE_FORM_FIELD":return{...e,formFields:e.formFields.map(e=>e.id===n.value.id?n.value:e)};case"REMOVE_FORM_FIELD":return{...e,formFields:e.formFields.filter(e=>e.id!==n.value)};case"SET_INVALID_FIELDS":return{...e,invalidFields:n.value};case"ADD_INVALID_FIELD":return{...e,invalidFields:[...e.invalidFields,n.value]};case"REMOVE_INVALID_FIELD":return{...e,invalidFields:e.invalidFields.filter(e=>e.id!==n.value)};case"CLEAR_INVALID_FIELDS":return{...e,invalidFields:[]};case"SET_FORM_JSON":return{...e,formJson:n.value};case"SET_DELETED_FIELDS":return{...e,deletedFields:n.value};default:return e}},r4=(e,n)=>{let{formFields:D,patient:t,sessionMode:S,visit:i}=n,[r,o]=(0,s.useState)(n.formJson),[g,a]=(0,s.useState)(!1),l=(0,s.useMemo)(()=>D?.map(n=>{let r={value:n,type:"field"},o={patient:t,mode:S,visit:i};if(n.hide?.hideWhenExpression){let t=nW(n.hide.hideWhenExpression,r,D,e,o);n.isHidden=t,Array.isArray(n.questions)&&n.questions.forEach(e=>{e.isHidden=t})}else n.isHidden=!1;"object"==typeof n.required&&"conditionalRequired"===n.required.type?n.isRequired=nZ(n,D,e):n.isRequired=(0,Dt.H)(n.required),"object"==typeof n.disabled&&n.disabled.disableWhenExpression?n.isDisabled=nW(n.disabled.disableWhenExpression,r,D,e,o):n.isDisabled=(0,Dt.H)(n.disabled),n.validators?.some(e=>"conditionalAnswered"===e.type)&&nQ(n,D),n.questionOptions.answers?.filter(e=>!e7(e.hide?.hideWhenExpression)).forEach(n=>{n.isHidden=nW(n.hide.hideWhenExpression,r,D,e,o)}),n.questionOptions.answers?.filter(e=>!e7(e.disable?.disableWhenExpression)).forEach(n=>{n.disable.isDisabled=nW(n.disable?.disableWhenExpression,r,D,e,o)}),"string"==typeof n.readonly&&r3(n.readonly)&&(n.meta.readonlyExpression=n.readonly,n.readonly=nW(n.readonly,r,D,e,o));let g=n.questionOptions.repeatOptions?.limitExpression;return"repeating"!==n.questionOptions.rendering||e7(g)||(n.questionOptions.repeatOptions.limit=nW(g,r,D,e,o)),n}),[e,D,t,S]);return(0,s.useEffect)(()=>{n.formJson?.pages?.forEach(n=>{n.hide?nX({value:n,type:"page"},D,e,S,t,nW,null):n.isHidden=!1,n?.sections?.forEach(n=>{n.hide?nX({value:n,type:"section"},D,e,S,t,nW,null):n.isHidden=!1})}),o(ns(n.formJson)),a(!0)},[n.formJson,D]),{evaluatedFormJson:r,evaluatedFields:l,evaluatedPagesVisibility:g}};function r3(e){return"true"!==e&&"false"!==e}function r0(e,n){let D=(0,s.useCallback)(n=>{e({type:"ADD_FORM_FIELD",value:n})},[]),t=(0,s.useCallback)(D=>{if(D.meta.groupId){let e=n.find(e=>e.id===D.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===D.id?D:e),t(e))}e({type:"UPDATE_FORM_FIELD",value:(0,t_.A)(D)})},[n]),S=(0,s.useCallback)(e=>n.find(n=>n.id===e),[n]),i=(0,s.useCallback)(n=>{e({type:"REMOVE_FORM_FIELD",value:n})},[]),r=(0,s.useCallback)(n=>{e({type:"SET_INVALID_FIELDS",value:n})},[]),o=(0,s.useCallback)(n=>{e({type:"ADD_INVALID_FIELD",value:n})},[]),g=(0,s.useCallback)(n=>{e({type:"REMOVE_INVALID_FIELD",value:n})},[]);return{addFormField:D,updateFormField:t,getFormField:S,removeFormField:i,setInvalidFields:r,addInvalidField:o,removeInvalidField:g,setForm:(0,s.useCallback)(n=>{e({type:"SET_FORM_JSON",value:ns(n)})},[]),setDeletedFields:(0,s.useCallback)(n=>{e({type:"SET_DELETED_FIELDS",value:n})},[])}}let r8=({processorContext:e,initialValues:n,isSubForm:D,setIsLoadingFormDependencies:t})=>{let{evaluatedFields:S,evaluatedFormJson:i,evaluatedPagesVisibility:r}=r4(n,e),{registerForm:o,setIsFormDirty:g,workspaceLayout:l,isFormExpanded:c}=SP(),u=eJ({defaultValues:n,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:h}}=u,[{formFields:d,invalidFields:p,formJson:f,deletedFields:m},y]=(0,s.useReducer)(r2,{...r1,formFields:S,formJson:i}),{addFormField:v,updateFormField:b,getFormField:w,removeFormField:M,setInvalidFields:L,addInvalidField:$,removeInvalidField:_,setForm:x,setDeletedFields:C}=r0(y,d);(0,s.useEffect)(()=>{let e=f.pages.filter(e=>!e.isSubform).map(e=>e);rS.updateScrollablePages(e)},[f.pages]),(0,s.useEffect)(()=>{rS.setEvaluatedPagesVisibility(r)},[r]),(0,s.useEffect)(()=>{rS.updatePagesWithErrors(p.map(e=>e.meta.pageId))},[p]);let E=(0,s.useMemo)(()=>({...e,workspaceLayout:l,methods:u,formFields:d,formJson:f,invalidFields:p,deletedFields:m,addFormField:v,updateFormField:b,getFormField:w,removeFormField:M,setInvalidFields:L,addInvalidField:$,removeInvalidField:_,setForm:x,setDeletedFields:C}),[e,l,u,d,f,p,m]);return(0,s.useEffect)(()=>{o(f.name,D,E)},[f.name,D,E]),(0,s.useEffect)(()=>{g(h)},[h]),a().createElement(Di,E,f.pages.map(e=>e.isSubform||n0(e)?e.isSubform&&e.subform?.form?a().createElement(oa,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:t}):a().createElement(rX,{key:e.label,page:e,isFormExpanded:c}):null))},r9=({context:e,setContext:n,setters:D,useCustomHooks:t,setIsLoadingCustomHooks:S})=>{let{isLoading:i=!1,error:r=null,data:o,updateContext:g}=t(e);return(0,s.useEffect)(()=>{!i&&g&&(g(n,D),S(!1))},[i]),null};function r7(e){let[n,D]=(0,s.useMemo)(()=>{let n=[],D=new Set,t=(e,S)=>{let i=S?{...e,meta:{...e.meta,groupId:S}}:e;n.push(i),i.questionOptions?.concept&&D.add(i.questionOptions.concept),i.questionOptions?.answers?.forEach(e=>{e.concept&&D.add(e.concept)}),"obsGroup"===i.type&&i.questions&&i.questions.forEach(e=>{t(e,i.id)})};return e.pages?.forEach(e=>e.sections?.forEach(e=>{e.questions?.forEach(e=>t(e))})),[n,JSON.stringify(Array.from(D).sort())]},[e]);return{formFields:n,conceptReferences:(0,s.useMemo)(()=>new Set(JSON.parse(D)),[D])}}let r6="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function r5(e){let{data:n,error:D,isLoading:t}=Sw()([`${o.restBaseUrl}/conceptreferences?v=${r6}`,e],([e,n])=>(0,o.openmrsFetch)(e,{headers:{"Content-Type":"application/json"},body:{references:n},method:"POST"}),{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{concepts:(0,s.useMemo)(()=>n?.data?Object.values(n.data):void 0,[n]),isLoading:t,error:D}}let oe={};function on(e){let n=(0,s.useMemo)(()=>{let n=new Set;return e.forEach(e=>{e.validators?.forEach(e=>n.add(e.type))}),Array.from(n).sort().join(",")},[e]),{data:D}=Sy()(n?["formFieldValidators",n]:null,async([,e])=>{let n=e.split(","),D=await Promise.all(n.map(e=>iW(e))),t={};return n.forEach((e,n)=>{t[e]=D[n]}),t},{keepPreviousData:!0});return D??oe}function oD(e,n){return(0,s.useMemo)(()=>e.length&&n?.length?e.map(e=>{let D=n2(e.questionOptions.concept,n);return e.questionOptions.concept=D?D.uuid:e.questionOptions.concept,e.label=e.label?e.label:D?.display,g.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&D?.conceptClass?.display==="Question"&&D?.answers?.length&&(e.questionOptions.answers=D.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:D},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let D=n2(e.concept,n);return{...e,concept:D?D.uuid:e.concept,label:e.label?e.label:D?.display}})),e}):e??[],[n,e])}let ot={},oS=e=>{let n=(0,s.useMemo)(()=>{let n=new Set;return e.forEach(e=>n.add(e.type)),Array.from(n).sort().join(",")},[e]),{data:D}=Sy()(n?["formFieldValueAdapters",n]:null,async([,e])=>{let n=e.split(","),D=await Promise.all(n.map(e=>iV(e))),t={};return n.forEach((e,n)=>{t[e]=D[n]}),t},{keepPreviousData:!0});return D??ot},oi="-esm-form-builder__loader__loaderContainer___ZkHfb",or="-esm-form-builder__loader__loader___YgDLP",oo=()=>{let{t:e}=(0,eX.useTranslation)();return a().createElement("div",{className:oi},a().createElement(h.OuH,{className:or,description:`${e("loading","Loading")} ...`}))},og=["patient","formJson","visit","sessionMode","sessionDate","location","currentProvider","layoutType","processor","formFields","formFieldAdapters","formFieldValidators"];function os(e,n){let D=og.filter(D=>D in n&&n[D]!==e[D]);D.length&&console.warn(`A form processor tried to set the context propert${1===D.length?"y":"ies"} ${D.join(", ")}, which the form engine derives itself. ${1===D.length?"It was":"They were"} ignored. Use the setters passed alongside setContext to update the domain object or custom dependencies.`)}let oa=({formJson:e,isSubForm:n=!1,setIsLoadingFormDependencies:D})=>{let{patient:t,sessionMode:S,formProcessors:i,layoutType:r,location:o,provider:g,sessionDate:l,visit:c}=SP(),{t:u}=(0,eX.useTranslation)(),h=(0,s.useMemo)(()=>{let n,D=i[e.processor];return D?n=new D(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),n=new SC(e)),n.prepareFormSchema(e),n},[i,e.processor]),{formFields:d,conceptReferences:p}=r7(e),{concepts:f,isLoading:m}=r5(Array.from(p)),y=oD(d,f),v=oS(d),b=on(d),w=(0,s.useMemo)(()=>y?.length?y:d??[],[y,d]),[M,L]=(0,s.useState)({}),$=(0,s.useMemo)(()=>({patient:t,formJson:e,sessionMode:S,layoutType:r,location:o,currentProvider:g,processor:h,sessionDate:l,visit:c,formFields:w,formFieldAdapters:v??{},formFieldValidators:b??{}}),[t,e,S,r,o,g,h,l,c,w,v,b]),_=(0,s.useMemo)(()=>({...$,...M}),[$,M]),x=(0,s.useCallback)(e=>{L(n=>{let D={...$,...n},t="function"==typeof e?e(D):e;return"function"==typeof e&&os(D,t),{domainObjectValue:t.domainObjectValue,previousDomainObjectValue:t.previousDomainObjectValue,customDependencies:t.customDependencies}})},[$]),C=(0,s.useMemo)(()=>({setDomainObjectValue:e=>L(n=>({...n,domainObjectValue:e})),setPreviousDomainObjectValue:e=>L(n=>({...n,previousDomainObjectValue:e})),setCustomDependencies:e=>L(n=>({...n,customDependencies:"function"==typeof e?e(n.customDependencies??{}):e}))}),[]),{isLoading:E}=rf(h,_,x,C),k=h.getCustomHooks().useCustomHooks,[A,T]=(0,s.useState)(!!k),{isLoadingInitialValues:O,initialValues:R,error:I}=rm(h,E||A||m,_),j=(0,s.useMemo)(()=>E||A||m||O,[E,A,m,O]);return(0,s.useEffect)(()=>{D(j)},[j,D]),(0,s.useEffect)(()=>{(0,n6.N)(I,u("errorLoadingInitialValues","Error loading initial values"))},[I,u]),(0,s.useEffect)(()=>{v&&rr(v)},[v]),a().createElement(a().Fragment,null,k&&a().createElement(r9,{context:_,setContext:x,setters:C,useCustomHooks:k,setIsLoadingCustomHooks:T}),j&&!n?a().createElement(oo,null):a().createElement(r8,{processorContext:_,initialValues:R,isSubForm:n,setIsLoadingFormDependencies:D}))},ol="-esm-form-builder__patient-banner__patientBannerContainer___KlhJI",oc=({patient:e,hideActionsOverflow:n})=>a().createElement("div",{className:ol},a().createElement(o.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:n}})),ou=({pages:e,defaultPage:n,activePages:D,evaluatedPagesVisibility:t})=>{let[S,i]=(0,s.useState)(null),[r,o]=(0,s.useState)(!1),[g,a]=(0,s.useState)(null),l=(0,s.useRef)(!0);return(0,s.useEffect)(()=>{r||!t||((()=>{let D=e.find(({label:e})=>e===n);if(D&&!D.isHidden)i(D.id),n4(D.id);else{let n=e.find(e=>!e.isHidden);n&&i(n.id)}})(),o(!0))},[e,n,t,r]),(0,s.useEffect)(()=>{let e=null;return r&&(e=setTimeout(()=>{l.current=!1},200)),()=>{e&&clearTimeout(e)}},[r]),(0,s.useEffect)(()=>{if(l.current)return;let n=null;if(g&&D.includes(g)){i(g),n=setTimeout(()=>{a(null)},100);return}return!g&&D.length>0&&i(D.reduce((n,D)=>e.findIndex(e=>e.id===n)<e.findIndex(e=>e.id===D)?n:D)),()=>{n&&clearTimeout(n)}},[D,g,e]),{currentActivePage:S,requestPage:(0,s.useCallback)(e=>{l.current=!1,a(e),i(e),n4(e)},[])}},oh="-esm-form-builder__sidebar__pageLink___Op55o",od="-esm-form-builder__sidebar__pageLinkTablet___cXw5r",op="-esm-form-builder__sidebar__activePage___buqNi",of="-esm-form-builder__sidebar__errorPage___Eu-K9",om="-esm-form-builder__sidebar__activeErrorPage___KHaKn",oy="-esm-form-builder__sidebar__sidebar___vTQvS",ov="-esm-form-builder__sidebar__sideNavActions___dzMCV",ob="-esm-form-builder__sidebar__divider___akCoV",ow="-esm-form-builder__sidebar__closeButton___HiIEp",oM="-esm-form-builder__sidebar__saveButton___6rQj1",oL="-esm-form-builder__sidebar__topMargin___Fh16B";function o$({page:e,currentActivePage:n,pagesWithErrors:D,requestPage:t}){let{t:S}=(0,eX.useTranslation)(),i=e.id===n,r=D.includes(e.id),g="tablet"===(0,o.useLayoutType)();return a().createElement("div",{className:c()(oh,{[op]:i&&!r,[of]:r&&!i,[om]:r&&i,[od]:g})},a().createElement("button",{onClick:n=>{n.preventDefault(),t(e.id)}},a().createElement("span",null,S(e.label))))}let o_=({defaultPage:e,isFormSubmitting:n,sessionMode:D,onCancel:t,handleClose:S,hideFormCollapseToggle:i,hideControls:r})=>{let{t:g}=(0,eX.useTranslation)(),{pages:l,pagesWithErrors:u,activePages:d,evaluatedPagesVisibility:p}=ru(),{currentActivePage:f,requestPage:m}=ou({pages:l,defaultPage:e,activePages:d,evaluatedPagesVisibility:p}),y=(0,o.useLayoutType)(),v=(0,s.useMemo)(()=>"tablet"===y?"lg":"sm",[y]);return a().createElement("div",{className:oy},l.filter(e=>n0(e)).map(e=>a().createElement(o$,{key:e.id,page:e,currentActivePage:f,pagesWithErrors:u,requestPage:m})),"view"!==D&&!r&&a().createElement("hr",{className:ob}),!r&&a().createElement("div",{className:ov},"view"!==D&&a().createElement(h.$nd,{className:oM,disabled:n,type:"submit",size:v},n?a().createElement(h.OuH,{description:g("submitting","Submitting")+"..."}):a().createElement("span",null,`${g("save","Save")}`)),a().createElement(h.$nd,{className:c()(ow,{[oL]:"view"===D}),kind:"tertiary",onClick:()=>{t?.(),S?.(),i()},size:v},"view"===D?g("close","Close"):g("cancel","Cancel"))))},ox="-esm-form-builder__form-engine__form___j8Gb3",oC="-esm-form-builder__form-engine__formContainer___Cvw6g",oE="-esm-form-builder__form-engine__formContent___F7MoF",ok="-esm-form-builder__form-engine__formContentInner___CXTIX",oA="-esm-form-builder__form-engine__formBody___DgyqX",oT="-esm-form-builder__form-engine__minifiedButtons___Ieyml",oO="-esm-form-builder__form-engine__markdownContainer___8OoYZ",oR="-esm-form-builder__form-engine__linearActivity___g2Tl3",oI="-esm-form-builder__form-engine__indeterminate___aYMI1",oj="-esm-form-builder__form-engine__saveButton___CQZOn",oN=({formJson:e,patientUUID:n,formUUID:D,encounterUUID:t,visit:S,formSessionIntent:i,mode:r,onSubmit:g,onCancel:l,handleClose:u,handleConfirmQuestionDeletion:d,markFormAsDirty:p,hideControls:f=!1,hidePatientBanner:m=!1,preFilledQuestions:y})=>{let{t:v}=(0,eX.useTranslation)(),b=(0,o.useSession)(),w=(0,s.useRef)(null),M=(0,s.useRef)(new Date),L=(0,s.useMemo)(()=>no(M.current,S),[S?.startDatetime,S?.stopDatetime]),$=rc(w),{patient:_,isLoadingPatient:x}=rp(n),[C,E]=(0,s.useState)(!1),[k,A]=(0,s.useState)(!1),[T,O]=(0,s.useState)(!1),R=e7(r)?e7(t)?"enter":"edit":r,{isFormExpanded:I,hideFormCollapseToggle:j}=rg(R),{hasMultiplePages:N}=ru(),{formJson:P,isLoading:F,formError:U}=iY(D,e,t,i,y),V=(0,s.useMemo)(()=>!m&&_&&"ultra-wide"===$&&"embedded-view"!==r,[_,r,$,m]),H=(0,s.useMemo)(()=>["narrow"].includes($),[$]),z=(0,s.useMemo)(()=>"embedded-view"!==r&&!C&&null!==N&&(H||!N),[r,H,C,N]),W=(0,s.useMemo)(()=>"embedded-view"!==r&&!C&&null!==N&&!H&&N,[H,C,N]);(0,s.useEffect)(()=>{(0,n6.N)(U,v("errorLoadingFormSchema","Error loading form schema"))},[U]),(0,s.useEffect)(()=>()=>{ro()},[]),(0,s.useEffect)(()=>{p?.(T)},[T]);let B=(0,s.useCallback)(e=>{e.preventDefault(),A(!0)},[]);return a().createElement("form",{ref:w,noValidate:!0,className:c()("cds--form",ox),onSubmit:B},x||F?a().createElement(oo,null):a().createElement(SN,{patient:_,patientUUID:n,sessionMode:R,sessionDate:L,formJson:P,workspaceLayout:"ultra-wide"===$?"maximized":"minimized",location:b?.sessionLocation,provider:b?.currentProvider,visit:S,handleConfirmQuestionDeletion:d,isFormExpanded:I,formSubmissionProps:{isSubmitting:k,setIsSubmitting:A,onSubmit:g,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:j,setIsFormDirty:O},a().createElement("div",{className:oC},C&&a().createElement("div",{className:oR},a().createElement("div",{className:oI})),a().createElement("div",{className:oE},W&&a().createElement(o_,{isFormSubmitting:k,sessionMode:r,defaultPage:P.defaultPage,onCancel:l,handleClose:u,hideFormCollapseToggle:j,hideControls:f}),a().createElement("div",{className:ok},V&&a().createElement(oc,{patient:_,hideActionsOverflow:!0}),P.markdown&&a().createElement("div",{className:oO},a().createElement(D0,{markdown:P.markdown})),a().createElement("div",{className:oA},a().createElement(oa,{formJson:P,setIsLoadingFormDependencies:E})),z&&!f&&a().createElement(h.Te$,{className:oT},a().createElement(h.$nd,{kind:"secondary",onClick:()=>{l&&l(),u&&u(),j()}},"view"===r?v("close","Close"):v("cancel","Cancel")),a().createElement(h.$nd,{className:oj,disabled:C||k||"view"===r,kind:"primary",type:"submit"},k?a().createElement(h.OuH,{description:v("submitting","Submitting")+"..."}):a().createElement("span",null,`${v("save","Save")}`))))))))},oP=function(e){return a().createElement(s.Suspense,{fallback:a().createElement(oo,null)},a().createElement(eX.I18nextProvider,{i18n:window.i18next,defaultNS:Sl.L},a().createElement(oN,e)))}},6232(e,n,D){"use strict";function t(e){return"boolean"==typeof e?e:"string"==typeof e?"true"==e:!!e}function S(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}D.d(n,{H:()=>t,O:()=>S})},10578(e,n,D){"use strict";D.d(n,{N:()=>S,j:()=>i});var t=D(46718);function S(e,n){if(e){let D=i(e).join(", ");console.error(e),(0,t.showSnackbar)({subtitle:D,title:n,kind:"error",isLowContrast:!1})}}function i(e){let n=e?.responseBody?.error?.fieldErrors,D=e?.responseBody?.error?.globalErrors;return n&&0!==Object.keys(n).length||D?D?.length?D.flatMap(e=>e.message):Object.values(n).flatMap(e=>e.map(e=>e.message)):[e?.responseBody?.error?.message??e?.message]}},77541(__unused_rspack_module,__webpack_exports__,__webpack_require__){"use strict";function evaluatePostSubmissionExpression(expression,encounters){let match,encounter=encounters[0],regx=/(?:\w+|'(?:\\'|[^'\n])*')/g,fieldIds=new Set;try{let replacedExpression;for(;match=regx.exec(expression);){let value=match[0].replace(/\\'/g,"'"),isBoolean=/^(true|false)$/i.test(value),isNumber=/^-?\d+$/.test(value),isFloat=/^-?\d+\.\d+$/.test(value);value.startsWith("'")&&value.endsWith("'")||"string"!=typeof value||isBoolean||isNumber||isFloat||fieldIds.add(value)}let fieldToValueMap={};return fieldIds.size&&(fieldToValueMap=getFieldValues(fieldIds,encounter)),replacedExpression=Object.keys(fieldToValueMap).length?expression.replace(/(\w+)/g,e=>Object.prototype.hasOwnProperty.call(fieldToValueMap,e)?fieldToValueMap[e]:e):expression,eval(replacedExpression)}catch(error){throw Error("Error evaluating expression")}}function getFieldValues(e,n){let D={};return e.forEach(e=>{let t=n.obs?.find(n=>n.formFieldPath.includes(e))?.value;"object"==typeof t&&(t=t.uuid),t&&(t=formatValue(t)),D[e]=t}),D}function formatValue(e){if("string"==typeof e&&(!(e.length>=2)||"'"!==e[0]||"'"!==e[e.length-1]))return`'${e}'`;return e}__webpack_require__.d(__webpack_exports__,{g:()=>evaluatePostSubmissionExpression})},80952(e,n,D){e=D.nmd(e),function(){var e="ace",n=function(){return this}();if(!n&&"u">typeof window&&(n=window),e||"u"<typeof requirejs){var D=function(e,n,t){"string"!=typeof e?D.original?D.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(t=n),D.modules[e]||(D.payloads[e]=t,D.modules[e]=null))};D.modules={},D.payloads={};var t=function(e,n,D){if("string"==typeof n){var t=r(e,n);if(void 0!=t)return D&&D(),t}else if("[object Array]"===Object.prototype.toString.call(n)){for(var i=[],o=0,g=n.length;o<g;++o){var s=r(e,n[o]);if(void 0==s&&S.original)return;i.push(s)}return D&&D.apply(null,i)||!0}},S=function(e,n){var D=t("",e,n);return void 0==D&&S.original?S.original.apply(this,arguments):D},i=function(e,n){if(-1!==n.indexOf("!")){var D=n.split("!");return i(e,D[0])+"!"+i(e,D[1])}if("."==n.charAt(0))for(n=e.split("/").slice(0,-1).join("/")+"/"+n;-1!==n.indexOf(".")&&t!=n;){var t=n;n=n.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return n},r=function(e,n){n=i(e,n);var S=D.modules[n];if(!S){if("function"==typeof(S=D.payloads[n])){var r={},o={id:n,uri:"",exports:r,packaged:!0};r=S(function(e,D){return t(n,e,D)},r,o)||o.exports,D.modules[n]=r,delete D.payloads[n]}S=D.modules[n]=r||S}return S};o(e)}function o(e){var t=n;e&&(n[e]||(n[e]={}),t=n[e]),t.define&&t.define.packaged||(D.original=t.define,t.define=D,t.define.packaged=!0),t.require&&t.require.packaged||(S.original=t.require,t.require=S,t.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,n,D){function t(e,n,D){Object.defineProperty(e,n,{value:D,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||t(String.prototype,"startsWith",function(e,n){return n=n||0,this.lastIndexOf(e,n)===n}),String.prototype.endsWith||t(String.prototype,"endsWith",function(e,n){var D=this;(void 0===n||n>D.length)&&(n=D.length),n-=e.length;var t=D.indexOf(e,n);return -1!==t&&t===n}),String.prototype.repeat||t(String.prototype,"repeat",function(e){for(var n="",D=this;e>0;)1&e&&(n+=D),(e>>=1)&&(D+=D);return n}),String.prototype.includes||t(String.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Object.assign||(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");for(var n=Object(e),D=1;D<arguments.length;D++){var t=arguments[D];null!=t&&Object.keys(t).forEach(function(e){n[e]=t[e]})}return n}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(n){return e[n]})}),Array.prototype.find||t(Array.prototype,"find",function(e){for(var n=this.length,D=arguments[1],t=0;t<n;t++){var S=this[t];if(e.call(D,S,t,this))return S}}),Array.prototype.findIndex||t(Array.prototype,"findIndex",function(e){for(var n=this.length,D=arguments[1],t=0;t<n;t++){var S=this[t];if(e.call(D,S,t,this))return t}}),Array.prototype.includes||t(Array.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Array.prototype.fill||t(Array.prototype,"fill",function(e){for(var n=this,D=n.length>>>0,t=arguments[1],S=0|t,i=S<0?Math.max(D+S,0):Math.min(S,D),r=arguments[2],o=void 0===r?D:0|r,g=o<0?Math.max(D+o,0):Math.min(o,D);i<g;)n[i]=e,i++;return n}),Array.of||t(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,n,D){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,n,D){n.deepCopy=function e(n){if("object"!=typeof n||!n)return n;if(Array.isArray(n)){D=[];for(var D,t=0;t<n.length;t++)D[t]=e(n[t]);return D}if("[object Object]"!==Object.prototype.toString.call(n))return n;for(var t in D={},n)D[t]=e(n[t]);return D}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,n,D){"use strict";n.last=function(e){return e[e.length-1]},n.stringReverse=function(e){return e.split("").reverse().join("")},n.stringRepeat=function(e,n){for(var D="";n>0;)1&n&&(D+=e),(n>>=1)&&(e+=e);return D};var t=/^\s\s*/,S=/\s\s*$/;n.stringTrimLeft=function(e){return e.replace(t,"")},n.stringTrimRight=function(e){return e.replace(S,"")},n.copyObject=function(e){var n={};for(var D in e)n[D]=e[D];return n},n.copyArray=function(e){for(var n=[],D=0,t=e.length;D<t;D++)e[D]&&"object"==typeof e[D]?n[D]=this.copyObject(e[D]):n[D]=e[D];return n},n.deepCopy=e("./deep_copy").deepCopy,n.arrayToMap=function(e){for(var n={},D=0;D<e.length;D++)n[e[D]]=1;return n},n.createMap=function(e){var n=Object.create(null);for(var D in e)n[D]=e[D];return n},n.arrayRemove=function(e,n){for(var D=0;D<=e.length;D++)n===e[D]&&e.splice(D,1)},n.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},n.escapeHTML=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},n.getMatchOffsets=function(e,n){var D=[];return e.replace(n,function(e){D.push({offset:arguments[arguments.length-2],length:e.length})}),D},n.deferredCall=function(e){var n=null,D=function(){n=null,e()},t=function(e){return t.cancel(),n=setTimeout(D,e||0),t};return t.schedule=t,t.call=function(){return this.cancel(),e(),t},t.cancel=function(){return clearTimeout(n),n=null,t},t.isPending=function(){return n},t},n.delayedCall=function(e,n){var D=null,t=function(){D=null,e()},S=function(e){null==D&&(D=setTimeout(t,e||n))};return S.delay=function(e){D&&clearTimeout(D),D=setTimeout(t,e||n)},S.schedule=S,S.call=function(){this.cancel(),e()},S.cancel=function(){D&&clearTimeout(D),D=null},S.isPending=function(){return D},S},n.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},n.skipEmptyMatch=function(e,n,D){return D&&e.codePointAt(n)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,n,D){"use strict";n.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},n.getOS=function(){return n.isMac?n.OS.MAC:n.isLinux?n.OS.LINUX:n.OS.WINDOWS};var t="object"==typeof navigator?navigator:{},S=(/mac|win|linux/i.exec(t.platform)||["other"])[0].toLowerCase(),i=t.userAgent||"",r=t.appName||"";n.isWin="win"==S,n.isMac="mac"==S,n.isLinux="linux"==S,n.isIE="Microsoft Internet Explorer"==r||r.indexOf("MSAppHost")>=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),n.isOldIE=n.isIE&&n.isIE<9,n.isGecko=n.isMozilla=i.match(/ Gecko\/\d+/),n.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),n.isWebKit=parseFloat(i.split("WebKit/")[1])||void 0,n.isChrome=parseFloat(i.split(" Chrome/")[1])||void 0,n.isSafari=parseFloat(i.split(" Safari/")[1])&&!n.isChrome||void 0,n.isEdge=parseFloat(i.split(" Edge/")[1])||void 0,n.isAIR=i.indexOf("AdobeAIR")>=0,n.isAndroid=i.indexOf("Android")>=0,n.isChromeOS=i.indexOf(" CrOS ")>=0,n.isIOS=/iPad|iPhone|iPod/.test(i)&&!window.MSStream,n.isIOS&&(n.isMac=!0),n.isMobile=n.isIOS||n.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,n,D){"use strict";var t,S=e("./useragent"),i="http://www.w3.org/1999/xhtml";n.buildDom=function e(n,D,t){if("string"==typeof n&&n){var S=document.createTextNode(n);return D&&D.appendChild(S),S}if(!Array.isArray(n))return n&&n.appendChild&&D&&D.appendChild(n),n;if("string"!=typeof n[0]||!n[0]){for(var i=[],r=0;r<n.length;r++){var o=e(n[r],D,t);o&&i.push(o)}return i}var g=document.createElement(n[0]),s=n[1],a=1;s&&"object"==typeof s&&!Array.isArray(s)&&(a=2);for(var r=a;r<n.length;r++)e(n[r],g,t);return 2==a&&Object.keys(s).forEach(function(e){var n=s[e];"class"===e?g.className=Array.isArray(n)?n.join(" "):n:"function"==typeof n||"value"==e||"$"==e[0]?g[e]=n:"ref"===e?t&&(t[n]=g):"style"===e?"string"==typeof n&&(g.style.cssText=n):null!=n&&g.setAttribute(e,n)}),D&&D.appendChild(g),g},n.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},n.createElement=function(e,n){return document.createElementNS?document.createElementNS(n||i,e):document.createElement(e)},n.removeChildren=function(e){e.innerHTML=""},n.createTextNode=function(e,n){return(n?n.ownerDocument:document).createTextNode(e)},n.createFragment=function(e){return(e?e.ownerDocument:document).createDocumentFragment()},n.hasCssClass=function(e,n){return -1!==(e.className+"").split(/\s+/g).indexOf(n)},n.addCssClass=function(e,D){n.hasCssClass(e,D)||(e.className+=" "+D)},n.removeCssClass=function(e,n){for(var D=e.className.split(/\s+/g);;){var t=D.indexOf(n);if(-1==t)break;D.splice(t,1)}e.className=D.join(" ")},n.toggleCssClass=function(e,n){for(var D=e.className.split(/\s+/g),t=!0;;){var S=D.indexOf(n);if(-1==S)break;t=!1,D.splice(S,1)}return t&&D.push(n),e.className=D.join(" "),t},n.setCssClass=function(e,D,t){t?n.addCssClass(e,D):n.removeCssClass(e,D)},n.hasCssString=function(e,n){var D,t=0;if(D=(n=n||document).querySelectorAll("style")){for(;t<D.length;)if(D[t++].id===e)return!0}},n.removeElementById=function(e,n){(n=n||document).getElementById(e)&&n.getElementById(e).remove()};var r=[];function o(){var e=r;r=null,e&&e.forEach(function(e){g(e[0],e[1])})}function g(e,D,S){if(!("u"<typeof document)){if(r){if(S)o();else if(!1===S)return r.push([e,D])}if(!t){var i=S;S&&S.getRootNode&&(i=S.getRootNode())&&i!=S||(i=document);var g=i.ownerDocument||i;if(D&&n.hasCssString(D,i))return null;D&&(e+="\n/*# sourceURL=ace/css/"+D+" */");var s=n.createElement("style");s.appendChild(g.createTextNode(e)),D&&(s.id=D),i==g&&(i=n.getDocumentHead(g)),i.insertBefore(s,i.firstChild)}}}if(n.useStrictCSP=function(e){t=e,!1==e?o():r||(r=[])},n.importCssString=g,n.importCssStylsheet=function(e,D){n.buildDom(["link",{rel:"stylesheet",href:e}],n.getDocumentHead(D))},n.scrollbarWidth=function(e){var D=n.createElement("ace_inner");D.style.width="100%",D.style.minWidth="0px",D.style.height="200px",D.style.display="block";var t=n.createElement("ace_outer"),S=t.style;S.position="absolute",S.left="-10000px",S.overflow="hidden",S.width="200px",S.minWidth="0px",S.height="150px",S.display="block",t.appendChild(D);var i=e&&e.documentElement||document&&document.documentElement;if(!i)return 0;i.appendChild(t);var r=D.offsetWidth;S.overflow="scroll";var o=D.offsetWidth;return r===o&&(o=t.clientWidth),i.removeChild(t),r-o},n.computedStyle=function(e,n){return window.getComputedStyle(e,"")||{}},n.setStyle=function(e,n,D){e[n]!==D&&(e[n]=D)},n.HAS_CSS_ANIMATION=!1,n.HAS_CSS_TRANSFORMS=!1,n.HI_DPI=!S.isWin||"u">typeof window&&window.devicePixelRatio>=1.5,S.isChromeOS&&(n.HI_DPI=!1),"u">typeof document){var s=document.createElement("div");n.HI_DPI&&void 0!==s.style.transform&&(n.HAS_CSS_TRANSFORMS=!0),S.isEdge||void 0===s.style.animationName||(n.HAS_CSS_ANIMATION=!0),s=null}n.HAS_CSS_TRANSFORMS?n.translate=function(e,n,D){e.style.transform="translate("+Math.round(n)+"px, "+Math.round(D)+"px)"}:n.translate=function(e,n,D){e.style.top=Math.round(D)+"px",e.style.left=Math.round(n)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./dom");n.get=function(e,n){var D=new XMLHttpRequest;D.open("GET",e,!0),D.onreadystatechange=function(){4===D.readyState&&n(D.responseText)},D.send(null)},n.loadScript=function(e,n){var D=t.getDocumentHead(),S=document.createElement("script");S.src=e,D.appendChild(S),S.onload=S.onreadystatechange=function(e,D){(D||!S.readyState||"loaded"==S.readyState||"complete"==S.readyState)&&(S=S.onload=S.onreadystatechange=null,D||n())}},n.qualifyURL=function(e){var n=document.createElement("a");return n.href=e,n.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,n,D){"use strict";n.inherits=function(e,n){e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(e,n){for(var D in n)e[D]=n[D];return e},n.implement=function(e,D){n.mixin(e,D)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,n,D){"use strict";var t={},S=function(){this.propagationStopped=!0},i=function(){this.defaultPrevented=!0};t._emit=t._dispatchEvent=function(e,n){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var D=this._eventRegistry[e]||[],t=this._defaultHandlers[e];if(D.length||t){"object"==typeof n&&n||(n={}),n.type||(n.type=e),n.stopPropagation||(n.stopPropagation=S),n.preventDefault||(n.preventDefault=i),D=D.slice();for(var r=0;r<D.length&&(D[r](n,this),!n.propagationStopped);r++);if(t&&!n.defaultPrevented)return t(n,this)}},t._signal=function(e,n){var D=(this._eventRegistry||{})[e];if(D){D=D.slice();for(var t=0;t<D.length;t++)D[t](n,this)}},t.once=function(e,n){var D=this;if(this.on(e,function t(){D.off(e,t),n.apply(null,arguments)}),!n)return new Promise(function(e){n=e})},t.setDefaultHandler=function(e,n){var D=this._defaultHandlers;if(D||(D=this._defaultHandlers={_disabled_:{}}),D[e]){var t=D[e],S=D._disabled_[e];S||(D._disabled_[e]=S=[]),S.push(t);var i=S.indexOf(n);-1!=i&&S.splice(i,1)}D[e]=n},t.removeDefaultHandler=function(e,n){var D=this._defaultHandlers;if(D){var t=D._disabled_[e];if(D[e]==n)t&&this.setDefaultHandler(e,t.pop());else if(t){var S=t.indexOf(n);-1!=S&&t.splice(S,1)}}},t.on=t.addEventListener=function(e,n,D){this._eventRegistry=this._eventRegistry||{};var t=this._eventRegistry[e];return t||(t=this._eventRegistry[e]=[]),-1==t.indexOf(n)&&t[D?"unshift":"push"](n),n},t.off=t.removeListener=t.removeEventListener=function(e,n){this._eventRegistry=this._eventRegistry||{};var D=this._eventRegistry[e];if(D){var t=D.indexOf(n);-1!==t&&D.splice(t,1)}},t.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},n.EventEmitter=t}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,n,D){n.reportError=function(e,n){var D=Error(e);D.data=n,"object"==typeof console&&console.error&&console.error(D),setTimeout(function(){throw D})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,n,D){n.defaultEnglishMessages={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions"}}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(e,n,D){var t,S,i=e("./oop"),r=e("./event_emitter").EventEmitter,o=e("./report_error").reportError,g=e("./default_english_messages").defaultEnglishMessages,s={setOptions:function(e){Object.keys(e).forEach(function(n){this.setOption(n,e[n])},this)},getOptions:function(e){var n={};if(e)Array.isArray(e)||(e=Object.keys(n=e));else{var D=this.$options;e=Object.keys(D).filter(function(e){return!D[e].hidden})}return e.forEach(function(e){n[e]=this.getOption(e)},this),n},setOption:function(e,n){if(this["$"+e]!==n){var D=this.$options[e];if(!D)return a('misspelled option "'+e+'"');if(D.forwardTo)return this[D.forwardTo]&&this[D.forwardTo].setOption(e,n);D.handlesSet||(this["$"+e]=n),D&&D.set&&D.set.call(this,n)}},getOption:function(e){var n=this.$options[e];return n?n.forwardTo?this[n.forwardTo]&&this[n.forwardTo].getOption(e):n&&n.get?n.get.call(this):this["$"+e]:a('misspelled option "'+e+'"')}};function a(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var l=function(){function e(){this.$defaultOptions={},t=g,S="dollarSigns"}return e.prototype.defineOptions=function(e,n,D){return e.$options||(this.$defaultOptions[n]=e.$options={}),Object.keys(D).forEach(function(n){var t=D[n];"string"==typeof t&&(t={forwardTo:t}),t.name||(t.name=n),e.$options[t.name]=t,"initialValue"in t&&(e["$"+t.name]=t.initialValue)}),i.implement(e,s),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(n){var D=e.$options[n];"value"in D&&e.setOption(n,D.value)})},e.prototype.setDefaultValue=function(e,n,D){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][n])break;if(!this.$defaultOptions[e][n])return!1}var t=this.$defaultOptions[e]||(this.$defaultOptions[e]={});t[n]&&(t.forwardTo?this.setDefaultValue(t.forwardTo,n,D):t[n].value=D)},e.prototype.setDefaultValues=function(e,n){Object.keys(n).forEach(function(D){this.setDefaultValue(e,D,n[D])},this)},e.prototype.setMessages=function(e,n){t=e,n&&n.placeholders&&(S=n.placeholders)},e.prototype.nls=function(e,n,D){!t[e]&&(a("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+n+"'."),t[n]||a("No message found for the default string '"+n+"' in the provided messages. Falling back to the default English message."));var i=t[e]||t[n]||n;return D&&("dollarSigns"===S&&(i=i.replace(/\$(\$|[\d]+)/g,function(e,n){return"$"==n?"$":D[n]})),"curlyBrackets"===S&&(i=i.replace(/\{([^\}]+)\}/g,function(e,n){return D[n]}))),i},e}();l.prototype.warn=a,l.prototype.reportError=o,i.implement(l.prototype,r),n.AppConfig=l}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,n,D){D.exports='.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print-margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm {\n background-color: #FFFFFF;\n color: black;\n}\n\n.ace-tm .ace_cursor {\n color: black;\n}\n \n.ace-tm .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(e,n,D){"use strict";n.isDark=!1,n.cssClass="ace-tm",n.cssText=e("./textmate-css"),n.$id="ace/theme/textmate",e("../lib/dom").importCssString(n.cssText,n.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(e,n,D){var t,S=e("./lib/lang"),i=e("./lib/net"),r=e("./lib/dom");D.exports=n=new(e("./lib/app_config")).AppConfig;var o={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};n.get=function(e){if(!o.hasOwnProperty(e))throw Error("Unknown config key: "+e);return o[e]},n.set=function(e,n){if(o.hasOwnProperty(e))o[e]=n;else if(!1==this.setDefaultValue("",e,n))throw Error("Unknown config key: "+e);"useStrictCSP"==e&&r.useStrictCSP(n)},n.all=function(){return S.copyObject(o)},n.$modes={},n.moduleUrl=function(e,n){if(o.$moduleUrls[e])return o.$moduleUrls[e];var D=e.split("/"),t="snippets"==(n=n||D[D.length-2]||"")?"/":"-",S=D[D.length-1];if("worker"==n&&"-"==t){var i=RegExp("^"+n+"[\\-_]|[\\-_]"+n+"$","g");S=S.replace(i,"")}(!S||S==n)&&D.length>1&&(S=D[D.length-2]);var r=o[n+"Path"];return null==r?r=o.basePath:"/"==t&&(n=t=""),r&&"/"!=r.slice(-1)&&(r+="/"),r+n+t+S+this.get("suffix")},n.setModuleUrl=function(e,n){return o.$moduleUrls[e]=n};var g=function(n,D){return"ace/theme/textmate"===n||"./theme/textmate"===n?D(null,e("./theme/textmate")):t?t(n,D):void console.error("loader is not configured")};n.setLoader=function(e){t=e},n.dynamicModules=Object.create(null),n.$loading={},n.$loaded={},n.loadModule=function(e,D){if(Array.isArray(e))var t,S=e[0],r=e[1];else if("string"==typeof e)var r=e;var o=function(e){if(e&&!n.$loading[r])return D&&D(e);if(n.$loading[r]||(n.$loading[r]=[]),n.$loading[r].push(D),!(n.$loading[r].length>1)){var t=function(){g(r,function(e,D){D&&(n.$loaded[r]=D),n._emit("load.module",{name:r,module:D});var t=n.$loading[r];n.$loading[r]=null,t.forEach(function(e){e&&e(D)})})};if(!n.get("packaged"))return t();i.loadScript(n.moduleUrl(r,S),t),s()}};if(n.dynamicModules[r])n.dynamicModules[r]().then(function(e){e.default?o(e.default):o(e)});else{try{t=this.$require(r)}catch(e){}o(t||n.$loaded[r])}},n.$require=function(e){if("function"==typeof D.require)return D.require(e)},n.setModuleLoader=function(e,D){n.dynamicModules[e]=D};var s=function(){o.basePath||o.workerPath||o.modePath||o.themePath||Object.keys(o.$moduleUrls).length||(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),s=function(){})};n.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,n,D){"use strict";e("./lib/fixoldbrowsers");var t=e("./config");t.setLoader(function(n,D){e([n],function(e){D(null,e)})});var S=function(){return this||"u">typeof window&&window}();function i(n){if(S&&S.document){t.set("packaged",n||e.packaged||D.packaged||S.define&&define.packaged);var i={},o="",g=document.currentScript||document._currentScript,s=g&&g.ownerDocument||document;g&&g.src&&(o=g.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=s.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l],u=c.src||c.getAttribute("src");if(u){for(var h=c.attributes,d=0,p=h.length;d<p;d++){var f=h[d];0===f.name.indexOf("data-ace-")&&(i[r(f.name.replace(/^data-ace-/,""))]=f.value)}var m=u.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);m&&(o=m[1])}}for(var y in o&&(i.base=i.base||o,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base,i)void 0!==i[y]&&t.set(y,i[y])}}function r(e){return e.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}D.exports=function(n){t.init=i,t.$require=e,n.require=e,"function"==typeof define&&(n.define=define)},i(!0)}),ace.define("ace/range",["require","exports","module"],function(e,n,D){"use strict";var t=function(){function e(e,n,D,t){this.start={row:e,column:n},this.end={row:D,column:t}}return e.prototype.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},e.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},e.prototype.contains=function(e,n){return 0==this.compare(e,n)},e.prototype.compareRange=function(e){var n,D=e.end,t=e.start;return 1==(n=this.compare(D.row,D.column))?1==(n=this.compare(t.row,t.column))?2:+(0==n):-1==n?-2:-1==(n=this.compare(t.row,t.column))?-1:42*(1==n)},e.prototype.comparePoint=function(e){return this.compare(e.row,e.column)},e.prototype.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},e.prototype.intersects=function(e){var n=this.compareRange(e);return -1==n||0==n||1==n},e.prototype.isEnd=function(e,n){return this.end.row==e&&this.end.column==n},e.prototype.isStart=function(e,n){return this.start.row==e&&this.start.column==n},e.prototype.setStart=function(e,n){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=n)},e.prototype.setEnd=function(e,n){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=n)},e.prototype.inside=function(e,n){if(0==this.compare(e,n)&&!(this.isEnd(e,n)||this.isStart(e,n)))return!0;return!1},e.prototype.insideStart=function(e,n){if(0==this.compare(e,n)&&!this.isEnd(e,n))return!0;return!1},e.prototype.insideEnd=function(e,n){if(0==this.compare(e,n)&&!this.isStart(e,n))return!0;return!1},e.prototype.compare=function(e,n){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?n>=this.start.column?0:-1:this.end.row===e?n<=this.end.column?0:1:0:n<this.start.column?-1:+(n>this.end.column)},e.prototype.compareStart=function(e,n){return this.start.row==e&&this.start.column==n?-1:this.compare(e,n)},e.prototype.compareEnd=function(e,n){return this.end.row==e&&this.end.column==n?1:this.compare(e,n)},e.prototype.compareInside=function(e,n){return this.end.row==e&&this.end.column==n?1:this.start.row==e&&this.start.column==n?-1:this.compare(e,n)},e.prototype.clipRows=function(n,D){if(this.end.row>D)var t={row:D+1,column:0};else if(this.end.row<n)var t={row:n,column:0};if(this.start.row>D)var S={row:D+1,column:0};else if(this.start.row<n)var S={row:n,column:0};return e.fromPoints(S||this.start,t||this.end)},e.prototype.extend=function(n,D){var t=this.compare(n,D);if(0==t)return this;if(-1==t)var S={row:n,column:D};else var i={row:n,column:D};return e.fromPoints(S||this.start,i||this.end)},e.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},e.prototype.isMultiLine=function(){return this.start.row!==this.end.row},e.prototype.clone=function(){return e.fromPoints(this.start,this.end)},e.prototype.collapseRows=function(){return 0==this.end.column?new e(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new e(this.start.row,0,this.end.row,0)},e.prototype.toScreenRange=function(n){var D=n.documentToScreenPosition(this.start),t=n.documentToScreenPosition(this.end);return new e(D.row,D.column,t.row,t.column)},e.prototype.moveBy=function(e,n){this.start.row+=e,this.start.column+=n,this.end.row+=e,this.end.column+=n},e}();t.fromPoints=function(e,n){return new t(e.row,e.column,n.row,n.column)},t.comparePoints=function(e,n){return e.row-n.row||e.column-n.column},n.Range=t}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,n,D){"use strict";for(var t=e("./oop"),S={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},i={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},r=0;r<10;r++)i["Digit"+r]=48+r,i["Numpad"+r]=96+r,S.PRINTABLE_KEYS[48+r]=""+r,S.FUNCTION_KEYS[96+r]="Numpad"+r;for(var r=65;r<91;r++){var o=String.fromCharCode(r+32);i["Key"+o.toUpperCase()]=r,S.PRINTABLE_KEYS[r]=o}for(var r=1;r<13;r++)i["F"+r]=111+r,S.FUNCTION_KEYS[111+r]="F"+r;var g={Shift:16,Control:17,Alt:18,Meta:224};for(var s in g)i[s]=i[s+"Left"]=i[s+"Right"]=g[s];for(var a in n.$codeToKeyCode=i,S.PRINTABLE_KEYS[173]="-",S.FUNCTION_KEYS){var l=S.FUNCTION_KEYS[a].toLowerCase();S[l]=parseInt(a,10)}for(var a in S.PRINTABLE_KEYS){var l=S.PRINTABLE_KEYS[a].toLowerCase();S[l]=parseInt(a,10)}t.mixin(S,S.MODIFIER_KEYS),t.mixin(S,S.PRINTABLE_KEYS),t.mixin(S,S.FUNCTION_KEYS),S.enter=S.return,S.escape=S.esc,S.del=S.delete,function(){for(var e=["cmd","ctrl","alt","shift"],n=Math.pow(2,e.length);n--;)S.KEY_MODS[n]=e.filter(function(e){return n&S.KEY_MODS[e]}).join("-")+"-"}(),S.KEY_MODS[0]="",S.KEY_MODS[-1]="input-",t.mixin(n,S),n.default=n,n.keyCodeToString=function(e){var n=S[e];return"string"!=typeof n&&(n=String.fromCharCode(e)),n.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,n,D){"use strict";var t,S=e("./keys"),i=e("./useragent"),r=null,o=0;function g(){t=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return t={passive:!1},!0}})}catch(e){}}function s(){return void 0==t&&g(),t}function a(e,n,D){this.elem=e,this.type=n,this.callback=D}a.prototype.destroy=function(){c(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var l=n.addListener=function(e,n,D,t){e.addEventListener(n,D,s()),t&&t.$toDestroy.push(new a(e,n,D))},c=n.removeListener=function(e,n,D){e.removeEventListener(n,D,s())};function u(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function h(e,n,D){var t=u(n);if(!D&&n.code&&(D=S.$codeToKeyCode[n.code]||D),!i.isMac&&r){if(n.getModifierState&&(n.getModifierState("OS")||n.getModifierState("Win"))&&(t|=8),r.altGr)if((3&t)==3)return;else r.altGr=0;if(18===D||17===D){var g=n.location;17===D&&1===g?1==r[D]&&(o=n.timeStamp):18===D&&3===t&&2===g&&n.timeStamp-o<50&&(r.altGr=!0)}}if(D in S.MODIFIER_KEYS&&(D=-1),t||13!==D||3!==n.location||(e(n,t,-D),!n.defaultPrevented)){if(i.isChromeOS&&8&t){if(e(n,t,D),n.defaultPrevented)return;t&=-9}return(!!t||D in S.FUNCTION_KEYS||D in S.PRINTABLE_KEYS)&&e(n,t,D)}}function d(){r=Object.create(null)}if(n.stopEvent=function(e){return n.stopPropagation(e),n.preventDefault(e),!1},n.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},n.preventDefault=function(e){e.preventDefault&&e.preventDefault()},n.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},n.capture=function(e,n,D){var t=e&&e.ownerDocument||document;function S(e){n&&n(e),D&&D(e),c(t,"mousemove",n),c(t,"mouseup",S),c(t,"dragstart",S)}return l(t,"mousemove",n),l(t,"mouseup",S),l(t,"dragstart",S),S},n.addMouseWheelListener=function(e,n,D){l(e,"wheel",function(e){var D=.15,t=e.deltaX||0,S=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=t*D,e.wheelY=S*D;break;case e.DOM_DELTA_LINE:var i=15;e.wheelX=15*t,e.wheelY=S*i;break;case e.DOM_DELTA_PAGE:var r=150;e.wheelX=150*t,e.wheelY=S*r}n(e)},D)},n.addMultiMouseDownListener=function(e,D,t,S,r){var o,g,s,a=0,c={2:"dblclick",3:"tripleclick",4:"quadclick"};function u(e){if(0!==n.getButton(e)?a=0:e.detail>1?++a>4&&(a=1):a=1,i.isIE){var r=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-g)>5;(!s||r)&&(a=1),s&&clearTimeout(s),s=setTimeout(function(){s=null},D[a-1]||600),1==a&&(o=e.clientX,g=e.clientY)}if(e._clicks=a,t[S]("mousedown",e),a>4)a=0;else if(a>1)return t[S](c[a],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){l(e,"mousedown",u,r)})},n.getModifierString=function(e){return S.KEY_MODS[u(e)]},n.addCommandKeyListener=function(e,D,t){var S=null;l(e,"keydown",function(e){r[e.keyCode]=(r[e.keyCode]||0)+1;var n=h(D,e,e.keyCode);return S=e.defaultPrevented,n},t),l(e,"keypress",function(e){S&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(n.stopEvent(e),S=null)},t),l(e,"keyup",function(e){r[e.keyCode]=null},t),r||(d(),l(window,"focus",d))},"object"==typeof window&&window.postMessage&&!i.isOldIE){var p=1;n.nextTick=function(e,D){D=D||window;var t="zero-timeout-message-"+p++,S=function(i){i.data==t&&(n.stopPropagation(i),c(D,"message",S),e())};l(D,"message",S),D.postMessage(t,"*")}}n.$idleBlocked=!1,n.onIdle=function(e,D){return setTimeout(function D(){n.$idleBlocked?setTimeout(D,100):e()},D)},n.$idleBlockId=null,n.blockIdle=function(e){n.$idleBlockId&&clearTimeout(n.$idleBlockId),n.$idleBlocked=!0,n.$idleBlockId=setTimeout(function(){n.$idleBlocked=!1},e||100)},n.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),n.nextFrame?n.nextFrame=n.nextFrame.bind(window):n.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(e,n,D){"use strict";var t;D.exports={lineMode:!1,pasteCancelled:function(){return!!(t&&t>Date.now()-50)||(t=!1)},cancel:function(){t=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../config").nls,i=e("../lib/useragent"),r=e("../lib/dom"),o=e("../lib/lang"),g=e("../clipboard"),s=i.isChrome<18,a=i.isIE,l=i.isChrome>63,c=400,u=e("../lib/keys"),h=u.KEY_MODS,d=i.isIOS,p=d?/\s/:/\n/,f=i.isMobile;n.TextInput=function(e,n){var D,m=r.createElement("textarea");m.className="ace_text-input",m.setAttribute("wrap","off"),m.setAttribute("autocorrect","off"),m.setAttribute("autocapitalize","off"),m.setAttribute("spellcheck","false"),m.style.opacity="0",e.insertBefore(m,e.firstChild);var y=!1,v=!1,b=!1,w=!1,M="";f||(m.style.fontSize="1px");var L=!1,$=!1,_="",x=0,C=0,E=0,k=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER,T=0;try{var O=document.activeElement===m}catch(e){}this.setNumberOfExtraLines=function(e){if(k=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER,e<0){T=0;return}T=e},this.setAriaOptions=function(e){if(e.activeDescendant?(m.setAttribute("aria-haspopup","true"),m.setAttribute("aria-autocomplete",e.inline?"both":"list"),m.setAttribute("aria-activedescendant",e.activeDescendant)):(m.setAttribute("aria-haspopup","false"),m.setAttribute("aria-autocomplete","both"),m.removeAttribute("aria-activedescendant")),e.role&&m.setAttribute("role",e.role),e.setLabel){m.setAttribute("aria-roledescription",S("text-input.aria-roledescription","editor"));var D="";n.$textInputAriaLabel&&(D+="".concat(n.$textInputAriaLabel,", ")),n.session&&(D+=S("text-input.aria-label","Cursor at row $0",[n.session.selection.cursor.row+1])),m.setAttribute("aria-label",D)}},this.setAriaOptions({role:"textbox"}),t.addListener(m,"blur",function(e){$||(n.onBlur(e),O=!1)},n),t.addListener(m,"focus",function(e){if(!$){if(O=!0,i.isEdge)try{if(!document.hasFocus())return}catch(e){}n.onFocus(e),i.isEdge?setTimeout(I):I()}},n),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:n.renderer.enableKeyboardAccessibility}),M||l||"browser"==this.$focusScroll)return m.focus({preventScroll:!0});var e=m.style.top;m.style.position="fixed",m.style.top="0px";try{var D=0!=m.getBoundingClientRect().top}catch(e){return}var t=[];if(D)for(var S=m.parentElement;S&&1==S.nodeType;)t.push(S),S.setAttribute("ace_nocontext","true"),S=!S.parentElement&&S.getRootNode?S.getRootNode().host:S.parentElement;m.focus({preventScroll:!0}),D&&t.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){m.style.position="","0px"==m.style.top&&(m.style.top=e)},0)},this.blur=function(){m.blur()},this.isFocused=function(){return O},n.on("beforeEndOperation",function(){var e=n.curOp,D=e&&e.command&&e.command.name;if("insertstring"!=D){var t=D&&(e.docChanged||e.selectionChanged);b&&t&&(_=m.value="",Y()),I()}});var R=function(e,D){for(var t=D,S=1;S<=e-k&&S<2*T+1;S++)t+=n.session.getLine(e-S).length+1;return t},I=d?function(e){if(O&&(!y||e)&&!w){e||(e="");var D="\n ab"+e+"cde fg\n";D!=m.value&&(m.value=_=D);var t=4,S=4+(e.length||+!n.selection.isEmpty());(x!=t||C!=S)&&m.setSelectionRange(t,S),x=t,C=S}}:function(){if(!b&&!w&&(O||F)){b=!0;var e=0,D=0,t="";if(n.session){var S=n.selection,i=S.getRange(),r=S.cursor.row;r===A+1?A=(k=A+1)+2*T:r===k-1?k=(A=k-1)-2*T:(r<k-1||r>A+1)&&(k=r>T?r-T:0,A=r>T?r+T:2*T);for(var o=[],g=k;g<=A;g++)o.push(n.session.getLine(g));if(t=o.join("\n"),e=R(i.start.row,i.start.column),D=R(i.end.row,i.end.column),i.start.row<k){var s=n.session.getLine(k-1);e=i.start.row<k-1?0:e,D+=s.length+1,t=s+"\n"+t}else if(i.end.row>A){var a=n.session.getLine(A+1);D=(i.end.row>A+1?a.length:i.end.column)+(t.length+1),t=t+"\n"+a}else f&&r>0&&(t="\n"+t,D+=1,e+=1);t.length>c&&(e<c&&D<c?t=t.slice(0,c):(t="\n",e==D?e=D=0:(e=0,D=1)));var l=t+"\n\n";l!=_&&(m.value=_=l,x=C=l.length)}if(F&&(x=m.selectionStart,C=m.selectionEnd),C!=D||x!=e||m.selectionEnd!=C)try{m.setSelectionRange(e,D),x=e,C=D}catch(e){}b=!1}};this.resetSelection=I,O&&n.onFocus();var j=function(e){return 0===e.selectionStart&&e.selectionEnd>=_.length&&e.value===_&&_&&e.selectionEnd!==C},N=function(e){!b&&(y?y=!1:j(m)?(n.selectAll(),I()):f&&m.selectionStart!=x&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,D){if(F&&(F=!1),v)return I(),e&&n.onPaste(e),v=!1,"";for(var t=m.selectionStart,S=m.selectionEnd,r=x,o=_.length-C,g=e,s=e.length-t,a=e.length-S,l=0;r>0&&_[l]==e[l];)l++,r--;for(g=g.slice(l),l=1;o>0&&_.length-l>x-1&&_[_.length-l]==e[e.length-l];)l++,o--;s-=l-1,a-=l-1;var c=g.length-l+1;if(c<0&&(r=-c,c=0),g=g.slice(0,c),!D&&!g&&!s&&!r&&!o&&!a)return"";w=!0;var u=!1;return i.isAndroid&&". "==g&&(g=" ",u=!0),(!g||r||o||s||a)&&!L?n.onTextInput(g,{extendLeft:r,extendRight:o,restoreStart:s,restoreEnd:a}):n.onTextInput(g),w=!1,_=e,x=t,C=S,E=a,u?"\n":g},V=function(e){if(b)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return n.execCommand("undo");if("historyRedo"==e.inputType)return n.execCommand("redo")}var D=m.value,t=U(D,!0);(D.length>c+100||p.test(t)||f&&x<1&&x==C)&&I()},H=function(e,n,D){var t=e.clipboardData||window.clipboardData;if(t&&!s){var S=a||D?"Text":"text/plain";try{if(n)return!1!==t.setData(S,n);return t.getData(S)}catch(e){if(!D)return H(e,n,!0)}}},z=function(e,D){var S=n.getCopyText();if(!S)return t.preventDefault(e);H(e,S)?(d&&(I(S),y=S,setTimeout(function(){y=!1},10)),D?n.onCut():n.onCopy(),t.preventDefault(e)):(y=!0,m.value=S,m.select(),setTimeout(function(){y=!1,I(),D?n.onCut():n.onCopy()}))},W=function(e){z(e,!0)},B=function(e){z(e,!1)},q=function(e){var D=H(e);g.pasteCancelled()||("string"==typeof D?(D&&n.onPaste(D,e),i.isIE&&setTimeout(I),t.preventDefault(e)):(m.value="",v=!0))};t.addCommandKeyListener(m,function(e,D,t){if(!b)return n.onCommandKey(e,D,t)},n),t.addListener(m,"select",N,n),t.addListener(m,"input",V,n),t.addListener(m,"cut",W,n),t.addListener(m,"copy",B,n),t.addListener(m,"paste",q,n),"oncut"in m&&"oncopy"in m&&"onpaste"in m||t.addListener(e,"keydown",function(e){if((!i.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:B(e);break;case 86:q(e);break;case 88:W(e)}},n);var G=function(e){if(!b&&n.onCompositionStart&&!n.$readOnly&&(b={},!L)){e.data&&(b.useTextareaForIME=!1),setTimeout(K,0),n._signal("compositionStart"),n.on("mousedown",Q);var D=n.getSelectionRange();D.end.row=D.start.row,D.end.column=D.start.column,b.markerRange=D,b.selectionStart=x,n.onCompositionStart(b),b.useTextareaForIME?(_=m.value="",x=0,C=0):(m.msGetInputContext&&(b.context=m.msGetInputContext()),m.getInputContext&&(b.context=m.getInputContext()))}},K=function(){if(b&&n.onCompositionUpdate&&!n.$readOnly){if(L)return Q();b.useTextareaForIME?n.onCompositionUpdate(m.value):(U(m.value),b.markerRange&&(b.context&&(b.markerRange.start.column=b.selectionStart=b.context.compositionStartOffset),b.markerRange.end.column=b.markerRange.start.column+C-b.selectionStart+E))}},Y=function(e){n.onCompositionEnd&&!n.$readOnly&&(b=!1,n.onCompositionEnd(),n.off("mousedown",Q),e&&V())};function Q(){$=!0,m.blur(),m.focus(),$=!1}var Z=o.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&m.value.length<m.selectionStart&&(b||(_=m.value),x=C=-1,I()),Z()}function X(){clearTimeout(D),D=setTimeout(function(){M&&(m.style.cssText=M,M=""),n.renderer.$isMousePressed=!1,n.renderer.$keepTextAreaAtCursor&&n.renderer.$moveTextAreaToCursor()},0)}t.addListener(m,"compositionstart",G,n),t.addListener(m,"compositionupdate",K,n),t.addListener(m,"keyup",J,n),t.addListener(m,"keydown",Z,n),t.addListener(m,"compositionend",Y,n),this.getElement=function(){return m},this.setCommandMode=function(e){L=e,m.readOnly=!1},this.setReadOnly=function(e){L||(m.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){F=!0,I(),n._emit("nativecontextmenu",{target:n,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,S){M||(M=m.style.cssText),m.style.cssText=(S?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+C)*n.renderer.characterWidth*.5+"px;";var o=n.container.getBoundingClientRect(),g=r.computedStyle(n.container),s=o.top+(parseInt(g.borderTopWidth)||0),a=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-s-m.clientHeight-2,c=function(e){r.translate(m,e.clientX-a-2,Math.min(e.clientY-s-2,l))};c(e),"mousedown"==e.type&&(n.renderer.$isMousePressed=!0,clearTimeout(D),i.isWin&&t.capture(n.container,c,X))},this.onContextMenuClose=X;var ee=function(e){n.textInput.onContextMenu(e),X()};function en(e,n,D){var t=null,S=!1;D.addEventListener("keydown",function(e){t&&clearTimeout(t),S=!0},!0),D.addEventListener("keyup",function(e){t=setTimeout(function(){S=!1},100)},!0);var i=function(e){if(document.activeElement===D&&!S&&!b&&!n.$mouseHandler.isMousePressed&&!y){var t=D.selectionStart,i=D.selectionEnd,r=null,o=0;if(0==t?r=u.up:1==t?r=u.home:i>C&&"\n"==_[i]?r=u.end:t<x&&" "==_[t-1]?(r=u.left,o=h.option):t<x||t==x&&C!=x&&t==i?r=u.left:i>C&&_.slice(0,i).split("\n").length>2?r=u.down:i>C&&" "==_[i-1]?(r=u.right,o=h.option):(i>C||i==C&&C!=x&&t==i)&&(r=u.right),t!==i&&(o|=h.shift),r){if(!n.onCommandKey({},o,r)&&n.commands){r=u.keyCodeToString(r);var g=n.commands.findKeyCommand(o,r);g&&n.execCommand(g)}x=t,C=i,I("")}}};document.addEventListener("selectionchange",i),n.on("destroy",function(){document.removeEventListener("selectionchange",i)})}t.addListener(m,"mouseup",ee,n),t.addListener(m,"mousedown",function(e){e.preventDefault(),X()},n),t.addListener(n.renderer.scroller,"contextmenu",ee,n),t.addListener(m,"contextmenu",ee,n),d&&en(e,n,m),this.destroy=function(){m.parentElement&&m.parentElement.removeChild(m)}},n.$setUserAgentForTests=function(e,n){f=e,d=n}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/useragent"),S=0,i=550,r=function(){function e(e){e.$clickSelection=null;var n=e.editor;n.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),n.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),n.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),n.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),n.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(n){e[n]=this[n]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}return e.prototype.onMouseDown=function(e){var n=e.inSelection(),D=e.getDocumentPosition();this.mousedownEvent=e;var S=this.editor,i=e.getButton();if(0!==i){(S.getSelectionRange().isEmpty()||1==i)&&S.selection.moveToPosition(D),2==i&&(S.textInput.onContextMenu(e.domEvent),t.isMozilla||e.preventDefault());return}if(this.mousedownEvent.time=Date.now(),n&&!S.isFocused()&&(S.focus(),this.$focusTimeout&&!this.$clickSelection&&!S.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(e);return}return this.captureMouse(e),this.startSelect(D,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,n){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var D=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?D.selection.selectToPosition(e):n||D.selection.moveToPosition(e),n||this.select(),D.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,n=this.editor,D=n.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var t=this.$clickSelection.comparePoint(D);if(-1==t)e=this.$clickSelection.end;else if(1==t)e=this.$clickSelection.start;else{var S=g(this.$clickSelection,D);D=S.cursor,e=S.anchor}n.selection.setSelectionAnchor(e.row,e.column)}n.selection.selectToPosition(D),n.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var n,D=this.editor,t=D.renderer.screenToTextCoordinates(this.x,this.y),S=D.selection[e](t.row,t.column);if(this.$clickSelection){var i=this.$clickSelection.comparePoint(S.start),r=this.$clickSelection.comparePoint(S.end);if(-1==i&&r<=0)n=this.$clickSelection.end,(S.end.row!=t.row||S.end.column!=t.column)&&(t=S.start);else if(1==r&&i>=0)n=this.$clickSelection.start,(S.start.row!=t.row||S.start.column!=t.column)&&(t=S.end);else if(-1==i&&1==r)t=S.end,n=S.start;else{var o=g(this.$clickSelection,t);t=o.cursor,n=o.anchor}D.selection.setSelectionAnchor(n.row,n.column)}D.selection.selectToPosition(t),D.renderer.scrollCursorIntoView()},e.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},e.prototype.focusWait=function(){var e=o(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),n=Date.now();(e>S||n-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},e.prototype.onDoubleClick=function(e){var n=e.getDocumentPosition(),D=this.editor,t=D.session.getBracketRange(n);t?(t.isEmpty()&&(t.start.column--,t.end.column++),this.setState("select")):(t=D.selection.getWordRange(n.row,n.column),this.setState("selectByWords")),this.$clickSelection=t,this.select()},e.prototype.onTripleClick=function(e){var n=e.getDocumentPosition(),D=this.editor;this.setState("selectByLines");var t=D.getSelectionRange();t.isMultiLine()&&t.contains(n.row,n.column)?(this.$clickSelection=D.selection.getLineRange(t.start.row),this.$clickSelection.end=D.selection.getLineRange(t.end.row).end):this.$clickSelection=D.selection.getLineRange(n.row),this.select()},e.prototype.onQuadClick=function(e){var n=this.editor;n.selectAll(),this.$clickSelection=n.getSelectionRange(),this.setState("selectAll")},e.prototype.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var n=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var D=this.$lastScroll,t=e.domEvent.timeStamp,S=t-D.t,r=S?e.wheelX/S:D.vx,o=S?e.wheelY/S:D.vy;S<i&&(r=(r+D.vx)/2,o=(o+D.vy)/2);var g=Math.abs(r/o),s=!1;if(g>=1&&n.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(s=!0),g<=1&&n.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(s=!0),s?D.allowed=t:t-D.allowed<i&&(Math.abs(r)<=1.5*Math.abs(D.vx)&&Math.abs(o)<=1.5*Math.abs(D.vy)?(s=!0,D.allowed=t):D.allowed=0),D.t=t,D.vx=r,D.vy=o,s)return n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function o(e,n,D,t){return Math.sqrt(Math.pow(D-e,2)+Math.pow(t-n,2))}function g(e,n){if(e.start.row==e.end.row)var D=2*n.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var D=2*n.row-e.start.row-e.end.row;else var D=n.column-4;return D<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}r.prototype.selectEnd=r.prototype.selectByLinesEnd,r.prototype.selectAllEnd=r.prototype.selectByLinesEnd,r.prototype.selectByWordsEnd=r.prototype.selectByLinesEnd,n.DefaultHandlers=r}),ace.define("ace/lib/scroll",["require","exports","module"],function(e,n,D){n.preventParentScroll=function(e){e.stopPropagation();var n=e.currentTarget;n.scrollHeight>n.clientHeight||e.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},i=e("./lib/dom");e("./lib/event");var r=e("./range").Range,o=e("./lib/scroll").preventParentScroll,g="ace_tooltip",s=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=i.createElement("div"),this.$element.className=g,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},e.prototype.getElement=function(){return this.$element||this.$init()},e.prototype.setText=function(e){this.getElement().textContent=e},e.prototype.setHtml=function(e){this.getElement().innerHTML=e},e.prototype.setPosition=function(e,n){this.getElement().style.left=e+"px",this.getElement().style.top=n+"px"},e.prototype.setClassName=function(e){i.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=g+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,n,D){null!=e&&this.setText(e),null!=n&&null!=D&&this.setPosition(n,D),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},e.prototype.hide=function(e){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=g,this.isOpen=!1)},e.prototype.getHeight=function(){return this.getElement().offsetHeight},e.prototype.getWidth=function(){return this.getElement().offsetWidth},e.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},e}(),a=new(function(){function e(){this.popups=[]}return e.prototype.addPopup=function(e){this.popups.push(e),this.updatePopups()},e.prototype.removePopup=function(e){var n=this.popups.indexOf(e);-1!==n&&(this.popups.splice(n,1),this.updatePopups())},e.prototype.updatePopups=function(){this.popups.sort(function(e,n){return n.priority-e.priority});var e,n,D,t,i=[];try{for(var r=S(this.popups),o=r.next();!o.done;o=r.next()){var g=o.value,s=!0;try{for(var a=(D=void 0,S(i)),l=a.next();!l.done;l=a.next()){var c=l.value;if(this.doPopupsOverlap(c,g)){s=!1;break}}}catch(e){D={error:e}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(D)throw D.error}}s?i.push(g):g.hide()}}catch(n){e={error:n}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.doPopupsOverlap=function(e,n){var D=e.getElement().getBoundingClientRect(),t=n.getElement().getBoundingClientRect();return D.left<t.right&&D.right>t.left&&D.top<t.bottom&&D.bottom>t.top},e}());n.popupManager=a,n.Tooltip=s,n.HoverTooltip=function(e){function n(n){void 0===n&&(n=document.body);var D=e.call(this,n)||this;D.timeout=void 0,D.lastT=0,D.idleTime=350,D.lastEvent=void 0,D.onMouseOut=D.onMouseOut.bind(D),D.onMouseMove=D.onMouseMove.bind(D),D.waitForHover=D.waitForHover.bind(D),D.hide=D.hide.bind(D);var t=D.getElement();return t.style.whiteSpace="pre-wrap",t.style.pointerEvents="auto",t.addEventListener("mouseout",D.onMouseOut),t.tabIndex=-1,t.addEventListener("blur",(function(){t.contains(document.activeElement)||this.hide()}).bind(D)),t.addEventListener("wheel",o),D}return t(n,e),n.prototype.addToEditor=function(e){e.on("mousemove",this.onMouseMove),e.on("mousedown",this.hide),e.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},n.prototype.removeFromEditor=function(e){e.off("mousemove",this.onMouseMove),e.off("mousedown",this.hide),e.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},n.prototype.onMouseMove=function(e,n){this.lastEvent=e,this.lastT=Date.now();var D=n.$mouseHandler.isMousePressed;if(this.isOpen){var t=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(t.row,t.column)||D||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||D||(this.lastEvent=e,this.timeout=setTimeout(this.waitForHover,this.idleTime))},n.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var e=Date.now()-this.lastT;if(this.idleTime-e>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-e);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},n.prototype.isOutsideOfText=function(e){var n=e.editor,D=e.getDocumentPosition(),t=n.session.getLine(D.row);if(D.column==t.length){var S=n.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),i=n.session.documentToScreenPosition(D.row,D.column);if(i.column!=S.column||i.row!=S.row)return!0}return!1},n.prototype.setDataProvider=function(e){this.$gatherData=e},n.prototype.showForRange=function(e,n,D,t){var S=10;if((!t||t==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var i=e.renderer;this.isOpen||(a.addPopup(this),this.$registerCloseEvents(),this.setTheme(i.theme)),this.isOpen=!0,this.addMarker(n,e.session),this.range=r.fromPoints(n.start,n.end);var o=i.textToScreenCoordinates(n.start.row,n.start.column),g=i.scroller.getBoundingClientRect();o.pageX<g.left&&(o.pageX=g.left);var s=this.getElement();s.innerHTML="",s.appendChild(D),s.style.maxHeight="",s.style.display="block";var l=s.clientHeight,c=s.clientWidth,u=window.innerHeight-o.pageY-i.lineHeight,h=!0;o.pageY-l<0&&o.pageY<u&&(h=!1),s.style.maxHeight=(h?o.pageY:u)-S+"px",s.style.top=h?"":o.pageY+i.lineHeight+"px",s.style.bottom=h?window.innerHeight-o.pageY+"px":"",s.style.left=Math.min(o.pageX,window.innerWidth-c-S)+"px"}},n.prototype.addMarker=function(e,n){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=n,this.marker=n&&n.addMarker(e,"ace_highlight-marker","text")},n.prototype.hide=function(e){(e||document.activeElement!=this.getElement())&&!(e&&e.target&&("keydown"!=e.type||e.ctrlKey||e.metaKey)&&this.$element.contains(e.target))&&(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,a.removePopup(this)))},n.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},n.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},n.prototype.onMouseOut=function(e){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,!this.isOpen||!e.relatedTarget||this.getElement().contains(e.relatedTarget)||!(e&&e.currentTarget.contains(e.relatedTarget))&&(e.relatedTarget.classList.contains("ace_content")||this.hide())},n}(s)}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config","ace/lib/lang"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},i=e("../lib/dom"),r=e("../lib/event"),o=e("../tooltip").Tooltip,g=e("../config").nls;e("../lib/lang"),n.GutterHandler=function(e){var n,D,t=e.editor,S=t.renderer.$gutterLayer,o=new s(t);function g(){var n=D.getDocumentPosition().row;if(n==t.session.getLength()){var i=t.renderer.pixelToScreenCoordinates(0,D.y).row,r=D.$pos;if(i>t.session.documentToScreenRow(r.row,r.column))return a()}if(o.showTooltip(n),o.isOpen)if(t.on("mousewheel",a),e.$tooltipFollowsMouse)l(D);else{var g=D.getGutterRow(),s=S.$lines.get(g);if(s){var c=s.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),u=o.getElement().style;u.left=c.right+"px",u.top=c.bottom+"px"}else l(D)}}function a(){n&&(n=clearTimeout(n)),o.isOpen&&(o.hideTooltip(),t.off("mousewheel",a))}function l(e){o.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(n){if(t.isFocused()&&0==n.getButton()&&"foldWidgets"!=S.getRegion(n)){var D=n.getDocumentPosition().row,i=t.session.selection;if(n.getShiftKey())i.selectTo(D,0);else{if(2==n.domEvent.detail)return t.selectAll(),n.preventDefault();e.$clickSelection=t.selection.getLineRange(D)}return e.setState("selectByLines"),e.captureMouse(n),n.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(t){var S=t.domEvent.target||t.domEvent.srcElement;if(i.hasCssClass(S,"ace_fold-widget"))return a();o.isOpen&&e.$tooltipFollowsMouse&&l(t),D=t,n||(n=setTimeout(function(){n=null,D&&!e.isMousePressed?g():a()},50))}),r.addListener(t.renderer.$gutter,"mouseout",function(e){D=null,o.isOpen&&!n&&(n=setTimeout(function(){n=null,a()},50))},t),t.on("changeSession",a),t.on("input",a)};var s=function(e){function n(n){var D=e.call(this,n.container)||this;return D.editor=n,D}return t(n,e),n.prototype.setPosition=function(e,n){var D=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight,S=this.getWidth(),i=this.getHeight();n+=15,(e+=15)+S>D&&(e-=e+S-D),n+i>t&&(n-=20+i),o.prototype.setPosition.call(this,e,n)},Object.defineProperty(n,"annotationLabels",{get:function(){return{error:{singular:g("gutter-tooltip.aria-label.error.singular","error"),plural:g("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:g("gutter-tooltip.aria-label.security.singular","security finding"),plural:g("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:g("gutter-tooltip.aria-label.warning.singular","warning"),plural:g("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:g("gutter-tooltip.aria-label.info.singular","information message"),plural:g("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:g("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:g("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),n.prototype.showTooltip=function(e){var D=this.editor.renderer.$gutterLayer,t=D.$annotations[e];o=t?{displayText:Array.from(t.displayText),type:Array.from(t.type)}:{displayText:[],type:[]};var S=D.session.getFoldLine(e);if(S&&D.$showFoldedAnnotations){for(var r,o,g,s={error:[],security:[],warning:[],info:[],hint:[]},a={error:1,security:2,warning:3,info:4,hint:5},l=e+1;l<=S.end.row;l++)if(D.$annotations[l])for(var c=0;c<D.$annotations[l].text.length;c++){var u=D.$annotations[l].type[c];s[u].push(D.$annotations[l].text[c]),(!g||a[u]<a[g])&&(g=u)}if(["error","security","warning"].includes(g)){var h="".concat(n.annotationsToSummaryString(s)," in folded code.");o.displayText.push(h),o.type.push(g+"_fold")}}if(0===o.displayText.length)return this.hide();for(var d={error:[],security:[],warning:[],info:[],hint:[]},p=D.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",l=0;l<o.displayText.length;l++){var f=i.createElement("span"),m=i.createElement("span");(r=m.classList).add.apply(r,["ace_".concat(o.type[l]),p]),m.setAttribute("aria-label","".concat(n.annotationLabels[o.type[l].replace("_fold","")].singular)),m.setAttribute("role","img"),m.appendChild(i.createTextNode(" ")),f.appendChild(m),f.appendChild(i.createTextNode(o.displayText[l])),f.appendChild(i.createElement("br")),d[o.type[l].replace("_fold","")].push(f)}var y=this.getElement();i.removeChildren(y),d.error.forEach(function(e){return y.appendChild(e)}),d.security.forEach(function(e){return y.appendChild(e)}),d.warning.forEach(function(e){return y.appendChild(e)}),d.info.forEach(function(e){return y.appendChild(e)}),d.hint.forEach(function(e){return y.appendChild(e)}),y.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.editor._signal("showGutterTooltip",this)},n.prototype.hideTooltip=function(){this.$element.removeAttribute("aria-live"),this.hide(),this.editor._signal("hideGutterTooltip",this)},n.annotationsToSummaryString=function(e){var D,t,i=[],r=["error","security","warning","info","hint"];try{for(var o=S(r),g=o.next();!g.done;g=o.next()){var s=g.value;if(e[s].length){var a=1===e[s].length?n.annotationLabels[s].singular:n.annotationLabels[s].plural;i.push("".concat(e[s].length," ").concat(a))}}}catch(e){D={error:e}}finally{try{g&&!g.done&&(t=o.return)&&t.call(o)}finally{if(D)throw D.error}}return i.join(", ")},n}(o);n.GutterTooltip=s}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../lib/useragent");n.MouseEvent=function(){function e(e,n){this.speed,this.wheelX,this.wheelY,this.domEvent=e,this.editor=n,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return e.prototype.stopPropagation=function(){t.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){t.preventDefault(this.domEvent),this.defaultPrevented=!0},e.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},e.prototype.getDocumentPosition=function(){return this.$pos||(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY)),this.$pos},e.prototype.getGutterRow=function(){var e=this.getDocumentPosition().row;return this.editor.session.documentToScreenRow(e,0)-this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0)},e.prototype.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=e.contains(n.row,n.column)}return this.$inSelection},e.prototype.getButton=function(){return t.getButton(this.domEvent)},e.prototype.getShiftKey=function(){return this.domEvent.shiftKey},e.prototype.getAccelKey=function(){return S.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},e}()}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/event"),i=e("../lib/useragent"),r=200,o=200,g=5;function s(e){var n,D,s,l,c,u=e.editor,h=t.createElement("div");h.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",h.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(n){e[n]=this[n]},this),u.on("mousedown",this.onMouseDown.bind(e));var d,p,f,m,y,v,b=u.container,w=0;function M(e,n){var D=Date.now(),t=!n||e.row!=n.row,S=!n||e.column!=n.column;!l||t||S?(u.moveCursorToPosition(e),l=D,c={x:p,y:f}):a(c.x,c.y,p,f)>g?l=null:D-l>=o&&(u.renderer.scrollCursorIntoView(),l=null)}function L(e,n){var D=Date.now(),t=u.renderer.layerConfig.lineHeight,S=u.renderer.layerConfig.characterWidth,i=u.renderer.scroller.getBoundingClientRect(),o={x:{left:p-i.left,right:i.right-p},y:{top:f-i.top,bottom:i.bottom-f}},g=Math.min(o.x.left,o.x.right),a=Math.min(o.y.top,o.y.bottom),l={row:e.row,column:e.column};g/S<=2&&(l.column+=o.x.left<o.x.right?-3:2),a/t<=1&&(l.row+=o.y.top<o.y.bottom?-1:1);var c=e.row!=l.row,h=e.column!=l.column,d=!n||e.row!=n.row;c||h&&!d?s?D-s>=r&&u.renderer.scrollCursorIntoView(l):s=D:s=null}function $(){var e=v;M(v=u.renderer.screenToTextCoordinates(p,f),e),L(v,e)}function _(){y=u.selection.toOrientedRange(),d=u.session.addMarker(y,"ace_selection",u.getSelectionStyle()),u.clearSelection(),u.isFocused()&&u.renderer.$cursorLayer.setBlinking(!1),clearInterval(m),$(),m=setInterval($,20),w=0,S.addListener(document,"mousemove",E)}function x(){clearInterval(m),u.session.removeMarker(d),d=null,u.selection.fromOrientedRange(y),u.isFocused()&&!D&&u.$resetCursorStyle(),y=null,v=null,w=0,s=null,l=null,S.removeListener(document,"mousemove",E)}this.onDragStart=function(e){if(this.cancelDrag||!b.draggable){var n=this;return setTimeout(function(){n.startSelect(),n.captureMouse(e)},0),e.preventDefault()}y=u.getSelectionRange();var t=e.dataTransfer;t.effectAllowed=u.getReadOnly()?"copy":"copyMove",u.container.appendChild(h),t.setDragImage&&t.setDragImage(h,0,0),setTimeout(function(){u.container.removeChild(h)}),t.clearData(),t.setData("Text",u.session.getTextRange()),D=!0,this.setState("drag")},this.onDragEnd=function(e){if(b.draggable=!1,D=!1,this.setState(null),!u.getReadOnly()){var t=e.dataTransfer.dropEffect;n||"move"!=t||u.session.remove(u.getSelectionRange()),u.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!u.getReadOnly()&&k(e.dataTransfer))return p=e.clientX,f=e.clientY,d||_(),w++,e.dataTransfer.dropEffect=n=A(e),S.preventDefault(e)},this.onDragOver=function(e){if(!u.getReadOnly()&&k(e.dataTransfer))return p=e.clientX,f=e.clientY,!d&&(_(),w++),null!==C&&(C=null),e.dataTransfer.dropEffect=n=A(e),S.preventDefault(e)},this.onDragLeave=function(e){if(--w<=0&&d)return x(),n=null,S.preventDefault(e)},this.onDrop=function(e){if(v){var t=e.dataTransfer;if(D)switch(n){case"move":y=y.contains(v.row,v.column)?{start:v,end:v}:u.moveText(y,v);break;case"copy":y=u.moveText(y,v,!0)}else{var i=t.getData("Text");y={start:v,end:u.session.insert(v,i)},u.focus(),n=null}return x(),S.preventDefault(e)}},S.addListener(b,"dragstart",this.onDragStart.bind(e),u),S.addListener(b,"dragend",this.onDragEnd.bind(e),u),S.addListener(b,"dragenter",this.onDragEnter.bind(e),u),S.addListener(b,"dragover",this.onDragOver.bind(e),u),S.addListener(b,"dragleave",this.onDragLeave.bind(e),u),S.addListener(b,"drop",this.onDrop.bind(e),u);var C=null;function E(){null==C&&(C=setTimeout(function(){null!=C&&d&&x()},20))}function k(e){var n=e.types;return!n||Array.prototype.some.call(n,function(e){return"text/plain"==e||"Text"==e})}function A(e){var n=["copy","copymove","all","uninitialized"],D=["move","copymove","linkmove","all","uninitialized"],t=i.isMac?e.altKey:e.ctrlKey,S="uninitialized";try{S=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return t&&n.indexOf(S)>=0?r="copy":D.indexOf(S)>=0?r="move":n.indexOf(S)>=0&&(r="copy"),r}}function a(e,n,D,t){return Math.sqrt(Math.pow(D-e,2)+Math.pow(t-n,2))}(function(){this.dragWait=function(){Date.now()-this.mousedownEvent.time>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){this.editor.container.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor;e.container.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=i.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var n=this.editor.container;if(i.isIE&&"dragReady"==this.state){var D=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);D>3&&n.dragDrop()}if("dragWait"===this.state){var D=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);D>0&&(n.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var n=this.editor,D=e.inSelection(),t=e.getButton(),S=e.domEvent.detail||1;if(1===S&&0===t&&D){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var r=e.domEvent.target||e.domEvent.srcElement;"unselectable"in r&&(r.unselectable="on"),n.getDragDelay()?(i.isWebKit&&(this.cancelDrag=!0,n.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(s.prototype),n.DragdropHandler=s}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./mouse_event").MouseEvent,S=e("../lib/event"),i=e("../lib/dom");n.addTouchListeners=function(e,n){var D,r,o,g,s,a,l,c,u,h="scroll",d=0,p=0,f=0,m=0;function y(){var e=window.navigator&&window.navigator.clipboard,D=!1,t=function(){var t=n.getCopyText(),r=n.session.getUndoManager().hasUndo();u.replaceChild(i.buildDom(D?["span",!t&&S("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],t&&S("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],t&&S("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],e&&S("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],r&&S("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],S("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],S("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),u.firstChild)},S=function(e){return n.commands.canExecute(e,n)},r=function(S){var i=S.target.getAttribute("action");if("more"==i||!D)return D=!D,t();"paste"==i?e.readText().then(function(e){n.execCommand(i,e)}):i&&(("cut"==i||"copy"==i)&&(e?e.writeText(n.getCopyText()):document.execCommand("copy")),n.execCommand(i)),u.firstChild.style.display="none",D=!1,"openCommandPalette"!=i&&n.focus()};u=i.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){h="menu",e.stopPropagation(),e.preventDefault(),n.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),r(e)},onclick:r},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],n.container)}function v(){if(!n.getOption("enableMobileMenu")){u&&b();return}u||y();var e=n.selection.cursor,D=n.renderer.textToScreenCoordinates(e.row,e.column),t=n.renderer.textToScreenCoordinates(0,0).pageX,S=n.renderer.scrollLeft,i=n.container.getBoundingClientRect();u.style.top=D.pageY-i.top-3+"px",D.pageX-i.left<i.width-70?(u.style.left="",u.style.right="10px"):(u.style.right="",u.style.left=t+S-i.left+"px"),u.style.display="",u.firstChild.style.display="none",n.on("input",b)}function b(e){u&&(u.style.display="none"),n.off("input",b)}function w(){clearTimeout(s=null);var e=n.selection.getRange(),D=e.contains(l.row,l.column);(e.isEmpty()||!D)&&(n.selection.moveToPosition(l),n.selection.selectWord()),h="wait",v()}function M(){clearTimeout(s=null),n.selection.moveToPosition(l);var e=p>=2?n.selection.getLineRange(l.row):n.session.getBracketRange(l);e&&!e.isEmpty()?n.selection.setRange(e):n.selection.selectWord(),h="wait"}function L(){d+=60,a=setInterval(function(){d--<=0&&(clearInterval(a),a=null),.01>Math.abs(f)&&(f=0),.01>Math.abs(m)&&(m=0),d<20&&(f*=.9),d<20&&(m*=.9);var e=n.session.getScrollTop();n.renderer.scrollBy(10*f,10*m),e==n.session.getScrollTop()&&(d=0)},10)}S.addListener(e,"contextmenu",function(e){if(c){var D=n.textInput.getElement();D.focus()}},n),S.addListener(e,"touchstart",function(e){var S=e.touches;if(s||S.length>1){clearTimeout(s),s=null,o=-1,h="zoom";return}c=n.$mouseHandler.isMousePressed=!0;var i=n.renderer.layerConfig.lineHeight,a=n.renderer.layerConfig.lineHeight,u=e.timeStamp;g=u;var y=S[0],v=y.clientX,b=y.clientY;if(Math.abs(D-v)+Math.abs(r-b)>i&&(o=-1),D=e.clientX=v,r=e.clientY=b,f=m=0,l=new t(e,n).getDocumentPosition(),u-o<500&&1==S.length&&!d)p++,e.preventDefault(),e.button=0,M();else{p=0;var L=n.selection.cursor,$=n.selection.isEmpty()?L:n.selection.anchor,_=n.renderer.$cursorLayer.getPixelPosition(L,!0),x=n.renderer.$cursorLayer.getPixelPosition($,!0),C=n.renderer.scroller.getBoundingClientRect(),E=n.renderer.layerConfig.offset,k=n.renderer.scrollLeft,A=function(e,n){return(e/=a)*e+(n=n/i-.75)*n};if(e.clientX<C.left){h="zoom";return}var T=A(e.clientX-C.left-_.left+k,e.clientY-C.top-_.top+E),O=A(e.clientX-C.left-x.left+k,e.clientY-C.top-x.top+E);T<3.5&&O<3.5&&(h=T>O?"cursor":"anchor"),h=O<3.5?"anchor":T<3.5?"cursor":"scroll",s=setTimeout(w,450)}o=u},n),S.addListener(e,"touchend",function(e){c=n.$mouseHandler.isMousePressed=!1,a&&clearInterval(a),"zoom"==h?(h="",d=0):s?(n.selection.moveToPosition(l),d=0,v()):"scroll"==h?(L(),b()):v(),clearTimeout(s),s=null},n),S.addListener(e,"touchmove",function(e){s&&(clearTimeout(s),s=null);var S=e.touches;if(!(S.length>1)&&"zoom"!=h){var i=S[0],o=D-i.clientX,a=r-i.clientY;if("wait"==h)if(!(o*o+a*a>4))return e.preventDefault();else h="cursor";D=i.clientX,r=i.clientY,e.clientX=i.clientX,e.clientY=i.clientY;var l=e.timeStamp,c=l-g;if(g=l,"scroll"==h){var u=new t(e,n);u.speed=1,u.wheelX=o,u.wheelY=a,10*Math.abs(o)<Math.abs(a)&&(o=0),10*Math.abs(a)<Math.abs(o)&&(a=0),0!=c&&(f=o/c,m=a/c),n._emit("mousewheel",u),u.propagationStopped||(f=m=0)}else{var d=new t(e,n).getDocumentPosition();"cursor"==h?n.selection.moveCursorToPosition(d):"anchor"==h&&n.selection.setSelectionAnchor(d.row,d.column),n.renderer.scrollCursorIntoView(d),e.preventDefault()}}},n)}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(e,n,D){"use strict";var t=e("../lib/event"),S=e("../lib/useragent"),i=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,o=e("./mouse_event").MouseEvent,g=e("./dragdrop_handler").DragdropHandler,s=e("./touch_handler").addTouchListeners,a=e("../config"),l=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var n=this;this.editor=e,new i(this),new r(this),new g(this);var D=function(n){document.hasFocus&&document.hasFocus()&&(e.isFocused()||document.activeElement!=(e.textInput&&e.textInput.getElement()))||window.focus(),e.focus(),setTimeout(function(){e.isFocused()||e.focus()})},o=e.renderer.getMouseEventTarget();t.addListener(o,"click",this.onMouseEvent.bind(this,"click"),e),t.addListener(o,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),t.addMultiMouseDownListener([o,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),t.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),s(e.container,e);var a=e.renderer.$gutter;t.addListener(a,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),t.addListener(a,"click",this.onMouseEvent.bind(this,"gutterclick"),e),t.addListener(a,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),t.addListener(a,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),t.addListener(o,"mousedown",D,e),t.addListener(a,"mousedown",D,e),S.isIE&&e.renderer.scrollBarV&&(t.addListener(e.renderer.scrollBarV.element,"mousedown",D,e),t.addListener(e.renderer.scrollBarH.element,"mousedown",D,e)),e.on("mousemove",function(D){if(!n.state&&!n.$dragDelay&&n.$dragEnabled){var t=e.renderer.screenToTextCoordinates(D.x,D.y),S=e.session.selection.getRange(),i=e.renderer;!S.isEmpty()&&S.insideStart(t.row,t.column)?i.setCursorStyle("default"):i.setCursorStyle("")}},e)}return e.prototype.onMouseEvent=function(e,n){this.editor.session&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseMove=function(e,n){var D=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;D&&D.length&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseWheel=function(e,n){var D=new o(n,this.editor);D.speed=2*this.$scrollSpeed,D.wheelX=n.wheelX,D.wheelY=n.wheelY,this.editor._emit(e,D)},e.prototype.setState=function(e){this.state=e},e.prototype.captureMouse=function(e,n){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var D=this.editor,i=this.editor.renderer;i.$isMousePressed=!0;var r=this,g=function(e){if(e){if(S.isWebKit&&!e.which&&r.releaseMouse)return r.releaseMouse();r.x=e.clientX,r.y=e.clientY,n&&n(e),r.mouseEvent=new o(e,r.editor),r.$mouseMoved=!0}},s=function(e){D.off("beforeEndOperation",l),clearInterval(c),D.session&&a(),r[r.state+"End"]&&r[r.state+"End"](e),r.state="",r.isMousePressed=i.$isMousePressed=!1,i.$keepTextAreaAtCursor&&i.$moveTextAreaToCursor(),r.$onCaptureMouseMove=r.releaseMouse=null,e&&r.onMouseEvent("mouseup",e),D.endOperation()},a=function(){r[r.state]&&r[r.state](),r.$mouseMoved=!1};if(S.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){s(e)});var l=function(e){r.releaseMouse&&D.curOp.command.name&&D.curOp.selectionChanged&&(r[r.state+"End"]&&r[r.state+"End"](),r.state="",r.releaseMouse())};D.on("beforeEndOperation",l),D.startOperation({command:{name:"mouse"}}),r.$onCaptureMouseMove=g,r.releaseMouse=t.capture(this.editor.container,g,s);var c=setInterval(a,20)},e.prototype.cancelContextMenu=function(){var e=(function(n){(!n||!n.domEvent||"contextmenu"==n.domEvent.type)&&(this.editor.off("nativecontextmenu",e),n&&n.domEvent&&t.stopEvent(n.domEvent))}).bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)},e.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},e}();l.prototype.releaseMouse=null,a.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150*!!S.isMac},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),n.MouseHandler=l}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom");n.FoldHandler=function(){return function(e){e.on("click",function(n){var D=n.getDocumentPosition(),S=e.session,i=S.getFoldAt(D.row,D.column,1);i&&(n.getAccelKey()?S.removeFold(i):S.expandFold(i),n.stop());var r=n.domEvent&&n.domEvent.target;r&&t.hasCssClass(r,"ace_inline_button")&&t.hasCssClass(r,"ace_toggle_wrap")&&(S.setOption("wrap",!S.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var D=n.getDocumentPosition().row,t=e.session;t.foldWidgets&&t.foldWidgets[D]&&e.session.onFoldWidgetClick(D,n),e.isFocused()||e.focus(),n.stop()}}),e.on("gutterdblclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var D=n.getDocumentPosition().row,t=e.session,S=t.getParentFoldRangeData(D,!0),i=S.range||S.firstRange;if(i){D=i.start.row;var r=t.getFoldAt(D,t.getLine(D).length,1);r?t.removeFold(r):(t.addFold("...",i),e.renderer.scrollCursorIntoView({row:i.start.row,column:0}))}n.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,n,D){"use strict";var t=e("../lib/keys"),S=e("../lib/event");n.KeyBinding=function(){function e(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)}return e.prototype.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},e.prototype.setKeyboardHandler=function(e){var n=this.$handlers;if(n[n.length-1]!=e){for(;n[n.length-1]&&n[n.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(n[n.length-1]);this.addKeyboardHandler(e,1)}},e.prototype.addKeyboardHandler=function(e,n){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var D=this.$handlers.indexOf(e);-1!=D&&this.$handlers.splice(D,1),void 0==n?this.$handlers.push(e):this.$handlers.splice(n,0,e),-1==D&&e.attach&&e.attach(this.$editor)}},e.prototype.removeKeyboardHandler=function(e){var n=this.$handlers.indexOf(e);return -1!=n&&(this.$handlers.splice(n,1),e.detach&&e.detach(this.$editor),!0)},e.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},e.prototype.getStatusText=function(){var e=this.$data,n=e.editor;return this.$handlers.map(function(D){return D.getStatusText&&D.getStatusText(n,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,n,D,t){for(var i,r=!1,o=this.$editor.commands,g=this.$handlers.length;g--&&(!(i=this.$handlers[g].handleKeyboard(this.$data,e,n,D,t))||!i.command||((r="null"==i.command||o.exec(i.command,this.$editor,i.args,t))&&t&&-1!=e&&!0!=i.passEvent&&!0!=i.command.passEvent&&S.stopEvent(t),!r)););return r||-1!=e||(i={command:"insertstring"},r=o.exec("insertstring",this.$editor,n)),r&&this.$editor._signal&&this.$editor._signal("keyboardActivity",i),r},e.prototype.onCommandKey=function(e,n,D){var S=t.keyCodeToString(D);return this.$callKeyboardHandlers(n,S,D,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,n,D){"use strict";var t=0,S=0,i=!1,r=!1,o=!1,g=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],s=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],a=0,l=1,c=0,u=1,h=2,d=3,p=4,f=5,m=6,y=7,v=8,b=9,w=10,M=11,L=12,$=13,_=14,x=15,C=16,E=17,k=18,A=[18,18,18,18,18,18,18,18,18,6,5,6,8,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,5,5,5,6,8,4,4,11,11,11,4,4,4,4,4,10,9,10,9,9,2,2,2,2,2,2,2,2,2,2,9,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,18,18,18,18,18,18,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,9,4,11,11,11,11,4,4,4,4,0,4,4,18,4,4,11,11,2,2,4,0,4,4,4,2,0,4,4,4,4,4],T=[8,8,8,8,8,8,8,8,8,8,8,18,18,18,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,5,13,14,15,16,17,9,11,11,11,11,11,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,9,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8];function O(e,n,D,a){var l=t?s:g,c=null,u=null,h=null,d=0,p=null,y=null,b=-1,w=null,M=null,L=[];if(!a)for(w=0,a=[];w<D;w++)a[w]=j(e[w]);for(M=0,S=t,i=!1,r=!1,o=!1;M<D;M++){if(c=d,L[M]=u=I(e,a,L,M),p=240&(d=l[c][u]),d&=15,n[M]=h=l[d][5],p>0)if(16==p){for(w=b;w<M;w++)n[w]=1;b=-1}else b=-1;if(y=l[d][6])-1==b&&(b=M);else if(b>-1){for(w=b;w<M;w++)n[w]=h;b=-1}a[M]==f&&(n[M]=0),S|=h}if(o){for(w=0;w<D;w++)if(a[w]==m){n[w]=t;for(var $=w-1;$>=0;$--)if(a[$]==v)n[$]=t;else break}}}function R(e,n,D){if(!(S<e)){if(1==e&&t==l&&!r)return void D.reverse();for(var i,o,g,s,a=D.length,c=0;c<a;){if(n[c]>=e){for(i=c+1;i<a&&n[i]>=e;)i++;for(o=c,g=i-1;o<g;o++,g--)s=D[o],D[o]=D[g],D[g]=s;c=i}c++}}}function I(e,n,D,S){var g,s,a,l,A=n[S];switch(A){case c:case u:i=!1;case p:case d:return A;case h:return i?d:h;case y:return i=!0,u;case v:return p;case b:if(S<1||S+1>=n.length||(g=D[S-1])!=h&&g!=d||(s=n[S+1])!=h&&s!=d)return p;return i&&(s=d),s==g?s:p;case w:if((g=S>0?D[S-1]:f)==h&&S+1<n.length&&n[S+1]==h)return h;return p;case M:if(S>0&&D[S-1]==h)return h;if(i)return p;for(l=S+1,a=n.length;l<a&&n[l]==M;)l++;if(l<a&&n[l]==h)return h;return p;case L:for(a=n.length,l=S+1;l<a&&n[l]==L;)l++;if(l<a){var T=e[S],O=T>=1425&&T<=2303||64286==T;if(g=n[l],O&&(g==u||g==y))return u}if(S<1||(g=n[S-1])==f)return p;return D[S-1];case f:return i=!1,r=!0,t;case m:return o=!0,p;case $:case _:case C:case E:case x:i=!1;case k:return p}}function j(e){var n=e.charCodeAt(0),D=n>>8;if(0==D)return n>191?c:A[n];if(5==D)return/[\u0591-\u05f4]/.test(e)?u:c;if(6==D)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return L;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return d;else if(1642==n)return M;else if(/[\u06f0-\u06f9]/.test(e))return h;else return y;if(32==D&&n<=8287)return T[255&n];if(254==D)return n>=65136?y:p;return p}n.L=0,n.R=u,n.EN=h,n.ON_R=3,n.AN=4,n.R_H=5,n.B=6,n.RLE=7,n.DOT="\xb7",n.doBidiReorder=function(e,D,S){if(e.length<2)return{};var i=e.split(""),r=Array(i.length),o=Array(i.length),g=[];t=S?l:a,O(i,g,i.length,D);for(var s=0;s<r.length;r[s]=s,s++);R(2,g,r),R(1,g,r);for(var s=0;s<r.length-1;s++)D[s]===d?g[s]=n.AN:g[s]===u&&(D[s]>y&&D[s]<$||D[s]===p||D[s]===k)?g[s]=n.ON_R:s>0&&"ل"===i[s-1]&&/\u0622|\u0623|\u0625|\u0627/.test(i[s])&&(g[s-1]=g[s]=n.R_H,s++);i[i.length-1]===n.DOT&&(g[i.length-1]=n.B),""===i[0]&&(g[0]=n.RLE);for(var s=0;s<r.length;s++)o[s]=g[r[s]];return{logicalFromVisual:r,bidiLevels:o}},n.hasBidiCharacters=function(e,n){for(var D=!1,t=0;t<e.length;t++)n[t]=j(e.charAt(t)),D||n[t]!=u&&n[t]!=y&&n[t]!=d||(D=!0);return D},n.getVisualFromLogicalIdx=function(e,n){for(var D=0;D<n.logicalFromVisual.length;D++)if(n.logicalFromVisual[D]==e)return D;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,n,D){"use strict";var t=e("./lib/bidiutil"),S=e("./lib/lang"),i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;n.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=t,this.charWidths=[],this.EOL="\xac",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="\xb6",this.RLE="",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=i.test(e.getValue())}return e.prototype.isBidiRow=function(e,n,D){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(n,D),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&i.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},e.prototype.getDocumentRow=function(){var e=0,n=this.session.$screenRowCache;if(n.length){var D=this.session.$getRowCacheIndex(n,this.currentRow);D>=0&&(e=this.session.$docRowCache[D])}return e},e.prototype.getSplitIndex=function(){var e=0,n=this.session.$screenRowCache;if(n.length)for(var D,t=this.session.$getRowCacheIndex(n,this.currentRow);this.currentRow-e>0&&(D=this.session.$getRowCacheIndex(n,this.currentRow-e-1))===t;)t=D,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,n){void 0===e&&(e=this.getDocumentRow());var D=e===this.session.getLength()-1?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var i=this.session.$wrapData[e];i&&(void 0===n&&(n=this.getSplitIndex()),n>0&&i.length?(this.wrapIndent=i.indent,this.wrapOffset=this.wrapIndent*this.charWidths[t.L],this.line=n<i.length?this.line.substring(i[n-1],i[n]):this.line.substring(i[i.length-1])):this.line=this.line.substring(0,i[n]),n==i.length&&(this.line+=this.showInvisibles?D:t.DOT))}else this.line+=this.showInvisibles?D:t.DOT;var r,o=this.session,g=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,n){return" "===e||o.isFullWidth(e.charCodeAt(0))?(r=" "===e?o.getScreenTabSize(n+g):2,g+=r-1,S.stringRepeat(t.DOT,r)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==t.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},e.prototype.updateBidiMap=function(){var e=[];t.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=t.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},e.prototype.markAsDirty=function(){this.currentRow=null},e.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var n=this.characterWidth=e.$characterSize.width,D=e.$measureCharWidth("ה");this.charWidths[t.L]=this.charWidths[t.EN]=this.charWidths[t.ON_R]=n,this.charWidths[t.R]=this.charWidths[t.AN]=D,this.charWidths[t.R_H]=.45*D,this.charWidths[t.B]=this.charWidths[t.RLE]=0,this.currentRow=null}},e.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},e.prototype.setEolChar=function(e){this.EOL=e},e.prototype.setContentWidth=function(e){this.contentWidth=e},e.prototype.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},e.prototype.setRtlDirection=function(e,n){for(var D=e.getCursorPosition(),t=e.selection.getSelectionAnchor().row;t<=D.row;t++)n||e.session.getLine(t).charAt(0)!==e.session.$bidiHandler.RLE?n&&e.session.getLine(t).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:t},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(t,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var n=+(this.line.charAt(0)===this.RLE),D=e>n?this.session.getOverwrite()?e:e-1:n,S=t.getVisualFromLogicalIdx(D,this.bidiMap),i=this.bidiMap.bidiLevels,r=0;!this.session.getOverwrite()&&e<=n&&i[S]%2!=0&&S++;for(var o=0;o<S;o++)r+=this.charWidths[i[o]];return!this.session.getOverwrite()&&e>n&&i[S]%2==0&&(r+=this.charWidths[i[S]]),this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(r+=this.rtlLineOffset),r},e.prototype.getSelections=function(e,n){var D,t=this.bidiMap,S=t.bidiLevels,i=[],r=0,o=Math.min(e,n)-this.wrapIndent,g=Math.max(e,n)-this.wrapIndent,s=!1,a=!1,l=0;this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var c,u=0;u<S.length;u++)c=t.logicalFromVisual[u],D=S[u],(s=c>=o&&c<g)&&!a?l=r:!s&&a&&i.push({left:l,width:r-l}),r+=this.charWidths[D],a=s;if(s&&u===S.length&&i.push({left:l,width:r-l}),this.isRtlDir)for(var h=0;h<i.length;h++)i[h].left+=this.rtlLineOffset;return i},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var n=0,e=Math.max(e,0),D=0,t=0,S=this.bidiMap.bidiLevels,i=this.charWidths[S[t]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>D+i/2;){if(D+=i,t===S.length-1){i=0;break}i=this.charWidths[S[++t]]}return t>0&&S[t-1]%2!=0&&S[t]%2==0?(e<D&&t--,n=this.bidiMap.logicalFromVisual[t]):t>0&&S[t-1]%2==0&&S[t]%2!=0?n=1+(e>D?this.bidiMap.logicalFromVisual[t]:this.bidiMap.logicalFromVisual[t-1]):this.isRtlDir&&t===S.length-1&&0===i&&S[t-1]%2==0||!this.isRtlDir&&0===t&&S[t]%2!=0?n=1+this.bidiMap.logicalFromVisual[t]:(t>0&&S[t-1]%2!=0&&0!==i&&t--,n=this.bidiMap.logicalFromVisual[t]),0===n&&this.isRtlDir&&n++,n+this.wrapIndent},e}()}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/lang"),i=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=function(){function e(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var n=this;this.cursor.on("change",function(e){n.$cursorChanged=!0,n.$silent||n._emit("changeCursor"),n.$isEmpty||n.$silent||n._emit("changeSelection"),n.$keepDesiredColumnOnChange||e.old.column==e.value.column||(n.$desiredColumn=null)}),this.anchor.on("change",function(){n.$anchorChanged=!0,n.$isEmpty||n.$silent||n._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(e,n){this.$isEmpty=!1,this.anchor.setPosition(e,n)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var e=this.anchor,n=this.lead;return e.row>n.row||e.row==n.row&&e.column>n.column},e.prototype.getRange=function(){var e=this.anchor,n=this.lead;return this.$isEmpty?r.fromPoints(n,n):this.isBackwards()?r.fromPoints(n,e):r.fromPoints(e,n)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(e,n){var D=n?e.end:e.start,t=n?e.start:e.end;this.$setSelection(D.row,D.column,t.row,t.column)},e.prototype.$setSelection=function(e,n,D,t){if(!this.$silent){var S=this.$isEmpty,i=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,n),this.cursor.setPosition(D,t),this.$isEmpty=!r.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||S!=this.$isEmpty||i)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(e){var n=this.lead;this.$isEmpty&&this.setSelectionAnchor(n.row,n.column),e.call(this)},e.prototype.selectTo=function(e,n){this.$moveSelection(function(){this.moveCursorTo(e,n)})},e.prototype.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},e.prototype.moveTo=function(e,n){this.clearSelection(),this.moveCursorTo(e,n)},e.prototype.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(e,n){if(void 0===n){var D=e||this.lead;e=D.row,n=D.column}return this.session.getWordRange(e,n)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var e=this.getCursor(),n=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(n)},e.prototype.getLineRange=function(e,n){var D,t="number"==typeof e?e:this.lead.row,S=this.session.getFoldLine(t);return(S?(t=S.start.row,D=S.end.row):D=t,!0===n)?new r(t,0,D,this.session.getLine(D).length):new r(t,0,D+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(e,n,D){var t=e.column,S=e.column+n;return D<0&&(t=e.column-n,S=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(t,S).split(" ").length-1==n},e.prototype.moveCursorLeft=function(){var e,n=this.lead.getPosition();if(e=this.session.getFoldAt(n.row,n.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===n.column)n.row>0&&this.moveCursorTo(n.row-1,this.doc.getLine(n.row-1).length);else{var D=this.session.getTabSize();this.wouldMoveIntoSoftTab(n,D,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-D):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var e,n=this.lead.getPosition();if(e=this.session.getFoldAt(n.row,n.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var D=this.session.getTabSize(),n=this.lead;this.wouldMoveIntoSoftTab(n,D,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,D):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,n=this.lead.column,D=this.session.documentToScreenRow(e,n),t=this.session.screenToDocumentPosition(D,0),S=this.session.getDisplayLine(e,null,t.row,t.column).match(/^\s*/);S[0].length==n||this.session.$useEmacsStyleLineStart||(t.column+=S[0].length),this.moveCursorToPosition(t)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,n=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==n.column){var D=this.session.getLine(n.row);if(n.column==D.length){var t=D.search(/\s+$/);t>0&&(n.column=t)}}this.moveCursorTo(n.row,n.column)},e.prototype.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,n=this.doc.getLine(e).length;this.moveCursorTo(e,n)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var e=this.lead.row,n=this.lead.column,D=this.doc.getLine(e),t=D.substring(n);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var S=this.session.getFoldAt(e,n,1);if(S)return void this.moveCursorTo(S.end.row,S.end.column);if(this.session.nonTokenRe.exec(t)&&(n+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,t=D.substring(n)),n>=D.length){this.moveCursorTo(e,D.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(t)&&(n+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,n)},e.prototype.moveCursorLongWordLeft=function(){var e,n=this.lead.row,D=this.lead.column;if(e=this.session.getFoldAt(n,D,-1))return void this.moveCursorTo(e.start.row,e.start.column);var t=this.session.getFoldStringAt(n,D,-1);null==t&&(t=this.doc.getLine(n).substring(0,D));var i=S.stringReverse(t);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(i)&&(D-=this.session.nonTokenRe.lastIndex,i=i.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),D<=0){this.moveCursorTo(n,0),this.moveCursorLeft(),n>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(i)&&(D-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(n,D)},e.prototype.$shortWordEndIndex=function(e){var n,D=0,t=/\s/,S=this.session.tokenRe;if(S.lastIndex=0,this.session.tokenRe.exec(e))D=this.session.tokenRe.lastIndex;else{for(;(n=e[D])&&t.test(n);)D++;if(D<1){for(S.lastIndex=0;(n=e[D])&&!S.test(n);)if(S.lastIndex=0,D++,t.test(n))if(D>2){D--;break}else{for(;(n=e[D])&&t.test(n);)D++;if(D>2)break}}}return S.lastIndex=0,D},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,n=this.lead.column,D=this.doc.getLine(e),t=D.substring(n),S=this.session.getFoldAt(e,n,1);if(S)return this.moveCursorTo(S.end.row,S.end.column);if(n==D.length){var i=this.doc.getLength();do e++,t=this.doc.getLine(e);while(e<i&&/^\s*$/.test(t));/^\s+/.test(t)||(t=""),n=0}var r=this.$shortWordEndIndex(t);this.moveCursorTo(e,n+r)},e.prototype.moveCursorShortWordLeft=function(){var e,n=this.lead.row,D=this.lead.column;if(e=this.session.getFoldAt(n,D,-1))return this.moveCursorTo(e.start.row,e.start.column);var t=this.session.getLine(n).substring(0,D);if(0===D){do n--,t=this.doc.getLine(n);while(n>0&&/^\s*$/.test(t));D=t.length,/\s+$/.test(t)||(t="")}var i=S.stringReverse(t),r=this.$shortWordEndIndex(i);return this.moveCursorTo(n,D-r)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(e,n){var D,t=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===n&&(0!==e&&(this.session.$bidiHandler.isBidiRow(t.row,this.lead.row)?(D=this.session.$bidiHandler.getPosLeft(t.column),t.column=Math.round(D/this.session.$bidiHandler.charWidths[0])):D=t.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?t.column=this.$desiredColumn:this.$desiredColumn=t.column),0!=e&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var S=this.session.lineWidgets[this.lead.row];e<0?e-=S.rowsAbove||0:e>0&&(e+=S.rowCount-(S.rowsAbove||0))}var i=this.session.screenToDocumentPosition(t.row+e,t.column,D);0!==e&&0===n&&i.row===this.lead.row&&(i.column,this.lead.column),this.moveCursorTo(i.row,i.column+n,0===n)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,n,D){var t=this.session.getFoldAt(e,n,1);t&&(e=t.start.row,n=t.start.column),this.$keepDesiredColumnOnChange=!0;var S=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(S.charAt(n))&&S.charAt(n-1)&&(this.lead.row==e&&this.lead.column==n+1?n-=1:n+=1),this.lead.setPosition(e,n),this.$keepDesiredColumnOnChange=!1,D||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,n,D){var t=this.session.screenToDocumentPosition(e,n);this.moveCursorTo(t.row,t.column,D)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(e){var n=this.getRange();return e?(e.start.column=n.start.column,e.start.row=n.start.row,e.end.column=n.end.column,e.end.row=n.end.row):e=n,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},e.prototype.getRangeOfMovements=function(e){var n=this.getCursor();try{e(this);var D=this.getCursor();return r.fromPoints(n,D)}catch(e){return r.fromPoints(n,n)}finally{this.moveCursorToPosition(n)}},e.prototype.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var n=e.clone();return n.isBackwards=e.cursor==e.start,n});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},e.prototype.fromJSON=function(e){if(void 0==e.start)if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var n=e.length;n--;){var D=r.fromPoints(e[n].start,e[n].end);e[n].isBackwards&&(D.cursor=D.start),this.addRange(D,!0)}return}else e=e[0];this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},e.prototype.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var n=this.ranges.length;n--;)if(!this.ranges[n].isEqual(e[n]))return!1;return!0},e}();o.prototype.setSelectionAnchor=o.prototype.setAnchor,o.prototype.getSelectionAnchor=o.prototype.getAnchor,o.prototype.setSelectionRange=o.prototype.setRange,t.implement(o.prototype,i),n.Selection=o}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,n,D){"use strict";var t=e("./lib/report_error").reportError,S=2e3,i=function(){function e(e){for(var n in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var D=this.states[n],t=[],S=0,i=this.matchMappings[n]={defaultToken:"text"},r="g",o=[],g=0;g<D.length;g++){var s=D[g];if(s.defaultToken&&(i.defaultToken=s.defaultToken),s.caseInsensitive&&-1===r.indexOf("i")&&(r+="i"),s.unicode&&-1===r.indexOf("u")&&(r+="u"),null!=s.regex){s.regex instanceof RegExp&&(s.regex=s.regex.toString().slice(1,-1));var a=s.regex,l=RegExp("(?:("+a+")|(.))").exec("a").length-2;Array.isArray(s.token)?1==s.token.length||1==l?s.token=s.token[0]:l-1!=s.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:s,groupCount:l-1}),s.token=s.token[0]):(s.tokenArray=s.token,s.token=null,s.onMatch=this.$arrayTokens):"function"!=typeof s.token||s.onMatch||(l>1?s.onMatch=this.$applyToken:s.onMatch=s.token),l>1&&(/\\\d/.test(s.regex)?a=s.regex.replace(/\\([0-9]+)/g,function(e,n){return"\\"+(parseInt(n,10)+S+1)}):(l=1,a=this.removeCapturingGroups(s.regex)),s.splitRegex||"string"==typeof s.token||o.push(s)),i[S]=g,S+=l,t.push(a),s.onMatch||(s.onMatch=null)}}t.length||(i[0]=0,t.push("$")),o.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,r)},this),this.regExps[n]=RegExp("("+t.join(")|(")+")|($)",r)}}return e.prototype.$setMaxTokenCount=function(e){S=0|e},e.prototype.$applyToken=function(e){var n=this.splitRegex.exec(e).slice(1),D=this.token.apply(this,n);if("string"==typeof D)return[{type:D,value:e}];for(var t=[],S=0,i=D.length;S<i;S++)n[S]&&(t[t.length]={type:D[S],value:n[S]});return t},e.prototype.$arrayTokens=function(e){if(!e)return[];var n=this.splitRegex.exec(e);if(!n)return"text";for(var D=[],t=this.tokenArray,S=0,i=t.length;S<i;S++)n[S+1]&&(D[D.length]={type:t[S],value:n[S+1]});return D},e.prototype.removeCapturingGroups=function(e){return e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(e,n){return n?"(?:":e})},e.prototype.createSplitterRegexp=function(e,n){if(-1!=e.indexOf("(?=")){var D=0,t=!1,S={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,n,i,r,o,g){return t?t="]"!=o:o?t=!0:r?(D==S.stack&&(S.end=g+1,S.stack=-1),D--):i&&(D++,1!=i.length&&(S.stack=D,S.start=g)),e}),null!=S.end&&/^\)*$/.test(e.substr(S.end))&&(e=e.substring(0,S.start)+e.substr(S.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(n||"").replace("g",""))},e.prototype.getLineTokens=function(e,n){if(n&&"string"!=typeof n){var D=n.slice(0);"#tmp"===(n=D[0])&&(D.shift(),n=D.shift())}else var D=[];var t=n||"start",i=this.states[t];i||(t="start",i=this.states[t]);var r=this.matchMappings[t],o=this.regExps[t];o.lastIndex=0;for(var g,s=[],a=0,l=0,c={type:null,value:""};g=o.exec(e);){var u=r.defaultToken,h=null,d=g[0],p=o.lastIndex;if(p-d.length>a){var f=e.substring(a,p-d.length);c.type==u?c.value+=f:(c.type&&s.push(c),c={type:u,value:f})}for(var m=0;m<g.length-2;m++)if(void 0!==g[m+1]){h=i[r[m]],u=h.onMatch?h.onMatch(d,t,D,e):h.token,h.next&&(t="string"==typeof h.next?h.next:h.next(t,D),(i=this.states[t])||(this.reportError("state doesn't exist",t),t="start",i=this.states[t]),r=this.matchMappings[t],a=p,(o=this.regExps[t]).lastIndex=p),h.consumeLineEnd&&(a=p);break}if(d){if("string"==typeof u)h&&!1===h.merge||c.type!==u?(c.type&&s.push(c),c={type:u,value:d}):c.value+=d;else if(u){c.type&&s.push(c),c={type:null,value:""};for(var m=0;m<u.length;m++)s.push(u[m])}}if(a==e.length)break;if(a=p,l++>S){for(l>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:n,line:e});a<e.length;)c.type&&s.push(c),c={value:e.substring(a,a+=500),type:"overflow"};t="start",D=[];break}}return c.type&&s.push(c),D.length>1&&D[0]!==t&&D.unshift("#tmp",t),{tokens:s,state:D.length?D:t}},e}();i.prototype.reportError=t,n.Tokenizer=i}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,n,D){"use strict";var t,S=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,n){if(!n){for(var D in e)this.$rules[D]=e[D];return}for(var D in e){for(var t=e[D],S=0;S<t.length;S++){var i=t[S];(i.next||i.onMatch)&&("string"==typeof i.next&&0!==i.next.indexOf(n)&&(i.next=n+i.next),i.nextState&&0!==i.nextState.indexOf(n)&&(i.nextState=n+i.nextState))}this.$rules[n+D]=t}},this.getRules=function(){return this.$rules},this.embedRules=function(e,n,D,t,i){var r="function"==typeof e?new e().getRules():e;if(t)for(var o=0;o<t.length;o++)t[o]=n+t[o];else for(var g in t=[],r)t.push(n+g);if(this.addRules(r,n),D)for(var s=Array.prototype[i?"push":"unshift"],o=0;o<t.length;o++)s.apply(this.$rules[t[o]],S(D));this.$embeds||(this.$embeds=[]),this.$embeds.push(n)},this.getEmbeds=function(){return this.$embeds};var e=function(e,n){return("start"!=e||n.length)&&n.unshift(this.nextState,e),this.nextState},n=function(e,n){return n.shift(),n.shift()||"start"};this.normalizeRules=function(){var D=0,t=this.$rules;function S(i){var r=t[i];r.processed=!0;for(var o=0;o<r.length;o++){var g=r[o],s=null;Array.isArray(g)&&(s=g,g={}),!g.regex&&g.start&&(g.regex=g.start,g.next||(g.next=[]),g.next.push({defaultToken:g.token},{token:g.token+".end",regex:g.end||g.start,next:"pop"}),g.token=g.token+".start",g.push=!0);var a=g.next||g.push;if(a&&Array.isArray(a)){var l=g.stateName;!l&&("string"!=typeof(l=g.token)&&(l=l[0]||""),t[l]&&(l+=D++)),t[l]=a,g.next=l,S(l)}else"pop"==a&&(g.next=n);if(g.push&&(g.nextState=g.next||g.push,g.next=e,delete g.push),g.rules)for(var c in g.rules)t[c]?t[c].push&&t[c].push.apply(t[c],g.rules[c]):t[c]=g.rules[c];var u="string"==typeof g?g:g.include;if(u&&("$self"===u&&(u="start"),s=Array.isArray(u)?u.map(function(e){return t[e]}):t[u]),s){var h=[o,1].concat(s);g.noEscape&&(h=h.filter(function(e){return!e.next})),r.splice.apply(r,h),o--}g.keywordMap&&(g.token=this.createKeywordMapper(g.keywordMap,g.defaultToken||"text",g.caseInsensitive),delete g.defaultToken)}}Object.keys(t).forEach(S,this)},this.createKeywordMapper=function(e,n,D,t){var S=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(n){for(var i=e[n].split(t||"|"),r=i.length;r--;){var o=i[r];this.$keywordList.push(o),D&&(o=o.toLowerCase()),S[o]=n}},this),e=null,D?function(e){return S[e.toLowerCase()]||n}:function(e){return S[e]||n}},this.getKeywords=function(){return this.$keywords}}).call((t=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),n.TextHighlightRules=t}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,n,D){"use strict";var t;(function(){this.add=function(e,n,D){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][n]=D},this.addBehaviours=function(e){for(var n in e)for(var D in e[n])this.add(n,D,e[n][D])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,n){if("function"==typeof e)var D=new e().getBehaviours(n);else var D=e.getBehaviours(n);this.addBehaviours(D)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var n={},D=0;D<e.length;D++)this.$behaviours[e[D]]&&(n[e[D]]=this.$behaviours[e[D]]);return n}}).call((t=function(){this.$behaviours={}}).prototype),n.Behaviour=t}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("./range").Range;n.TokenIterator=function(){function e(e,n,D){this.$session=e,this.$row=n,this.$rowTokens=e.getTokens(n);var t=e.getTokenAt(n,D);this.$tokenIndex=t?t.index:-1}return e.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},e.prototype.stepForward=function(){var e;for(this.$tokenIndex+=1;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentTokenRow=function(){return this.$row},e.prototype.getCurrentTokenColumn=function(){var e=this.$rowTokens,n=this.$tokenIndex,D=e[n].start;if(void 0!==D)return D;for(D=0;n>0;)n-=1,D+=e[n].value.length;return D},e.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},e.prototype.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],n=this.getCurrentTokenColumn();return new t(this.$row,n,this.$row,n+e.value.length)},e}()}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,n,D){"use strict";var t,S,i=e("../../lib/oop"),r=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,g=e("../../lib/lang"),s=["text","paren.rparen","rparen","paren","punctuation.operator"],a=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],l={},c={'"':'"',"'":"'"},u=function(e){var n=-1;if(e.multiSelect&&(n=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount})),l[n])return t=l[n];t=l[n]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(e,n,D,t){var S=e.end.row-e.start.row;return{text:D+n+t,selection:[0,e.start.column+1,S,e.end.column+ +!S]}};(S=function(e){e=e||{},this.add("braces","insertion",function(n,D,i,r,o){var s=i.getCursorPosition(),a=r.doc.getLine(s.row);if("{"==o){u(i);var l=i.getSelectionRange(),c=r.doc.getTextRange(l),d=r.getTokenAt(s.row,s.column);if(""!==c&&"{"!==c&&i.getWrapBehavioursEnabled())return h(l,c,"{","}");if(d&&/(?:string)\.quasi|\.xml/.test(d.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(d.type)})||/(string)\.quasi/.test(d.type)&&"$"!==d.value[s.column-d.start-1])return;return S.recordAutoInsert(i,r,"}"),{text:"{}",selection:[1,1]}}if(S.isSaneInsertion(i,r))if(/[\]\}\)]/.test(a[s.column])||i.inMultiSelectMode||e.braces)return S.recordAutoInsert(i,r,"}"),{text:"{}",selection:[1,1]};else return S.recordMaybeInsert(i,r,"{"),{text:"{",selection:[1,1]}}else if("}"==o){u(i);var p=a.substring(s.column,s.column+1);if("}"==p&&null!==r.$findOpeningBracket("}",{column:s.column+1,row:s.row})&&S.isAutoInsertedClosing(s,a,o))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==o||"\r\n"==o){u(i);var f="";S.isMaybeInsertedClosing(s,a)&&(f=g.stringRepeat("}",t.maybeInsertedBrackets),S.clearMaybeInsertedClosing());var p=a.substring(s.column,s.column+1);if("}"===p){var m=r.findMatchingBracket({row:s.row,column:s.column+1},"}");if(!m)return null;var y=this.$getIndent(r.getLine(m.row))}else if(!f)return void S.clearMaybeInsertedClosing();else var y=this.$getIndent(a);var v=y+r.getTabString();return{text:"\n"+v+"\n"+y+f,selection:[1,v.length,1,v.length]}}else S.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,n,D,S,i){var r=S.doc.getTextRange(i);if(!i.isMultiLine()&&"{"==r){if(u(D),"}"==S.doc.getLine(i.start.row).substring(i.end.column,i.end.column+1))return i.end.column++,i;t.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,n,D,t,i){if("("==i){u(D);var r=D.getSelectionRange(),o=t.doc.getTextRange(r);if(""!==o&&D.getWrapBehavioursEnabled())return h(r,o,"(",")");if(S.isSaneInsertion(D,t))return S.recordAutoInsert(D,t,")"),{text:"()",selection:[1,1]}}else if(")"==i){u(D);var g=D.getCursorPosition(),s=t.doc.getLine(g.row);if(")"==s.substring(g.column,g.column+1)&&null!==t.$findOpeningBracket(")",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,i))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,n,D,t,S){var i=t.doc.getTextRange(S);if(!S.isMultiLine()&&"("==i&&(u(D),")"==t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)))return S.end.column++,S}),this.add("brackets","insertion",function(e,n,D,t,i){if("["==i){u(D);var r=D.getSelectionRange(),o=t.doc.getTextRange(r);if(""!==o&&D.getWrapBehavioursEnabled())return h(r,o,"[","]");if(S.isSaneInsertion(D,t))return S.recordAutoInsert(D,t,"]"),{text:"[]",selection:[1,1]}}else if("]"==i){u(D);var g=D.getCursorPosition(),s=t.doc.getLine(g.row);if("]"==s.substring(g.column,g.column+1)&&null!==t.$findOpeningBracket("]",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,i))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,n,D,t,S){var i=t.doc.getTextRange(S);if(!S.isMultiLine()&&"["==i&&(u(D),"]"==t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)))return S.end.column++,S}),this.add("string_dquotes","insertion",function(e,n,D,t,S){var i=t.$mode.$quotes||c;if(1==S.length&&i[S]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(S))return;u(D);var r=S,o=D.getSelectionRange(),g=t.doc.getTextRange(o);if(""!==g&&(1!=g.length||!i[g])&&D.getWrapBehavioursEnabled())return h(o,g,r,r);if(!g){var s,a=D.getCursorPosition(),l=t.doc.getLine(a.row),d=l.substring(a.column-1,a.column),p=l.substring(a.column,a.column+1),f=t.getTokenAt(a.row,a.column),m=t.getTokenAt(a.row,a.column+1);if("\\"==d&&f&&/escape/.test(f.type))return null;var y=f&&/string|escape/.test(f.type),v=!m||/string|escape/.test(m.type);if(p==r)(s=y!==v)&&/string\.end/.test(m.type)&&(s=!1);else{if(y&&!v||y&&v)return null;var b=t.$mode.tokenRe;b.lastIndex=0;var w=b.test(d);b.lastIndex=0;var M=b.test(p),L=t.$mode.$pairQuotesAfter;if(!(L&&L[r]&&L[r].test(d))&&w||M||p&&!/[\s;,.})\]\\]/.test(p))return null;var $=l[a.column-2];if(d==r&&($==r||b.test($)))return null;s=!0}return{text:s?r+r:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,n,D,t,S){var i=t.$mode.$quotes||c,r=t.doc.getTextRange(S);if(!S.isMultiLine()&&i.hasOwnProperty(r)&&(u(D),t.doc.getLine(S.start.row).substring(S.start.column+1,S.start.column+2)==r))return S.end.column++,S}),!1!==e.closeDocComment&&this.add("doc comment end","insertion",function(e,n,D,t,S){if("doc-start"===e&&("\n"===S||"\r\n"===S)&&D.selection.isEmpty()){var i=D.getCursorPosition();if(0!==i.column){for(var r=t.doc.getLine(i.row),o=t.doc.getLine(i.row+1),g=t.getTokens(i.row),s=0,a=0;a<g.length;a++){s+=g[a].value.length;var l=g[a];if(s>=i.column){if(s===i.column){if(!/\.doc/.test(l.type))return;if(/\*\//.test(l.value)){var c=g[a+1];if(!c||!/\.doc/.test(c.type))return}}var u=i.column-(s-l.value.length),h=l.value.indexOf("*/"),d=l.value.indexOf("/**",h>-1?h+2:0);if(-1!==d&&u>d&&u<d+3||-1!==h&&-1!==d&&u>=h&&u<=d||!/\.doc/.test(l.type))return;break}}var p=this.$getIndent(r);if(/\s*\*/.test(o))if(/^\s*\*/.test(r))return{text:S+p+"* ",selection:[1,2+p.length,1,2+p.length]};else return{text:S+p+" * ",selection:[1,3+p.length,1,3+p.length]};if(/\/\*\*/.test(r.substring(0,i.column)))return{text:S+p+" * "+S+" "+p+"*/",selection:[1,4+p.length,1,4+p.length]}}}})}).isSaneInsertion=function(e,n){var D=e.getCursorPosition(),t=new o(n,D.row,D.column);if(!this.$matchTokenType(t.getCurrentToken()||"text",s)){if(/[)}\]]/.test(e.session.getLine(D.row)[D.column]))return!0;var S=new o(n,D.row,D.column+1);if(!this.$matchTokenType(S.getCurrentToken()||"text",s))return!1}return t.stepForward(),t.getCurrentTokenRow()!==D.row||this.$matchTokenType(t.getCurrentToken()||"text",a)},S.$matchTokenType=function(e,n){return n.indexOf(e.type||e)>-1},S.recordAutoInsert=function(e,n,D){var S=e.getCursorPosition(),i=n.doc.getLine(S.row);this.isAutoInsertedClosing(S,i,t.autoInsertedLineEnd[0])||(t.autoInsertedBrackets=0),t.autoInsertedRow=S.row,t.autoInsertedLineEnd=D+i.substr(S.column),t.autoInsertedBrackets++},S.recordMaybeInsert=function(e,n,D){var S=e.getCursorPosition(),i=n.doc.getLine(S.row);this.isMaybeInsertedClosing(S,i)||(t.maybeInsertedBrackets=0),t.maybeInsertedRow=S.row,t.maybeInsertedLineStart=i.substr(0,S.column)+D,t.maybeInsertedLineEnd=i.substr(S.column),t.maybeInsertedBrackets++},S.isAutoInsertedClosing=function(e,n,D){return t.autoInsertedBrackets>0&&e.row===t.autoInsertedRow&&D===t.autoInsertedLineEnd[0]&&n.substr(e.column)===t.autoInsertedLineEnd},S.isMaybeInsertedClosing=function(e,n){return t.maybeInsertedBrackets>0&&e.row===t.maybeInsertedRow&&n.substr(e.column)===t.maybeInsertedLineEnd&&n.substr(0,e.column)==t.maybeInsertedLineStart},S.popAutoInsertedClosing=function(){t.autoInsertedLineEnd=t.autoInsertedLineEnd.substr(1),t.autoInsertedBrackets--},S.clearMaybeInsertedClosing=function(){t&&(t.maybeInsertedBrackets=0,t.maybeInsertedRow=-1)},i.inherits(S,r),n.CstyleBehaviour=S}),ace.define("ace/unicode",["require","exports","module"],function(e,n,D){"use strict";for(var t=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],S=0,i=[],r=0;r<t.length;r+=2)i.push(S+=t[r]),t[r+1]&&i.push(45,S+=t[r+1]);n.wordChars=String.fromCharCode.apply(null,i)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,n,D){"use strict";var t,S=e("../config"),i=e("../tokenizer").Tokenizer,r=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,g=e("../unicode"),s=e("../lib/lang"),a=e("../token_iterator").TokenIterator,l=e("../range").Range;(function(){this.$defaultBehaviour=new o,this.tokenRe=RegExp("^["+g.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+g.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new i(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,n,D,t){var S=n.doc,i=!0,r=!0,o=1/0,g=n.getTabSize(),a=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var l=this.lineCommentStart.map(s.escapeRegExp).join("|"),c=this.lineCommentStart[0];else var l=s.escapeRegExp(this.lineCommentStart),c=this.lineCommentStart;l=RegExp("^(\\s*)(?:"+l+") ?"),a=n.getUseSoftTabs();var u=function(e,n){var D=e.match(l);if(D){var t=D[1].length,i=D[0].length;!f(e,t,i)&&" "==D[0][i-1]&&i--,S.removeInLine(n,t,i)}},h=c+" ",d=function(e,n){(!i||/\S/.test(e))&&(f(e,o,o)?S.insertInLine({row:n,column:o},h):S.insertInLine({row:n,column:o},c))},p=function(e,n){return l.test(e)},f=function(e,n,D){for(var t=0;n--&&" "==e.charAt(n);)t++;if(t%g!=0)return!1;for(var t=0;" "==e.charAt(D++);)t++;return g>2?t%g!=g-1:t%g==0}}else{if(!this.blockComment)return!1;var c=this.blockComment.start,m=this.blockComment.end,l=RegExp("^(\\s*)(?:"+s.escapeRegExp(c)+")"),y=RegExp("(?:"+s.escapeRegExp(m)+")\\s*$"),d=function(e,n){!p(e,n)&&(!i||/\S/.test(e))&&(S.insertInLine({row:n,column:e.length},m),S.insertInLine({row:n,column:o},c))},u=function(e,n){var D;(D=e.match(y))&&S.removeInLine(n,e.length-D[0].length,e.length),(D=e.match(l))&&S.removeInLine(n,D[1].length,D[0].length)},p=function(e,D){if(l.test(e))return!0;for(var t=n.getTokens(D),S=0;S<t.length;S++)if("comment"===t[S].type)return!0}}function v(e){for(var n=D;n<=t;n++)e(S.getLine(n),n)}var b=1/0;v(function(e,n){var D=e.search(/\S/);-1!==D?(D<o&&(o=D),r&&!p(e,n)&&(r=!1)):b>e.length&&(b=e.length)}),o==1/0&&(o=b,i=!1,r=!1),a&&o%g!=0&&(o=Math.floor(o/g)*g),v(r?u:d)},this.toggleBlockComment=function(e,n,D,t){var S=this.blockComment;if(S){!S.start&&S[0]&&(S=S[0]);var i=new a(n,t.row,t.column),r=i.getCurrentToken();n.selection;var o=n.selection.toOrientedRange();if(r&&/comment/.test(r.type)){for(;r&&/comment/.test(r.type);){var g,s,c,u,h=r.value.indexOf(S.start);if(-1!=h){var d=i.getCurrentTokenRow(),p=i.getCurrentTokenColumn()+h;c=new l(d,p,d,p+S.start.length);break}r=i.stepBackward()}for(var i=new a(n,t.row,t.column),r=i.getCurrentToken();r&&/comment/.test(r.type);){var h=r.value.indexOf(S.end);if(-1!=h){var d=i.getCurrentTokenRow(),p=i.getCurrentTokenColumn()+h;u=new l(d,p,d,p+S.end.length);break}r=i.stepForward()}u&&n.remove(u),c&&(n.remove(c),g=c.start.row,s=-S.start.length)}else s=S.start.length,g=D.start.row,n.insert(D.end,S.end),n.insert(D.start,S.start);o.start.row==g&&(o.start.column+=s),o.end.row==g&&(o.end.column+=s),n.selection.fromOrientedRange(o)}},this.getNextLineIndent=function(e,n,D){return this.$getIndent(n)},this.checkOutdent=function(e,n,D){return!1},this.autoOutdent=function(e,n,D){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var n in this.$embeds=[],this.$modes={},e)if(e[n]){var D=e[n],t=D.prototype.$id,i=S.$modes[t];i||(S.$modes[t]=i=new D),S.$modes[n]||(S.$modes[n]=i),this.$embeds.push(n),this.$modes[n]=i}for(var r=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],o=function(e){!function(n){var D=r[e],t=n[D];n[r[e]]=function(){return this.$delegator(D,arguments,t)}}(g)},g=this,n=0;n<r.length;n++)o(n)},this.$delegator=function(e,n,D){var t=n[0]||"start";if("string"!=typeof t){if(Array.isArray(t[2])){var S=t[2][t[2].length-1],i=this.$modes[S];if(i)return i[e].apply(i,[t[1]].concat([].slice.call(n,1)))}t=t[0]||"start"}for(var r=0;r<this.$embeds.length;r++)if(this.$modes[this.$embeds[r]]){var o=t.split(this.$embeds[r]);if(!o[0]&&o[1]){n[0]=o[1];var i=this.$modes[this.$embeds[r]];return i[e].apply(i,n)}}var g=D.apply(this,n);return D?g:void 0},this.transformAction=function(e,n,D,t,S){if(this.$behaviour){var i=this.$behaviour.getBehaviours();for(var r in i)if(i[r][n]){var o=i[r][n].apply(this,arguments);if(o)return o}}},this.getKeywords=function(e){if(!this.completionKeywords){var n=this.$tokenizer.rules,D=[];for(var t in n)for(var S=n[t],i=0,r=S.length;i<r;i++)if("string"==typeof S[i].token)/keyword|support|storage/.test(S[i].token)&&D.push(S[i].regex);else if("object"==typeof S[i].token){for(var o=0,g=S[i].token.length;o<g;o++)if(/keyword|support|storage/.test(S[i].token[o])){var t=S[i].regex.match(/\(.+?\)/g)[o];D.push(t.substr(1,t.length-2))}}this.completionKeywords=D}return e?D.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,n,D,t){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((t=function(){this.HighlightRules=r}).prototype),n.Mode=t}),ace.define("ace/apply_delta",["require","exports","module"],function(e,n,D){"use strict";n.applyDelta=function(e,n,D){var t=n.start.row,S=n.start.column,i=e[t]||"";switch(n.action){case"insert":if(1===n.lines.length)e[t]=i.substring(0,S)+n.lines[0]+i.substring(S);else{var r=[t,1].concat(n.lines);e.splice.apply(e,r),e[t]=i.substring(0,S)+e[t],e[t+n.lines.length-1]+=i.substring(S)}break;case"remove":var o=n.end.column,g=n.end.row;t===g?e[t]=i.substring(0,S)+i.substring(o):e.splice(t,g-t+1,i.substring(0,S)+e[g].substring(o))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,i=function(){function e(e,n,D){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof n?this.setPosition(n.row,n.column):this.setPosition(n,D)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(e){if((e.start.row!=e.end.row||e.start.row==this.row)&&!(e.start.row>this.row)){var n=o(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)}},e.prototype.setPosition=function(e,n,D){if(t=D?{row:e,column:n}:this.$clipPositionToDocument(e,n),this.row!=t.row||this.column!=t.column){var t,S={row:this.row,column:this.column};this.row=t.row,this.column=t.column,this._signal("change",{old:S,value:t})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(e,n){var D={};return e>=this.document.getLength()?(D.row=Math.max(0,this.document.getLength()-1),D.column=this.document.getLine(D.row).length):e<0?(D.row=0,D.column=0):(D.row=e,D.column=Math.min(this.document.getLine(D.row).length,Math.max(0,n))),n<0&&(D.column=0),D},e}();function r(e,n,D){var t=D?e.column<=n.column:e.column<n.column;return e.row<n.row||e.row==n.row&&t}function o(e,n,D){var t="insert"==e.action,S=(t?1:-1)*(e.end.row-e.start.row),i=(t?1:-1)*(e.end.column-e.start.column),o=e.start,g=t?o:e.end;return r(n,o,D)?{row:n.row,column:n.column}:r(g,n,!D)?{row:n.row+S,column:n.column+(n.row==g.row?i:0)}:{row:o.row,column:o.column}}i.prototype.$insertRight=!1,t.implement(i.prototype,S),n.Anchor=i}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./apply_delta").applyDelta,i=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=e("./anchor").Anchor,g=function(){function e(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return e.prototype.setValue=function(e){var n=this.getLength()-1;this.remove(new r(0,0,n,this.getLine(n).length)),this.insert({row:0,column:0},e||"")},e.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},e.prototype.createAnchor=function(e,n){return new o(this,e,n)},e.prototype.$detectNewLine=function(e){var n=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=n?n[1]:"\n",this._signal("changeNewLineMode")},e.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},e.prototype.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},e.prototype.getNewLineMode=function(){return this.$newLineMode},e.prototype.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},e.prototype.getLine=function(e){return this.$lines[e]||""},e.prototype.getLines=function(e,n){return this.$lines.slice(e,n+1)},e.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},e.prototype.getLength=function(){return this.$lines.length},e.prototype.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},e.prototype.getLinesForRange=function(e){var n;if(e.start.row===e.end.row)n=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(n=this.getLines(e.start.row,e.end.row))[0]=(n[0]||"").substring(e.start.column);var D=n.length-1;e.end.row-e.start.row==D&&(n[D]=n[D].substring(0,e.end.column))}return n},e.prototype.insertLines=function(e,n){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,n)},e.prototype.removeLines=function(e,n){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,n)},e.prototype.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},e.prototype.insert=function(e,n){return 1>=this.getLength()&&this.$detectNewLine(n),this.insertMergedLines(e,this.$split(n))},e.prototype.insertInLine=function(e,n){var D=this.clippedPos(e.row,e.column),t=this.pos(e.row,e.column+n.length);return this.applyDelta({start:D,end:t,action:"insert",lines:[n]},!0),this.clonePos(t)},e.prototype.clippedPos=function(e,n){var D=this.getLength();void 0===e?e=D:e<0?e=0:e>=D&&(e=D-1,n=void 0);var t=this.getLine(e);return void 0==n&&(n=t.length),{row:e,column:n=Math.min(Math.max(n,0),t.length)}},e.prototype.clonePos=function(e){return{row:e.row,column:e.column}},e.prototype.pos=function(e,n){return{row:e,column:n}},e.prototype.$clipPosition=function(e){var n=this.getLength();return e.row>=n?(e.row=Math.max(0,n-1),e.column=this.getLine(n-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},e.prototype.insertFullLines=function(e,n){e=Math.min(Math.max(e,0),this.getLength());var D=0;e<this.getLength()?(n=n.concat([""]),D=0):(n=[""].concat(n),e--,D=this.$lines[e].length),this.insertMergedLines({row:e,column:D},n)},e.prototype.insertMergedLines=function(e,n){var D=this.clippedPos(e.row,e.column),t={row:D.row+n.length-1,column:(1==n.length?D.column:0)+n[n.length-1].length};return this.applyDelta({start:D,end:t,action:"insert",lines:n}),this.clonePos(t)},e.prototype.remove=function(e){var n=this.clippedPos(e.start.row,e.start.column),D=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:n,end:D,action:"remove",lines:this.getLinesForRange({start:n,end:D})}),this.clonePos(n)},e.prototype.removeInLine=function(e,n,D){var t=this.clippedPos(e,n),S=this.clippedPos(e,D);return this.applyDelta({start:t,end:S,action:"remove",lines:this.getLinesForRange({start:t,end:S})},!0),this.clonePos(t)},e.prototype.removeFullLines=function(e,n){e=Math.min(Math.max(0,e),this.getLength()-1);var D=(n=Math.min(Math.max(0,n),this.getLength()-1))==this.getLength()-1&&e>0,t=n<this.getLength()-1,S=D?e-1:e,i=D?this.getLine(S).length:0,o=t?n+1:n,g=t?0:this.getLine(o).length,s=new r(S,i,o,g),a=this.$lines.slice(e,n+1);return this.applyDelta({start:s.start,end:s.end,action:"remove",lines:this.getLinesForRange(s)}),a},e.prototype.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},e.prototype.replace=function(e,n){var D;return(e instanceof r||(e=r.fromPoints(e.start,e.end)),0===n.length&&e.isEmpty())?e.start:n==this.getTextRange(e)?e.end:(this.remove(e),D=n?this.insert(e.start,n):e.start)},e.prototype.applyDeltas=function(e){for(var n=0;n<e.length;n++)this.applyDelta(e[n])},e.prototype.revertDeltas=function(e){for(var n=e.length-1;n>=0;n--)this.revertDelta(e[n])},e.prototype.applyDelta=function(e,n){var D="insert"==e.action;(D?!(e.lines.length<=1)||e.lines[0]:r.comparePoints(e.start,e.end))&&(D&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(S(this.$lines,e,n),this._signal("change",e)))},e.prototype.$safeApplyDelta=function(e){var n=this.$lines.length;("remove"==e.action&&e.start.row<n&&e.end.row<n||"insert"==e.action&&e.start.row<=n)&&this.applyDelta(e)},e.prototype.$splitAndapplyLargeDelta=function(e,n){for(var D=e.lines,t=D.length-n+1,S=e.start.row,i=e.start.column,r=0,o=0;r<t;r=o){o+=n-1;var g=D.slice(r,o);g.push(""),this.applyDelta({start:this.pos(S+r,i),end:this.pos(S+o,i=0),action:e.action,lines:g},!0)}e.lines=D.slice(r),e.start.row=S+r,e.start.column=i,this.applyDelta(e,!0)},e.prototype.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},e.prototype.indexToPosition=function(e,n){for(var D=this.$lines||this.getAllLines(),t=this.getNewLineCharacter().length,S=n||0,i=D.length;S<i;S++)if((e-=D[S].length+t)<0)return{row:S,column:e+D[S].length+t};return{row:i-1,column:e+D[i-1].length+t}},e.prototype.positionToIndex=function(e,n){for(var D=this.$lines||this.getAllLines(),t=this.getNewLineCharacter().length,S=0,i=Math.min(e.row,D.length),r=n||0;r<i;++r)S+=D[r].length+t;return S+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();g.prototype.$autoNewLine="",g.prototype.$newLineMode="auto",t.implement(g.prototype,i),n.Document=g}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,i=function(){function e(e,n){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var D=this;this.$worker=function(){if(D.running){for(var e=new Date,n=D.currentLine,t=-1,S=D.doc,i=n;D.lines[n];)n++;var r=S.getLength(),o=0;for(D.running=!1;n<r;){D.$tokenizeRow(n),t=n;do n++;while(D.lines[n]);if(++o%5==0&&new Date-e>20){D.running=setTimeout(D.$worker,20);break}}D.currentLine=n,-1==t&&(t=n),i<=t&&D.fireUpdateEvent(i,t)}}}return e.prototype.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},e.prototype.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},e.prototype.fireUpdateEvent=function(e,n){var D={first:e,last:n};this._signal("update",{data:D})},e.prototype.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},e.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},e.prototype.$updateOnChange=function(e){var n=e.start.row,D=e.end.row-n;if(0===D)this.lines[n]=null;else if("remove"==e.action)this.lines.splice(n,D+1,null),this.states.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.lines.splice.apply(this.lines,t),this.states.splice.apply(this.states,t)}this.currentLine=Math.min(n,this.currentLine,this.doc.getLength()),this.stop()},e.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},e.prototype.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},e.prototype.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},e.prototype.$tokenizeRow=function(e){var n=this.doc.getLine(e),D=this.states[e-1],t=this.tokenizer.getLineTokens(n,D,e);return this.states[e]+""!=t.state+""?(this.states[e]=t.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=t.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();t.implement(i.prototype,S),n.BackgroundTokenizer=i}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,n,D){"use strict";var t=e("./lib/lang"),S=e("./range").Range,i=function(){function e(e,n,D){void 0===D&&(D="text"),this.setRegexp(e),this.clazz=n,this.type=D}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,n,D,i){if(this.regExp)for(var r=i.firstRow,o=i.lastRow,g={},s=r;s<=o;s++){var a=this.cache[s];null==a&&((a=t.getMatchOffsets(D.getLine(s),this.regExp)).length>this.MAX_RANGES&&(a=a.slice(0,this.MAX_RANGES)),a=a.map(function(e){return new S(s,e.offset,s,e.offset+e.length)}),this.cache[s]=a.length?a:"");for(var l=a.length;l--;){var c=a[l].toScreenRange(D),u=c.toString();g[u]||(g[u]=!0,n.drawSingleLineMarker(e,c,this.clazz,i))}}},e}();i.prototype.MAX_RANGES=500,n.SearchHighlight=i}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=function(){function e(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return e.prototype.addSession=function(e){this.$session=e},e.prototype.add=function(e,n,D){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===n||!this.lastDeltas){this.lastDeltas=[];var t=this.$undoStack.length;t>this.$undoDepth-1&&this.$undoStack.splice(0,t-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev}("remove"==e.action||"insert"==e.action)&&(this.$lastDelta=e),this.lastDeltas.push(e)}},e.prototype.addSelection=function(e,n){this.selections.push({value:e,rev:n||this.$rev})},e.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},e.prototype.markIgnored=function(e,n){null==n&&(n=this.$rev+1);for(var D=this.$undoStack,t=D.length;t--;){var S=D[t][0];if(S.id<=e)break;S.id<n&&(S.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,n){for(var D=this.selections,t=D.length;t--;){var S=D[t];if(S.rev<e)return n&&(S=D[t+1]),S}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,n){null==n&&(n=this.$rev+1);for(var D=this.$undoStack,t=null,S=0,i=D.length;i--;){var r=D[i][0];if(r.id<n&&!t&&(t=i+1),r.id<=e){S=i+1;break}}return D.slice(S,t)},e.prototype.getChangedRanges=function(e,n){null==n&&(n=this.$rev+1)},e.prototype.getChangedLines=function(e,n){null==n&&(n=this.$rev+1)},e.prototype.undo=function(e,n){this.lastDeltas=null;var D=this.$undoStack;if(S(D,D.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var t=D.pop(),i=null;return t&&(i=e.undoChanges(t,n),this.$redoStack.push(t),this.$syncRev()),this.$fromUndo=!1,i}},e.prototype.redo=function(e,n){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var D=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);m(this.$redoStack,D),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var t=this.$redoStack.pop(),S=null;return t&&(S=e.redoChanges(t,n),this.$undoStack.push(t),this.$syncRev()),this.$fromUndo=!1,S},e.prototype.$syncRev=function(){var e=this.$undoStack,n=e[e.length-1],D=n&&n[0].id||0;this.$redoStackBaseRev=D,this.$rev=D},e.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},e.prototype.canUndo=function(){return this.$undoStack.length>0},e.prototype.canRedo=function(){return this.$redoStack.length>0},e.prototype.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},e.prototype.isAtBookmark=function(){return this.$rev===this.mark},e.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},e.prototype.fromJSON=function(e){this.reset(),this.$undoStack=e.$undoStack,this.$redoStack=e.$redoStack},e.prototype.$prettyPrint=function(e){return e?s(e):s(this.$undoStack)+"\n---\n"+s(this.$redoStack)},e}();function S(e,n){for(var D=n;D--;){var t=e[D];if(t&&!t[0].ignore){for(;D<n-1;){var S=c(e[D],e[D+1]);e[D]=S[0],e[D+1]=S[1],D++}return!0}}}t.prototype.hasUndo=t.prototype.canUndo,t.prototype.hasRedo=t.prototype.canRedo,t.prototype.isClean=t.prototype.isAtBookmark,t.prototype.markClean=t.prototype.bookmark;var i=e("./range").Range,r=i.comparePoints;function o(e){return{row:e.row,column:e.column}}function g(e){return{start:o(e.start),end:o(e.end),action:e.action,lines:e.lines.slice()}}function s(e){if(Array.isArray(e=e||this))return e.map(s).join("\n");var n="";return e.action?n=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(n=Array.isArray(e.value)?e.value.map(a).join("\n"):a(e.value)),e.start&&(n+=a(e)),(e.id||e.rev)&&(n+=" ("+(e.id||e.rev)+")"),n}function a(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function l(e,n){var D="insert"==e.action,t="insert"==n.action;if(D&&t)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.start,e.start)))return null;h(e,n,1)}else if(D&&!t)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.end,e.start)))return null;h(e,n,-1)}else if(!D&&t)if(r(n.start,e.start)>=0)h(n,e,1);else{if(!(0>=r(n.start,e.start)))return null;h(e,n,1)}else if(!D&&!t)if(r(n.start,e.start)>=0)h(n,e,1);else{if(!(0>=r(n.end,e.start)))return null;h(e,n,-1)}return[n,e]}function c(e,n){for(var D=e.length;D--;)for(var t=0;t<n.length;t++)if(!l(e[D],n[t])){for(;D<e.length;){for(;t--;)l(n[t],e[D]);t=n.length,D++}return[e,n]}return e.selectionBefore=n.selectionBefore=e.selectionAfter=n.selectionAfter=null,[n,e]}function u(e,n){var D,t,S="insert"==e.action,o="insert"==n.action;if(S&&o)0>r(e.start,n.start)?h(n,e,1):h(e,n,1);else if(S&&!o)r(e.start,n.end)>=0?h(e,n,-1):(0>=r(e.start,n.start)||h(e,i.fromPoints(n.start,e.start),-1),h(n,e,1));else if(!S&&o)r(n.start,e.end)>=0?h(n,e,-1):(0>=r(n.start,e.start)||h(n,i.fromPoints(e.start,n.start),-1),h(e,n,1));else if(!S&&!o)if(r(n.start,e.end)>=0)h(n,e,-1);else{if(!(0>=r(n.end,e.start)))return 0>r(e.start,n.start)&&(D=e,e=p(e,n.start)),r(e.end,n.end)>0&&(t=p(e,n.end)),d(n.end,e.start,e.end,-1),t&&!D&&(e.lines=t.lines,e.start=t.start,e.end=t.end,t=e),[n,D,t].filter(Boolean);h(e,n,-1)}return[n,e]}function h(e,n,D){d(e.start,n.start,n.end,D),d(e.end,n.start,n.end,D)}function d(e,n,D,t){e.row==(1==t?n:D).row&&(e.column+=t*(D.column-n.column)),e.row+=t*(D.row-n.row)}function p(e,n){var D=e.lines,t=e.end;e.end=o(n);var S=e.end.row-e.start.row,i=D.splice(S,D.length),r=S?n.column:n.column-e.start.column;return D.push(i[0].substring(0,r)),i[0]=i[0].substr(r),{start:o(n),end:t,lines:i,action:e.action}}function f(e,n){n=g(n);for(var D=e.length;D--;){for(var t=e[D],S=0;S<t.length;S++){var i=u(t[S],n);n=i[0],2!=i.length&&(i[2]?(t.splice(S+1,1,i[1],i[2]),S++):!i[1]&&(t.splice(S,1),S--))}t.length||e.splice(D,1)}return e}function m(e,n){for(var D=0;D<n.length;D++)for(var t=n[D],S=0;S<t.length;S++)f(e,t[S])}i.comparePoints,n.UndoManager=t}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("../range").Range;n.FoldLine=function(){function e(e,n){this.foldData=e,Array.isArray(n)?this.folds=n:n=this.folds=[n];var D=n[n.length-1];this.range=new t(n[0].start.row,n[0].start.column,D.end.row,D.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}return e.prototype.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(n){n.start.row+=e,n.end.row+=e})},e.prototype.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,n){return-e.range.compareEnd(n.start.row,n.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):0>this.range.compareStart(e.end.row,e.end.column)&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else if(e.end.row==this.start.row)this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column;else throw Error("Trying to add fold to FoldRow that doesn't have a matching row");e.foldLine=this},e.prototype.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},e.prototype.walk=function(e,n,D){var t,S,i,r=0,o=this.folds,g=!0;null==n&&(n=this.end.row,D=this.end.column);for(var s=0;s<o.length;s++){if(-1==(S=(t=o[s]).range.compareStart(n,D)))return void e(null,n,D,r,g);if((i=!(i=e(null,t.start.row,t.start.column,r,g))&&e(t.placeholder,t.start.row,t.start.column,r))||0===S)return;g=!t.sameRow,r=t.end.column}e(null,n,D,r,g)},e.prototype.getNextFoldTo=function(e,n){for(var D,t,S=0;S<this.folds.length;S++){if(-1==(t=(D=this.folds[S]).range.compareEnd(e,n)))return{fold:D,kind:"after"};if(0===t)return{fold:D,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,n,D){var t,S,i=this.getNextFoldTo(e,n);if(i){if(t=i.fold,"inside"==i.kind&&t.start.column!=n&&t.start.row!=e)window.console&&window.console.log(e,n,t);else if(t.start.row==e){var r=(S=this.folds).indexOf(t);for(0===r&&(this.start.column+=D);r<S.length;r++){if(t=S[r],t.start.column+=D,!t.sameRow)return;t.end.column+=D}this.end.column+=D}}},e.prototype.split=function(n,D){var t=this.getNextFoldTo(n,D);if(!t||"inside"==t.kind)return null;var S=t.fold,i=this.folds,r=this.foldData,o=i.indexOf(S),g=i[o-1];this.end.row=g.end.row,this.end.column=g.end.column;var s=new e(r,i=i.splice(o,i.length-o));return r.splice(r.indexOf(this)+1,0,s),s},e.prototype.merge=function(e){for(var n=e.folds,D=0;D<n.length;D++)this.addFold(n[D]);var t=this.foldData;t.splice(t.indexOf(e),1)},e.prototype.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(n){e.push(" "+n.toString())}),e.push("]"),e.join("\n")},e.prototype.idxToPosition=function(e){for(var n=0,D=0;D<this.folds.length;D++){var t=this.folds[D];if((e-=t.start.column-n)<0)return{row:t.start.row,column:t.start.column+e};if((e-=t.placeholder.length)<0)return t.start;n=t.end.column}return{row:this.end.row,column:this.end.column+e}},e}()}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("./range").Range.comparePoints,S=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,n,D){for(var S=this.ranges,i=D||0;i<S.length;i++){var r=S[i],o=t(e,r.end);if(!(o>0)){var g=t(e,r.start);if(0===o)return n&&0!==g?-i-2:i;if(g>0||0===g&&!n)return i;break}}return-i-1},e.prototype.add=function(e){var n=!e.isEmpty(),D=this.pointIndex(e.start,n);D<0&&(D=-D-1);var t=this.pointIndex(e.end,n,D);return t<0?t=-t-1:t++,this.ranges.splice(D,t-D,e)},e.prototype.addList=function(e){for(var n=[],D=e.length;D--;)n.push.apply(n,this.add(e[D]));return n},e.prototype.substractPoint=function(e){var n=this.pointIndex(e);if(n>=0)return this.ranges.splice(n,1)},e.prototype.merge=function(){for(var e,n=[],D=this.ranges,S=(D=D.sort(function(e,n){return t(e.start,n.start)}))[0],i=1;i<D.length;i++){e=S,S=D[i];var r=t(e.end,S.start);!(r<0)&&(0!=r||e.isEmpty()||S.isEmpty())&&(0>t(e.end,S.end)&&(e.end.row=S.end.row,e.end.column=S.end.column),D.splice(i,1),n.push(S),S=e,i--)}return this.ranges=D,n},e.prototype.contains=function(e,n){return this.pointIndex({row:e,column:n})>=0},e.prototype.containsPoint=function(e){return this.pointIndex(e)>=0},e.prototype.rangeAtPoint=function(e){var n=this.pointIndex(e);if(n>=0)return this.ranges[n]},e.prototype.clipRows=function(e,n){var D=this.ranges;if(D[0].start.row>n||D[D.length-1].start.row<e)return[];var t=this.pointIndex({row:e,column:0});t<0&&(t=-t-1);var S=this.pointIndex({row:n,column:0},t);S<0&&(S=-S-1);for(var i=[],r=t;r<S;r++)i.push(D[r]);return i},e.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},e.prototype.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},e.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},e.prototype.$onChange=function(e){for(var n=e.start,D=e.end,t=n.row,S=D.row,i=this.ranges,r=0,o=i.length;r<o;r++){var g=i[r];if(g.end.row>=t)break}if("insert"==e.action)for(var s=S-t,a=-n.column+D.column;r<o;r++){var g=i[r];if(g.start.row>t)break;if(g.start.row==t&&g.start.column>=n.column&&(g.start.column==n.column&&this.$bias<=0||(g.start.column+=a,g.start.row+=s)),g.end.row==t&&g.end.column>=n.column){if(g.end.column==n.column&&this.$bias<0)continue;g.end.column==n.column&&a>0&&r<o-1&&g.end.column>g.start.column&&g.end.column==i[r+1].start.column&&(g.end.column-=a),g.end.column+=a,g.end.row+=s}}else for(var s=t-S,a=n.column-D.column;r<o;r++){var g=i[r];if(g.start.row>S)break;g.end.row<S&&(t<g.end.row||t==g.end.row&&n.column<g.end.column)?(g.end.row=t,g.end.column=n.column):g.end.row==S?g.end.column<=D.column?(s||g.end.column>n.column)&&(g.end.column=n.column,g.end.row=n.row):(g.end.column+=a,g.end.row+=s):g.end.row>S&&(g.end.row+=s),g.start.row<S&&(t<g.start.row||t==g.start.row&&n.column<g.start.column)?(g.start.row=t,g.start.column=n.column):g.start.row==S?g.start.column<=D.column?(s||g.start.column>n.column)&&(g.start.column=n.column,g.start.row=n.row):(g.start.column+=a,g.start.row+=s):g.start.row>S&&(g.start.row+=s)}if(0!=s&&r<o)for(;r<o;r++){var g=i[r];g.start.row+=s,g.end.row+=s}},e}();S.prototype.comparePoints=t,n.RangeList=S}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}();function S(e,n){e.row-=n.row,0==e.row&&(e.column-=n.column)}function i(e,n){S(e.start,n),S(e.end,n)}function r(e,n){0==e.row&&(e.column+=n.column),e.row+=n.row}function o(e,n){r(e.start,n),r(e.end,n)}n.Fold=function(e){function n(n,D){var t=e.call(this)||this;return t.foldLine=null,t.placeholder=D,t.range=n,t.start=n.start,t.end=n.end,t.sameRow=n.start.row==n.end.row,t.subFolds=t.ranges=[],t}return t(n,e),n.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},n.prototype.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(n){n.setFoldLine(e)})},n.prototype.clone=function(){var e=new n(this.range.clone(),this.placeholder);return this.subFolds.forEach(function(n){e.subFolds.push(n.clone())}),e.collapseChildren=this.collapseChildren,e},n.prototype.addSubFold=function(e){if(!this.range.isEqual(e)){i(e,this.start);for(var n=e.start.row,D=e.start.column,t=0,S=-1;t<this.subFolds.length&&1==(S=this.subFolds[t].range.compare(n,D));t++);var r=this.subFolds[t],o=0;if(0==S)if(r.range.containsRange(e))return r.addSubFold(e);else o=1;for(var n=e.range.end.row,D=e.range.end.column,g=t,S=-1;g<this.subFolds.length&&1==(S=this.subFolds[g].range.compare(n,D));g++);0==S&&g++;for(var s=this.subFolds.splice(t,g-t,e),a=0==S?s.length-1:s.length,l=o;l<a;l++)e.addSubFold(s[l]);return e.setFoldLine(this.foldLine),e}},n.prototype.restoreRange=function(e){return o(e,this.start)},n}(e("../range_list").RangeList)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(e,n,D){"use strict";var t=e("../range").Range,S=e("./fold_line").FoldLine,i=e("./fold").Fold,r=e("../token_iterator").TokenIterator,o=e("../mouse/mouse_event").MouseEvent;n.Folding=function(){this.getFoldAt=function(e,n,D){var t=this.getFoldLine(e);if(!t)return null;for(var S=t.folds,i=0;i<S.length;i++){var r=S[i].range;if(r.contains(e,n)){if(1==D&&r.isEnd(e,n)&&!r.isEmpty()||-1==D&&r.isStart(e,n)&&!r.isEmpty())continue;return S[i]}}},this.getFoldsInRange=function(e){var n=e.start,D=e.end,t=this.$foldData,S=[];n.column+=1,D.column-=1;for(var i=0;i<t.length;i++){var r=t[i].range.compareRange(e);if(2!=r){if(-2==r)break;for(var o=t[i].folds,g=0;g<o.length;g++){var s=o[g];if(-2==(r=s.range.compareRange(e)))break;if(2!=r){if(42==r)break;S.push(s)}}}}return n.column-=1,D.column+=1,S},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var n=[];e.forEach(function(e){n=n.concat(this.getFoldsInRange(e))},this)}else var n=this.getFoldsInRange(e);return n},this.getAllFolds=function(){for(var e=[],n=this.$foldData,D=0;D<n.length;D++)for(var t=0;t<n[D].folds.length;t++)e.push(n[D].folds[t]);return e},this.getFoldStringAt=function(e,n,D,t){if(!(t=t||this.getFoldLine(e)))return null;for(var S,i,r={end:{column:0}},o=0;o<t.folds.length;o++){var g=(i=t.folds[o]).range.compareEnd(e,n);if(-1==g){S=this.getLine(i.start.row).substring(r.end.column,i.start.column);break}if(0===g)return null;r=i}return(S||(S=this.getLine(i.start.row).substring(r.end.column)),-1==D)?S.substring(0,n-r.end.column):1==D?S.substring(n-r.end.column):S},this.getFoldLine=function(e,n){var D=this.$foldData,t=0;for(n&&(t=D.indexOf(n)),-1==t&&(t=0);t<D.length;t++){var S=D[t];if(S.start.row<=e&&S.end.row>=e)return S;if(S.end.row>e)break}return null},this.getNextFoldLine=function(e,n){var D=this.$foldData,t=0;for(n&&(t=D.indexOf(n)),-1==t&&(t=0);t<D.length;t++){var S=D[t];if(S.end.row>=e)return S}return null},this.getFoldedRowCount=function(e,n){for(var D=this.$foldData,t=n-e+1,S=0;S<D.length;S++){var i=D[S],r=i.end.row,o=i.start.row;if(r>=n){o<n&&(o>=e?t-=n-o:t=0);break}r>=e&&(o>=e?t-=r-o:t-=r-e+1)}return t},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,n){return e.start.row-n.start.row}),e},this.addFold=function(e,n){var D,t=this.$foldData,r=!1;e instanceof i?D=e:(D=new i(n,e)).collapseChildren=n.collapseChildren,this.$clipRangeToDocument(D.range);var o=D.start.row,g=D.start.column,s=D.end.row,a=D.end.column,l=this.getFoldAt(o,g,1),c=this.getFoldAt(s,a,-1);if(l&&c==l)return l.addSubFold(D);l&&!l.range.isStart(o,g)&&this.removeFold(l),c&&!c.range.isEnd(s,a)&&this.removeFold(c);var u=this.getFoldsInRange(D.range);u.length>0&&(this.removeFolds(u),D.collapseChildren||u.forEach(function(e){D.addSubFold(e)}));for(var h=0;h<t.length;h++){var d=t[h];if(s==d.start.row){d.addFold(D),r=!0;break}if(o==d.end.row){if(d.addFold(D),r=!0,!D.sameRow){var p=t[h+1];p&&p.start.row==s&&d.merge(p)}break}if(s<=d.start.row)break}return r||(d=this.$addFoldLine(new S(this.$foldData,D))),this.$useWrapMode?this.$updateWrapData(d.start.row,d.start.row):this.$updateRowLengthCache(d.start.row,d.start.row),this.$modified=!0,this._signal("changeFold",{data:D,action:"add"}),D},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var n=e.foldLine,D=n.start.row,t=n.end.row,S=this.$foldData,i=n.folds;if(1==i.length)S.splice(S.indexOf(n),1);else if(n.range.isEnd(e.end.row,e.end.column))i.pop(),n.end.row=i[i.length-1].end.row,n.end.column=i[i.length-1].end.column;else if(n.range.isStart(e.start.row,e.start.column))i.shift(),n.start.row=i[0].start.row,n.start.column=i[0].start.column;else if(e.sameRow)i.splice(i.indexOf(e),1);else{var r=n.split(e.start.row,e.start.column);(i=r.folds).shift(),r.start.row=i[0].start.row,r.start.column=i[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(D,t):this.$updateRowLengthCache(D,t)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var n=[],D=0;D<e.length;D++)n.push(e[D]);n.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(n){e.restoreRange(n),this.addFold(n)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,n){if(null==e)D=new t(0,0,this.getLength(),0),null==n&&(n=!0);else if("number"==typeof e)D=new t(e,0,e,this.getLine(e).length);else if("row"in e)D=t.fromPoints(e,e);else{if(Array.isArray(e))return S=[],e.forEach(function(e){S=S.concat(this.unfold(e))},this),S;D=e}for(var D,S=this.getFoldsInRangeList(D),i=S;1==S.length&&0>t.comparePoints(S[0].start,D.start)&&t.comparePoints(S[0].end,D.end)>0;)this.expandFolds(S),S=this.getFoldsInRangeList(D);if(!1!=n?this.removeFolds(S):this.expandFolds(S),i.length)return i},this.isRowFolded=function(e,n){return!!this.getFoldLine(e,n)},this.getRowFoldEnd=function(e,n){var D=this.getFoldLine(e,n);return D?D.end.row:e},this.getRowFoldStart=function(e,n){var D=this.getFoldLine(e,n);return D?D.start.row:e},this.getFoldDisplayLine=function(e,n,D,t,S){null==t&&(t=e.start.row),null==S&&(S=0),null==n&&(n=e.end.row),null==D&&(D=this.getLine(n).length);var i=this.doc,r="";return e.walk(function(e,n,D,o){if(!(n<t)){if(n==t){if(D<S)return;o=Math.max(S,o)}null!=e?r+=e:r+=i.getLine(n).substring(o,D)}},n,D),r},this.getDisplayLine=function(e,n,D,t){var S,i=this.getFoldLine(e);return i?this.getFoldDisplayLine(i,e,n,D,t):(S=this.doc.getLine(e)).substring(t||0,n||S.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(n){var D=n.folds.map(function(e){return e.clone()});return new S(e,D)})},this.toggleFold=function(e){var n,D,t=this.selection.getRange();if(t.isEmpty()){var S=t.start;if(n=this.getFoldAt(S.row,S.column))return void this.expandFold(n);(D=this.findMatchingBracket(S))?1==t.comparePoint(D)?t.end=D:(t.start=D,t.start.column++,t.end.column--):(D=this.findMatchingBracket({row:S.row,column:S.column+1}))?(1==t.comparePoint(D)?t.end=D:t.start=D,t.start.column++):t=this.getCommentFoldRange(S.row,S.column)||t}else{var i=this.getFoldsInRange(t);if(e&&i.length)return void this.expandFolds(i);1==i.length&&(n=i[0])}if(n||(n=this.getFoldAt(t.start.row,t.start.column)),n&&n.range.toString()==t.toString())return void this.expandFold(n);var r="...";if(!t.isMultiLine()){if((r=this.getTextRange(t)).length<4)return;r=r.trim().substring(0,2)+".."}this.addFold(r,t)},this.getCommentFoldRange=function(e,n,D){var S=new r(this,e,n),i=S.getCurrentToken(),o=i&&i.type;if(i&&/^comment|string/.test(o)){"comment"==(o=o.match(/comment|string/)[0])&&(o+="|doc-start|\\.doc");var g=new RegExp(o),s=new t;if(1!=D){do i=S.stepBackward();while(i&&g.test(i.type));i=S.stepForward()}s.start.row=S.getCurrentTokenRow(),s.start.column=S.getCurrentTokenColumn()+i.value.length,S=new r(this,e,n);var a=this.getState(S.$row);if(-1!=D){var l=-1;do if(i=S.stepForward(),-1==l){var c=this.getState(S.$row);a.toString()!==c.toString()&&(l=S.$row)}else if(S.$row>l)break;while(i&&g.test(i.type));i=S.stepBackward()}else i=S.getCurrentToken();return s.end.row=S.getCurrentTokenRow(),s.end.column=S.getCurrentTokenColumn(),s}},this.foldAll=function(e,n,D,t){void 0==D&&(D=1e5);var S=this.foldWidgets;if(S){n=n||this.getLength(),e=e||0;for(var i=e;i<n;i++)if((null==S[i]&&(S[i]=this.getFoldWidget(i)),"start"==S[i])&&(!t||t(i))){var r=this.getFoldWidgetRange(i);r&&r.isMultiLine()&&r.end.row<=n&&r.start.row>=e&&(i=r.end.row,r.collapseChildren=D,this.addFold("...",r))}}},this.foldToLevel=function(e){for(this.foldAll();e-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var e=this;this.foldAll(null,null,null,function(n){for(var D=e.getTokens(n),t=0;t<D.length;t++){var S=D[t];if(!("text"==S.type&&/^\s+$/.test(S.value))){if(/comment/.test(S.type))return!0;return!1}}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var n=this.$foldMode;this.$setFolding(null),this.$setFolding(n)}},this.$setFolding=function(e){if(this.$foldMode!=e){if(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!e||"manual"==this.$foldStyle){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(e,n){var D=this.foldWidgets;if(!D||n&&D[e])return{};for(var t,S=e-1;S>=0;){var i=D[S];if(null==i&&(i=D[S]=this.getFoldWidget(S)),"start"==i){var r=this.getFoldWidgetRange(S);if(t||(t=r),r&&r.end.row>=e)break}S--}return{range:-1!==S&&r,firstRange:t}},this.onFoldWidgetClick=function(e,n){n instanceof o&&(n=n.domEvent);var D={children:n.shiftKey,all:n.ctrlKey||n.metaKey,siblings:n.altKey};if(!this.$toggleFoldWidget(e,D)){var t=n.target||n.srcElement;t&&/ace_fold-widget/.test(t.className)&&(t.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,n){if(this.getFoldWidget){var D=this.getFoldWidget(e),t=this.getLine(e),S="end"===D?-1:1,i=this.getFoldAt(e,-1===S?0:t.length,S);if(i)return n.children||n.all?this.removeFold(i):this.expandFold(i),i;var r=this.getFoldWidgetRange(e,!0);if(r&&!r.isMultiLine()&&(i=this.getFoldAt(r.start.row,r.start.column,1))&&r.isEqual(i.range))return this.removeFold(i),i;if(n.siblings){var o=this.getParentFoldRangeData(e);if(o.range)var g=o.range.start.row+1,s=o.range.end.row;this.foldAll(g,s,1e4*!!n.all)}else n.children?(s=r?r.end.row:this.getLength(),this.foldAll(e+1,s,1e4*!!n.all)):r&&(n.all&&(r.collapseChildren=1e4),this.addFold("...",r));return r}},this.toggleFoldWidget=function(e){var n=this.selection.getCursor().row;n=this.getRowFoldStart(n);var D=this.$toggleFoldWidget(n,{});if(!D){var t=this.getParentFoldRangeData(n,!0);if(D=t.range||t.firstRange){n=D.start.row;var S=this.getFoldAt(n,this.getLine(n).length,1);S?this.removeFold(S):this.addFold("...",D)}}},this.updateFoldWidgets=function(e){var n=e.start.row,D=e.end.row-n;if(0===D)this.foldWidgets[n]=null;else if("remove"==e.action)this.foldWidgets.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,t)}},this.tokenizerUpdateFoldWidgets=function(e){var n=e.data;n.first!=n.last&&this.foldWidgets.length>n.first&&this.foldWidgets.splice(n.first,this.foldWidgets.length)}}}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,n,D){"use strict";var t=e("../token_iterator").TokenIterator,S=e("../range").Range;n.BracketMatch=function(){this.findMatchingBracket=function(e,n){if(0==e.column)return null;var D=n||this.getLine(e.row).charAt(e.column-1);if(""==D)return null;var t=D.match(/([\(\[\{])|([\)\]\}])/);return t?t[1]?this.$findClosingBracket(t[1],e):this.$findOpeningBracket(t[2],e):null},this.getBracketRange=function(e){var n,D=this.getLine(e.row),t=!0,i=D.charAt(e.column-1),r=i&&i.match(/([\(\[\{])|([\)\]\}])/);if(r||(i=D.charAt(e.column),e={row:e.row,column:e.column+1},r=i&&i.match(/([\(\[\{])|([\)\]\}])/),t=!1),!r)return null;if(r[1]){var o=this.$findClosingBracket(r[1],e);if(!o)return null;n=S.fromPoints(e,o),!t&&(n.end.column++,n.start.column--),n.cursor=n.end}else{var o=this.$findOpeningBracket(r[2],e);if(!o)return null;n=S.fromPoints(o,e),!t&&(n.start.column++,n.end.column--),n.cursor=n.start}return n},this.getMatchingBracketRanges=function(e,n){var D=this.getLine(e.row),t=/([\(\[\{])|([\)\]\}])/,i=!n&&D.charAt(e.column-1),r=i&&i.match(t);if(r||(i=(void 0===n||n)&&D.charAt(e.column),e={row:e.row,column:e.column+1},r=i&&i.match(t)),!r)return null;var o=new S(e.row,e.column-1,e.row,e.column),g=r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e);return g?[o,new S(g.row,g.column,g.row,g.column+1)]:[o]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,n,D){var S=this.$brackets[e],i=1,r=new t(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){D||(D=RegExp("(\\.?"+o.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var g=n.column-r.getCurrentTokenColumn()-2,s=o.value;;){for(;g>=0;){var a=s.charAt(g);if(a==S){if(0==(i-=1))return{row:r.getCurrentTokenRow(),column:g+r.getCurrentTokenColumn()}}else a==e&&(i+=1);g-=1}do o=r.stepBackward();while(o&&!D.test(o.type));if(null==o)break;g=(s=o.value).length-1}return null}},this.$findClosingBracket=function(e,n,D){var S=this.$brackets[e],i=1,r=new t(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){D||(D=RegExp("(\\.?"+o.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var g=n.column-r.getCurrentTokenColumn();;){for(var s=o.value,a=s.length;g<a;){var l=s.charAt(g);if(l==S){if(0==(i-=1))return{row:r.getCurrentTokenRow(),column:g+r.getCurrentTokenColumn()}}else l==e&&(i+=1);g+=1}do o=r.stepForward();while(o&&!D.test(o.type));if(null==o)break;g=0}return null}},this.getMatchingTags=function(e){var n=new t(this,e.row,e.column),D=this.$findTagName(n);if(D){var S=n.stepBackward();return"<"===S.value?this.$findClosingTag(n,D):this.$findOpeningTag(n,D)}},this.$findTagName=function(e){var n=e.getCurrentToken(),D=!1,t=!1;if(n&&-1===n.type.indexOf("tag-name"))do(n=t?e.stepBackward():e.stepForward())&&("/>"===n.value?t=!0:-1!==n.type.indexOf("tag-name")&&(D=!0));while(n&&!D);return n},this.$findClosingTag=function(e,n){var D,t=n.value,i=n.value,r=0,o=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);n=e.stepForward();var g=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length),s=!1;do{if(-1!==(D=n).type.indexOf("tag-close")&&!s){var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);s=!0}if(n=e.stepForward()){if(">"===n.value&&!s){var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);s=!0}if(-1!==n.type.indexOf("tag-name")){if(i===(t=n.value)){if("<"===D.value)r++;else if("</"===D.value&&--r<0){e.stepBackward();var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);n=e.stepForward();var c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length);if(-1===n.type.indexOf("tag-close")&&(n=e.stepForward()),!n||">"!==n.value)return;var u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(i===t&&"/>"===n.value&&--r<0)var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),c=l,u=c,a=new S(g.end.row,g.end.column,g.end.row,g.end.column+1)}}while(n&&r>=0);if(o&&a&&l&&u&&g&&c)return{openTag:new S(o.start.row,o.start.column,a.end.row,a.end.column),closeTag:new S(l.start.row,l.start.column,u.end.row,u.end.column),openTagName:g,closeTagName:c}},this.$findOpeningTag=function(e,n){var D=e.getCurrentToken(),t=n.value,i=0,r=e.getCurrentTokenRow(),o=e.getCurrentTokenColumn(),g=o+2,s=new S(r,o,r,g);e.stepForward();var a=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length);if(-1===n.type.indexOf("tag-close")&&(n=e.stepForward()),n&&">"===n.value){var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);e.stepBackward(),e.stepBackward();do if(n=D,r=e.getCurrentTokenRow(),g=(o=e.getCurrentTokenColumn())+n.value.length,D=e.stepBackward(),n){if(-1!==n.type.indexOf("tag-name")){if(t===n.value)if("<"===D.value){if(++i>0){var c=new S(r,o,r,g),u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do n=e.stepForward();while(n&&">"!==n.value);var h=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===D.value&&i--}else if("/>"===n.value){for(var d=0,p=D;p;){if(-1!==p.type.indexOf("tag-name")&&p.value===t){i--;break}if("<"===p.value)break;p=e.stepBackward(),d++}for(var f=0;f<d;f++)e.stepForward()}}while(D&&i<=0);if(u&&h&&s&&l&&c&&a)return{openTag:new S(u.start.row,u.start.column,h.end.row,h.end.column),closeTag:new S(s.start.row,s.start.column,l.end.row,l.end.column),openTagName:c,closeTagName:a}}}}}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/lang"),i=e("./bidihandler").BidiHandler,r=e("./config"),o=e("./lib/event_emitter").EventEmitter,g=e("./selection").Selection,s=e("./mode/text").Mode,a=e("./range").Range,l=e("./document").Document,c=e("./background_tokenizer").BackgroundTokenizer,u=e("./search_highlight").SearchHighlight,h=e("./undomanager").UndoManager,d=function(){function e(n,D){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.prevOp={},this.$foldData=[],this.id="session"+ ++e.$uid,this.$foldData.toString=function(){return this.join("\n")},this.bgTokenizer=new c(new s().getTokenizer(),this);var t=this;this.bgTokenizer.on("update",function(e){t._signal("tokenizerUpdate",e)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof n&&n.getLine||(n=new l(n)),this.setDocument(n),this.selection=new g(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new i(this),r.resetOptions(this),this.setMode(D),r._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return e.prototype.$initOperationListeners=function(){var e=this;this.curOp=null,this.on("change",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.docChanged=!0},!0),this.on("changeSelection",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.selectionChanged=!0},!0),this.$operationResetTimer=S.delayedCall(this.endOperation.bind(this,!0))},e.prototype.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(e={}),this.$operationResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",e)},e.prototype.endOperation=function(e){if(this.curOp){if(e&&!1===e.returnValue){this.curOp=null,this._signal("endOperation",e);return}if(!0!=e||!this.curOp.command||"mouse"!=this.curOp.command.name){var n=this.selection.toJSON();this.curOp.selectionAfter=n,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(n),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",e)}}},e.prototype.setDocument=function(e){this.doc&&this.doc.off("change",this.$onChange),this.doc=e,e.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},e.prototype.getDocument=function(){return this.doc},e.prototype.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var n=this.$docRowCache.length,D=this.$getRowCacheIndex(this.$docRowCache,e)+1;n>D&&(this.$docRowCache.splice(D,n),this.$screenRowCache.splice(D,n))},e.prototype.$getRowCacheIndex=function(e,n){for(var D=0,t=e.length-1;D<=t;){var S=D+t>>1,i=e[S];if(n>i)D=S+1;else{if(!(n<i))return S;t=S-1}}return D-1},e.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},e.prototype.onChangeFold=function(e){var n=e.data;this.$resetRowCache(n.start.row)},e.prototype.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var n=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(n&&n.length&&(this.$undoManager.add({action:"removeFolds",folds:n},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},e.prototype.onSelectionChange=function(){this._signal("changeSelection")},e.prototype.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},e.fromJSON=function(n){"string"==typeof n&&(n=JSON.parse(n));var D=new h;D.$undoStack=n.history.undo,D.$redoStack=n.history.redo,D.mark=n.history.mark,D.$rev=n.history.rev;var t=new e(n.value);return n.folds.forEach(function(e){t.addFold("...",a.fromPoints(e.start,e.end))}),t.setAnnotations(n.annotations),t.setBreakpoints(n.breakpoints),t.setMode(n.mode),t.setScrollLeft(n.scrollLeft),t.setScrollTop(n.scrollTop),t.setUndoManager(D),t.selection.fromJSON(n.selection),t},e.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(e){return e.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},e.prototype.toString=function(){return this.doc.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.getState=function(e){return this.bgTokenizer.getState(e)},e.prototype.getTokens=function(e){return this.bgTokenizer.getTokens(e)},e.prototype.getTokenAt=function(e,n){var D,t=this.bgTokenizer.getTokens(e),S=0;if(null==n){var i=t.length-1;S=this.getLine(e).length}else for(var i=0;i<t.length&&!((S+=t[i].value.length)>=n);i++);return(D=t[i])?(D.index=i,D.start=S-D.value.length,D):null},e.prototype.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var n=this;e.addSession(this),this.$syncInformUndoManager=function(){n.$informUndoManager.cancel(),n.mergeUndoDeltas=!1},this.$informUndoManager=S.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},e.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},e.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},e.prototype.getTabString=function(){return this.getUseSoftTabs()?S.stringRepeat(" ",this.getTabSize()):" "},e.prototype.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},e.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},e.prototype.setTabSize=function(e){this.setOption("tabSize",e)},e.prototype.getTabSize=function(){return this.$tabSize},e.prototype.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},e.prototype.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},e.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},e.prototype.setOverwrite=function(e){this.setOption("overwrite",e)},e.prototype.getOverwrite=function(){return this.$overwrite},e.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},e.prototype.addGutterDecoration=function(e,n){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+n,this._signal("changeBreakpoint",{})},e.prototype.removeGutterDecoration=function(e,n){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+n,""),this._signal("changeBreakpoint",{})},e.prototype.getBreakpoints=function(){return this.$breakpoints},e.prototype.setBreakpoints=function(e){this.$breakpoints=[];for(var n=0;n<e.length;n++)this.$breakpoints[e[n]]="ace_breakpoint";this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},e.prototype.setBreakpoint=function(e,n){void 0===n&&(n="ace_breakpoint"),n?this.$breakpoints[e]=n:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.addMarker=function(e,n,D,t){var S=this.$markerId++,i={range:e,type:D||"line",renderer:"function"==typeof D?D:null,clazz:n,inFront:!!t,id:S};return t?(this.$frontMarkers[S]=i,this._signal("changeFrontMarker")):(this.$backMarkers[S]=i,this._signal("changeBackMarker")),S},e.prototype.addDynamicMarker=function(e,n){if(e.update){var D=this.$markerId++;return e.id=D,e.inFront=!!n,n?(this.$frontMarkers[D]=e,this._signal("changeFrontMarker")):(this.$backMarkers[D]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var n=this.$frontMarkers[e]||this.$backMarkers[e];if(n){var D=n.inFront?this.$frontMarkers:this.$backMarkers;delete D[e],this._signal(n.inFront?"changeFrontMarker":"changeBackMarker")}},e.prototype.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},e.prototype.highlight=function(e){if(!this.$searchHighlight){var n=new u(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(n)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,n,D,t){"number"!=typeof n&&(D=n,n=e),D||(D="ace_step");var S=new a(e,0,n,1/0);return S.id=this.addMarker(S,D,"fullLine",t),S},e.prototype.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},e.prototype.getAnnotations=function(){return this.$annotations||[]},e.prototype.clearAnnotations=function(){this.setAnnotations([])},e.prototype.$detectNewLine=function(e){var n=e.match(/^.*?(\r?\n)/m);n?this.$autoNewLine=n[1]:this.$autoNewLine="\n"},e.prototype.getWordRange=function(e,n){var D=this.getLine(e),t=!1;if(n>0&&(t=!!D.charAt(n-1).match(this.tokenRe)),t||(t=!!D.charAt(n).match(this.tokenRe)),t)var S=this.tokenRe;else if(/^\s+$/.test(D.slice(n-1,n+1)))var S=/\s/;else var S=this.nonTokenRe;var i=n;if(i>0){do i--;while(i>=0&&D.charAt(i).match(S));i++}for(var r=n;r<D.length&&D.charAt(r).match(S);)r++;return new a(e,i,e,r)},e.prototype.getAWordRange=function(e,n){for(var D=this.getWordRange(e,n),t=this.getLine(D.end.row);t.charAt(D.end.column).match(/[ \t]/);)D.end.column+=1;return D},e.prototype.setNewLineMode=function(e){this.doc.setNewLineMode(e)},e.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},e.prototype.setUseWorker=function(e){this.setOption("useWorker",e)},e.prototype.getUseWorker=function(){return this.$useWorker},e.prototype.onReloadTokenizer=function(e){var n=e.data;this.bgTokenizer.start(n.first),this._signal("tokenizerUpdate",e)},e.prototype.setMode=function(e,n){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var D=e,t=D.path}else t=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new s),this.$modes[t]&&!D){this.$onChangeMode(this.$modes[t]),n&&n();return}this.$modeId=t,r.loadModule(["mode",t],(function(e){if(this.$modeId!==t)return n&&n();this.$modes[t]&&!D?this.$onChangeMode(this.$modes[t]):e&&e.Mode&&(e=new e.Mode(D),D||(this.$modes[t]=e,e.$id=t),this.$onChangeMode(e)),n&&n()}).bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},e.prototype.$onChangeMode=function(e,n){if(n||(this.$modeId=e.$id),this.$mode!==e){var D=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var t=e.getTokenizer();if(void 0!==t.on){var S=this.onReloadTokenizer.bind(this);t.on("update",S)}this.bgTokenizer.setTokenizer(t),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,n||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:D,mode:e}))}},e.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},e.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){r.warn("Could not load worker",e),this.$worker=null}},e.prototype.getMode=function(){return this.$mode},e.prototype.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},e.prototype.getScrollTop=function(){return this.$scrollTop},e.prototype.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},e.prototype.getScrollLeft=function(){return this.$scrollLeft},e.prototype.getScreenWidth=function(){return(this.$computeWidth(),this.lineWidgets)?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},e.prototype.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(n){n&&n.screenWidth>e&&(e=n.screenWidth)}),this.lineWidgetWidth=e},e.prototype.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var n=this.doc.getAllLines(),D=this.$rowLengthCache,t=0,S=0,i=this.$foldData[S],r=i?i.start.row:1/0,o=n.length,g=0;g<o;g++){if(g>r){if((g=i.end.row+1)>=o)break;r=(i=this.$foldData[S++])?i.start.row:1/0}null==D[g]&&(D[g]=this.$getStringScreenWidth(n[g])[0]),D[g]>t&&(t=D[g])}this.screenWidth=t}},e.prototype.getLine=function(e){return this.doc.getLine(e)},e.prototype.getLines=function(e,n){return this.doc.getLines(e,n)},e.prototype.getLength=function(){return this.doc.getLength()},e.prototype.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},e.prototype.insert=function(e,n){return this.doc.insert(e,n)},e.prototype.remove=function(e){return this.doc.remove(e)},e.prototype.removeFullLines=function(e,n){return this.doc.removeFullLines(e,n)},e.prototype.undoChanges=function(e,n){if(e.length){this.$fromUndo=!0;for(var D=e.length-1;-1!=D;D--){var t=e[D];"insert"==t.action||"remove"==t.action?this.doc.revertDelta(t):t.folds&&this.addFolds(t.folds)}!n&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},e.prototype.redoChanges=function(e,n){if(e.length){this.$fromUndo=!0;for(var D=0;D<e.length;D++){var t=e[D];("insert"==t.action||"remove"==t.action)&&this.doc.$safeApplyDelta(t)}!n&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},e.prototype.setUndoSelect=function(e){this.$undoSelect=e},e.prototype.$getUndoSelection=function(e,n){function D(e){return n?"insert"!==e.action:"insert"===e.action}for(var t,S,i=0;i<e.length;i++){var r=e[i];if(r.start){if(!t){t=D(r)?a.fromPoints(r.start,r.end):a.fromPoints(r.start,r.start);continue}D(r)?(S=r.start,-1==t.compare(S.row,S.column)&&t.setStart(S),S=r.end,1==t.compare(S.row,S.column)&&t.setEnd(S)):(S=r.start,-1==t.compare(S.row,S.column)&&(t=a.fromPoints(r.start,r.start)))}}return t},e.prototype.replace=function(e,n){return this.doc.replace(e,n)},e.prototype.moveText=function(e,n,D){var t=this.getTextRange(e),S=this.getFoldsInRange(e),i=a.fromPoints(n,n);if(!D){this.remove(e);var r=e.start.row-e.end.row,o=r?-e.end.column:e.start.column-e.end.column;o&&(i.start.row==e.end.row&&i.start.column>e.end.column&&(i.start.column+=o),i.end.row==e.end.row&&i.end.column>e.end.column&&(i.end.column+=o)),r&&i.start.row>=e.end.row&&(i.start.row+=r,i.end.row+=r)}if(i.end=this.insert(i.start,t),S.length){var g=e.start,s=i.start,r=s.row-g.row,o=s.column-g.column;this.addFolds(S.map(function(e){return(e=e.clone()).start.row==g.row&&(e.start.column+=o),e.end.row==g.row&&(e.end.column+=o),e.start.row+=r,e.end.row+=r,e}))}return i},e.prototype.indentRows=function(e,n,D){D=D.replace(/\t/g,this.getTabString());for(var t=e;t<=n;t++)this.doc.insertInLine({row:t,column:0},D)},e.prototype.outdentRows=function(e){for(var n=e.collapseRows(),D=new a(0,0,0,0),t=this.getTabSize(),S=n.start.row;S<=n.end.row;++S){var i=this.getLine(S);D.start.row=S,D.end.row=S;for(var r=0;r<t&&" "==i.charAt(r);++r);r<t&&" "==i.charAt(r)?(D.start.column=r,D.end.column=r+1):(D.start.column=0,D.end.column=r),this.remove(D)}},e.prototype.$moveLines=function(e,n,D){if(e=this.getRowFoldStart(e),n=this.getRowFoldEnd(n),D<0){var t=this.getRowFoldStart(e+D);if(t<0)return 0;var S=t-e}else if(D>0){var t=this.getRowFoldEnd(n+D);if(t>this.doc.getLength()-1)return 0;var S=t-n}else{e=this.$clipRowToDocument(e);var S=(n=this.$clipRowToDocument(n))-e+1}var i=new a(e,0,n,Number.MAX_VALUE),r=this.getFoldsInRange(i).map(function(e){return e=e.clone(),e.start.row+=S,e.end.row+=S,e}),o=0==D?this.doc.getLines(e,n):this.doc.removeFullLines(e,n);return this.doc.insertFullLines(e+S,o),r.length&&this.addFolds(r),S},e.prototype.moveLinesUp=function(e,n){return this.$moveLines(e,n,-1)},e.prototype.moveLinesDown=function(e,n){return this.$moveLines(e,n,1)},e.prototype.duplicateLines=function(e,n){return this.$moveLines(e,n,0)},e.prototype.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},e.prototype.$clipColumnToRow=function(e,n){return n<0?0:Math.min(this.doc.getLine(e).length,n)},e.prototype.$clipPositionToDocument=function(e,n){if(n=Math.max(0,n),e<0)e=0,n=0;else{var D=this.doc.getLength();e>=D?(e=D-1,n=this.doc.getLine(D-1).length):n=Math.min(this.doc.getLine(e).length,n)}return{row:e,column:n}},e.prototype.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var n=this.doc.getLength()-1;return e.end.row>n?(e.end.row=n,e.end.column=this.doc.getLine(n).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},e.prototype.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var n=this.getLength();this.$wrapData=Array(n),this.$updateWrapData(0,n-1)}this._signal("changeWrapMode")}},e.prototype.getUseWrapMode=function(){return this.$useWrapMode},e.prototype.setWrapLimitRange=function(e,n){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==n)&&(this.$wrapLimitRange={min:e,max:n},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},e.prototype.adjustWrapLimit=function(e,n){var D=this.$wrapLimitRange;D.max<0&&(D={min:n,max:n});var t=this.$constrainWrapLimit(e,D.min,D.max);return t!=this.$wrapLimit&&t>1&&(this.$wrapLimit=t,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,n,D){return n&&(e=Math.max(n,e)),D&&(e=Math.min(D,e)),e},e.prototype.getWrapLimit=function(){return this.$wrapLimit},e.prototype.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},e.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},e.prototype.$updateInternalDataOnChange=function(e){var n=this.$useWrapMode,D=e.action,t=e.start,S=e.end,i=t.row,r=S.row,o=r-i,g=null;if(this.$updating=!0,0!=o)if("remove"===D){this[n?"$wrapData":"$rowLengthCache"].splice(i,o);var s=this.$foldData;g=this.getFoldsInRange(e),this.removeFolds(g);var a=this.getFoldLine(S.row),l=0;if(a){a.addRemoveChars(S.row,S.column,t.column-S.column),a.shiftRow(-o);var c=this.getFoldLine(i);c&&c!==a&&(c.merge(a),a=c),l=s.indexOf(a)+1}for(;l<s.length;l++){var a=s[l];a.start.row>=S.row&&a.shiftRow(-o)}r=i}else{var u=Array(o);u.unshift(i,0);var h=n?this.$wrapData:this.$rowLengthCache;h.splice.apply(h,u);var s=this.$foldData,a=this.getFoldLine(i),l=0;if(a){var d=a.range.compareInside(t.row,t.column);0==d?(a=a.split(t.row,t.column))&&(a.shiftRow(o),a.addRemoveChars(r,0,S.column-t.column)):-1==d&&(a.addRemoveChars(i,0,S.column-t.column),a.shiftRow(o)),l=s.indexOf(a)+1}for(;l<s.length;l++){var a=s[l];a.start.row>=i&&a.shiftRow(o)}}else{o=Math.abs(e.start.column-e.end.column),"remove"===D&&(g=this.getFoldsInRange(e),this.removeFolds(g),o=-o);var a=this.getFoldLine(i);a&&a.addRemoveChars(i,t.column,o)}return n&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,n?this.$updateWrapData(i,r):this.$updateRowLengthCache(i,r),g},e.prototype.$updateRowLengthCache=function(e,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[n]=null},e.prototype.$updateWrapData=function(e,n){var D,t,S=this.doc.getAllLines(),i=this.getTabSize(),r=this.$wrapData,o=this.$wrapLimit,g=e;for(n=Math.min(n,S.length-1);g<=n;)(t=this.getFoldLine(g,t))?(D=[],t.walk((function(e,n,t,i){var r;if(null!=e){(r=this.$getDisplayTokens(e,D.length))[0]=m;for(var o=1;o<r.length;o++)r[o]=y}else r=this.$getDisplayTokens(S[n].substring(i,t),D.length);D=D.concat(r)}).bind(this),t.end.row,S[t.end.row].length+1),r[t.start.row]=this.$computeWrapSplits(D,o,i),g=t.end.row+1):(D=this.$getDisplayTokens(S[g]),r[g]=this.$computeWrapSplits(D,o,i),g++)},e.prototype.$computeWrapSplits=function(e,n,D){if(0==e.length)return[];var t=[],S=e.length,i=0,r=0,o=this.$wrapAsCode,g=this.$indentedSoftWrap,s=n<=Math.max(2*D,8)||!1===g?0:Math.floor(n/2);function a(){var n=0;if(0===s)return n;if(g)for(var t=0;t<e.length;t++){var S=e[t];if(S==b)n+=1;else if(S==w)n+=D;else if(S==M)continue;else break}return o&&!1!==g&&(n+=D),Math.min(n,s)}function l(n){for(var D=n-i,S=i;S<n;S++){var o=e[S];(12===o||2===o)&&(D-=1)}t.length||(t.indent=c=a()),r+=D,t.push(r),i=n}for(var c=0;S-i>n-c;){var u=i+n-c;if(e[u-1]>=b&&e[u]>=b){l(u);continue}if(e[u]==m||e[u]==y){for(;u!=i-1&&e[u]!=m;u--);if(u>i){l(u);continue}for(u=i+n;u<e.length&&e[u]==y;u++);if(u==e.length)break;l(u);continue}for(var h=Math.max(u-(n-(n>>2)),i-1);u>h&&e[u]<m;)u--;if(o){for(;u>h&&e[u]<m;)u--;for(;u>h&&e[u]==v;)u--}else for(;u>h&&e[u]<b;)u--;if(u>h){l(++u);continue}e[u=i+n]==f&&u--,l(u-c)}return t},e.prototype.$getDisplayTokens=function(e,n){var D,t=[];n=n||0;for(var S=0;S<e.length;S++){var i=e.charCodeAt(S);if(9==i){D=this.getScreenTabSize(t.length+n),t.push(w);for(var r=1;r<D;r++)t.push(M)}else 32==i?t.push(b):i>39&&i<48||i>57&&i<64?t.push(v):i>=4352&&L(i)?t.push(p,f):t.push(p)}return t},e.prototype.$getStringScreenWidth=function(e,n,D){var t,S;if(0==n)return[0,0];for(null==n&&(n=1/0),D=D||0,S=0;S<e.length&&(9==(t=e.charCodeAt(S))?D+=this.getScreenTabSize(D):t>=4352&&L(t)?D+=2:D+=1,!(D>n));S++);return[D,S]},e.prototype.getRowLength=function(e){var n=1;return(this.lineWidgets&&(n+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+n:n},e.prototype.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},e.prototype.getRowWrapIndent=function(e){if(!this.$useWrapMode)return 0;var n=this.screenToDocumentPosition(e,Number.MAX_VALUE),D=this.$wrapData[n.row];return D.length&&D[0]<n.column?D.indent:0},e.prototype.getScreenLastRowColumn=function(e){var n=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(n.row,n.column)},e.prototype.getDocumentLastRowColumn=function(e,n){var D=this.documentToScreenRow(e,n);return this.getScreenLastRowColumn(D)},e.prototype.getDocumentLastRowColumnPosition=function(e,n){var D=this.documentToScreenRow(e,n);return this.screenToDocumentPosition(D,Number.MAX_VALUE/10)},e.prototype.getRowSplitData=function(e){if(this.$useWrapMode)return this.$wrapData[e]},e.prototype.getScreenTabSize=function(e){return this.$tabSize-(e%this.$tabSize|0)},e.prototype.screenToDocumentRow=function(e,n){return this.screenToDocumentPosition(e,n).row},e.prototype.screenToDocumentColumn=function(e,n){return this.screenToDocumentPosition(e,n).column},e.prototype.screenToDocumentPosition=function(e,n,D){if(e<0)return{row:0,column:0};var t,S,i=0,r=0,o=0,g=0,s=this.$screenRowCache,a=this.$getRowCacheIndex(s,e),l=s.length;if(l&&a>=0)var o=s[a],i=this.$docRowCache[a],c=e>s[l-1];else var c=!l;for(var u=this.getLength()-1,h=this.getNextFoldLine(i),d=h?h.start.row:1/0;o<=e&&!(o+(g=this.getRowLength(i))>e)&&!(i>=u);)o+=g,++i>d&&(i=h.end.row+1,d=(h=this.getNextFoldLine(i,h))?h.start.row:1/0),c&&(this.$docRowCache.push(i),this.$screenRowCache.push(o));if(h&&h.start.row<=i)t=this.getFoldDisplayLine(h),i=h.start.row;else{if(o+g<=e||i>u)return{row:u,column:this.getLine(u).length};t=this.getLine(i),h=null}var p=0,f=Math.floor(e-o);if(this.$useWrapMode){var m=this.$wrapData[i];m&&(S=m[f],f>0&&m.length&&(p=m.indent,r=m[f-1]||m[m.length-1],t=t.substring(r)))}return(void 0!==D&&this.$bidiHandler.isBidiRow(o+f,i,f)&&(n=this.$bidiHandler.offsetToCol(D)),r+=this.$getStringScreenWidth(t,n-p)[1],this.$useWrapMode&&r>=S&&(r=S-1),h)?h.idxToPosition(r):{row:i,column:r}},e.prototype.documentToScreenPosition=function(e,n){if(void 0===n)var D=this.$clipPositionToDocument(e.row,e.column);else D=this.$clipPositionToDocument(e,n);e=D.row,n=D.column;var t=0,S=null,i=null;(i=this.getFoldAt(e,n,1))&&(e=i.start.row,n=i.start.column);var r,o=0,g=this.$docRowCache,s=this.$getRowCacheIndex(g,e),a=g.length;if(a&&s>=0)var o=g[s],t=this.$screenRowCache[s],l=e>g[a-1];else var l=!a;for(var c=this.getNextFoldLine(o),u=c?c.start.row:1/0;o<e;){if(o>=u){if((r=c.end.row+1)>e)break;u=(c=this.getNextFoldLine(r,c))?c.start.row:1/0}else r=o+1;t+=this.getRowLength(o),o=r,l&&(this.$docRowCache.push(o),this.$screenRowCache.push(t))}var h="";c&&o>=u?(h=this.getFoldDisplayLine(c,e,n),S=c.start.row):(h=this.getLine(e).substring(0,n),S=e);var d=0;if(this.$useWrapMode){var p=this.$wrapData[S];if(p){for(var f=0;h.length>=p[f];)t++,f++;h=h.substring(p[f-1]||0,h.length),d=f>0?p.indent:0}}return this.lineWidgets&&this.lineWidgets[o]&&this.lineWidgets[o].rowsAbove&&(t+=this.lineWidgets[o].rowsAbove),{row:t,column:d+this.$getStringScreenWidth(h)[0]}},e.prototype.documentToScreenColumn=function(e,n){return this.documentToScreenPosition(e,n).column},e.prototype.documentToScreenRow=function(e,n){return this.documentToScreenPosition(e,n).row},e.prototype.getScreenLength=function(){var e=0,n=null;if(this.$useWrapMode)for(var D=this.$wrapData.length,t=0,S=0,n=this.$foldData[S++],i=n?n.start.row:1/0;t<D;){var r=this.$wrapData[t];e+=r?r.length+1:1,++t>i&&(t=n.end.row+1,i=(n=this.$foldData[S++])?n.start.row:1/0)}else{e=this.getLength();for(var o=this.$foldData,S=0;S<o.length;S++)e-=(n=o[S]).end.row-n.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},e.prototype.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(n,D,t){var S,i;if(0===D)return[0,0];for(D||(D=1/0),t=t||0,i=0;i<n.length&&(" "===(S=n.charAt(i))?t+=this.getScreenTabSize(t):t+=e.getCharacterWidth(S),!(t>D));i++);return[t,i]})},e.prototype.getPrecedingCharacter=function(){var e=this.selection.getCursor();return 0===e.column?0===e.row?"":this.doc.getNewLineCharacter():this.getLine(e.row)[e.column-1]},e.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},e}();d.$uid=0,d.prototype.$modes=r.$modes,d.prototype.getValue=d.prototype.toString,d.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},d.prototype.$overwrite=!1,d.prototype.$mode=null,d.prototype.$modeId=null,d.prototype.$scrollTop=0,d.prototype.$scrollLeft=0,d.prototype.$wrapLimit=80,d.prototype.$useWrapMode=!1,d.prototype.$wrapLimitRange={min:null,max:null},d.prototype.lineWidgets=null,d.prototype.isFullWidth=L,t.implement(d.prototype,o);var p=1,f=2,m=3,y=4,v=9,b=10,w=11,M=12;function L(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),r.defineOptions(d.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var n="number"==typeof e?e:null;this.setWrapLimitRange(n,n),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){(e="auto"==e?"text"!=this.$mode.type:"text"!=e)!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){(e=parseInt(e))>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),n.EditSession=d}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,n,D){"use strict";var t=e("./lib/lang"),S=e("./lib/oop"),i=e("./range").Range;function r(e,n){var D=t.supportsLookbehind();function S(e,t){if(void 0===t&&(t=!0),(D&&n.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||n.regExp)return D&&n.$supportsUnicodeFlag?t?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var i=Array.from(e),r=i[0],o=i[i.length-1];return S(r)+e+S(o,!1)}n.Search=function(){function e(){this.$options={}}return e.prototype.set=function(e){return S.mixin(this.$options,e),this},e.prototype.getOptions=function(){return t.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var n=this.$options,D=this.$matchIterator(e,n);if(!D)return!1;var t=null;return D.forEach(function(e,D,S,r){return t=new i(e,D,S,r),!(D==r&&n.start&&n.start.start&&!1!=n.skipCurrent&&t.isEqual(n.start))||(t=null,!1)}),t},e.prototype.findAll=function(e){var n=this.$options;if(!n.needle)return[];this.$assembleRegExp(n);var D=n.range,S=D?e.getLines(D.start.row,D.end.row):e.doc.getAllLines(),r=[],o=n.re;if(n.$isMultiLine){var g,s=o.length,a=S.length-s;e:for(var l=o.offset||0;l<=a;l++){for(var c=0;c<s;c++)if(-1==S[l+c].search(o[c]))continue e;var u=S[l],h=S[l+s-1],d=u.length-u.match(o[0])[0].length,p=h.match(o[s-1])[0].length;g&&g.end.row===l&&g.end.column>d||(r.push(g=new i(l,d,l+s-1,p)),s>2&&(l=l+s-2))}}else for(var f=0;f<S.length;f++)for(var m=t.getMatchOffsets(S[f],o),c=0;c<m.length;c++){var y=m[c];r.push(new i(f,y.offset,f,y.offset+y.length))}if(D){for(var v=D.start.column,b=D.end.column,f=0,c=r.length-1;f<c&&r[f].start.column<v&&0==r[f].start.row;)f++;for(var w=D.end.row-D.start.row;f<c&&r[c].end.column>b&&r[c].end.row==w;)c--;for(r=r.slice(f,c+1),f=0,c=r.length;f<c;f++)r[f].start.row+=D.start.row,r[f].end.row+=D.start.row}return r},e.prototype.replace=function(e,n){var D=this.$options,t=this.$assembleRegExp(D);if(D.$isMultiLine)return n;if(t){var S=t.exec(e);if(!S||S[0].length!=e.length)return null;if(D.regExp||(n=n.replace(/\$/g,"$$$$")),n=e.replace(t,n),D.preserveCase){n=n.split("");for(var i=Math.min(e.length,e.length);i--;){var r=e[i];r&&r.toLowerCase()!=r?n[i]=n[i].toUpperCase():n[i]=n[i].toLowerCase()}n=n.join("")}return n}},e.prototype.$assembleRegExp=function(e,n){if(e.needle instanceof RegExp)return e.re=e.needle;var D=e.needle;if(!e.needle)return e.re=!1;e.regExp||(D=t.escapeRegExp(D));var S=e.caseSensitive?"gm":"gmi";try{RegExp(D,"u"),e.$supportsUnicodeFlag=!0,S+="u"}catch(n){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(D=r(D,e)),e.$isMultiLine=!n&&/[\n\r]/.test(D),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(D,S);try{var i=new RegExp(D,S)}catch(e){i=!1}return e.re=i},e.prototype.$assembleMultilineRegExp=function(e,n){for(var D=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),t=[],S=0;S<D.length;S++)try{t.push(new RegExp(D[S],n))}catch(e){return!1}return t},e.prototype.$matchIterator=function(e,n){var D=this.$assembleRegExp(n);if(!D)return!1;var S=!0==n.backwards,i=!1!=n.skipCurrent,r=D.unicode,o=n.range,g=n.start;g||(g=o?o[S?"end":"start"]:e.selection.getRange()),g.start&&(g=g[i!=S?"end":"start"]);var s=o?o.start.row:0,a=o?o.end.row:e.getLength()-1;if(S)var l=function(e){var D=g.row;if(!u(D,g.column,e)){for(D--;D>=s;D--)if(u(D,Number.MAX_VALUE,e))return;if(!1!=n.wrap){for(D=a,s=g.row;D>=s;D--)if(u(D,Number.MAX_VALUE,e))return}}};else var l=function(e){var D=g.row;if(!u(D,g.column,e)){for(D+=1;D<=a;D++)if(u(D,0,e))return;if(!1!=n.wrap){for(D=s,a=g.row;D<=a;D++)if(u(D,0,e))return}}};if(n.$isMultiLine)var c=D.length,u=function(n,t,i){var r=S?n-c+1:n;if(!(r<0||r+c>e.getLength())){var o=e.getLine(r),g=o.search(D[0]);if((S||!(g<t))&&-1!==g){for(var s=1;s<c;s++)if(-1==(o=e.getLine(r+s)).search(D[s]))return;var a=o.match(D[c-1])[0].length;if((!S||!(a>t))&&i(r,g,r+c-1,a))return!0}}};else if(S)var u=function(n,S,i){var o,g=e.getLine(n),s=[],a=0;for(D.lastIndex=0;o=D.exec(g);){var l=o[0].length;if(a=o.index,!l){if(a>=g.length)break;D.lastIndex=a+=t.skipEmptyMatch(g,a,r)}if(o.index+l>S)break;s.push(o.index,l)}for(var c=s.length-1;c>=0;c-=2){var u=s[c-1],l=s[c];if(i(n,u,n,u+l))return!0}};else var u=function(n,S,i){var o,g,s=e.getLine(n);for(D.lastIndex=S;g=D.exec(s);){var a=g[0].length;if(i(n,o=g.index,n,o+a))return!0;if(!a&&(D.lastIndex=o+=t.skipEmptyMatch(s,o,r),o>=s.length))return!1}};return{forEach:l}},e}()}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("../lib/keys"),i=e("../lib/useragent"),r=S.KEY_MODS,o=function(){function e(e,n){this.$init(e,n,!1)}return e.prototype.$init=function(e,n,D){this.platform=n||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=D},e.prototype.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},e.prototype.removeCommand=function(e,n){var D=e&&("string"==typeof e?e:e.name);e=this.commands[D],n||delete this.commands[D];var t=this.commandKeyBinding;for(var S in t){var i=t[S];if(i==e)delete t[S];else if(Array.isArray(i)){var r=i.indexOf(e);-1!=r&&(i.splice(r,1),1==i.length&&(t[S]=i[0]))}}},e.prototype.bindKey=function(e,n,D){if("object"==typeof e&&e&&(void 0==D&&(D=e.position),e=e[this.platform]),e){if("function"==typeof n)return this.addCommand({exec:n,bindKey:e,name:n.name||e});e.split("|").forEach(function(e){var t="";if(-1!=e.indexOf(" ")){var S=e.split(/\s+/);e=S.pop(),S.forEach(function(e){var n=this.parseKeys(e),D=r[n.hashId]+n.key;t+=(t?" ":"")+D,this._addCommandToBinding(t,"chainKeys")},this),t+=" "}var i=this.parseKeys(e),o=r[i.hashId]+i.key;this._addCommandToBinding(t+o,n,D)},this)}},e.prototype._addCommandToBinding=function(e,n,D){var t,S=this.commandKeyBinding;if(n)if(!S[e]||this.$singleCommand)S[e]=n;else{Array.isArray(S[e])?-1!=(t=S[e].indexOf(n))&&S[e].splice(t,1):S[e]=[S[e]],"number"!=typeof D&&(D=g(n));var i=S[e];for(t=0;t<i.length&&!(g(i[t])>D);t++);i.splice(t,0,n)}else delete S[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(n){var D=e[n];if(D){if("string"==typeof D)return this.bindKey(D,n);"function"==typeof D&&(D={exec:D}),"object"==typeof D&&(D.name||(D.name=n),this.addCommand(D))}},this)},e.prototype.removeCommands=function(e){Object.keys(e).forEach(function(n){this.removeCommand(e[n])},this)},e.prototype.bindKeys=function(e){Object.keys(e).forEach(function(n){this.bindKey(n,e[n])},this)},e.prototype._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},e.prototype.parseKeys=function(e){var n=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),D=n.pop(),t=S[D];if(S.FUNCTION_KEYS[t])D=S.FUNCTION_KEYS[t].toLowerCase();else if(!n.length)return{key:D,hashId:-1};else if(1==n.length&&"shift"==n[0])return{key:D.toUpperCase(),hashId:-1};for(var i=0,r=n.length;r--;){var o=S.KEY_MODS[n[r]];if(null==o)return"u">typeof console&&console.error("invalid modifier "+n[r]+" in "+e),!1;i|=o}return{key:D,hashId:i}},e.prototype.findKeyCommand=function(e,n){var D=r[e]+n;return this.commandKeyBinding[D]},e.prototype.handleKeyboard=function(e,n,D,t){if(!(t<0)){var S=r[n]+D,i=this.commandKeyBinding[S];return(e.$keyChain&&(e.$keyChain+=" "+S,i=this.commandKeyBinding[e.$keyChain]||i),i&&("chainKeys"==i||"chainKeys"==i[i.length-1]))?(e.$keyChain=e.$keyChain||S,{command:"null"}):(e.$keyChain&&(n&&4!=n||1!=D.length?(-1==n||t>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-S.length-1)),{command:i})}},e.prototype.getStatusText=function(e,n){return n.$keyChain||""},e}();function g(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var s=function(e){function n(n,D){var t=e.call(this,n,D)||this;return t.$singleCommand=!0,t}return t(n,e),n}(o);s.call=function(e,n,D){o.prototype.$init.call(e,n,D,!0)},o.call=function(e,n,D){o.prototype.$init.call(e,n,D,!1)},n.HashHandler=s,n.MultiHashHandler=o}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,r=e("../lib/event_emitter").EventEmitter,o=function(e){function n(n,D){var t=e.call(this,D,n)||this;return t.byName=t.commands,t.setDefaultHandler("exec",function(e){return e.args?e.command.exec(e.editor,e.args,e.event,!1):e.command.exec(e.editor,{},e.event,!0)}),t}return t(n,e),n.prototype.exec=function(e,n,D){if(Array.isArray(e)){for(var t=e.length;t--;)if(this.exec(e[t],n,D))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!this.canExecute(e,n))return!1;var S={editor:n,command:e,args:D};return S.returnValue=this._emit("exec",S),this._signal("afterExec",S),!1!==S.returnValue},n.prototype.canExecute=function(e,n){return"string"==typeof e&&(e=this.commands[e]),!!e&&(!n||!n.$readOnly||!!e.readOnly)&&(!1==this.$checkCommandState||!e.isAvailable||!!e.isAvailable(n))},n.prototype.toggleRecording=function(e){if(!this.$inReplay)return(e&&e._emit("changeStatus"),this.recording)?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(e){this.macro.push([e.command,e.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},n.prototype.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(n){"string"==typeof n?this.exec(n,e):this.exec(n[0],e,n[1])},this)}finally{this.$inReplay=!1}}},n.prototype.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})},n}(i);S.implement(o.prototype,r),n.CommandManager=o}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,n,D){"use strict";var t=e("../lib/lang"),S=e("../config"),i=e("../range").Range;function r(e,n){return{win:e,mac:n}}n.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:r("Ctrl-,","Command-,"),exec:function(e){S.loadModule("ace/ext/settings_menu",function(n){n.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:r("Alt-E","F4"),exec:function(e){S.loadModule("ace/ext/error_marker",function(n){n.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:r("Alt-Shift-E","Shift-F4"),exec:function(e){S.loadModule("ace/ext/error_marker",function(n){n.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:r("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:r(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:r("Ctrl-L","Command-L"),exec:function(e,n){"number"!=typeof n||isNaN(n)||e.gotoLine(n),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:r("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:r("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:r("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:r("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:r(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:r(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:r("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:r("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:r("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:r("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:r("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:r("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:r("Ctrl-F","Command-F"),exec:function(e){S.loadModule("ace/ext/searchbox",function(n){n.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:r("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:r("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:r("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:r("Up","Up|Ctrl-P"),exec:function(e,n){e.navigateUp(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:r("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:r("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:r("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:r("Down","Down|Ctrl-N"),exec:function(e,n){e.navigateDown(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:r("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:r("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:r("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:r("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:r("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:r("Left","Left|Ctrl-B"),exec:function(e,n){e.navigateLeft(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:r("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:r("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:r("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:r("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:r("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:r("Right","Right|Ctrl-F"),exec:function(e,n){e.navigateRight(n.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:r(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:r("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:r(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:r("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:r("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:r("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:r("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:r("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:r("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:r("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:r(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var n=e.$copyWithEmptySelection&&e.selection.isEmpty()?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,n){e.$handlePaste(n)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:r("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:r("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:r("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:r("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:r("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:r("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:r("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:r("Ctrl-H","Command-Option-F"),exec:function(e){S.loadModule("ace/ext/searchbox",function(n){n.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:r("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:r("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:r("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:r("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:r("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:r("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:r("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:r("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:r("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:r("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:r("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:r("Ctrl-Shift-Backspace",null),exec:function(e){var n=e.selection.getRange();n.start.column=0,e.session.remove(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:r("Ctrl-Shift-Delete",null),exec:function(e){var n=e.selection.getRange();n.end.column=Number.MAX_VALUE,e.session.remove(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:r("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:r("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:r("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:r("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:r("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:r("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,n){e.insert(n)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,n){e.insert(t.stringRepeat(n.text||"",n.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:r(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:r("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:r("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:r("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:r(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:r("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var n=e.selection.getRange();n.start.column=n.end.column=0,n.end.row++,e.selection.setRange(n,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:r("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:r(null,null),exec:function(e){for(var n=e.selection.isBackwards(),D=n?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),S=n?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),r=e.session.doc.getLine(D.row).length,o=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,g=e.session.doc.getLine(D.row),s=D.row+1;s<=S.row+1;s++){var a=t.stringTrimLeft(t.stringTrimRight(e.session.doc.getLine(s)));0!==a.length&&(a=" "+a),g+=a}S.row+1<e.session.doc.getLength()-1&&(g+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new i(D.row,0,S.row+2,0),g),o>0?(e.selection.moveCursorTo(D.row,D.column),e.selection.selectTo(D.row,D.column+o)):(r=e.session.doc.getLine(D.row).length>r?r+1:r,e.selection.moveCursorTo(D.row,r))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:r(null,null),exec:function(e){var n=e.session.doc.getLength()-1,D=e.session.doc.getLine(n).length,t=e.selection.rangeList.ranges,S=[];t.length<1&&(t=[e.selection.getRange()]);for(var r=0;r<t.length;r++)r==t.length-1&&(t[r].end.row!==n||t[r].end.column!==D)&&S.push(new i(t[r].end.row,t[r].end.column,n,D)),0===r?(0!==t[r].start.row||0!==t[r].start.column)&&S.push(new i(0,0,t[r].start.row,t[r].start.column)):S.push(new i(t[r-1].end.row,t[r-1].end.column,t[r].start.row,t[r].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var r=0;r<S.length;r++)e.selection.addRange(S[r],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert("\n")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(e){e.selection.clearSelection();var n=e.getCursorPosition();e.selection.moveTo(n.row-1,Number.MAX_VALUE),e.insert("\n"),0===n.row&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:r("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:r(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var o=1;o<9;o++)n.commands.push({name:"foldToLevel"+o,description:"Fold To Level "+o,level:o,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("./lib/dom");n.LineWidgets=function(){function e(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return e.prototype.getRowLength=function(e){var n;return(n=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+1+n:1+n},e.prototype.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(n){n&&n.rowCount&&!n.hidden&&(e+=n.rowCount)}),e},e.prototype.$onChangeEditor=function(e){this.attach(e.editor)},e.prototype.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},e.prototype.detach=function(e){var n=this.editor;if(n){this.editor=null,n.widgetManager=null,n.renderer.off("beforeRender",this.measureWidgets),n.renderer.off("afterRender",this.renderWidgets);var D=this.session.lineWidgets;D&&D.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},e.prototype.updateOnFold=function(e,n){var D=n.lineWidgets;if(D&&e.action){for(var t=e.data,S=t.start.row,i=t.end.row,r="add"==e.action,o=S+1;o<i;o++)D[o]&&(D[o].hidden=r);D[i]&&(r?D[S]?D[i].hidden=r:D[S]=D[i]:(D[S]==D[i]&&(D[S]=void 0),D[i].hidden=r))}},e.prototype.updateOnChange=function(e){var n=this.session.lineWidgets;if(n){var D=e.start.row,t=e.end.row-D;if(0===t);else if("remove"==e.action){var S=n.splice(D+1,t);!n[D]&&S[S.length-1]&&(n[D]=S.pop()),S.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var i=Array(t);n[D]&&null!=n[D].column&&e.start.column>n[D].column&&D++,i.unshift(D,0),n.splice.apply(n,i),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var n=!0;e.forEach(function(e,D){if(e)for(n=!1,e.row=D;e.$oldWidget;)e.$oldWidget.row=D,e=e.$oldWidget}),n&&(this.session.lineWidgets=null)}},e.prototype.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=Array(this.session.getLength()));var n=this.session.lineWidgets[e.row];return n&&(e.$oldWidget=n,n.el&&n.el.parentNode&&(n.el.parentNode.removeChild(n.el),n._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},e.prototype.addLineWidget=function(e){if(this.$registerLineWidget(e),e.session=this.session,!this.editor)return e;var n=this.editor.renderer;e.html&&!e.el&&(e.el=t.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=t.createElement("div"),e.el.textContent=e.text),e.el&&(t.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&t.addCssClass(e.el,e.className),e.el.style.position="absolute",e.el.style.zIndex="5",n.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex="3"),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight)),null==e.rowCount&&(e.rowCount=e.pixelHeight/n.layerConfig.lineHeight);var D=this.session.getFoldAt(e.row,0);if(e.$fold=D,D){var S=this.session.lineWidgets;e.row!=D.end.row||S[D.start.row]?e.hidden=!0:S[D.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,n),this.onWidgetChanged(e),e},e.prototype.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(e){}if(this.session.lineWidgets){var n=this.session.lineWidgets[e.row];if(n==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else for(;n;){if(n.$oldWidget==e){n.$oldWidget=e.$oldWidget;break}n=n.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},e.prototype.getWidgetsAtRow=function(e){for(var n=this.session.lineWidgets,D=n&&n[e],t=[];D;)t.push(D),D=D.$oldWidget;return t},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,n){var D=this.session._changedWidgets,t=n.layerConfig;if(D&&D.length){for(var S=1/0,i=0;i<D.length;i++){var r=D[i];if(r&&r.el&&r.session==this.session){if(!r._inDocument){if(this.session.lineWidgets[r.row]!=r)continue;r._inDocument=!0,n.container.appendChild(r.el)}r.h=r.el.offsetHeight,r.fixedWidth||(r.w=r.el.offsetWidth,r.screenWidth=Math.ceil(r.w/t.characterWidth));var o=r.h/t.lineHeight;r.coverLine&&(o-=this.session.getRowLineCount(r.row))<0&&(o=0),r.rowCount!=o&&(r.rowCount=o,r.row<S&&(S=r.row))}}S!=1/0&&(this.session._emit("changeFold",{data:{start:{row:S}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},e.prototype.renderWidgets=function(e,n){var D=n.layerConfig,t=this.session.lineWidgets;if(t){for(var S=Math.min(this.firstRow,D.firstRow),i=Math.max(this.lastRow,D.lastRow,t.length);S>0&&!t[S];)S--;this.firstRow=D.firstRow,this.lastRow=D.lastRow,n.$cursorLayer.config=D;for(var r=S;r<=i;r++){var o=t[r];if(o&&o.el){if(o.hidden){o.el.style.top=-100-(o.pixelHeight||0)+"px";continue}o._inDocument||(o._inDocument=!0,n.container.appendChild(o.el));var g=n.$cursorLayer.getPixelPosition({row:r,column:0},!0).top;o.coverLine||(g+=D.lineHeight*this.session.getRowLineCount(o.row)),o.el.style.top=g-D.offset+"px";var s=o.coverGutter?0:n.gutterWidth;o.fixedWidth||(s-=n.scrollLeft),o.el.style.left=s+"px",o.fullWidth&&o.screenWidth&&(o.el.style.minWidth=D.width+2*D.padding+"px"),o.fixedWidth?o.el.style.right=n.scrollBar.getWidth()+"px":o.el.style.right=""}}}},e}()}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(e,n,D){"use strict";var t=e("../lib/keys"),S=e("../mouse/default_gutter_handler").GutterTooltip;n.GutterKeyboardHandler=function(){function e(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new S(this.editor)}return e.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},e.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},e.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===t.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=t.enter)return;e.preventDefault();var n=this.editor.getCursorPosition().row;this.editor.isRowVisible(n)||this.editor.scrollToLine(n,!0,!0),setTimeout((function(){var e=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),n=this.$findNearestFoldWidget(e),D=this.$findNearestAnnotation(e);if(null!==n||null!==D){if(null===n&&null!==D){this.activeRowIndex=D,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==n&&null===D){this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(D-e)<Math.abs(n-e)){this.activeRowIndex=D,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}}).bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout((function(){this.editor._signal("gutterkeydown",new i(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===t.tab)return void e.preventDefault();if(e.keyCode===t.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===t.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===t.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===t.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===t.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===t.enter||e.keyCode===t.space){switch(e.preventDefault(),this.activeLane){case"fold":if("start"===this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]){var n=this.$rowIndexToRow(this.activeRowIndex);this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout((function(){this.$rowIndexToRow(this.activeRowIndex)!==n&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(n),this.$focusFoldWidget(this.activeRowIndex))}).bind(this),10);break}this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)];break;case"annotation":var D=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),S=this.annotationTooltip.getElement().style;S.left=D.right+"px",S.top=D.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex))}return}},e.prototype.$blurGutter=function(){if(null!==this.activeRowIndex)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex)}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},e.prototype.$isFoldWidgetVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),D="none"!==this.$getFoldWidget(e).style.display;return n&&D},e.prototype.$isAnnotationVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),D="none"!==this.$getAnnotation(e).style.display;return n&&D},e.prototype.$getFoldWidget=function(e){return this.lines.get(e).element.childNodes[1]},e.prototype.$getAnnotation=function(e){return this.lines.get(e).element.childNodes[2]},e.prototype.$findNearestFoldWidget=function(e){if(this.$isFoldWidgetVisible(e))return e;for(var n=0;e-n>0||e+n<this.lines.getLength()-1;){if(e-++n>=0&&this.$isFoldWidgetVisible(e-n))return e-n;if(e+n<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+n))return e+n}return null},e.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var n=0;e-n>0||e+n<this.lines.getLength()-1;){if(e-++n>=0&&this.$isAnnotationVisible(e-n))return e-n;if(e+n<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+n))return e+n}return null},e.prototype.$focusFoldWidget=function(e){if(null!=e){var n=this.$getFoldWidget(e);n.classList.add(this.editor.renderer.keyboardFocusClassName),n.focus()}},e.prototype.$focusAnnotation=function(e){if(null!=e){var n=this.$getAnnotation(e);n.classList.add(this.editor.renderer.keyboardFocusClassName),n.focus()}},e.prototype.$blurFoldWidget=function(e){var n=this.$getFoldWidget(e);n.classList.remove(this.editor.renderer.keyboardFocusClassName),n.blur()},e.prototype.$blurAnnotation=function(e){var n=this.$getAnnotation(e);n.classList.remove(this.editor.renderer.keyboardFocusClassName),n.blur()},e.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$switchLane=function(e){switch(e){case"annotation":if("annotation"===this.activeLane)break;var n=this.$findNearestAnnotation(this.activeRowIndex);if(null==n)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=n,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if("fold"===this.activeLane)break;var D=this.$findNearestFoldWidget(this.activeRowIndex);if(null==D)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=D,this.$focusFoldWidget(this.activeRowIndex)}},e.prototype.$rowIndexToRow=function(e){var n=this.lines.get(e);return n?n.row:null},e.prototype.$rowToRowIndex=function(e){for(var n=0;n<this.lines.getLength();n++)if(this.lines.get(n).row==e)return n;return null},e}();var i=function(){function e(e,n){this.gutterKeyboardHandler=n,this.domEvent=e}return e.prototype.getKey=function(){return t.keyCodeToString(this.domEvent.keyCode)},e.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},e.prototype.isInAnnotationLane=function(){return"annotation"===this.gutterKeyboardHandler.activeLane},e.prototype.isInFoldLane=function(){return"fold"===this.gutterKeyboardHandler.activeLane},e}();n.GutterKeyboardEvent=i}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/line_widgets","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys"],function(e,n,D){"use strict";var t=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,D=n&&e[n],t=0;if(D)return D.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/lang"),o=e("./lib/useragent"),g=e("./keyboard/textinput").TextInput,s=e("./mouse/mouse_handler").MouseHandler,a=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,c=e("./edit_session").EditSession,u=e("./search").Search,h=e("./range").Range,d=e("./lib/event_emitter").EventEmitter,p=e("./commands/command_manager").CommandManager,f=e("./commands/default_commands").commands,m=e("./config"),y=e("./token_iterator").TokenIterator,v=e("./line_widgets").LineWidgets,b=e("./keyboard/gutter_handler").GutterKeyboardHandler,w=e("./config").nls,M=e("./clipboard"),L=e("./lib/keys"),$=function(){function e(n,D,t){this.session,this.$toDestroy=[];var S=n.getContainerElement();this.container=S,this.renderer=n,this.id="editor"+ ++e.$uid,this.commands=new p(o.isMac?"mac":"win",f),"object"==typeof document&&(this.textInput=new g(n.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new s(this),new a(this)),this.keyBinding=new l(this),this.$search=new u().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=r.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(e,n){n._$emitInputEvent.schedule(31)}),this.setSession(D||t&&t.session||new c("")),m.resetOptions(this),t&&this.setOptions(t),m._signal("editor",this)}return e.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},e.prototype.startOperation=function(e){this.session.startOperation(e)},e.prototype.endOperation=function(e){this.session.endOperation(e)},e.prototype.onStartOperation=function(e){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,e||(this.previousCommand=null)},e.prototype.onEndOperation=function(e){if(this.curOp&&this.session){if(e&&!1===e.returnValue){this.curOp=null;return}if(this._signal("beforeEndOperation"),this.curOp){var n=this.curOp.command,D=n&&n.scrollIntoView;if(D){switch(D){case"center-animate":D="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var t=this.selection.getRange(),S=this.renderer.layerConfig;(t.start.row>=S.lastRow||t.end.row<=S.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==D&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}}},e.prototype.$historyTracker=function(e){if(this.$mergeUndoDeltas){var n=this.prevOp,D=this.$mergeableCommands,t=n.command&&e.command.name==n.command.name;if("insertstring"==e.command.name){var S=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),t=t&&this.mergeNextCommand&&(!/\s/.test(S)||/\s/.test(n.args)),this.mergeNextCommand=!0}else t=t&&-1!==D.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(t=!1),t?this.session.mergeUndoDeltas=!0:-1!==D.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},e.prototype.setKeyboardHandler=function(e,n){if(e&&"string"==typeof e&&"ace"!=e){this.$keybindingId=e;var D=this;m.loadModule(["keybinding",e],function(t){D.$keybindingId==e&&D.keyBinding.setKeyboardHandler(t&&t.handler),n&&n()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),n&&n()},e.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},e.prototype.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var n=this.session;if(n){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var D=this.session.getSelection();D.off("changeCursor",this.$onCursorChange),D.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:n}),this.curOp=null,n&&n._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&!e.destroyed&&e.bgTokenizer.scheduleStart()}},e.prototype.getSession=function(){return this.session},e.prototype.setValue=function(e,n){return this.session.doc.setValue(e),n?1==n?this.navigateFileEnd():-1==n&&this.navigateFileStart():this.selectAll(),e},e.prototype.getValue=function(){return this.session.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.resize=function(e){this.renderer.onResize(e)},e.prototype.setTheme=function(e,n){this.renderer.setTheme(e,n)},e.prototype.getTheme=function(){return this.renderer.getTheme()},e.prototype.setStyle=function(e){this.renderer.setStyle(e)},e.prototype.unsetStyle=function(e){this.renderer.unsetStyle(e)},e.prototype.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container).fontSize},e.prototype.setFontSize=function(e){this.setOption("fontSize",e)},e.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var n=e.session;if(n&&!n.destroyed){n.$bracketHighlight&&(n.$bracketHighlight.markerIds.forEach(function(e){n.removeMarker(e)}),n.$bracketHighlight=null);var D=e.getCursorPosition(),t=e.getKeyboardHandler(),S=t&&t.$getDirectionForHighlight&&t.$getDirectionForHighlight(e),i=n.getMatchingBracketRanges(D,S);if(!i){var r=new y(n,D.row,D.column).getCurrentToken();if(r&&/\b(?:tag-open|tag-name)/.test(r.type)){var o=n.getMatchingTags(D);o&&(i=[o.openTagName.isEmpty()?o.openTag:o.openTagName,o.closeTagName.isEmpty()?o.closeTag:o.closeTagName])}}if(!i&&n.$mode.getMatching&&(i=n.$mode.getMatching(e.session)),!i){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var g="ace_bracket";Array.isArray(i)?1==i.length&&(g="ace_error_bracket"):i=[i],2==i.length&&(0==h.comparePoints(i[0].end,i[1].start)?i=[h.fromPoints(i[0].start,i[1].end)]:0==h.comparePoints(i[0].start,i[1].end)&&(i=[h.fromPoints(i[1].start,i[0].end)])),n.$bracketHighlight={ranges:i,markerIds:i.map(function(e){return n.addMarker(e,g,"text")})},e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide()}},50)}},e.prototype.focus=function(){this.textInput.focus()},e.prototype.isFocused=function(){return this.textInput.isFocused()},e.prototype.blur=function(){this.textInput.blur()},e.prototype.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},e.prototype.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},e.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},e.prototype.onDocumentChange=function(e){var n=this.session.$useWrapMode,D=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,D,n),this._signal("change",e),this.$cursorChange()},e.prototype.onTokenizerUpdate=function(e){var n=e.data;this.renderer.updateLines(n.first,n.last)},e.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},e.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},e.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},e.prototype.$updateHighlightActiveLine=function(){var e,n=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),this.renderer.$maxLines&&1===this.session.getLength()&&!(this.renderer.$minLines>1)&&(e=!1)),n.$highlightLineMarker&&!e)n.removeMarker(n.$highlightLineMarker.id),n.$highlightLineMarker=null;else if(!n.$highlightLineMarker&&e){var D=new h(e.row,e.column,e.row,1/0);D.id=n.addMarker(D,"ace_active-line","screenLine"),n.$highlightLineMarker=D}else e&&(n.$highlightLineMarker.start.row=e.row,n.$highlightLineMarker.end.row=e.row,n.$highlightLineMarker.start.column=e.column,n._signal("changeBackMarker"))},e.prototype.onSelectionChange=function(e){var n=this.session;if(n.$selectionMarker&&n.removeMarker(n.$selectionMarker),n.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var D=this.selection.getRange(),t=this.getSelectionStyle();n.$selectionMarker=n.addMarker(D,"ace_selection",t)}var S=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(S),this._signal("changeSelection")},e.prototype.$getSelectionHighLightRegexp=function(){var e=this.session,n=this.getSelectionRange();if(!(n.isEmpty()||n.isMultiLine())){var D=n.start.column,t=n.end.column,S=e.getLine(n.start.row),i=S.substring(D,t);if(!(i.length>5e3)&&/[\w\d]/.test(i)){var r=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:i}),o=S.substring(D-1,t+1);if(r.test(o))return r}}},e.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},e.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},e.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},e.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},e.prototype.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},e.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},e.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},e.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},e.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},e.prototype.getCopyText=function(){var e=this.getSelectedText(),n=this.session.doc.getNewLineCharacter(),D=!1;if(!e&&this.$copyWithEmptySelection){D=!0;for(var t=this.selection.getAllRanges(),S=0;S<t.length;S++){var i=t[S];S&&t[S-1].start.row==i.start.row||(e+=this.session.getLine(i.start.row)+n)}}var r={text:e};return this._signal("copy",r),M.lineMode=!!D&&r.text,r.text},e.prototype.onCopy=function(){this.commands.exec("copy",this)},e.prototype.onCut=function(){this.commands.exec("cut",this)},e.prototype.onPaste=function(e,n){var D={text:e,event:n};this.commands.exec("paste",this,D)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var n=e.text,D=n===M.lineMode,t=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)D?t.insert({row:this.selection.lead.row,column:0},n):this.insert(n);else if(D)this.selection.rangeList.ranges.forEach(function(e){t.insert({row:e.start.row,column:0},n)});else{var S=n.split(/\r\n|\r|\n/),i=this.selection.rangeList.ranges,r=2==S.length&&(!S[0]||!S[1]);if(S.length!=i.length||r)return this.commands.exec("insertstring",this,n);for(var o=i.length;o--;){var g=i[o];g.isEmpty()||t.remove(g),t.insert(g.start,S[o])}}},e.prototype.execCommand=function(e,n){return this.commands.exec(e,this,n)},e.prototype.insert=function(e,n){var D=this.session,t=D.getMode(),S=this.getCursorPosition();if(this.getBehavioursEnabled()&&!n){var i=t.transformAction(D.getState(S.row),"insertion",this,D,e);i&&(e===i.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=i.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var r=h.fromPoints(S,S);r.end.column+=e.length,this.session.remove(r)}}else{var r=this.getSelectionRange();S=this.session.remove(r),this.clearSelection()}if("\n"==e||"\r\n"==e){var o=D.getLine(S.row);if(S.column>o.search(/\S|$/)){var g=o.substr(S.column).search(/\S|$/);D.doc.removeInLine(S.row,S.column,S.column+g)}}this.clearSelection();var s=S.column,a=D.getState(S.row),o=D.getLine(S.row),l=t.checkOutdent(a,o,e);if(D.insert(S,e),i&&i.selection&&(2==i.selection.length?this.selection.setSelectionRange(new h(S.row,s+i.selection[0],S.row,s+i.selection[1])):this.selection.setSelectionRange(new h(S.row+i.selection[0],i.selection[1],S.row+i.selection[2],i.selection[3]))),this.$enableAutoIndent){if(D.getDocument().isNewLine(e)){var c=t.getNextLineIndent(a,o.slice(0,S.column),D.getTabString());D.insert({row:S.row+1,column:0},c)}l&&t.autoOutdent(a,D,S.row)}},e.prototype.autoIndent=function(){for(var e=this.session,n=e.getMode(),D=this.selection.isEmpty()?[new h(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),t="",S="",i="",r=e.getTabString(),o=0;o<D.length;o++)for(var g=D[o].start.row,s=D[o].end.row,a=g;a<=s;a++){a>0&&(t=e.getState(a-1),S=e.getLine(a-1),i=n.getNextLineIndent(t,S,r));var l=e.getLine(a),c=n.$getIndent(l);if(i!==c){if(c.length>0){var u=new h(a,0,a,c.length);e.remove(u)}i.length>0&&e.insert({row:a,column:0},i)}n.autoOutdent(t,e,a)}},e.prototype.onTextInput=function(e,n){if(!n)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var D=this.applyComposition.bind(this,e,n);this.selection.rangeCount?this.forEachSelection(D):D(),this.endOperation()},e.prototype.applyComposition=function(e,n){if(n.extendLeft||n.extendRight){var D=this.selection.getRange();D.start.column-=n.extendLeft,D.end.column+=n.extendRight,D.start.column<0&&(D.start.row--,D.start.column+=this.session.getLine(D.start.row).length+1),this.selection.setRange(D),e||D.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),n.restoreStart||n.restoreEnd){var D=this.selection.getRange();D.start.column-=n.restoreStart,D.end.column-=n.restoreEnd,this.selection.setRange(D)}},e.prototype.onCommandKey=function(e,n,D){return this.keyBinding.onCommandKey(e,n,D)},e.prototype.setOverwrite=function(e){this.session.setOverwrite(e)},e.prototype.getOverwrite=function(){return this.session.getOverwrite()},e.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},e.prototype.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},e.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},e.prototype.setDragDelay=function(e){this.setOption("dragDelay",e)},e.prototype.getDragDelay=function(){return this.getOption("dragDelay")},e.prototype.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},e.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},e.prototype.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},e.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},e.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},e.prototype.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},e.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},e.prototype.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},e.prototype.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},e.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},e.prototype.setHighlightIndentGuides=function(e){this.renderer.setHighlightIndentGuides(e)},e.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},e.prototype.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},e.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},e.prototype.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},e.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},e.prototype.setReadOnly=function(e){this.setOption("readOnly",e)},e.prototype.getReadOnly=function(){return this.getOption("readOnly")},e.prototype.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},e.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},e.prototype.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},e.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},e.prototype.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},e.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var n=this.getSelectionRange();if(this.getBehavioursEnabled()){var D=this.session,t=D.getState(n.start.row),S=D.getMode().transformAction(t,"deletion",this,D,n);if(0===n.end.column){var i=D.getTextRange(n);if("\n"==i[i.length-1]){var r=D.getLine(n.end.row);/^\s+$/.test(r)&&(n.end.column=r.length)}}S&&(n=S)}this.session.remove(n),this.clearSelection()},e.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},e.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},e.prototype.setGhostText=function(e,n){this.session.widgetManager||(this.session.widgetManager=new v(this.session),this.session.widgetManager.attach(this)),this.renderer.setGhostText(e,n)},e.prototype.removeGhostText=function(){this.session.widgetManager&&this.renderer.removeGhostText()},e.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var e,n,D=this.getCursorPosition(),t=D.column;if(0!==t){var S=this.session.getLine(D.row);t<S.length?(e=S.charAt(t)+S.charAt(t-1),n=new h(D.row,t-1,D.row,t+1)):(e=S.charAt(t-1)+S.charAt(t-2),n=new h(D.row,t-2,D.row,t)),this.session.replace(n,e),this.session.selection.moveToPosition(n.end)}}},e.prototype.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),D=this.session.getTextRange(n);this.session.replace(n,D.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),D=this.session.getTextRange(n);this.session.replace(n,D.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,n=this.getSelectionRange();if(n.start.row<n.end.row){var D=this.$getSelectedRows();e.indentRows(D.first,D.last," ");return}if(n.start.column<n.end.column){var t=e.getTextRange(n);if(!/^\s+$/.test(t)){var D=this.$getSelectedRows();e.indentRows(D.first,D.last," ");return}}var S=e.getLine(n.start.row),i=n.start,o=e.getTabSize(),g=e.documentToScreenColumn(i.row,i.column);if(this.session.getUseSoftTabs())var s=o-g%o,a=r.stringRepeat(" ",s);else{for(var s=g%o;" "==S[n.start.column-1]&&s;)n.start.column--,s--;this.selection.setSelectionRange(n),a=" "}return this.insert(a)},e.prototype.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},e.prototype.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},e.prototype.sortLines=function(){for(var e=this.$getSelectedRows(),n=this.session,D=[],t=e.first;t<=e.last;t++)D.push(n.getLine(t));D.sort(function(e,n){return e.toLowerCase()<n.toLowerCase()?-1:+(e.toLowerCase()>n.toLowerCase())});for(var S=new h(0,0,0,0),t=e.first;t<=e.last;t++){var i=n.getLine(t);S.start.row=t,S.end.row=t,S.end.column=i.length,n.replace(S,D[t-e.first])}},e.prototype.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),n=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,n.first,n.last)},e.prototype.toggleBlockComment=function(){var e=this.getCursorPosition(),n=this.session.getState(e.row),D=this.getSelectionRange();this.session.getMode().toggleBlockComment(n,this.session,D,e)},e.prototype.getNumberAt=function(e,n){var D=/[\-]?[0-9]+(?:\.[0-9]+)?/g;D.lastIndex=0;for(var t=this.session.getLine(e);D.lastIndex<n;){var S=D.exec(t);if(S.index<=n&&S.index+S[0].length>=n)return{value:S[0],start:S.index,end:S.index+S[0].length}}return null},e.prototype.modifyNumber=function(e){var n=this.selection.getCursor().row,D=this.selection.getCursor().column,t=new h(n,D-1,n,D),S=this.session.getTextRange(t);if(!isNaN(parseFloat(S))&&isFinite(S)){var i=this.getNumberAt(n,D);if(i){var r=i.value.indexOf(".")>=0?i.start+i.value.indexOf(".")+1:i.end,o=i.start+i.value.length-r,g=parseFloat(i.value);g*=Math.pow(10,o),r!==i.end&&D<r?e*=Math.pow(10,i.end-D-1):e*=Math.pow(10,i.end-D),g+=e;var s=(g/=Math.pow(10,o)).toFixed(o),a=new h(n,i.start,n,i.end);this.session.replace(a,s),this.moveCursorTo(n,Math.max(i.start+1,D+s.length-i.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,n=this.selection.getCursor().row,D=this.selection.getCursor().column;this.selection.selectWord();var t=this.getSelectedText(),S=this.selection.getWordRange().start.column,i=t.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=D-S-1;o<0&&(o=0);var g=0,s=0,a=this;t.match(/[A-Za-z0-9_]+/)&&i.forEach(function(e,D){s=g+e.length,o>=g&&o<=s&&(t=e,a.selection.clearSelection(),a.moveCursorTo(n,g+S),a.selection.selectTo(n,s+S)),g=s});for(var l=this.$toggleWordPairs,c=0;c<l.length;c++)for(var u=l[c],h=0;h<=1;h++){var d=+!h,p=t.match(RegExp("^\\s?_?("+r.escapeRegExp(u[h])+")\\s?$","i"));p&&t.match(RegExp("([_]|^|\\s)("+r.escapeRegExp(p[1])+")($|\\s)","g"))&&(e=t.replace(RegExp(r.escapeRegExp(u[h]),"i"),function(e){var n=u[d];return e.toUpperCase()==e?n=n.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(n=n.substr(0,0)+u[d].charAt(0).toUpperCase()+n.substr(1)),n}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,n){var D=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),S=n;S<0&&(S=0);var i,r,o,g=0,s=0;try{for(var a=t(D),l=a.next();!l.done;l=a.next()){var c=l.value;if(s=g+c.length,S>=g&&S<=s&&c.match(/((?:https?|ftp):\/\/[\S]+)/)){o=c.replace(/[\s:.,'";}\]]+$/,"");break}g=s}}catch(e){i={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},e.prototype.openLink=function(){var e=this.selection.getCursor(),n=this.findLinkAt(e.row,e.column);return n&&window.open(n,"_blank"),null!=n},e.prototype.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},e.prototype.duplicateSelection=function(){var e=this.selection,n=this.session,D=e.getRange(),t=e.isBackwards();if(D.isEmpty()){var S=D.start.row;n.duplicateLines(S,S)}else{var i=t?D.start:D.end,r=n.insert(i,n.getTextRange(D));D.start=i,D.end=r,e.setSelectionRange(D,t)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,n,D){return this.session.moveText(e,n,D)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,n){var D,t,S=this.selection;if(!S.inMultiSelectMode||this.inVirtualSelectionMode){var i=S.toOrientedRange();D=this.$getSelectedRows(i),t=this.session.$moveLines(D.first,D.last,n?0:e),n&&-1==e&&(t=0),i.moveBy(t,0),S.fromOrientedRange(i)}else{var r=S.rangeList.ranges;S.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var o=0,g=0,s=r.length,a=0;a<s;a++){var l=a;r[a].moveBy(o,0);for(var c=(D=this.$getSelectedRows(r[a])).first,u=D.last;++a<s;){g&&r[a].moveBy(g,0);var h=this.$getSelectedRows(r[a]);if(n&&h.first!=u||!n&&h.first>u+1)break;u=h.last}for(a--,o=this.session.$moveLines(c,u,n?0:e),n&&-1==e&&(l=a+1);l<=a;)r[l].moveBy(o,0),l++;n||(o=0),g+=o}S.fromOrientedRange(S.ranges[0]),S.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},e.prototype.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},e.prototype.onCompositionStart=function(e){this.renderer.showComposition(e)},e.prototype.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},e.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},e.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},e.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},e.prototype.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},e.prototype.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},e.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},e.prototype.$moveByPage=function(e,n){var D=this.renderer,t=this.renderer.layerConfig,S=e*Math.floor(t.height/t.lineHeight);!0===n?this.selection.$moveSelection(function(){this.moveCursorBy(S,0)}):!1===n&&(this.selection.moveCursorBy(S,0),this.selection.clearSelection());var i=D.scrollTop;D.scrollBy(0,S*t.lineHeight),null!=n&&D.scrollCursorIntoView(null,.5),D.animateScrolling(i)},e.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},e.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},e.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},e.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},e.prototype.scrollPageDown=function(){this.$moveByPage(1)},e.prototype.scrollPageUp=function(){this.$moveByPage(-1)},e.prototype.scrollToRow=function(e){this.renderer.scrollToRow(e)},e.prototype.scrollToLine=function(e,n,D,t){this.renderer.scrollToLine(e,n,D,t)},e.prototype.centerSelection=function(){var e=this.getSelectionRange(),n={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(n,.5)},e.prototype.getCursorPosition=function(){return this.selection.getCursor()},e.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},e.prototype.getSelectionRange=function(){return this.selection.getRange()},e.prototype.selectAll=function(){this.selection.selectAll()},e.prototype.clearSelection=function(){this.selection.clearSelection()},e.prototype.moveCursorTo=function(e,n){this.selection.moveCursorTo(e,n)},e.prototype.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},e.prototype.jumpToMatching=function(e,n){var D,t,S,i,r=this.getCursorPosition(),o=new y(this.session,r.row,r.column),g=o.getCurrentToken(),s=0;g&&-1!==g.type.indexOf("tag-name")&&(g=o.stepBackward());var a=g||o.stepForward();if(a){var l=!1,c={},u=r.column-a.start,d={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(a.value.match(/[{}()\[\]]/g)){for(;u<a.value.length&&!l;u++)if(d[a.value[u]])switch(isNaN(c[t=d[a.value[u]]+"."+a.type.replace("rparen","lparen")])&&(c[t]=0),a.value[u]){case"(":case"[":case"{":c[t]++;break;case")":case"]":case"}":c[t]--,-1===c[t]&&(D="bracket",l=!0)}}else -1!==a.type.indexOf("tag-name")&&(isNaN(c[a.value])&&(c[a.value]=0),"<"===g.value&&s>1?c[a.value]++:"</"===g.value&&c[a.value]--,-1===c[a.value]&&(D="tag",l=!0));l||(g=a,s++,a=o.stepForward(),u=0)}while(a&&!l);if(D){if("bracket"===D)!(S=this.session.getBracketRange(r))&&(i=(S=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn()+u-1,o.getCurrentTokenRow(),o.getCurrentTokenColumn()+u-1)).start,(n||i.row===r.row&&2>Math.abs(i.column-r.column))&&(S=this.session.getBracketRange(i)));else if("tag"===D){if(!a||-1===a.type.indexOf("tag-name"))return;if(0===(S=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2,o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2)).compare(r.row,r.column)){var p=this.session.getMatchingTags(r);p&&(p.openTag.contains(r.row,r.column)?i=(S=p.closeTag).start:(S=p.openTag,i=p.closeTag.start.row===r.row&&p.closeTag.start.column===r.column?S.end:S.start))}i=i||S.start}i=S&&S.cursor||i,i&&(e?S&&n?this.selection.setRange(S):S&&S.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(i.row,i.column):this.selection.moveTo(i.row,i.column))}}},e.prototype.gotoLine=function(e,n,D){this.selection.clearSelection(),this.session.unfold({row:e-1,column:n||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,n||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,D)},e.prototype.navigateTo=function(e,n){this.selection.moveTo(e,n)},e.prototype.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var n=this.selection.anchor.getPosition();return this.moveCursorToPosition(n)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},e.prototype.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var n=this.selection.anchor.getPosition();return this.moveCursorToPosition(n)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},e.prototype.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var n=this.getSelectionRange().start;this.moveCursorToPosition(n)}this.clearSelection()},e.prototype.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var n=this.getSelectionRange().end;this.moveCursorToPosition(n)}this.clearSelection()},e.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},e.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},e.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},e.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},e.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},e.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},e.prototype.replace=function(e,n){n&&this.$search.set(n);var D=this.$search.find(this.session),t=0;return D&&(this.$tryReplace(D,e)&&(t=1),this.selection.setSelectionRange(D),this.renderer.scrollSelectionIntoView(D.start,D.end)),t},e.prototype.replaceAll=function(e,n){n&&this.$search.set(n);var D=this.$search.findAll(this.session),t=0;if(!D.length)return t;var S=this.getSelectionRange();this.selection.moveTo(0,0);for(var i=D.length-1;i>=0;--i)this.$tryReplace(D[i],e)&&t++;return this.selection.setSelectionRange(S),t},e.prototype.$tryReplace=function(e,n){var D=this.session.getTextRange(e);return null!==(n=this.$search.replace(D,n))?(e.end=this.session.replace(e,n),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,n,D){n||(n={}),"string"==typeof e||e instanceof RegExp?n.needle=e:"object"==typeof e&&S.mixin(n,e);var t=this.selection.getRange();null==n.needle&&((e=this.session.getTextRange(t)||this.$search.$options.needle)||(t=this.session.getWordRange(t.start.row,t.start.column),e=this.session.getTextRange(t)),this.$search.set({needle:e})),this.$search.set(n),n.start||this.$search.set({start:t});var i=this.$search.find(this.session);return n.preventScroll?i:i?(this.revealRange(i,D),i):void(n.backwards?t.start=t.end:t.end=t.start,this.selection.setRange(t))},e.prototype.findNext=function(e,n){this.find({skipCurrent:!0,backwards:!1},e,n)},e.prototype.findPrevious=function(e,n){this.find(e,{skipCurrent:!0,backwards:!0},n)},e.prototype.revealRange=function(e,n){this.session.unfold(e),this.selection.setSelectionRange(e);var D=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==n&&this.renderer.animateScrolling(D)},e.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(e){e.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},e.prototype.setAutoScrollEditorIntoView=function(e){if(e){var n,D=this,t=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var S=this.$scrollAnchor;S.style.cssText="position:absolute",this.container.insertBefore(S,this.container.firstChild);var i=this.on("changeSelection",function(){t=!0}),r=this.renderer.on("beforeRender",function(){t&&(n=D.renderer.container.getBoundingClientRect())}),o=this.renderer.on("afterRender",function(){if(t&&n&&(D.isFocused()||D.searchBox&&D.searchBox.isFocused())){var e=D.renderer,i=e.$cursorLayer.$pixelPos,r=e.layerConfig,o=i.top-r.offset;null!=(t=i.top>=0&&o+n.top<0||(!(i.top<r.height)||!(i.top+n.top+r.lineHeight>window.innerHeight))&&null)&&(S.style.top=o+"px",S.style.left=i.left+"px",S.style.height=r.lineHeight+"px",S.scrollIntoView(t)),t=n=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",i),this.renderer.off("afterRender",o),this.renderer.off("beforeRender",r))}}},e.prototype.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",n=this.renderer.$cursorLayer;n&&(n.setSmoothBlinking(/smooth/.test(e)),n.isBlinking=!this.$readOnly&&"wide"!=e,i.setCssClass(n.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,n,D){var t=this;m.loadModule("ace/ext/prompt",function(S){S.prompt(t,e,n,D)})},e}();$.$uid=0,$.prototype.curOp=null,$.prototype.prevOp={},$.prototype.$mergeableCommands=["backspace","del","insertstring"],$.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],S.implement($.prototype,d),m.defineOptions($.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?_.attach(this):_.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?_.attach(this):_.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var e=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),i.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(e||this.renderer.placeholderNode)!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"");else{this.renderer.on("afterRender",this.$updatePlaceholder),i.addCssClass(this.container,"ace_hasPlaceholder");var n=i.createElement("div");n.className="ace_placeholder",n.textContent=this.$placeholder||"",this.renderer.placeholderNode=n,this.renderer.content.appendChild(this.renderer.placeholderNode)}}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(e){var n,D={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(e){e.blur(),e.renderer.scroller.focus()},readOnly:!0},t=function(e){if(e.target==this.renderer.scroller&&e.keyCode===L.enter){e.preventDefault();var n=this.getCursorPosition().row;this.isRowVisible(n)||this.scrollToLine(n,!0,!0),this.focus()}};e?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(3*!!o.isWin),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",w("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",w("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",t.bind(this)),this.commands.addCommand(D),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",w("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",w("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),n||(n=new b(this)),n.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",t.bind(this)),this.commands.removeCommand(D),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),n&&n.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(e){this.$textInputAriaLabel=e},initialValue:""},enableMobileMenu:{set:function(e){this.$enableMobileMenu=e},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var _={getText:function(e,n){return(Math.abs(e.selection.lead.row-n)||n+1+(n<9?"\xb7":""))+""},getWidth:function(e,n,D){return Math.max(n.toString().length,(D.lastRow+1).toString().length,2)*D.characterWidth},update:function(e,n){n.renderer.$loop.schedule(n.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};n.Editor=$}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom");n.Lines=function(){function e(e,n){this.element=e,this.canvasHeight=n||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return e.prototype.moveContainer=function(e){t.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},e.prototype.pageChanged=function(e,n){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight)},e.prototype.computeLineTop=function(e,n,D){var t=Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight);return D.documentToScreenRow(e,0)*n.lineHeight-t*this.canvasHeight},e.prototype.computeLineHeight=function(e,n,D){return n.lineHeight*D.getRowLineCount(e)},e.prototype.getLength=function(){return this.cells.length},e.prototype.get=function(e){return this.cells[e]},e.prototype.shift=function(){this.$cacheCell(this.cells.shift())},e.prototype.pop=function(){this.$cacheCell(this.cells.pop())},e.prototype.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var n=t.createFragment(this.element),D=0;D<e.length;D++)n.appendChild(e[D].element);this.element.appendChild(n)}else this.cells.push(e),this.element.appendChild(e.element)},e.prototype.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var n=t.createFragment(this.element),D=0;D<e.length;D++)n.appendChild(e[D].element);this.element.firstChild?this.element.insertBefore(n,this.element.firstChild):this.element.appendChild(n)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},e.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},e.prototype.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},e.prototype.createCell=function(e,n,D,S){var i=this.cellCache.pop();if(!i){var r=t.createElement("div");S&&S(r),this.element.appendChild(r),i={element:r,text:"",row:e}}return i.row=e,i},e}()}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/oop"),i=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,o=e("./lines").Lines,g=e("../config").nls,s=function(){function e(e){this.element=t.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new o(this.element),this.$lines.$offsetCoefficient=1}return e.prototype.setSession=function(e){this.session&&this.session.off("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},e.prototype.addGutterDecoration=function(e,n){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,n)},e.prototype.removeGutterDecoration=function(e,n){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,n)},e.prototype.setAnnotations=function(e){this.$annotations=[];for(var n=0;n<e.length;n++){var D=e[n],t=D.row,S=this.$annotations[t];S||(S=this.$annotations[t]={text:[],type:[],displayText:[]});var r=D.text,o=D.text,g=D.type;r=r?i.escapeHTML(r):D.html||"",o=o||D.html||"",-1===S.text.indexOf(r)&&(S.text.push(r),S.type.push(g),S.displayText.push(o));var s=D.className;s?S.className=s:"error"===g?S.className=" ace_error":"security"!==g||/\bace_error\b/.test(S.className)?"warning"!==g||/\bace_(error|security)\b/.test(S.className)?"info"!==g||S.className?"hint"!==g||S.className||(S.className=" ace_hint"):S.className=" ace_info":S.className=" ace_warning":S.className=" ace_security"}},e.prototype.$updateAnnotations=function(e){if(this.$annotations.length){var n=e.start.row,D=e.end.row-n;if(0===D);else if("remove"==e.action)this.$annotations.splice(n,D+1,null);else{var t=Array(D+1);t.unshift(n,1),this.$annotations.splice.apply(this.$annotations,t)}}},e.prototype.update=function(e){this.config=e;var n=this.session,D=e.firstRow,t=Math.min(e.lastRow+e.gutterOffset,n.getLength()-1);this.oldLastRow=t,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var S=n.getNextFoldLine(D),i=S?S.start.row:1/0,r=null,o=-1,g=D;;){if(g>i&&(g=S.end.row+1,i=(S=n.getNextFoldLine(g,S))?S.start.row:1/0),g>t){for(;this.$lines.getLength()>o+1;)this.$lines.pop();break}(r=this.$lines.get(++o))?r.row=g:(r=this.$lines.createCell(g,e,this.session,a),this.$lines.push(r)),this.$renderCell(r,e,S,g),g++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var n=this.session,D=n.gutterRenderer||this.$renderer,t=n.$firstLineNumber,S=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||n.$useWrapMode)&&(S=n.getLength()+t-1);var i=D?D.getWidth(n,S,e):S.toString().length*e.characterWidth,r=this.$padding||this.$computePadding();(i+=r.left+r.right)===this.gutterWidth||isNaN(i)||(this.gutterWidth=i,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",i))},e.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},e.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var n=this.$lines.cells;this.$cursorCell=null;for(var D=0;D<n.length;D++){var t=n[D];if(t.row>=this.$cursorRow){if(t.row>this.$cursorRow){var S=this.session.getFoldLine(this.$cursorRow);if(D>0&&S&&S.start.row==n[D-1].row)t=n[D-1];else break}t.element.className="ace_gutter-active-line "+t.element.className,this.$cursorCell=t;break}}}}},e.prototype.scrollLines=function(e){var n=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(n,e))return this.update(e);this.$lines.moveContainer(e);var D=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),t=this.oldLastRow;if(this.oldLastRow=D,!n||t<e.firstRow||D<n.firstRow)return this.update(e);if(n.firstRow<e.firstRow)for(var S=this.session.getFoldedRowCount(n.firstRow,e.firstRow-1);S>0;S--)this.$lines.shift();if(t>D)for(var S=this.session.getFoldedRowCount(D+1,t);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,n.firstRow-1)),D>t&&this.$lines.push(this.$renderLines(e,t+1,D)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,n,D){for(var t=[],S=n,i=this.session.getNextFoldLine(S),r=i?i.start.row:1/0;S>r&&(S=i.end.row+1,r=(i=this.session.getNextFoldLine(S,i))?i.start.row:1/0),!(S>D);){var o=this.$lines.createCell(S,e,this.session,a);this.$renderCell(o,e,i,S),t.push(o),S++}return t},e.prototype.$renderCell=function(e,n,D,S){var i,r=e.element,o=this.session,s=r.childNodes[0],a=r.childNodes[1],l=r.childNodes[2],c=l.firstChild,u=o.$firstLineNumber,h=o.$breakpoints,d=o.$decorations,p=o.gutterRenderer||this.$renderer,f=this.$showFoldWidgets&&o.foldWidgets,m=D?D.start.row:Number.MAX_VALUE,y=n.lineHeight+"px",v=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",b=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",w=(p?p.getText(o,S):S+u).toString();if(this.$highlightGutterLine&&(S==this.$cursorRow||D&&S<this.$cursorRow&&S>=m&&this.$cursorRow<=D.end.row)&&(v+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),h[S]&&(v+=h[S]),d[S]&&(v+=d[S]),this.$annotations[S]&&S!==m&&(v+=this.$annotations[S].className),f){var M=f[S];null==M&&(M=f[S]=o.getFoldWidget(S))}if(M){var L="ace_fold-widget ace_"+M,$="start"==M&&S==m&&S<D.end.row;if($){L+=" ace_closed";for(var _="",x=!1,C=S+1;C<=D.end.row;C++)if(this.$annotations[C]){if(" ace_error"===this.$annotations[C].className){x=!0,_=" ace_error_fold";break}" ace_security"===this.$annotations[C].className?(x=!0,_=" ace_security_fold"):" ace_warning"===this.$annotations[C].className&&" ace_security_fold"!==_&&(x=!0,_=" ace_warning_fold")}v+=_}else L+=" ace_open";a.className!=L&&(a.className=L),t.setStyle(a.style,"height",y),t.setStyle(a.style,"display","inline-block"),a.setAttribute("role","button"),a.setAttribute("tabindex","-1");var E=o.getFoldWidgetRange(S);E?a.setAttribute("aria-label",g("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[E.start.row+1,E.end.row+1])):D?a.setAttribute("aria-label",g("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[D.start.row+1,D.end.row+1])):a.setAttribute("aria-label",g("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[S+1])),$?(a.setAttribute("aria-expanded","false"),a.setAttribute("title",g("gutter.code-folding.closed.title","Unfold code"))):(a.setAttribute("aria-expanded","true"),a.setAttribute("title",g("gutter.code-folding.open.title","Fold code")))}else a&&(t.setStyle(a.style,"display","none"),a.setAttribute("tabindex","0"),a.removeAttribute("role"),a.removeAttribute("aria-label"));if(x&&this.$showFoldedAnnotations){switch(l.className="ace_gutter_annotation",c.className=b,c.className+=_,t.setStyle(c.style,"height",y),t.setStyle(l.style,"display","block"),t.setStyle(l.style,"height",y),_){case" ace_error_fold":i=g("gutter.annotation.aria-label.error","Error, read annotations row $0",[w]);break;case" ace_security_fold":i=g("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[w]);break;case" ace_warning_fold":i=g("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[w])}l.setAttribute("aria-label",i),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else if(this.$annotations[S]){switch(l.className="ace_gutter_annotation",c.className=b,this.$useSvgGutterIcons?c.className+=this.$annotations[S].className:r.classList.add(this.$annotations[S].className.replace(" ","")),t.setStyle(c.style,"height",y),t.setStyle(l.style,"display","block"),t.setStyle(l.style,"height",y),this.$annotations[S].className){case" ace_error":i=g("gutter.annotation.aria-label.error","Error, read annotations row $0",[w]);break;case" ace_security":i=g("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[w]);break;case" ace_warning":i=g("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[w]);break;case" ace_info":i=g("gutter.annotation.aria-label.info","Info, read annotations row $0",[w]);break;case" ace_hint":i=g("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[w])}l.setAttribute("aria-label",i),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else t.setStyle(l.style,"display","none"),l.removeAttribute("aria-label"),l.removeAttribute("role"),l.setAttribute("tabindex","0");return w!==s.data&&(s.data=w),r.className!=v&&(r.className=v),t.setStyle(e.element.style,"height",this.$lines.computeLineHeight(S,n,o)+"px"),t.setStyle(e.element.style,"top",this.$lines.computeLineTop(S,n,o)+"px"),e.text=w,"none"===l.style.display&&"none"===a.style.display?e.element.setAttribute("aria-hidden",!0):e.element.setAttribute("aria-hidden",!1),e},e.prototype.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},e.prototype.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},e.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},e.prototype.setShowFoldWidgets=function(e){e?t.addCssClass(this.element,"ace_folding-enabled"):t.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},e.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},e.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=t.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},e.prototype.getRegion=function(e){var n=this.$padding||this.$computePadding(),D=this.element.getBoundingClientRect();return e.x<n.left+D.left?"markers":this.$showFoldWidgets&&e.x>D.right-n.right?"foldWidgets":void 0},e}();function a(e){var n=document.createTextNode("");e.appendChild(n);var D=t.createElement("span");e.appendChild(D);var S=t.createElement("span");e.appendChild(S);var i=t.createElement("span");return S.appendChild(i),e}s.prototype.$fixedWidth=!1,s.prototype.$highlightGutterLine=!0,s.prototype.$renderer="",s.prototype.$showLineNumbers=!0,s.prototype.$showFoldWidgets=!0,S.implement(s.prototype,r),n.Gutter=s}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../range").Range,S=e("../lib/dom"),i=function(){function e(e){this.element=S.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setMarkers=function(e){this.markers=e},e.prototype.elt=function(e,n){var D=-1!=this.i&&this.element.childNodes[this.i];D?this.i++:(D=document.createElement("div"),this.element.appendChild(D),this.i=-1),D.style.cssText=n,D.className=e},e.prototype.update=function(e){if(e){for(var n in this.config=e,this.i=0,this.markers){var D,t=this.markers[n];if(!t.range){t.update(D,this,this.session,e);continue}var S=t.range.clipRows(e.firstRow,e.lastRow);if(!S.isEmpty())if(S=S.toScreenRange(this.session),t.renderer){var i=this.$getTop(S.start.row,e),r=this.$padding+S.start.column*e.characterWidth;t.renderer(D,S,r,i,e)}else"fullLine"==t.type?this.drawFullLineMarker(D,S,t.clazz,e):"screenLine"==t.type?this.drawScreenLineMarker(D,S,t.clazz,e):S.isMultiLine()?"text"==t.type?this.drawTextMarker(D,S,t.clazz,e):this.drawMultiLineMarker(D,S,t.clazz,e):this.drawSingleLineMarker(D,S,t.clazz+" ace_start ace_br15",e)}if(-1!=this.i)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},e.prototype.$getTop=function(e,n){return(e-n.firstRowScreen)*n.lineHeight},e.prototype.drawTextMarker=function(e,n,D,S,i){for(var o=this.session,g=n.start.row,s=n.end.row,a=g,l=0,c=0,u=o.getScreenLastRowColumn(a),h=new t(a,n.start.column,a,c);a<=s;a++)h.start.row=h.end.row=a,h.start.column=a==g?n.start.column:o.getRowWrapIndent(a),h.end.column=u,l=c,c=u,u=a+1<s?o.getScreenLastRowColumn(a+1):a==s?0:n.end.column,this.drawSingleLineMarker(e,h,D+(a==g?" ace_start":"")+" ace_br"+r(a==g||a==g+1&&n.start.column,l<c,c>u,a==s),S,+(a!=s),i)},e.prototype.drawMultiLineMarker=function(e,n,D,t,S){var i=this.$padding,r=t.lineHeight,o=this.$getTop(n.start.row,t),g=i+n.start.column*t.characterWidth;if(S=S||"",this.session.$bidiHandler.isBidiRow(n.start.row)){var s=n.clone();s.end.row=s.start.row,s.end.column=this.session.getLine(s.start.row).length,this.drawBidiSingleLineMarker(e,s,D+" ace_br1 ace_start",t,null,S)}else this.elt(D+" ace_br1 ace_start","height:"+r+"px;right:"+i+"px;top:"+o+"px;left:"+g+"px;"+(S||""));if(this.session.$bidiHandler.isBidiRow(n.end.row)){var s=n.clone();s.start.row=s.end.row,s.start.column=0,this.drawBidiSingleLineMarker(e,s,D+" ace_br12",t,null,S)}else{o=this.$getTop(n.end.row,t);var a=n.end.column*t.characterWidth;this.elt(D+" ace_br12","height:"+r+"px;width:"+a+"px;top:"+o+"px;left:"+i+"px;"+(S||""))}if(!((r=(n.end.row-n.start.row-1)*t.lineHeight)<=0)){o=this.$getTop(n.start.row+1,t);var l=!!n.start.column|8*!n.end.column;this.elt(D+(l?" ace_br"+l:""),"height:"+r+"px;right:"+i+"px;top:"+o+"px;left:"+i+"px;"+(S||""))}},e.prototype.drawSingleLineMarker=function(e,n,D,t,S,i){if(this.session.$bidiHandler.isBidiRow(n.start.row))return this.drawBidiSingleLineMarker(e,n,D,t,S,i);var r=t.lineHeight,o=(n.end.column+(S||0)-n.start.column)*t.characterWidth,g=this.$getTop(n.start.row,t),s=this.$padding+n.start.column*t.characterWidth;this.elt(D,"height:"+r+"px;width:"+o+"px;top:"+g+"px;left:"+s+"px;"+(i||""))},e.prototype.drawBidiSingleLineMarker=function(e,n,D,t,S,i){var r=t.lineHeight,o=this.$getTop(n.start.row,t),g=this.$padding;this.session.$bidiHandler.getSelections(n.start.column,n.end.column).forEach(function(e){this.elt(D,"height:"+r+"px;width:"+(e.width+(S||0))+"px;top:"+o+"px;left:"+(g+e.left)+"px;"+(i||""))},this)},e.prototype.drawFullLineMarker=function(e,n,D,t,S){var i=this.$getTop(n.start.row,t),r=t.lineHeight;n.start.row!=n.end.row&&(r+=this.$getTop(n.end.row,t)-i),this.elt(D,"height:"+r+"px;top:"+i+"px;left:0;right:0;"+(S||""))},e.prototype.drawScreenLineMarker=function(e,n,D,t,S){var i=this.$getTop(n.start.row,t),r=t.lineHeight;this.elt(D,"height:"+r+"px;top:"+i+"px;left:0;right:0;"+(S||""))},e}();function r(e,n,D,t){return!!e|2*!!n|4*!!D|8*!!t}i.prototype.$padding=0,n.Marker=i}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,n,D){var t=new Set(["text","rparen","lparen"]);n.isTextToken=function(e){return t.has(e)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(e,n,D){"use strict";var t=e("../lib/oop"),S=e("../lib/dom"),i=e("../lib/lang"),r=e("./lines").Lines,o=e("../lib/event_emitter").EventEmitter,g=e("../config").nls,s=e("./text_util").isTextToken,a=function(){function e(e){this.dom=S,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new r(this.element)}return e.prototype.$updateEolChar=function(){var e=this.session.doc,n="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode()?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=n)return this.EOL_CHAR=n,!0},e.prototype.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},e.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},e.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},e.prototype.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",(function(e){this._signal("changeCharacterSize",e)}).bind(this)),this.$pollSizeChanges()},e.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},e.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},e.prototype.setSession=function(e){this.session=e,e&&this.$computeTabString()},e.prototype.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,"string"==typeof e?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},e.prototype.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},e.prototype.setHighlightIndentGuides=function(e){return this.$highlightIndentGuides!==e&&(this.$highlightIndentGuides=e,e)},e.prototype.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var n=this.$tabStrings=[0],D=1;D<e+1;D++)if(this.showTabs){var t=this.dom.createElement("span");t.className="ace_invisible ace_invisible_tab",t.textContent=i.stringRepeat(this.TAB_CHAR,D),n.push(t)}else n.push(this.dom.createTextNode(i.stringRepeat(" ",D),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var S="ace_indent-guide",r=this.showSpaces?" ace_invisible ace_invisible_space":"",o=this.showSpaces?i.stringRepeat(this.SPACE_CHAR,this.tabSize):i.stringRepeat(" ",this.tabSize),g=this.showTabs?" ace_invisible ace_invisible_tab":"",s=this.showTabs?i.stringRepeat(this.TAB_CHAR,this.tabSize):o,t=this.dom.createElement("span");t.className=S+r,t.textContent=o,this.$tabStrings[" "]=t;var t=this.dom.createElement("span");t.className=S+g,t.textContent=s,this.$tabStrings[" "]=t}},e.prototype.updateLines=function(e,n,D){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var t=Math.max(n,e.firstRow),S=Math.min(D,e.lastRow),i=this.element.childNodes,r=0,o=e.firstRow;o<t;o++){var g=this.session.getFoldLine(o);if(g)if(g.containsRow(t)){t=g.start.row;break}else o=g.end.row;r++}for(var s=!1,o=t,g=this.session.getNextFoldLine(o),a=g?g.start.row:1/0;o>a&&(o=g.end.row+1,a=(g=this.session.getNextFoldLine(o,g))?g.start.row:1/0),!(o>S);){var l=i[r++];if(l){this.dom.removeChildren(l),this.$renderLine(l,o,o==a&&g),s&&(l.style.top=this.$lines.computeLineTop(o,e,this.session)+"px");var c=e.lineHeight*this.session.getRowLength(o)+"px";l.style.height!=c&&(s=!0,l.style.height=c)}o++}if(s)for(;r<this.$lines.cells.length;){var u=this.$lines.cells[r++];u.element.style.top=this.$lines.computeLineTop(u.row,e,this.session)+"px"}},e.prototype.scrollLines=function(e){var n=this.config;if(this.config=e,this.$lines.pageChanged(n,e))return this.update(e);this.$lines.moveContainer(e);var D=e.lastRow,t=n?n.lastRow:-1;if(!n||t<e.firstRow||D<n.firstRow||!n||n.lastRow<e.firstRow||e.lastRow<n.firstRow)return this.update(e);if(n.firstRow<e.firstRow)for(var S=this.session.getFoldedRowCount(n.firstRow,e.firstRow-1);S>0;S--)this.$lines.shift();if(n.lastRow>e.lastRow)for(var S=this.session.getFoldedRowCount(e.lastRow+1,n.lastRow);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,n.firstRow-1)),e.lastRow>n.lastRow&&this.$lines.push(this.$renderLinesFragment(e,n.lastRow+1,e.lastRow)),this.$highlightIndentGuide()},e.prototype.$renderLinesFragment=function(e,n,D){for(var t=[],i=n,r=this.session.getNextFoldLine(i),o=r?r.start.row:1/0;i>o&&(i=r.end.row+1,o=(r=this.session.getNextFoldLine(i,r))?r.start.row:1/0),!(i>D);){var g=this.$lines.createCell(i,e,this.session),s=g.element;this.dom.removeChildren(s),S.setStyle(s.style,"height",this.$lines.computeLineHeight(i,e,this.session)+"px"),S.setStyle(s.style,"top",this.$lines.computeLineTop(i,e,this.session)+"px"),this.$renderLine(s,i,i==o&&r),this.$useLineGroups()?s.className="ace_line_group":s.className="ace_line",t.push(g),i++}return t},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var n=e.firstRow,D=e.lastRow,t=this.$lines;t.getLength();)t.pop();t.push(this.$renderLinesFragment(e,n,D))},e.prototype.$renderToken=function(e,n,D,t){for(var S,r=this,o=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,a=this.dom.createFragment(this.element),l=0;S=o.exec(t);){var c=S[1],u=S[2],h=S[3],d=S[4],p=S[5];if(r.showSpaces||!u){var f=l!=S.index?t.slice(l,S.index):"";if(l=S.index+S[0].length,f&&a.appendChild(this.dom.createTextNode(f,this.element)),c){var m=r.session.getScreenTabSize(n+S.index);a.appendChild(r.$tabStrings[m].cloneNode(!0)),n+=m-1}else if(u)if(r.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=i.stringRepeat(r.SPACE_CHAR,u.length),a.appendChild(y)}else a.appendChild(this.dom.createTextNode(u,this.element));else if(h){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=i.stringRepeat(r.SPACE_CHAR,h.length),a.appendChild(y)}else if(d){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className=r.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",y.textContent=r.showSpaces?r.SPACE_CHAR:d,a.appendChild(y)}else if(p){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className="ace_cjk",y.textContent=p,a.appendChild(y)}}}if(a.appendChild(this.dom.createTextNode(l?t.slice(l):t,this.element)),s(D.type))e.appendChild(a);else{var v="ace_"+D.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==D.type&&(y.style.width=D.value.length*this.config.characterWidth+"px",y.setAttribute("title",g("inline-fold.closed.title","Unfold code"))),y.className=v,y.appendChild(a),e.appendChild(y)}return n+t.length},e.prototype.renderIndentGuide=function(e,n,D){var t=n.search(this.$indentGuideRe);if(t<=0||t>=D)return n;if(" "==n[0]){for(var S=(t-=t%this.tabSize)/this.tabSize,i=0;i<S;i++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(t)}if(" "==n[0]){for(var i=0;i<t;i++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(t)}return this.$highlightIndentGuide(),n},e.prototype.$highlightIndentGuide=function(){if(this.$highlightIndentGuides&&this.displayIndentGuides){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var e=this.session.doc.$lines;if(e){var n=this.session.selection.getCursor(),D=/^\s*/.exec(this.session.doc.getLine(n.row))[0].length,t=Math.floor(D/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:t,start:n.row};var S=this.session.$bracketHighlight;if(S){for(var i=this.session.$bracketHighlight.ranges,r=0;r<i.length;r++)if(n.row!==i[r].start.row){this.$highlightIndentGuideMarker.end=i[r].start.row,n.row>i[r].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&""!==e[n.row]&&n.column===e[n.row].length){this.$highlightIndentGuideMarker.dir=1;for(var r=n.row+1;r<e.length;r++){var o=e[r],g=/^\s*/.exec(o)[0].length;if(""!==o&&(this.$highlightIndentGuideMarker.end=r,g<=D))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,n=0;n<e.length;n++){var D=e[n].element.childNodes;if(D.length>0){for(var t=0;t<D.length;t++)if(D[t].classList&&D[t].classList.contains("ace_indent-guide-active")){D[t].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,n){if(""!==this.session.doc.getLine(e.row)){var D=e.element.childNodes;if(D){var t=D[n-1];t&&t.classList&&t.classList.contains("ace_indent-guide")&&t.classList.add("ace_indent-guide-active")}}},e.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var e=this.$lines.cells;this.$clearActiveIndentGuide();var n=this.$highlightIndentGuideMarker.indentLevel;if(0!==n)if(1===this.$highlightIndentGuideMarker.dir)for(var D=0;D<e.length;D++){var t=e[D];if(this.$highlightIndentGuideMarker.end&&t.row>=this.$highlightIndentGuideMarker.start+1){if(t.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(t,n)}}else for(var D=e.length-1;D>=0;D--){var t=e[D];if(this.$highlightIndentGuideMarker.end&&t.row<this.$highlightIndentGuideMarker.start){if(t.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(t,n)}}}},e.prototype.$createLineElement=function(e){var n=this.dom.createElement("div");return n.className="ace_line",n.style.height=this.config.lineHeight+"px",n},e.prototype.$renderWrappedLine=function(e,n,D){var t=0,S=0,r=D[0],o=0,g=this.$createLineElement();e.appendChild(g);for(var s=0;s<n.length;s++){var a=n[s],l=a.value;if(0==s&&this.displayIndentGuides){if(t=l.length,!(l=this.renderIndentGuide(g,l,r)))continue;t-=l.length}if(t+l.length<r)o=this.$renderToken(g,o,a,l),t+=l.length;else{for(;t+l.length>=r;)o=this.$renderToken(g,o,a,l.substring(0,r-t)),l=l.substring(r-t),t=r,g=this.$createLineElement(),e.appendChild(g),g.appendChild(this.dom.createTextNode(i.stringRepeat("\xa0",D.indent),this.element)),o=0,r=D[++S]||Number.MAX_VALUE;0!=l.length&&(t+=l.length,o=this.$renderToken(g,o,a,l))}}D[D.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(g,o,null,"",!0)},e.prototype.$renderSimpleLine=function(e,n){for(var D=0,t=0;t<n.length;t++){var S=n[t],i=S.value;if(0!=t||!this.displayIndentGuides||(i=this.renderIndentGuide(e,i))){if(D+i.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,D,S,i);D=this.$renderToken(e,D,S,i)}}},e.prototype.$renderOverflowMessage=function(e,n,D,t,S){D&&this.$renderToken(e,n,D,t.slice(0,this.MAX_LINE_LENGTH-n));var i=this.dom.createElement("span");i.className="ace_inline_button ace_keyword ace_toggle_wrap",i.textContent=S?"<hide>":"<click to see more...>",e.appendChild(i)},e.prototype.$renderLine=function(e,n,D){if(D||!1==D||(D=this.session.getFoldLine(n)),D)var t=this.$getFoldLineTokens(n,D);else var t=this.session.getTokens(n);var S=e;if(t.length){var i=this.session.getRowSplitData(n);if(i&&i.length){this.$renderWrappedLine(e,t,i);var S=e.lastChild}else{var S=e;this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S)),this.$renderSimpleLine(S,t)}}else this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S));if(this.showEOL&&S){D&&(n=D.end.row);var r=this.dom.createElement("span");r.className="ace_invisible ace_invisible_eol",r.textContent=n==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,S.appendChild(r)}},e.prototype.$getFoldLineTokens=function(e,n){var D=this.session,t=[];function S(e,n,D){for(var S=0,i=0;i+e[S].value.length<n;)if(i+=e[S].value.length,++S==e.length)return;if(i!=n){var r=e[S].value.substring(n-i);r.length>D-n&&(r=r.substring(0,D-n)),t.push({type:e[S].type,value:r}),i=n+r.length,S+=1}for(;i<D&&S<e.length;){var r=e[S].value;r.length+i>D?t.push({type:e[S].type,value:r.substring(0,D-i)}):t.push(e[S]),i+=r.length,S+=1}}var i=D.getTokens(e);return n.walk(function(e,n,r,o,g){null!=e?t.push({type:"fold",value:e}):(g&&(i=D.getTokens(n)),i.length&&S(i,o,r))},n.end.row,this.session.getLine(n.end.row).length),t},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();a.prototype.EOF_CHAR="\xb6",a.prototype.EOL_CHAR_LF="\xac",a.prototype.EOL_CHAR_CRLF="\xa4",a.prototype.EOL_CHAR=a.prototype.EOL_CHAR_LF,a.prototype.TAB_CHAR="—",a.prototype.SPACE_CHAR="\xb7",a.prototype.$padding=0,a.prototype.MAX_LINE_LENGTH=1e4,a.prototype.showInvisibles=!1,a.prototype.showSpaces=!1,a.prototype.showTabs=!1,a.prototype.showEOL=!1,a.prototype.displayIndentGuides=!0,a.prototype.$highlightIndentGuides=!0,a.prototype.$tabStrings=[],a.prototype.destroy={},a.prototype.onChangeTabSize=a.prototype.$computeTabString,t.implement(a.prototype,o),n.Text=a}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=function(){function e(e){this.element=t.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),t.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var n=this.cursors,D=n.length;D--;)t.setStyle(n[D].style,"opacity",e?"":"0")},e.prototype.$startCssAnimation=function(){for(var e=this.cursors,n=e.length;n--;)e[n].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&t.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,t.removeCssClass(this.element,"ace_animate-blinking")},e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},e.prototype.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},e.prototype.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,t.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=t.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},e.prototype.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},e.prototype.hideCursor=function(){this.isVisible=!1,t.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,t.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,t.removeCssClass(this.element,"ace_smooth-blinking")),e(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible)return void this.$stopCssAnimation();if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&t.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),t.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var n=(function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){e(!0),n()},this.blinkInterval),n()}},e.prototype.getPixelPosition=function(e,n){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var D=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(D.row,e.row)?this.session.$bidiHandler.getPosLeft(D.column):D.column*this.config.characterWidth),top:(D.row-(n?this.config.firstRowScreen:0))*this.config.lineHeight}},e.prototype.isCursorInView=function(e,n){return e.top>=0&&e.top<n.maxHeight},e.prototype.update=function(e){this.config=e;var n=this.session.$selectionMarkers,D=0,S=0;(void 0===n||0===n.length)&&(n=[{cursor:null}]);for(var D=0,i=n.length;D<i;D++){var r=this.getPixelPosition(n[D].cursor,!0);if(!(r.top>e.height+e.offset)&&!(r.top<0)||!(D>1)){var o=this.cursors[S++]||this.addCursor(),g=o.style;this.drawCursor?this.drawCursor(o,r,e,n[D],this.session):this.isCursorInView(r,e)?(t.setStyle(g,"display","block"),t.translate(o,r.left,r.top),t.setStyle(g,"width",Math.round(e.characterWidth)+"px"),t.setStyle(g,"height",e.lineHeight+"px")):t.setStyle(g,"display","none")}}for(;this.cursors.length>S;)this.removeCursor();var s=this.session.getOverwrite();this.$setOverwrite(s),this.$pixelPos=r,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?t.addCssClass(this.element,"ace_overwrite-cursors"):t.removeCssClass(this.element,"ace_overwrite-cursors"))},e.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},e}();S.prototype.$padding=0,S.prototype.drawCursor=null,n.Cursor=S}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,g=32768,s=function(){function e(e,n){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+n,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\xa0",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,r.addListener(this.element,"scroll",this.onScroll.bind(this)),r.addListener(this.element,"mousedown",r.preventDefault)}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();S.implement(s.prototype,o);var a=function(e){function n(n,D){var t=e.call(this,n,"-v")||this;return t.scrollTop=0,t.scrollHeight=0,D.$scrollbarWidth=t.width=i.scrollbarWidth(n.ownerDocument),t.inner.style.width=t.element.style.width=(t.width||15)+5+"px",t.$minWidth=0,t}return t(n,e),n.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},n.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},n.prototype.setHeight=function(e){this.element.style.height=e+"px"},n.prototype.setScrollHeight=function(e){this.scrollHeight=e,e>g?(this.coeff=g/e,e=g):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},n.prototype.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)},n}(s);a.prototype.setInnerHeight=a.prototype.setScrollHeight;var l=function(e){function n(n,D){var t=e.call(this,n,"-h")||this;return t.scrollLeft=0,t.height=D.$scrollbarWidth,t.inner.style.height=t.element.style.height=(t.height||15)+5+"px",t}return t(n,e),n.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},n.prototype.getHeight=function(){return this.isVisible?this.height:0},n.prototype.setWidth=function(e){this.element.style.width=e+"px"},n.prototype.setInnerWidth=function(e){this.inner.style.width=e+"px"},n.prototype.setScrollWidth=function(e){this.inner.style.width=e+"px"},n.prototype.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)},n}(s);n.ScrollBar=a,n.ScrollBarV=a,n.ScrollBarH=l,n.VScrollBar=a,n.HScrollBar=l}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=this&&this.__extends||function(){var e=function(n,D){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var D in n)Object.prototype.hasOwnProperty.call(n,D)&&(e[D]=n[D])})(n,D)};return function(n,D){if("function"!=typeof D&&null!==D)throw TypeError("Class extends value "+String(D)+" is not a constructor or null");function t(){this.constructor=n}e(n,D),n.prototype=null===D?Object.create(D):(t.prototype=D.prototype,new t)}}(),S=e("./lib/oop"),i=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter;i.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n position: absolute;\n background: rgba(128, 128, 128, 0.6);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid #bbb;\n border-radius: 2px;\n z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n position: absolute;\n z-index: 6;\n background: none;\n overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n z-index: 6;\n right: 0;\n top: 0;\n width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n z-index: 8;\n right: 0;\n width: 100%;\n}\n.ace_editor>.ace_sb-h {\n bottom: 0;\n left: 0;\n height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n bottom: 0;\n height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n z-index: 8;\n background: #000;\n}","ace_scrollbar.css",!1);var g=function(){function e(e,n){this.element=i.createElement("div"),this.element.className="ace_sb"+n,this.inner=i.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,r.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();S.implement(g.prototype,o);var s=function(e){function n(n,D){var t=e.call(this,n,"-v")||this;return t.scrollTop=0,t.scrollHeight=0,t.parent=n,t.width=t.VScrollWidth,t.renderer=D,t.inner.style.width=t.element.style.width=(t.width||15)+"px",t.$minWidth=0,t}return t(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var D=this,t=n.clientY,S=function(e){t=e.clientY},i=function(){clearInterval(a)},o=n.clientY,g=this.thumbTop,s=function(){if(void 0!==t){var e=D.scrollTopFromThumbTop(g+t-o);e!==D.scrollTop&&D._emit("scroll",{data:e})}};r.capture(this.inner,S,i);var a=setInterval(s,20);return r.preventDefault(n)}var l=n.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(l)}),r.preventDefault(n)}},n.prototype.getHeight=function(){return this.height},n.prototype.scrollTopFromThumbTop=function(e){var n=e*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return(n|=0)<0?n=0:n>this.pageHeight-this.viewHeight&&(n=this.pageHeight-this.viewHeight),n},n.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},n.prototype.setHeight=function(e){this.height=Math.max(0,e),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},n.prototype.setScrollHeight=function(e,n){(this.pageHeight!==e||n)&&(this.pageHeight=e,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},n.prototype.setScrollTop=function(e){this.scrollTop=e,e<0&&(e=0),this.thumbTop=e*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},n}(g);s.prototype.setInnerHeight=s.prototype.setScrollHeight;var a=function(e){function n(n,D){var t=e.call(this,n,"-h")||this;return t.scrollLeft=0,t.scrollWidth=0,t.height=t.HScrollHeight,t.inner.style.height=t.element.style.height=(t.height||12)+"px",t.renderer=D,t}return t(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var D=this,t=n.clientX,S=function(e){t=e.clientX},i=function(){clearInterval(a)},o=n.clientX,g=this.thumbLeft,s=function(){if(void 0!==t){var e=D.scrollLeftFromThumbLeft(g+t-o);e!==D.scrollLeft&&D._emit("scroll",{data:e})}};r.capture(this.inner,S,i);var a=setInterval(s,20);return r.preventDefault(n)}var l=n.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(l)}),r.preventDefault(n)}},n.prototype.getHeight=function(){return this.isVisible?this.height:0},n.prototype.scrollLeftFromThumbLeft=function(e){var n=e*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return(n|=0)<0?n=0:n>this.pageWidth-this.viewWidth&&(n=this.pageWidth-this.viewWidth),n},n.prototype.setWidth=function(e){this.width=Math.max(0,e),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},n.prototype.setScrollWidth=function(e,n){(this.pageWidth!==e||n)&&(this.pageWidth=e,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},n.prototype.setScrollLeft=function(e){this.scrollLeft=e,e<0&&(e=0),this.thumbLeft=e*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},n}(g);a.prototype.setInnerWidth=a.prototype.setScrollWidth,n.ScrollBar=s,n.ScrollBarV=s,n.ScrollBarH=a,n.VScrollBar=s,n.HScrollBar=a}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,n,D){"use strict";var t=e("./lib/event");n.RenderLoop=function(){function e(e,n){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=n||window;var D=this;this._flush=function(e){D.pending=!1;var n=D.changes;if(n&&(t.blockIdle(100),D.changes=0,D.onRender(n)),D.changes){if(D.$recursionLimit--<0)return;D.schedule()}else D.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(t.nextFrame(this._flush),this.pending=!0)},e.prototype.clear=function(e){var n=this.changes;return this.changes=0,n},e}()}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,n,D){var t=e("../lib/oop"),S=e("../lib/dom"),i=e("../lib/lang"),r=e("../lib/event"),o=e("../lib/useragent"),g=e("../lib/event_emitter").EventEmitter,s=512,a="function"==typeof ResizeObserver,l=200,c=function(){function e(e){this.el=S.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=S.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=S.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=i.stringRepeat("X",s),this.$characterSize={width:0,height:0},a?this.$addObserver():this.checkForSizeChanges()}return e.prototype.$setMeasureNodeStyles=function(e,n){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",o.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=n?"hidden":"visible"},e.prototype.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var n=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=n&&n.width===e.width&&n.height===e.height,this._emit("changeCharacterSize",{data:e})}},e.prototype.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(n){e.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},e.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=r.onIdle(function n(){e.checkForSizeChanges(),r.onIdle(n,500)},500)},e.prototype.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},e.prototype.$measureSizes=function(e){var n={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/s};return 0===n.width||0===n.height?null:n},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=i.stringRepeat(e,s),this.$main.getBoundingClientRect().width/s},e.prototype.getCharacterWidth=function(e){var n=this.charSizes[e];return void 0===n&&(n=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),n},e.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype.$getZoom=function(e){return e&&e.parentElement?(Number(window.getComputedStyle(e).zoom)||1)*this.$getZoom(e.parentElement):1},e.prototype.$initTransformMeasureNodes=function(){var e=function(e,n){return["div",{style:"position: absolute;top:"+e+"px;left:"+n+"px;"}]};this.els=S.buildDom([e(0,0),e(l,0),e(0,l),e(l,l)],this.el)},e.prototype.transformCoordinates=function(e,n){function D(e,n,D){var t=e[1]*n[0]-e[0]*n[1];return[(-n[1]*D[0]+n[0]*D[1])/t,(e[1]*D[0]-e[0]*D[1])/t]}function t(e,n){return[e[0]-n[0],e[1]-n[1]]}function S(e,n){return[e[0]+n[0],e[1]+n[1]]}function i(e,n){return[e*n[0],e*n[1]]}function r(e){var n=e.getBoundingClientRect();return[n.left,n.top]}e&&(e=i(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var o=r(this.els[0]),g=r(this.els[1]),s=r(this.els[2]),a=r(this.els[3]),c=D(t(a,g),t(a,s),t(S(g,s),S(a,o))),u=i(1+c[0],t(g,o)),h=i(1+c[1],t(s,o));if(n){var d=n,p=c[0]*d[0]/l+c[1]*d[1]/l+1,f=S(i(d[0],u),i(d[1],h));return S(i(1/p/l,f),o)}var m=t(e,o),y=D(t(u,i(c[0],m)),t(h,i(c[1],m)),m);return i(l,y)},e}();c.prototype.$characterSize={width:0,height:0},t.implement(c.prototype,g),n.FontMetrics=c}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,n,D){D.exports='\n.ace_br1 {border-top-left-radius : 3px;}\n.ace_br2 {border-top-right-radius : 3px;}\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\n.ace_br4 {border-bottom-right-radius: 3px;}\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\n.ace_br8 {border-bottom-left-radius : 3px;}\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n\n\n.ace_editor {\n position: relative;\n overflow: hidden;\n padding: 0;\n font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'Source Code Pro\', \'source-code-pro\', monospace;\n direction: ltr;\n text-align: left;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n forced-color-adjust: none;\n}\n\n.ace_scroller {\n position: absolute;\n overflow: hidden;\n top: 0;\n bottom: 0;\n background-color: inherit;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n cursor: text;\n}\n\n.ace_content {\n position: absolute;\n box-sizing: border-box;\n min-width: 100%;\n contain: style size layout;\n font-variant-ligatures: no-common-ligatures;\n}\n\n.ace_keyboard-focus:focus {\n box-shadow: inset 0 0 0 2px #5E9ED6;\n outline: none;\n}\n\n.ace_dragging .ace_scroller:before{\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n content: \'\';\n background: rgba(250, 250, 250, 0.01);\n z-index: 1000;\n}\n.ace_dragging.ace_dark .ace_scroller:before{\n background: rgba(0, 0, 0, 0.01);\n}\n\n.ace_gutter {\n position: absolute;\n overflow : hidden;\n width: auto;\n top: 0;\n bottom: 0;\n left: 0;\n cursor: default;\n z-index: 4;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n contain: style size layout;\n}\n\n.ace_gutter-active-line {\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.ace_scroller.ace_scroll-left:after {\n content: "";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n pointer-events: none;\n}\n\n.ace_gutter-cell, .ace_gutter-cell_svg-icons {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-left: 19px;\n padding-right: 6px;\n background-repeat: no-repeat;\n}\n\n.ace_gutter-cell_svg-icons .ace_gutter_annotation {\n margin-left: -14px;\n float: left;\n}\n\n.ace_gutter-cell .ace_gutter_annotation {\n margin-left: -19px;\n float: left;\n}\n\n.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\n}\n\n.ace_icon_svg.ace_error {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: darkorange;\n}\n.ace_icon_svg.ace_info {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: royalblue;\n}\n.ace_icon_svg.ace_hint {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");\n background-color: silver;\n}\n\n.ace_icon_svg.ace_error_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");\n background-color: darkorange;\n}\n\n.ace_scrollbar {\n contain: strict;\n position: absolute;\n right: 0;\n bottom: 0;\n z-index: 6;\n}\n\n.ace_scrollbar-inner {\n position: absolute;\n cursor: text;\n left: 0;\n top: 0;\n}\n\n.ace_scrollbar-v{\n overflow-x: hidden;\n overflow-y: scroll;\n top: 0;\n}\n\n.ace_scrollbar-h {\n overflow-x: scroll;\n overflow-y: hidden;\n left: 0;\n}\n\n.ace_print-margin {\n position: absolute;\n height: 100%;\n}\n\n.ace_text-input {\n position: absolute;\n z-index: 0;\n width: 0.5em;\n height: 1em;\n opacity: 0;\n background: transparent;\n -moz-appearance: none;\n appearance: none;\n border: none;\n resize: none;\n outline: none;\n overflow: hidden;\n font: inherit;\n padding: 0 1px;\n margin: 0 -1px;\n contain: strict;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n user-select: text;\n /*with `pre-line` chrome inserts instead of space*/\n white-space: pre!important;\n}\n.ace_text-input.ace_composition {\n background: transparent;\n color: inherit;\n z-index: 1000;\n opacity: 1;\n}\n.ace_composition_placeholder { color: transparent }\n.ace_composition_marker { \n border-bottom: 1px solid;\n position: absolute;\n border-radius: 0;\n margin-top: 1px;\n}\n\n[ace_nocontext=true] {\n transform: none!important;\n filter: none!important;\n clip-path: none!important;\n mask : none!important;\n contain: none!important;\n perspective: none!important;\n mix-blend-mode: initial!important;\n z-index: auto;\n}\n\n.ace_layer {\n z-index: 1;\n position: absolute;\n overflow: hidden;\n /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/\n word-wrap: normal;\n white-space: pre;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n /* setting pointer-events: auto; on node under the mouse, which changes\n during scroll, will break mouse wheel scrolling in Safari */\n pointer-events: none;\n}\n\n.ace_gutter-layer {\n position: relative;\n width: auto;\n text-align: right;\n pointer-events: auto;\n height: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer {\n font: inherit !important;\n position: absolute;\n height: 1000000px;\n width: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\n contain: style size layout;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ace_hidpi .ace_text-layer,\n.ace_hidpi .ace_gutter-layer,\n.ace_hidpi .ace_content,\n.ace_hidpi .ace_gutter {\n contain: strict;\n}\n.ace_hidpi .ace_text-layer > .ace_line, \n.ace_hidpi .ace_text-layer > .ace_line_group {\n contain: strict;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n box-sizing: border-box;\n border-left: 2px solid;\n /* workaround for smooth cursor repaintng whole screen in chrome */\n transform: translatez(0);\n}\n\n.ace_multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_slim-cursors .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_overwrite-cursors .ace_cursor {\n border-left-width: 0;\n border-bottom: 1px solid;\n}\n\n.ace_hidden-cursors .ace_cursor {\n opacity: 0.2;\n}\n\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\n opacity: 0;\n}\n\n.ace_smooth-blinking .ace_cursor {\n transition: opacity 0.18s;\n}\n\n.ace_animate-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: step-end;\n animation-name: blink-ace-animate;\n animation-iteration-count: infinite;\n}\n\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: ease-in-out;\n animation-name: blink-ace-animate-smooth;\n}\n \n@keyframes blink-ace-animate {\n from, to { opacity: 1; }\n 60% { opacity: 0; }\n}\n\n@keyframes blink-ace-animate-smooth {\n from, to { opacity: 1; }\n 45% { opacity: 1; }\n 60% { opacity: 0; }\n 85% { opacity: 0; }\n}\n\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_error_bracket {\n position: absolute;\n border-bottom: 1px solid #DE5555;\n border-radius: 0;\n}\n\n.ace_marker-layer .ace_active-line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected-word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\n}\n\n.ace_tooltip {\n background-color: #f5f5f5;\n border: 1px solid gray;\n border-radius: 1px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n color: black;\n max-width: 100%;\n padding: 3px 4px;\n position: fixed;\n z-index: 999999;\n box-sizing: border-box;\n cursor: default;\n white-space: pre-wrap;\n word-wrap: break-word;\n line-height: normal;\n font-style: normal;\n font-weight: normal;\n letter-spacing: normal;\n pointer-events: none;\n overflow: auto;\n max-width: min(60em, 66vw);\n overscroll-behavior: contain;\n}\n.ace_tooltip pre {\n white-space: pre-wrap;\n}\n\n.ace_tooltip.ace_dark {\n background-color: #636363;\n color: #fff;\n}\n\n.ace_tooltip:focus {\n outline: 1px solid #5E9ED6;\n}\n\n.ace_icon {\n display: inline-block;\n width: 18px;\n vertical-align: top;\n}\n\n.ace_icon_svg {\n display: inline-block;\n width: 12px;\n vertical-align: top;\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-size: 12px;\n -webkit-mask-position: center;\n}\n\n.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: none;\n width: 11px;\n vertical-align: top;\n\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n cursor: pointer;\n}\n\n.ace_folding-enabled .ace_fold-widget {\n display: inline-block; \n}\n\n.ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\n}\n\n.ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\n}\n.ace_dark .ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n\n.ace_inline_button {\n border: 1px solid lightgray;\n display: inline-block;\n margin: -1px 8px;\n padding: 0 5px;\n pointer-events: auto;\n cursor: pointer;\n}\n.ace_inline_button:hover {\n border-color: gray;\n background: rgba(200,200,200,0.2);\n display: inline-block;\n pointer-events: auto;\n}\n\n.ace_fold-widget.ace_invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_nobold .ace_bold {\n font-weight: normal;\n}\n\n.ace_italic {\n font-style: italic;\n}\n\n\n.ace_error-marker {\n background-color: rgba(255, 0, 0,0.2);\n position: absolute;\n z-index: 9;\n}\n\n.ace_highlight-marker {\n background-color: rgba(255, 255, 0,0.2);\n position: absolute;\n z-index: 8;\n}\n\n.ace_mobile-menu {\n position: absolute;\n line-height: 1.5;\n border-radius: 4px;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n background: white;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #dcdcdc;\n color: black;\n}\n.ace_dark > .ace_mobile-menu {\n background: #333;\n color: #ccc;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #444;\n\n}\n.ace_mobile-button {\n padding: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n.ace_mobile-button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_mobile-button:active {\n background-color: #ddd;\n}\n\n.ace_placeholder {\n position: relative;\n font-family: arial;\n transform: scale(0.9);\n transform-origin: left;\n white-space: pre;\n opacity: 0.7;\n margin: 0 10px;\n z-index: 1;\n}\n\n.ace_ghost_text {\n opacity: 0.5;\n font-style: italic;\n}\n\n.ace_ghost_text_container > div {\n white-space: pre;\n}\n\n.ghost_text_line_wrapped::after {\n content: "↩";\n position: absolute;\n}\n\n.ace_lineWidgetContainer.ace_ghost_text {\n margin: 0px 4px\n}\n\n.ace_screenreader-only {\n position:absolute;\n left:-10000px;\n top:auto;\n width:1px;\n height:1px;\n overflow:hidden;\n}\n\n.ace_hidden_token {\n display: none;\n}'}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(e,n,D){"use strict";var t=e("../lib/dom"),S=e("../lib/oop"),i=e("../lib/event_emitter").EventEmitter,r=function(){function e(e,n){this.canvas=t.createElement("canvas"),this.renderer=n,this.pixelRatio=1,this.maxHeight=n.layerConfig.maxHeight,this.lineHeight=n.layerConfig.lineHeight,this.canvasHeight=e.parent.scrollHeight,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvasWidth=e.width,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},e.element.appendChild(this.canvas)}return e.prototype.$updateDecorators=function(e){var n=!0===this.renderer.theme.isDark?this.colors.dark:this.colors.light;e&&(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,(e.lastRow+1)*this.lineHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight);var D=this.canvas.getContext("2d");function t(e,n){return e.priority<n.priority?-1:+(e.priority>n.priority)}var S=this.renderer.session.$annotations;if(D.clearRect(0,0,this.canvas.width,this.canvas.height),S){var i={info:1,warning:2,error:3};S.forEach(function(e){e.priority=i[e.type]||null}),S=S.sort(t);for(var r=this.renderer.session.$foldData,o=0;o<S.length;o++){var g=S[o].row,s=this.compensateFoldRows(g,r),a=Math.round((g-s)*this.lineHeight*this.heightRatio),l=Math.round((g-s)*this.lineHeight*this.heightRatio),c=Math.round(((g-s)*this.lineHeight+this.lineHeight)*this.heightRatio);if(c-l<this.minDecorationHeight){var u=(l+c)/2|0;u<this.halfMinDecorationHeight?u=this.halfMinDecorationHeight:u+this.halfMinDecorationHeight>this.canvasHeight&&(u=this.canvasHeight-this.halfMinDecorationHeight),l=Math.round(u-this.halfMinDecorationHeight),c=Math.round(u+this.halfMinDecorationHeight)}D.fillStyle=n[S[o].type]||null,D.fillRect(0,a,this.canvasWidth,c-l)}}var h=this.renderer.session.selection.getCursor();if(h){var s=this.compensateFoldRows(h.row,r),a=Math.round((h.row-s)*this.lineHeight*this.heightRatio);D.fillStyle="rgba(0, 0, 0, 0.5)",D.fillRect(0,a,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,n){var D=0;if(n&&n.length>0)for(var t=0;t<n.length;t++)e>n[t].start.row&&e<n[t].end.row?D+=e-n[t].start.row:e>=n[t].end.row&&(D+=n[t].end.row-n[t].start.row);return D},e}();S.implement(r.prototype,i),n.Decorator=r}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(e,n,D){"use strict";var t=e("./lib/oop"),S=e("./lib/dom"),i=e("./lib/lang"),r=e("./config"),o=e("./layer/gutter").Gutter,g=e("./layer/marker").Marker,s=e("./layer/text").Text,a=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,c=e("./scrollbar").VScrollBar,u=e("./scrollbar_custom").HScrollBar,h=e("./scrollbar_custom").VScrollBar,d=e("./renderloop").RenderLoop,p=e("./layer/font_metrics").FontMetrics,f=e("./lib/event_emitter").EventEmitter,m=e("./css/editor-css"),y=e("./layer/decorators").Decorator,v=e("./lib/useragent"),b=e("./layer/text_util").isTextToken;S.importCssString(m,"ace_editor.css",!1);var w=function(){function e(e,n){var D=this;this.container=e||S.createElement("div"),S.addCssClass(this.container,"ace_editor"),S.HI_DPI&&S.addCssClass(this.container,"ace_hidpi"),this.setTheme(n),null==r.get("useStrictCSP")&&r.set("useStrictCSP",!1),this.$gutter=S.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=S.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=S.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new g(this.content);var t=this.$textLayer=new s(this.content);this.canvas=t.element,this.$markerFront=new g(this.content),this.$cursorLayer=new a(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(e){D.$scrollAnimation||D.session.setScrollTop(e.data-D.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){D.$scrollAnimation||D.session.setScrollLeft(e.data-D.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new p(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){D.updateCharacterSize(),D.onResize(!0,D.gutterWidth,D.$size.width,D.$size.height),D._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!v.isIOS,this.$loop=new d(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),r.resetOptions(this),r._signal("renderer",this)}return e.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),S.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},e.prototype.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&0>=e.getScrollTop()&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},e.prototype.updateLines=function(e,n,D){if(void 0===n&&(n=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<n&&(this.$changedLines.lastRow=n)):this.$changedLines={firstRow:e,lastRow:n},this.$changedLines.lastRow<this.layerConfig.firstRow)if(!D)return;else this.$changedLines.lastRow=this.layerConfig.lastRow;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},e.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},e.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},e.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},e.prototype.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},e.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},e.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},e.prototype.onResize=function(e,n,D,t){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var S=this.container;t||(t=S.clientHeight||S.scrollHeight),!t&&this.$maxLines&&this.lineHeight>1&&(!S.style.height||"0px"==S.style.height)&&(S.style.height="1px",t=S.clientHeight||S.scrollHeight),D||(D=S.clientWidth||S.scrollWidth);var i=this.$updateCachedSize(e,n,D,t);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!D&&!t)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(i|this.$changes,!0):this.$loop.schedule(i|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},e.prototype.$updateCachedSize=function(e,n,D,t){t-=this.$extraHeight||0;var i=0,r=this.$size,o={width:r.width,height:r.height,scrollerHeight:r.scrollerHeight,scrollerWidth:r.scrollerWidth};if(t&&(e||r.height!=t)&&(r.height=t,i|=this.CHANGE_SIZE,r.scrollerHeight=r.height,this.$horizScroll&&(r.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(r.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",i|=this.CHANGE_SCROLL),D&&(e||r.width!=D)){i|=this.CHANGE_SIZE,r.width=D,null==n&&(n=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=n,S.setStyle(this.scrollBarH.element.style,"left",n+"px"),S.setStyle(this.scroller.style,"left",n+this.margin.left+"px"),r.scrollerWidth=Math.max(0,D-n-this.scrollBarV.getWidth()-this.margin.h),S.setStyle(this.$gutter.style,"left",this.margin.left+"px");var g=this.scrollBarV.getWidth()+"px";S.setStyle(this.scrollBarH.element.style,"right",g),S.setStyle(this.scroller.style,"right",g),S.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(r.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(i|=this.CHANGE_FULL)}return r.$dirty=!D||!t,i&&this._signal("resize",o),i},e.prototype.onGutterResize=function(e){var n=this.$showGutter?e:0;n!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,n,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()||this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},e.prototype.adjustWrapLimit=function(){var e=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth);return this.session.adjustWrapLimit(e,this.$showPrintMargin&&this.$printMarginColumn)},e.prototype.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},e.prototype.getAnimatedScroll=function(){return this.$animatedScroll},e.prototype.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},e.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},e.prototype.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},e.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},e.prototype.setHighlightIndentGuides=function(e){this.setOption("highlightIndentGuides",e)},e.prototype.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},e.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},e.prototype.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},e.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},e.prototype.getShowGutter=function(){return this.getOption("showGutter")},e.prototype.setShowGutter=function(e){return this.setOption("showGutter",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=S.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=S.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var n=this.$printMarginEl.style;n.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",n.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},e.prototype.getContainerElement=function(){return this.container},e.prototype.getMouseEventTarget=function(){return this.scroller},e.prototype.getTextAreaContainer=function(){return this.container},e.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var e=this.textarea.style,n=this.$composition;if(!this.$keepTextAreaAtCursor&&!n)return void S.translate(this.textarea,-100,0);var D=this.$cursorLayer.$pixelPos;if(D){n&&n.markerRange&&(D=this.$cursorLayer.getPixelPosition(n.markerRange.start,!0));var t=this.layerConfig,i=D.top,r=D.left;i-=t.offset;var o=n&&n.useTextareaForIME||v.isMobile?this.lineHeight:1;if(i<0||i>t.height-o)return void S.translate(this.textarea,0,0);var g=1,s=this.$size.height-o;if(n)if(n.useTextareaForIME){var a=this.textarea.value;g=this.characterWidth*this.session.$getStringScreenWidth(a)[0]}else i+=this.lineHeight+2;else i+=this.lineHeight;r-=this.scrollLeft,r>this.$size.scrollerWidth-g&&(r=this.$size.scrollerWidth-g),r+=this.gutterWidth+this.margin.left,S.setStyle(e,"height",o+"px"),S.setStyle(e,"width",g+"px"),S.translate(this.textarea,Math.min(r,this.$size.scrollerWidth-g),Math.min(i,s))}}},e.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},e.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+ +(0!==this.layerConfig.offset)},e.prototype.getLastFullyVisibleRow=function(){var e=this.layerConfig,n=e.lastRow;return this.session.documentToScreenRow(n,0)*e.lineHeight-this.session.getScrollTop()>e.height-e.lineHeight?n-1:n},e.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},e.prototype.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},e.prototype.setScrollMargin=function(e,n,D,t){var S=this.scrollMargin;S.top=0|e,S.bottom=0|n,S.right=0|t,S.left=0|D,S.v=S.top+S.bottom,S.h=S.left+S.right,S.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-S.top),this.updateFull()},e.prototype.setMargin=function(e,n,D,t){var S=this.margin;S.top=0|e,S.bottom=0|n,S.right=0|t,S.left=0|D,S.v=S.top+S.bottom,S.h=S.left+S.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},e.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},e.prototype.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},e.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},e.prototype.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},e.prototype.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,n=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(n-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-n&&(e=this.scrollTop+n,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},e.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},e.prototype.freeze=function(){this.$frozen=!0},e.prototype.unfreeze=function(){this.$frozen=!1},e.prototype.$renderChanges=function(e,n){if(this.$changes&&(e|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!e&&!n){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var D=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),D.firstRow!=this.layerConfig.firstRow&&D.firstRowScreen==this.layerConfig.firstRowScreen){var t=this.scrollTop+(D.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;t>0&&(this.scrollTop=t,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}D=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),S.translate(this.content,-this.scrollLeft,-D.offset);var i=D.width+2*this.$padding+"px",r=D.minHeight+"px";S.setStyle(this.content.style,"width",i),S.setStyle(this.content.style,"height",r)}if(e&this.CHANGE_H_SCROLL&&(S.translate(this.content,-this.scrollLeft,-D.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),e&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(D),this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D),this.$markerBack.update(D),this.$markerFront.update(D),this.$cursorLayer.update(D),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}if(e&this.CHANGE_SCROLL){this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(D):this.$textLayer.scrollLines(D),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(D):this.$gutterLayer.scrollLines(D)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D),this.$markerBack.update(D),this.$markerFront.update(D),this.$cursorLayer.update(D),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(D),this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(D),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(D)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(D),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(D),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(D),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,n=this.$maxLines*this.lineHeight,D=Math.min(n,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(D+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&D>this.$maxPixelHeight&&(D=this.$maxPixelHeight);var t=!(D<=2*this.lineHeight)&&e>n;if(D!=this.desiredHeight||this.$size.height!=this.desiredHeight||t!=this.$vScroll){t!=this.$vScroll&&(this.$vScroll=t,this.scrollBarV.setVisible(t));var S=this.container.clientWidth;this.container.style.height=D+"px",this.$updateCachedSize(!0,this.$gutterWidth,S,D),this.desiredHeight=D,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,n,D=this.session,t=this.$size,S=t.height<=2*this.lineHeight,i=this.session.getScreenLength()*this.lineHeight,r=this.$getLongestLine(),o=!S&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-r-2*this.$padding<0),g=this.$horizScroll!==o;g&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var s=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var a=t.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=l;var c=this.scrollMargin;this.session.setScrollTop(Math.max(-c.top,Math.min(this.scrollTop,i-t.scrollerHeight+c.bottom))),this.session.setScrollLeft(Math.max(-c.left,Math.min(this.scrollLeft,r+2*this.$padding-t.scrollerWidth+c.right)));var u=!S&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+l<0||this.scrollTop>c.top),h=s!==u;h&&(this.$vScroll=u,this.scrollBarV.setVisible(u));var d=this.scrollTop%this.lineHeight,p=Math.ceil(a/this.lineHeight)-1,f=Math.max(0,Math.round((this.scrollTop-d)/this.lineHeight)),m=f+p,y=this.lineHeight;f=D.screenToDocumentRow(f,0);var v=D.getFoldLine(f);v&&(f=v.start.row),e=D.documentToScreenRow(f,0),n=D.getRowLength(f)*y,m=Math.min(D.screenToDocumentRow(m,0),D.getLength()-1),a=t.scrollerHeight+D.getRowLength(m)*y+n,d=this.scrollTop-e*y;var b=0;return(this.layerConfig.width!=r||g)&&(b=this.CHANGE_H_SCROLL),(g||h)&&(b|=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),h&&(r=this.$getLongestLine())),this.layerConfig={width:r,padding:this.$padding,firstRow:f,firstRowScreen:e,lastRow:m,lineHeight:y,characterWidth:this.characterWidth,minHeight:a,maxHeight:i,offset:d,gutterOffset:y?Math.max(0,Math.ceil((d+t.height-t.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(r-this.$padding),b},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,n=this.$changedLines.lastRow;this.$changedLines=null;var D=this.layerConfig;if(!(e>D.lastRow+1)&&!(n<D.firstRow)){if(n===1/0){this.$showGutter&&this.$gutterLayer.update(D),this.$textLayer.update(D);return}return this.$textLayer.updateLines(D,e,n),!0}}},e.prototype.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},e.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},e.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},e.prototype.addGutterDecoration=function(e,n){this.$gutterLayer.addGutterDecoration(e,n)},e.prototype.removeGutterDecoration=function(e,n){this.$gutterLayer.removeGutterDecoration(e,n)},e.prototype.updateBreakpoints=function(e){this._rows=e,this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},e.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},e.prototype.showCursor=function(){this.$cursorLayer.showCursor()},e.prototype.scrollSelectionIntoView=function(e,n,D){this.scrollCursorIntoView(e,D),this.scrollCursorIntoView(n,D)},e.prototype.scrollCursorIntoView=function(e,n,D){if(0!==this.$size.scrollerHeight){var t=this.$cursorLayer.getPixelPosition(e),S=t.left,i=t.top,r=D&&D.top||0,o=D&&D.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var g=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;g+r>i?(n&&g+r>i+this.lineHeight&&(i-=n*this.$size.scrollerHeight),0===i&&(i=-this.scrollMargin.top),this.session.setScrollTop(i)):g+this.$size.scrollerHeight-o<i+this.lineHeight&&(n&&g+this.$size.scrollerHeight-o<i-this.lineHeight&&(i+=n*this.$size.scrollerHeight),this.session.setScrollTop(i+this.lineHeight+o-this.$size.scrollerHeight));var s=this.scrollLeft,a=2*this.layerConfig.characterWidth;S-a<s?((S-=a)<this.$padding+a&&(S=-this.scrollMargin.left),this.session.setScrollLeft(S)):(S+=a,s+this.$size.scrollerWidth<S+this.characterWidth?this.session.setScrollLeft(Math.round(S+this.characterWidth-this.$size.scrollerWidth)):s<=this.$padding&&S-s<this.characterWidth&&this.session.setScrollLeft(0))}},e.prototype.getScrollTop=function(){return this.session.getScrollTop()},e.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},e.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},e.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},e.prototype.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},e.prototype.alignCursor=function(e,n){"number"==typeof e&&(e={row:e,column:0});var D=this.$cursorLayer.getPixelPosition(e),t=this.$size.scrollerHeight-this.lineHeight,S=D.top-t*(n||0);return this.session.setScrollTop(S),S},e.prototype.$calcSteps=function(e,n){var D=0,t=this.STEPS,S=[],i=function(e,n,D){return D*(Math.pow(e-1,3)+1)+n};for(D=0;D<t;++D)S.push(i(D/this.STEPS,e,n-e));return S},e.prototype.scrollToLine=function(e,n,D,t){var S=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;n&&(S-=this.$size.scrollerHeight/2);var i=this.scrollTop;this.session.setScrollTop(S),!1!==D&&this.animateScrolling(i,t)},e.prototype.animateScrolling=function(e,n){var D=this.scrollTop;if(this.$animatedScroll){var t=this;if(e!=D){if(this.$scrollAnimation){var S=this.$scrollAnimation.steps;if(S.length&&(e=S[0])==D)return}var i=t.$calcSteps(e,D);this.$scrollAnimation={from:e,to:D,steps:i},clearInterval(this.$timer),t.session.setScrollTop(i.shift()),t.session.$scrollTop=D,this.$timer=setInterval(function(){return t.$stopAnimation?void r():t.session?void(i.length?(t.session.setScrollTop(i.shift()),t.session.$scrollTop=D):null!=D?(t.session.$scrollTop=-1,t.session.setScrollTop(D),D=null):r()):clearInterval(t.$timer)},10)}}function r(){t.$timer=clearInterval(t.$timer),t.$scrollAnimation=null,t.$stopAnimation=!1,n&&n()}},e.prototype.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},e.prototype.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},e.prototype.scrollTo=function(e,n){this.session.setScrollTop(n),this.session.setScrollLeft(e)},e.prototype.scrollBy=function(e,n){n&&this.session.setScrollTop(this.session.getScrollTop()+n),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},e.prototype.isScrollableBy=function(e,n){if(n<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||n>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},e.prototype.pixelToScreenCoordinates=function(e,n){if(this.$hasCssTransforms){var D={top:0,left:0},t=this.$fontMetrics.transformCoordinates([e,n]);e=t[1]-this.gutterWidth-this.margin.left,n=t[0]}else D=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-D.left-this.$padding,i=S/this.characterWidth,r=Math.floor((n+this.scrollTop-D.top)/this.lineHeight),o=this.$blockCursor?Math.floor(i):Math.round(i);return{row:r,column:o,side:i-o>0?1:-1,offsetX:S}},e.prototype.screenToTextCoordinates=function(e,n){if(this.$hasCssTransforms){var D={top:0,left:0},t=this.$fontMetrics.transformCoordinates([e,n]);e=t[1]-this.gutterWidth-this.margin.left,n=t[0]}else D=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-D.left-this.$padding,i=S/this.characterWidth,r=this.$blockCursor?Math.floor(i):Math.round(i),o=Math.floor((n+this.scrollTop-D.top)/this.lineHeight);return this.session.screenToDocumentPosition(o,Math.max(r,0),S)},e.prototype.textToScreenCoordinates=function(e,n){var D=this.scroller.getBoundingClientRect(),t=this.session.documentToScreenPosition(e,n),S=this.$padding+(this.session.$bidiHandler.isBidiRow(t.row,e)?this.session.$bidiHandler.getPosLeft(t.column):Math.round(t.column*this.characterWidth)),i=t.row*this.lineHeight;return{pageX:D.left+S-this.scrollLeft,pageY:D.top+i-this.scrollTop}},e.prototype.visualizeFocus=function(){S.addCssClass(this.container,"ace_focus")},e.prototype.visualizeBlur=function(){S.removeCssClass(this.container,"ace_focus")},e.prototype.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),void 0==e.useTextareaForIME&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(S.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},e.prototype.setCompositionText=function(e){var n=this.session.selection.cursor;this.addToken(e,"composition_placeholder",n.row,n.column),this.$moveTextAreaToCursor()},e.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),S.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},e.prototype.setGhostText=function(e,n){var D=this.session.selection.cursor,t=n||{row:D.row,column:D.column};this.removeGhostText();var i=this.$calculateWrappedTextChunks(e,t);this.addToken(i[0].text,"ghost_text",t.row,t.column),this.$ghostText={text:e,position:{row:t.row,column:t.column}};var r=S.createElement("div");if(i.length>1){var o,g=this.hideTokensAfterPosition(t.row,t.column);i.slice(1).forEach(function(e){var n=S.createElement("div"),D=S.createElement("span");D.className="ace_ghost_text",e.wrapped&&(n.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),D.appendChild(S.createTextNode(e.text)),n.appendChild(D),r.appendChild(n),o=n}),g.forEach(function(e){var n=S.createElement("span");b(e.type)||(n.className="ace_"+e.type.replace(/\./g," ace_")),n.appendChild(S.createTextNode(e.value)),o.appendChild(n)}),this.$ghostTextWidget={el:r,row:t.row,column:t.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var s=this.$cursorLayer.getPixelPosition(t,!0),a=this.container.getBoundingClientRect().height,l=i.length*this.lineHeight;if(l<a-s.top)return;l<a?this.scrollBy(0,(i.length-1)*this.lineHeight):this.scrollToRow(t.row)}},e.prototype.$calculateWrappedTextChunks=function(e,n){var D=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;D=D<=0?60:D;for(var t=e.split(/\r?\n/),S=[],i=0;i<t.length;i++){var r=this.session.$getDisplayTokens(t[i],n.column),o=this.session.$computeWrapSplits(r,D,this.session.$tabSize);if(o.length>0){var g=0;o.push(t[i].length);for(var s=0;s<o.length;s++){var a=t[i].slice(g,o[s]);S.push({text:a,wrapped:!0}),g=o[s]}}else S.push({text:t[i],wrapped:!1})}return S},e.prototype.removeGhostText=function(){if(this.$ghostText){var e=this.$ghostText.position;this.removeExtraToken(e.row,e.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},e.prototype.addToken=function(e,n,D,t){var S=this.session;S.bgTokenizer.lines[D]=null;var i={type:n,value:e},r=S.getTokens(D);if(null!=t&&r.length)for(var o=0,g=0;g<r.length;g++){var s=r[g];if(t<=(o+=s.value.length)){var a=s.value.length-(o-t),l=s.value.slice(0,a),c=s.value.slice(a);r.splice(g,1,{type:s.type,value:l},i,{type:s.type,value:c});break}}else r.push(i);this.updateLines(D,D)},e.prototype.hideTokensAfterPosition=function(e,n){for(var D=this.session.getTokens(e),t=0,S=!1,i=[],r=0;r<D.length;r++){var o=D[r];if(t+=o.value.length,"ghost_text"!==o.type){if(S){i.push({type:o.type,value:o.value}),o.type="hidden_token";continue}t===n&&(S=!0)}}return this.updateLines(e,e),i},e.prototype.removeExtraToken=function(e,n){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,n){var D=this;if(this.$themeId=e,D._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)i(e);else{var t=e||this.$options.theme.initialValue;r.loadModule(["theme",t],i)}function i(t){if(D.$themeId!=e)return n&&n();if(!t||!t.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");t.$id&&(D.$themeId=t.$id),S.importCssString(t.cssText,t.cssClass,D.container),D.theme&&S.removeCssClass(D.container,D.theme.cssClass);var i="padding"in t?t.padding:"padding"in(D.theme||{})?4:D.$padding;D.$padding&&i!=D.$padding&&D.setPadding(i),D.$theme=t.cssClass,D.theme=t,S.addCssClass(D.container,t.cssClass),S.setCssClass(D.container,"ace_dark",t.isDark),D.$size&&(D.$size.width=0,D.$updateSizeAsync()),D._dispatchEvent("themeLoaded",{theme:t}),n&&n(),v.isSafari&&D.scroller&&(D.scroller.style.background="red",D.scroller.style.background="")}},e.prototype.getTheme=function(){return this.$themeId},e.prototype.setStyle=function(e,n){S.setCssClass(this.container,e,!1!==n)},e.prototype.unsetStyle=function(e){S.removeCssClass(this.container,e)},e.prototype.setCursorStyle=function(e){S.setStyle(this.scroller.style,"cursor",e)},e.prototype.setMouseCursor=function(e){S.setStyle(this.scroller.style,"cursor",e)},e.prototype.attachToShadowRoot=function(){S.importCssString(m,"ace_editor.css",this.container)},e.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},e.prototype.$updateCustomScrollbar=function(e){var n=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,!0===e?(this.scrollBarV=new h(this.container,this),this.scrollBarH=new u(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.$scrollDecorator=new y(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}))},e.prototype.$addResizeObserver=function(){if(window.ResizeObserver&&!this.$resizeObserver){var e=this;this.$resizeTimer=i.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(n){var D=n[0].contentRect.width,t=n[0].contentRect.height;Math.abs(e.$size.width-D)>1||Math.abs(e.$size.height-t)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();w.prototype.CHANGE_CURSOR=1,w.prototype.CHANGE_MARKER=2,w.prototype.CHANGE_GUTTER=4,w.prototype.CHANGE_SCROLL=8,w.prototype.CHANGE_LINES=16,w.prototype.CHANGE_TEXT=32,w.prototype.CHANGE_SIZE=64,w.prototype.CHANGE_MARKER_BACK=128,w.prototype.CHANGE_MARKER_FRONT=256,w.prototype.CHANGE_FULL=512,w.prototype.CHANGE_H_SCROLL=1024,w.prototype.$changes=0,w.prototype.$padding=null,w.prototype.$frozen=!1,w.prototype.STEPS=8,t.implement(w.prototype,f),r.defineOptions(w.prototype,"renderer",{useResizeObserver:{set:function(e){!e&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):e&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(e){this.$gutterLayer.$useSvgGutterIcons=e},initialValue:!1},showFoldedAnnotations:{set:function(e){this.$gutterLayer.$showFoldedAnnotations=e},initialValue:!1},fadeFoldWidgets:{set:function(e){S.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(e){!0==this.$textLayer.setHighlightIndentGuides(e)?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<0x1ffffffffffff||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(e){this.$updateCustomScrollbar(e)},initialValue:!1},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!v.isMobile&&!v.isIE}}),n.VirtualRenderer=w}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,n,D){"use strict";var t=e("../lib/oop"),S=e("../lib/net"),i=e("../lib/event_emitter").EventEmitter,r=e("../config");function o(e){var n="importScripts('"+S.qualifyURL(e)+"');";try{return new Blob([n],{type:"application/javascript"})}catch(e){var D=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return D.append(n),D.getBlob("application/javascript")}}function g(e){if("u"<typeof Worker)return{postMessage:function(){},terminate:function(){}};if(r.get("loadWorkerFromBlob")){var n=o(e);return new Worker((window.URL||window.webkitURL).createObjectURL(n))}return new Worker(e)}var s=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){t.implement(this,i),this.$createWorkerFromOldConfig=function(n,D,t,S,i){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),r.get("packaged")||!e.toUrl)S=S||r.moduleUrl(D,"worker");else{var o=this.$normalizePath;S=S||o(e.toUrl("ace/worker/worker.js",null,"_"));var s={};n.forEach(function(n){s[n]=o(e.toUrl(n,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=g(S),i&&this.send("importScripts",i),this.$worker.postMessage({init:!0,tlns:s,module:D,classname:t}),this.$worker},this.onMessage=function(e){var n=e.data;switch(n.type){case"event":this._signal(n.name,{data:n.data});break;case"call":var D=this.callbacks[n.id];D&&(D(n.data),delete this.callbacks[n.id]);break;case"error":this.reportError(n.data);break;case"log":window.console&&console.log&&console.log.apply(console,n.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return S.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(e){e.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,n){this.$worker.postMessage({command:e,args:n})},this.call=function(e,n,D){if(D){var t=this.callbackId++;this.callbacks[t]=D,n.push(t)}this.send(e,n)},this.emit=function(e,n){try{n.data&&n.data.err&&(n.data.err={message:n.data.err.message,stack:n.data.err.stack,code:n.data.err.code}),this.$worker&&this.$worker.postMessage({event:e,data:{data:n.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener,!0)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(s.prototype),n.UIWorkerClient=function(e,n,D){var t=null,S=!1,o=Object.create(i),g=[],a=new s({messageBuffer:g,terminate:function(){},postMessage:function(e){g.push(e),t&&(S?setTimeout(l):l())}});a.setEmitSync=function(e){S=e};var l=function(){var e=g.shift();e.command?t[e.command].apply(t,e.args):e.event&&o._signal(e.event,e.data)};return o.postMessage=function(e){a.onMessage({data:e})},o.callback=function(e,n){this.postMessage({type:"call",id:n,data:e})},o.emit=function(e,n){this.postMessage({type:"event",name:e,data:n})},r.loadModule(["worker",n],function(e){for(t=new e[D](o);g.length;)l()}),a},n.WorkerClient=s,n.createWorker=g}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,n,D){"use strict";var t=e("./range").Range,S=e("./lib/event_emitter").EventEmitter,i=e("./lib/oop"),r=function(){function e(e,n,D,t,S,i){var r=this;this.length=n,this.session=e,this.doc=e.getDocument(),this.mainClass=S,this.othersClass=i,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=t,this.$onCursorChange=function(){setTimeout(function(){r.onCursorChange()})},this.$pos=D;var o=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=o.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return e.prototype.setup=function(){var e=this,n=this.doc,D=this.session;this.selectionBefore=D.selection.toJSON(),D.selection.inMultiSelectMode&&D.selection.toSingleRange(),this.pos=n.createAnchor(this.$pos.row,this.$pos.column);var S=this.pos;S.$insertRight=!0,S.detach(),S.markerId=D.addMarker(new t(S.row,S.column,S.row,S.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(D){var t=n.createAnchor(D.row,D.column);t.$insertRight=!0,t.detach(),e.others.push(t)}),D.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,n=this;this.othersActive=!0,this.others.forEach(function(D){D.markerId=e.addMarker(new t(D.row,D.column,D.row,D.column+n.length),n.othersClass,null,!1)})}},e.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},e.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var n=e;if(n.start.row===n.end.row&&n.start.row===this.pos.row){this.$updating=!0;var D="insert"===e.action?n.end.column-n.start.column:n.start.column-n.end.column,S=n.start.column>=this.pos.column&&n.start.column<=this.pos.column+this.length+1,i=n.start.column-this.pos.column;if(this.updateAnchors(e),S&&(this.length+=D),S&&!this.session.$fromUndo){if("insert"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],g={row:o.row,column:o.column+i};this.doc.insertMergedLines(g,e.lines)}else if("remove"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],g={row:o.row,column:o.column+i};this.doc.remove(new t(g.row,g.column,g.row,g.column-D))}}this.$updating=!1,this.updateMarkers()}},e.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var n=this.others.length;n--;)this.others[n].onChange(e);this.updateMarkers()},e.prototype.updateMarkers=function(){if(!this.$updating){var e=this,n=this.session,D=function(D,S){n.removeMarker(D.markerId),D.markerId=n.addMarker(new t(D.row,D.column,D.row,D.column+e.length),S,null,!1)};D(this.pos,this.mainClass);for(var S=this.others.length;S--;)D(this.others[S],this.othersClass)}},e.prototype.onCursorChange=function(e){if(!this.$updating&&this.session){var n=this.session.selection.getCursor();n.row===this.pos.row&&n.column>=this.pos.column&&n.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},e.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},e.prototype.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),n=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,D=0;D<n;D++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();i.implement(r.prototype,S),n.PlaceHolder=r}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,D){var t=e("../lib/event"),S=e("../lib/useragent");function i(e,n){return e.row==n.row&&e.column==n.column}n.onMouseDown=function(e){var n=e.domEvent,D=n.altKey,r=n.shiftKey,o=n.ctrlKey,g=e.getAccelKey(),s=e.getButton();if(o&&S.isMac&&(s=n.button),e.editor.inMultiSelectMode&&2==s)return void e.editor.textInput.onContextMenu(e.domEvent);if(!o&&!D&&!g){0===s&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===s){var a=e.editor,l=a.selection,c=a.inMultiSelectMode,u=e.getDocumentPosition(),h=l.getCursor(),d=e.inSelection()||l.isEmpty()&&i(u,h),p=e.x,f=e.y,m=function(e){p=e.clientX,f=e.clientY},y=a.session,v=a.renderer.pixelToScreenCoordinates(p,f),b=v;if(a.$mouseHandler.$enableJumpToDef)o&&D||g&&D?L=r?"block":"add":D&&a.$blockSelectEnabled&&(L="block");else if(g&&!D){if(L="add",!c&&r)return}else D&&a.$blockSelectEnabled&&(L="block");if(L&&S.isMac&&n.ctrlKey&&a.$mouseHandler.cancelContextMenu(),"add"==L){if(!c&&d)return;if(!c){var w=l.toOrientedRange();a.addSelectionMarker(w)}var M=l.rangeList.rangeAtPoint(u);a.inVirtualSelectionMode=!0,r&&(M=null,w=l.ranges[0]||w,a.removeSelectionMarker(w)),a.once("mouseup",function(){var e=l.toOrientedRange();M&&e.isEmpty()&&i(M.cursor,e.cursor)?l.substractPoint(e.cursor):(r?l.substractPoint(w.cursor):w&&(a.removeSelectionMarker(w),l.addRange(w)),l.addRange(e)),a.inVirtualSelectionMode=!1})}else if("block"==L){e.stop(),a.inVirtualSelectionMode=!0;var L,$,_=[],x=function(){var e=a.renderer.pixelToScreenCoordinates(p,f),n=y.screenToDocumentPosition(e.row,e.column,e.offsetX);i(b,e)&&i(n,l.lead)||(b=e,a.selection.moveToPosition(n),a.renderer.scrollCursorIntoView(),a.removeSelectionMarkers(_),_=l.rectangularRangeBlock(b,v),a.$mouseHandler.$clickSelection&&1==_.length&&_[0].isEmpty()&&(_[0]=a.$mouseHandler.$clickSelection.clone()),_.forEach(a.addSelectionMarker,a),a.updateSelectionMarkers())};c&&!g?l.toSingleRange():!c&&g&&($=l.toOrientedRange(),a.addSelectionMarker($)),r?v=y.documentToScreenPosition(l.lead):l.moveToPosition(u),b={row:-1,column:-1};var C=function(e){x(),clearInterval(k),a.removeSelectionMarkers(_),_.length||(_=[l.toOrientedRange()]),$&&(a.removeSelectionMarker($),l.toSingleRange($));for(var n=0;n<_.length;n++)l.addRange(_[n]);a.inVirtualSelectionMode=!1,a.$mouseHandler.$clickSelection=null},E=x;t.capture(a.container,m,C);var k=setInterval(function(){E()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,n,D){n.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(e){e.multiSelect.rangeCount>1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],n.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}],n.keyboardHandler=new(e("../keyboard/hash_handler")).HashHandler(n.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,n,D){var t=e("./range_list").RangeList,S=e("./range").Range,i=e("./selection").Selection,r=e("./mouse/multi_select_handler").onMouseDown,o=e("./lib/event"),g=e("./lib/lang"),s=e("./commands/multi_select_commands");n.commands=s.defaultCommands.concat(s.multiSelectCommands);var a=new(e("./search")).Search;function l(e,n,D){return a.$options.wrap=!0,a.$options.needle=n,a.$options.backwards=-1==D,a.find(e)}(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(e("./edit_session").EditSession.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,n){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var D=this.toOrientedRange();if(this.rangeList.add(D),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),n||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(D),this.$onAddRange(D)}e.cursor||(e.cursor=e.end);var t=this.rangeList.add(e);return this.$onAddRange(e),t.length&&this.$onRemoveRange(t),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),n||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var n=this.rangeList.removeAll();n.length&&this.$onRemoveRange(n),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var n=this.rangeList.substractPoint(e);if(n)return this.$onRemoveRange(n),n[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var n=this.rangeList.ranges.pop();e.push(n),this.rangeCount=0}for(var D=e.length;D--;){var t=this.ranges.indexOf(e[D]);this.ranges.splice(t,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(n=n||this.ranges[0])&&!n.isEqual(this.getRange())&&this.fromOrientedRange(n)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new t,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var e=this.ranges.length?this.ranges:[this.getRange()],n=[],D=0;D<e.length;D++){var t=e[D],i=t.start.row,r=t.end.row;if(i===r)n.push(t.clone());else{for(n.push(new S(i,t.start.column,i,this.session.getLine(i).length));++i<r;)n.push(this.getLineRange(i,!0));n.push(new S(r,0,r,t.end.column))}0!=D||this.isBackwards()||(n=n.reverse())}this.toSingleRange();for(var D=n.length;D--;)this.addRange(n[D])},this.joinSelections=function(){var e=this.rangeList.ranges,n=e[e.length-1],D=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(D,n.cursor==n.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,n=e[e.length-1],D=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(D,n.cursor==n.start)}else{var t=this.session.documentToScreenPosition(this.cursor),i=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(t,i).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,n,D){var t,i=[],r=e.column<n.column;if(r)var o=e.column,g=n.column,s=e.offsetX,a=n.offsetX;else var o=n.column,g=e.column,s=n.offsetX,a=e.offsetX;var l=e.row<n.row;if(l)var c=e.row,h=n.row;else var c=n.row,h=e.row;o<0&&(o=0),c<0&&(c=0),c==h&&(D=!0);for(var d=c;d<=h;d++){var p=S.fromPoints(this.session.screenToDocumentPosition(d,o,s),this.session.screenToDocumentPosition(d,g,a));if(p.isEmpty()){if(t&&u(p.end,t))break;t=p.end}p.cursor=r?p.start:p.end,i.push(p)}if(l&&i.reverse(),!D){for(var f=i.length-1;i[f].isEmpty()&&f>0;)f--;if(f>0)for(var m=0;i[m].isEmpty();)m++;for(var y=f;y>=m;y--)i[y].isEmpty()&&i.splice(y,1)}return i}}).call(i.prototype);var c=e("./editor").Editor;function u(e,n){return e.row==n.row&&e.column==n.column}function h(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=n.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",r),e.commands.addCommands(s.defaultCommands),d(e))}function d(e){if(e.textInput){var n=e.textInput.getElement(),D=!1;o.addListener(n,"keydown",function(n){var S=18==n.keyCode&&!(n.ctrlKey||n.shiftKey||n.metaKey);e.$blockSelectEnabled&&S?D||(e.renderer.setMouseCursor("crosshair"),D=!0):D&&t()},e),o.addListener(n,"keyup",t,e),o.addListener(n,"blur",t,e)}function t(n){D&&(e.renderer.setMouseCursor(""),D=!1)}}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var n=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",n),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var n=this.session.$selectionMarkers.indexOf(e);-1!=n&&this.session.$selectionMarkers.splice(n,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var n=this.session.$selectionMarkers,D=e.length;D--;){var t=e[D];if(t.marker){this.session.removeMarker(t.marker);var S=n.indexOf(t);-1!=S&&n.splice(S,1)}}this.session.selectionMarkerCount=n.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(s.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(s.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var n=e.command,D=e.editor;if(D.multiSelect){if(n.multiSelectAction)"forEach"==n.multiSelectAction?t=D.forEachSelection(n,e.args):"forEachLine"==n.multiSelectAction?t=D.forEachSelection(n,e.args,!0):"single"==n.multiSelectAction?(D.exitMultiSelectMode(),t=n.exec(D,e.args||{})):t=n.multiSelectAction(D,e.args||{});else{var t=n.exec(D,e.args||{});D.multiSelect.addRange(D.multiSelect.toOrientedRange()),D.multiSelect.mergeOverlappingRanges()}return t}},this.forEachSelection=function(e,n,D){if(!this.inVirtualSelectionMode){var t,S=D&&D.keepOrder,r=!0==D||D&&D.$byLines,o=this.session,g=this.selection,s=g.rangeList,a=(S?g:s).ranges;if(!a.length)return e.exec?e.exec(this,n||{}):e(this,n||{});var l=g._eventRegistry;g._eventRegistry={};var c=new i(o);this.inVirtualSelectionMode=!0;for(var u=a.length;u--;){if(r)for(;u>0&&a[u].start.row==a[u-1].end.row;)u--;c.fromOrientedRange(a[u]),c.index=u,this.selection=o.selection=c;var h=e.exec?e.exec(this,n||{}):e(this,n||{});t||void 0===h||(t=h),c.toOrientedRange(a[u])}c.detach(),this.selection=o.selection=g,this.inVirtualSelectionMode=!1,g._eventRegistry=l,g.mergeOverlappingRanges(),g.ranges[0]&&g.fromOrientedRange(g.ranges[0]);var d=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),d&&d.from==d.to&&this.renderer.animateScrolling(d.from),t}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var n=this.multiSelect.rangeList.ranges,D=[],t=0;t<n.length;t++)D.push(this.session.getTextRange(n[t]));var S=this.session.getDocument().getNewLineCharacter();(e=D.join(S)).length==(D.length-1)*S.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,n){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var D=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||n!=this.multiSelect.anchor){var t=n==this.multiSelect.anchor?D.cursor==D.start?D.end:D.start:D.cursor;t.row!=n.row||this.session.$clipPositionToDocument(t.row,t.column).column!=n.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,n,D){if((n=n||{}).needle=e||n.needle,void 0==n.needle){var t=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();n.needle=this.session.getTextRange(t)}this.$search.set(n);var S=this.$search.findAll(this.session);if(!S.length)return 0;var i=this.multiSelect;D||i.toSingleRange(S[0]);for(var r=S.length;r--;)i.addRange(S[r],!0);return t&&i.rangeList.rangeAtPoint(t.start)&&i.addRange(t,!0),S.length},this.selectMoreLines=function(e,n){var D=this.selection.toOrientedRange(),t=D.cursor==D.end,i=this.session.documentToScreenPosition(D.cursor);this.selection.$desiredColumn&&(i.column=this.selection.$desiredColumn);var r=this.session.screenToDocumentPosition(i.row+e,i.column);if(D.isEmpty())var o=r;else var g=this.session.documentToScreenPosition(t?D.end:D.start),o=this.session.screenToDocumentPosition(g.row+e,g.column);if(t){var s=S.fromPoints(r,o);s.cursor=s.start}else{var s=S.fromPoints(o,r);s.cursor=s.end}if(s.desiredColumn=i.column,this.selection.inMultiSelectMode){if(n)var a=D.cursor}else this.selection.addRange(D);this.selection.addRange(s),a&&this.selection.substractPoint(a)},this.transposeSelections=function(e){for(var n=this.session,D=n.multiSelect,t=D.ranges,S=t.length;S--;){var i=t[S];if(i.isEmpty()){var r=n.getWordRange(i.start.row,i.start.column);i.start.row=r.start.row,i.start.column=r.start.column,i.end.row=r.end.row,i.end.column=r.end.column}}D.mergeOverlappingRanges();for(var o=[],S=t.length;S--;){var i=t[S];o.unshift(n.getTextRange(i))}e<0?o.unshift(o.pop()):o.push(o.shift());for(var S=t.length;S--;){var i=t[S],g=i.clone();n.replace(i,o[S]),i.start.row=g.start.row,i.start.column=g.start.column}D.fromOrientedRange(D.ranges[0])},this.selectMore=function(e,n,D){var t=this.session,S=t.multiSelect.toOrientedRange();if(!S.isEmpty()||((S=t.getWordRange(S.start.row,S.start.column)).cursor=-1==e?S.start:S.end,this.multiSelect.addRange(S),!D)){var i=t.getTextRange(S),r=l(t,i,e);r&&(r.cursor=-1==e?r.start:r.end,this.session.unfold(r),this.multiSelect.addRange(r),this.renderer.scrollCursorIntoView(null,.5)),n&&this.multiSelect.substractPoint(S.cursor)}},this.alignCursors=function(){var e=this.session,n=e.multiSelect,D=n.ranges,t=-1,i=D.filter(function(e){if(e.cursor.row==t)return!0;t=e.cursor.row});if(D.length&&i.length!=D.length-1){i.forEach(function(e){n.substractPoint(e.cursor)});var r=0,o=1/0,s=D.map(function(n){var D=n.cursor,t=e.getLine(D.row).substr(D.column).search(/\S/g);return -1==t&&(t=0),D.column>r&&(r=D.column),t<o&&(o=t),t});D.forEach(function(n,D){var t=n.cursor,i=r-t.column,a=s[D]-o;i>a?e.insert(t,g.stringRepeat(" ",i-a)):e.remove(new S(t.row,t.column,t.row,t.column-i+a)),n.start.column=n.end.column=r,n.start.row=n.end.row=t.row,n.cursor=n.end}),n.fromOrientedRange(D[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var a=this.selection.getRange(),l=a.start.row,c=a.end.row,u=l==c;if(u){var h,d=this.session.getLength();do h=this.session.getLine(c);while(/[=:]/.test(h)&&++c<d);do h=this.session.getLine(l);while(/[=:]/.test(h)&&--l>0);l<0&&(l=0),c>=d&&(c=d-1)}var p=this.session.removeFullLines(l,c);p=this.$reAlignText(p,u),this.session.insert({row:l,column:0},p.join("\n")+"\n"),u||(a.start.column=0,a.end.column=p[p.length-1].length),this.selection.setRange(a)}},this.$reAlignText=function(e,n){var D,t,S,i=!0,r=!0;return e.map(function(e){var n=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return n?(null==D?(D=n[1].length,t=n[2].length,S=n[3].length):(D+t+S!=n[1].length+n[2].length+n[3].length&&(r=!1),D!=n[1].length&&(i=!1),D>n[1].length&&(D=n[1].length),t<n[2].length&&(t=n[2].length),S>n[3].length&&(S=n[3].length)),n):[e]}).map(n?s:i?r?a:s:l);function o(e){return g.stringRepeat(" ",e)}function s(e){return e[2]?o(D)+e[2]+o(t-e[2].length+S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function a(e){return e[2]?o(D+t-e[2].length)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?o(D)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(c.prototype),n.onSessionChange=function(e){var n=e.session;n&&!n.multiSelect&&(n.$selectionMarkers=[],n.selection.$initRangeList(),n.multiSelect=n.selection),this.multiSelect=n&&n.multiSelect;var D=e.oldSession;D&&(D.multiSelect.off("addRange",this.$onAddRange),D.multiSelect.off("removeRange",this.$onRemoveRange),D.multiSelect.off("multiSelect",this.$onMultiSelect),D.multiSelect.off("singleSelect",this.$onSingleSelect),D.multiSelect.lead.off("change",this.$checkMultiselectChange),D.multiSelect.anchor.off("change",this.$checkMultiselectChange)),n&&(n.multiSelect.on("addRange",this.$onAddRange),n.multiSelect.on("removeRange",this.$onRemoveRange),n.multiSelect.on("multiSelect",this.$onMultiSelect),n.multiSelect.on("singleSelect",this.$onSingleSelect),n.multiSelect.lead.on("change",this.$checkMultiselectChange),n.multiSelect.anchor.on("change",this.$checkMultiselectChange)),n&&this.inMultiSelectMode!=n.selection.inMultiSelectMode&&(n.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},n.MultiSelect=h,e("./config").defineOptions(c.prototype,"editor",{enableMultiselect:{set:function(e){h(this),e?this.on("mousedown",r):this.off("mousedown",r)},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,n,D){"use strict";var t=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,n,D){var t=e.getLine(D);return this.foldingStartMarker.test(t)?"start":"markbeginend"==n&&this.foldingStopMarker&&this.foldingStopMarker.test(t)?"end":""},this.getFoldWidgetRange=function(e,n,D){return null},this.indentationBlock=function(e,n,D){var S=/\S/,i=e.getLine(n),r=i.search(S);if(-1!=r){for(var o=D||i.length,g=e.getLength(),s=n,a=n;++n<g;){var l=e.getLine(n).search(S);if(-1!=l){if(l<=r){var c=e.getTokenAt(n,0);if(!c||"string"!==c.type)break}a=n}}if(a>s){var u=e.getLine(a).length;return new t(s,o,a,u)}}},this.openingBracketBlock=function(e,n,D,S,i){var r={row:D,column:S+1},o=e.$findClosingBracket(n,r,i);if(o){var g=e.foldWidgets[o.row];return null==g&&(g=e.getFoldWidget(o.row)),"start"==g&&o.row>r.row&&(o.row--,o.column=e.getLine(o.row).length),t.fromPoints(r,o)}},this.closingBracketBlock=function(e,n,D,S,i){var r={row:D,column:S},o=e.$findOpeningBracket(n,r);if(o)return o.column++,r.column--,t.fromPoints(o,r)}}).call((n.FoldMode=function(){}).prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range","ace/config"],function(e,n,D){"use strict";var t=e("../line_widgets").LineWidgets,S=e("../lib/dom"),i=e("../range").Range,r=e("../config").nls;function o(e,n,D){for(var t=0,S=e.length-1;t<=S;){var i=t+S>>1,r=D(n,e[i]);if(r>0)t=i+1;else{if(!(r<0))return i;S=i-1}}return-(t+1)}function g(e,n,D){var t=e.getAnnotations().sort(i.comparePoints);if(t.length){var S=o(t,{row:n,column:-1},i.comparePoints);S<0&&(S=-S-1),S>=t.length?S=D>0?0:t.length-1:0===S&&D<0&&(S=t.length-1);var r=t[S];if(r&&D){if(r.row===n){do r=t[S+=D];while(r&&r.row===n);if(!r)return t.slice()}var g=[];n=r.row;do g[D<0?"unshift":"push"](r),r=t[S+=D];while(r&&r.row==n);return g.length&&g}}}n.showErrorMarker=function(e,n){var D,i=e.session;i.widgetManager||(i.widgetManager=new t(i),i.widgetManager.attach(e));var o=e.getCursorPosition(),s=o.row,a=i.widgetManager.getWidgetsAtRow(s).filter(function(e){return"errorMarker"==e.type})[0];a?a.destroy():s-=n;var l=g(i,s,n);if(l){var c=l[0];o.column=(c.pos&&"number"!=typeof c.column?c.pos.sc:c.column)||0,o.row=c.row,D=e.renderer.$gutterLayer.$annotations[o.row]}else{if(a)return;D={displayText:[r("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(o.row),e.selection.moveToPosition(o);var u={row:o.row,fixedWidth:!0,coverGutter:!0,el:S.createElement("div"),type:"errorMarker"},h=u.el.appendChild(S.createElement("div")),d=u.el.appendChild(S.createElement("div"));d.className="error_widget_arrow "+D.className;var p=e.renderer.$cursorLayer.getPixelPosition(o).left;d.style.left=p+e.renderer.gutterWidth-5+"px",u.el.className="error_widget_wrapper",h.className="error_widget "+D.className,D.displayText.forEach(function(e,n){h.appendChild(S.createTextNode(e)),n<D.displayText.length-1&&h.appendChild(S.createElement("br"))}),h.appendChild(S.createElement("div"));var f=function(e,n,D){if(0===n&&("esc"===D||"return"===D))return u.destroy(),{command:"null"}};u.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(f),i.widgetManager.removeLineWidget(u),e.off("changeSelection",u.destroy),e.off("changeSession",u.destroy),e.off("mouseup",u.destroy),e.off("change",u.destroy))},e.keyBinding.addKeyboardHandler(f),e.on("changeSelection",u.destroy),e.on("changeSession",u.destroy),e.on("mouseup",u.destroy),e.on("change",u.destroy),e.session.widgetManager.addLineWidget(u),u.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:u.el.offsetHeight})},S.importCssString("\n .error_widget_wrapper {\n background: inherit;\n color: inherit;\n border:none\n }\n .error_widget {\n border-top: solid 2px;\n border-bottom: solid 2px;\n margin: 5px 0;\n padding: 10px 40px;\n white-space: pre-wrap;\n }\n .error_widget.ace_error, .error_widget_arrow.ace_error{\n border-color: #ff5a5a\n }\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n border-color: #F1D817\n }\n .error_widget.ace_info, .error_widget_arrow.ace_info{\n border-color: #5a5a5a\n }\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n border-color: #5aaa5a\n }\n .error_widget_arrow {\n position: absolute;\n border: solid 5px;\n border-top-color: transparent!important;\n border-right-color: transparent!important;\n border-left-color: transparent!important;\n top: -5px;\n }\n","error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(e,n,D){"use strict";e("./loader_build")(n);var t=e("./lib/dom"),S=e("./range").Range,i=e("./editor").Editor,r=e("./edit_session").EditSession,o=e("./undomanager").UndoManager,g=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),n.config=e("./config"),n.edit=function(e,D){if("string"==typeof e){var S=e;if(!(e=document.getElementById(S)))throw Error("ace.edit can't find div #"+S)}if(e&&e.env&&e.env.editor instanceof i)return e.env.editor;var r="";if(e&&/input|textarea/i.test(e.tagName)){var o=e;r=o.value,e=t.createElement("pre"),o.parentNode.replaceChild(e,o)}else e&&(r=e.textContent,e.innerHTML="");var s=n.createEditSession(r),a=new i(new g(e),s,D),l={document:s,editor:a,onResize:a.resize.bind(a,null)};return o&&(l.textarea=o),a.on("destroy",function(){l.editor.container.env=null}),a.container.env=a.env=l,a},n.createEditSession=function(e,n){var D=new r(e,n);return D.setUndoManager(new o),D},n.Range=S,n.Editor=i,n.EditSession=r,n.UndoManager=o,n.VirtualRenderer=g,n.version=n.config.version}),function(){ace.require(["ace/ace"],function(n){n&&(n.config.init(!0),n.define=ace.define);var D=function(){return this}();for(var t in!D&&"u">typeof window&&(D=window),!D&&"u">typeof self&&(D=self),D.ace||(D.ace=n),n)n.hasOwnProperty(t)&&(D.ace[t]=n[t]);D.ace.default=D.ace,e&&(e.exports=D.ace)})}()},20047(e,n,D){e=D.nmd(e),ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(e,n,D){"use strict";var t=e("./lib/dom"),S=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,r=e("./lib/lang"),o=e("./range").Range,g=e("./range_list").RangeList,s=e("./keyboard/hash_handler").HashHandler,a=e("./tokenizer").Tokenizer,l=e("./clipboard"),c={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,n,D){var t=e.session.getTextRange();return D?t.replace(/\n\r?([ \t]*\S)/g,"\n"+D+"$1"):t},CURRENT_LINE:function(e){return e.session.getLine(e.getCursorPosition().row)},PREV_LINE:function(e){return e.session.getLine(e.getCursorPosition().row-1)},LINE_INDEX:function(e){return e.getCursorPosition().row},LINE_NUMBER:function(e){return e.getCursorPosition().row+1},SOFT_TABS:function(e){return e.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(e){return e.session.getTabSize()},CLIPBOARD:function(e){return l.getText&&l.getText()},FILENAME:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0]},FILENAME_BASE:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(e){return this.FILEPATH(e).replace(/[^/\\]*$/,"")},FILEPATH:function(e){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(e){var n=e.session.$mode||{};return n.blockComment&&n.blockComment.start||""},BLOCK_COMMENT_END:function(e){var n=e.session.$mode||{};return n.blockComment&&n.blockComment.end||""},LINE_COMMENT:function(e){return(e.session.$mode||{}).lineCommentStart||""},CURRENT_YEAR:u.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:u.bind(null,{year:"2-digit"}),CURRENT_MONTH:u.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:u.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:u.bind(null,{month:"short"}),CURRENT_DATE:u.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:u.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:u.bind(null,{weekday:"short"}),CURRENT_HOUR:u.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:u.bind(null,{minute:"2-digit"}),CURRENT_SECOND:u.bind(null,{second:"2-digit"})};function u(e){var n=new Date().toLocaleString("en-us",e);return 1==n.length?"0"+n:n}c.SELECTED_TEXT=c.SELECTION;var h=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=c}return e.prototype.getTokenizer=function(){return e.$tokenizer||this.createTokenizer()},e.prototype.createTokenizer=function(){function n(e){return(e=e.substr(1),/^\d+$/.test(e))?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function D(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var t={regex:"/("+D("/")+"+)/",onMatch:function(e,n,D){var t=D[0];return t.fmtString=!0,t.guard=e.slice(1,-1),t.flag="",""},next:"formatString"};return e.$tokenizer=new a({start:[{regex:/\\./,onMatch:function(e,n,D){var t=e[1];return"}"==t&&D.length?e=t:-1!="`$\\".indexOf(t)&&(e=t),[e]}},{regex:/}/,onMatch:function(e,n,D){return[D.length?D.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:n},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,D,t){var S=n(e.substr(1));return t.unshift(S[0]),S},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+D("\\|")+"*\\|",onMatch:function(e,n,D){var t=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return D[0].choices=t,[t[0]]},next:"start"},t,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,n,D){return D.length&&D[0].expectElse?(D[0].expectElse=!1,D[0].ifEnd={elseEnd:D[0]},[D[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,n,D){var t=e[1];return"}"==t&&D.length||-1!="`$\\".indexOf(t)?e=t:"n"==t?e="\n":"t"==t?e=" ":-1!="ulULE".indexOf(t)&&(e={changeCase:t,local:t>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,n,D){var t=D.shift();return t&&(t.flag=e.slice(1,-1)),this.next=t&&t.tabstopId?"start":"",[t||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,n,D){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,n,D){var t={text:e.slice(2)};return D.unshift(t),[t]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,n,D){var t=D.shift();return this.next=t&&t.tabstopId?"start":"",[t||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,n,D){return D[0].formatFunction=e.slice(2,-1),[D.shift()]},next:"formatString"},t,{regex:/:[\?\-+]?/,onMatch:function(e,n,D){"+"==e[1]&&(D[0].ifEnd=D[0]),"?"==e[1]&&(D[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),e.$tokenizer},e.prototype.tokenizeTmSnippet=function(e,n){return this.getTokenizer().getLineTokens(e,n).tokens.map(function(e){return e.value||e})},e.prototype.getVariableValue=function(e,n,D){if(/^\d+$/.test(n))return(this.variables.__||{})[n]||"";if(/^[A-Z]\d+$/.test(n))return(this.variables[n[0]+"__"]||{})[n.substr(1)]||"";if(n=n.replace(/^TM_/,""),!this.variables.hasOwnProperty(n))return"";var t=this.variables[n];return"function"==typeof t&&(t=this.variables[n](e,n,D)),null==t?"":t},e.prototype.tmStrFormat=function(e,n,D){if(!n.fmt)return e;var t=n.flag||"",S=n.guard;S=new RegExp(S,t.replace(/[^gim]/g,""));var i="string"==typeof n.fmt?this.tokenizeTmSnippet(n.fmt,"formatString"):n.fmt,r=this;return e.replace(S,function(){var e=r.variables.__;r.variables.__=[].slice.call(arguments);for(var n=r.resolveVariables(i,D),t="E",S=0;S<n.length;S++){var o=n[S];if("object"==typeof o)if(n[S]="",o.changeCase&&o.local){var g=n[S+1];g&&"string"==typeof g&&("u"==o.changeCase?n[S]=g[0].toUpperCase():n[S]=g[0].toLowerCase(),n[S+1]=g.substr(1))}else o.changeCase&&(t=o.changeCase);else"U"==t?n[S]=o.toUpperCase():"L"==t&&(n[S]=o.toLowerCase())}return r.variables.__=e,n.join("")})},e.prototype.tmFormatFunction=function(e,n,D){return"upcase"==n.formatFunction?e.toUpperCase():"downcase"==n.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,n){for(var D=[],t="",S=!0,i=0;i<e.length;i++){var r=e[i];if("string"==typeof r){D.push(r),"\n"==r?(S=!0,t=""):S&&(t=/^\t*/.exec(r)[0],S=/\S/.test(r));continue}if(r){if(S=!1,r.fmtString){var o=e.indexOf(r,i+1);-1==o&&(o=e.length),r.fmt=e.slice(i+1,o),i=o}if(r.text){var g=this.getVariableValue(n,r.text,t)+"";r.fmtString&&(g=this.tmStrFormat(g,r,n)),r.formatFunction&&(g=this.tmFormatFunction(g,r,n)),g&&!r.ifEnd?(D.push(g),s(r)):!g&&r.ifEnd&&s(r.ifEnd)}else r.elseEnd?s(r.elseEnd):null!=r.tabstopId?D.push(r):null!=r.changeCase&&D.push(r)}}function s(n){var D=e.indexOf(n,i+1);-1!=D&&(i=D)}return D},e.prototype.getDisplayTextForSnippet=function(e,n){return d.call(this,e,n).text},e.prototype.insertSnippetForSelection=function(e,n,D){void 0===D&&(D={});var t=d.call(this,e,n,D),S=e.getSelectionRange(),i=e.session.replace(S,t.text),r=new p(e),o=e.inVirtualSelectionMode&&e.selection.index;r.addTabstops(t.tabstops,S.start,i,o)},e.prototype.insertSnippet=function(e,n,D){void 0===D&&(D={});var t=this;if(e.inVirtualSelectionMode)return t.insertSnippetForSelection(e,n,D);e.forEachSelection(function(){t.insertSnippetForSelection(e,n,D)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},e.prototype.$getScope=function(e){var n=e.session.$mode.$id||"";if("html"===(n=n.split("/").pop())||"php"===n){"php"!==n||e.session.$mode.inlinePhp||(n="html");var D=e.getCursorPosition(),t=e.session.getState(D.row);"object"==typeof t&&(t=t[0]),t.substring&&("js-"==t.substring(0,3)?n="javascript":"css-"==t.substring(0,4)?n="css":"php-"==t.substring(0,4)&&(n="php"))}return n},e.prototype.getActiveScopes=function(e){var n=this.$getScope(e),D=[n],t=this.snippetMap;return t[n]&&t[n].includeScopes&&D.push.apply(D,t[n].includeScopes),D.push("_"),D},e.prototype.expandWithTab=function(e,n){var D=this,t=e.forEachSelection(function(){return D.expandSnippetForSelection(e,n)},null,{keepOrder:!0});return t&&e.tabstopManager&&e.tabstopManager.tabNext(),t},e.prototype.expandSnippetForSelection=function(e,n){var D,t=e.getCursorPosition(),S=e.session.getLine(t.row),i=S.substring(0,t.column),r=S.substr(t.column),o=this.snippetMap;return this.getActiveScopes(e).some(function(e){var n=o[e];return n&&(D=this.findMatchingSnippet(n,i,r)),!!D},this),!!D&&(!!n&&!!n.dryRun||(e.session.doc.removeInLine(t.row,t.column-D.replaceBefore.length,t.column+D.replaceAfter.length),this.variables.M__=D.matchBefore,this.variables.T__=D.matchAfter,this.insertSnippetForSelection(e,D.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,n,D){for(var t=e.length;t--;){var S=e[t];if((!S.startRe||S.startRe.test(n))&&(!S.endRe||S.endRe.test(D))&&(S.startRe||S.endRe))return S.matchBefore=S.startRe?S.startRe.exec(n):[""],S.matchAfter=S.endRe?S.endRe.exec(D):[""],S.replaceBefore=S.triggerRe?S.triggerRe.exec(n)[0]:"",S.replaceAfter=S.endTriggerRe?S.endTriggerRe.exec(D)[0]:"",S}},e.prototype.register=function(e,n){var D=this.snippetMap,t=this.snippetNameMap,S=this;function i(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function o(e,n,D){return e=i(e),n=i(n),D?(e=n+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=n)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function g(e){e.scope||(e.scope=n||"_"),D[n=e.scope]||(D[n]=[],t[n]={});var i=t[n];if(e.name){var g=i[e.name];g&&S.unregister(g),i[e.name]=e}D[n].push(e),e.prefix&&(e.tabTrigger=e.prefix),!e.content&&e.body&&(e.content=Array.isArray(e.body)?e.body.join("\n"):e.body),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=r.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=o(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger),e.endRe=o(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger))}e||(e=[]),Array.isArray(e)?e.forEach(g):Object.keys(e).forEach(function(n){g(e[n])}),this._signal("registerSnippets",{scope:n})},e.prototype.unregister=function(e,n){var D=this.snippetMap,t=this.snippetNameMap;function S(e){var S=t[e.scope||n];if(S&&S[e.name]){delete S[e.name];var i=D[e.scope||n],r=i&&i.indexOf(e);r>=0&&i.splice(r,1)}}e.content?S(e):Array.isArray(e)&&e.forEach(S)},e.prototype.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var n,D=[],t={},S=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;n=S.exec(e);){if(n[1])try{t=JSON.parse(n[1]),D.push(t)}catch(e){}if(n[4])t.content=n[4].replace(/^\t/gm,""),D.push(t),t={};else{var i=n[2],r=n[3];if("regex"==i){var o=/\/((?:[^\/\\]|\\.)*)|$/g;t.guard=o.exec(r)[1],t.trigger=o.exec(r)[1],t.endTrigger=o.exec(r)[1],t.endGuard=o.exec(r)[1]}else"snippet"==i?(t.tabTrigger=r.match(/^\S*/)[0],t.name||(t.name=r)):i&&(t[i]=r)}}return D},e.prototype.getSnippetByName=function(e,n){var D,t=this.snippetNameMap;return this.getActiveScopes(n).some(function(n){var S=t[n];return S&&(D=S[e]),!!D},this),D},e}();S.implement(h.prototype,i);var d=function(e,n,D){void 0===D&&(D={});var t=e.getCursorPosition(),S=e.session.getLine(t.row),i=e.session.getTabString(),r=S.match(/^\s*/)[0];t.column<r.length&&(r=r.slice(0,t.column)),n=n.replace(/\r/g,"");var o=this.tokenizeTmSnippet(n);o=(o=this.resolveVariables(o,e)).map(function(e){return"\n"!=e||D.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,i):e:e+r});var g=[];o.forEach(function(e,n){if("object"==typeof e){var D=e.tabstopId,t=g[D];if(t||((t=g[D]=[]).index=D,t.value="",t.parents={}),-1===t.indexOf(e)){e.choices&&!t.choices&&(t.choices=e.choices),t.push(e);var S=o.indexOf(e,n+1);if(-1!==S){var i=o.slice(n+1,S),r=i.some(function(e){return"object"==typeof e});r&&!t.value?t.value=i:i.length&&(!t.value||"string"!=typeof t.value)&&(t.value=i.join(""))}}}}),g.forEach(function(e){e.length=0});var s={};function a(e){for(var n=[],D=0;D<e.length;D++){var t=e[D];if("object"==typeof t){if(s[t.tabstopId])continue;t=n[e.lastIndexOf(t,D-1)]||{tabstopId:t.tabstopId}}n[D]=t}return n}for(var l=0;l<o.length;l++){var c=o[l];if("object"==typeof c){var u=c.tabstopId,h=g[u],d=o.indexOf(c,l+1);if(s[u]){s[u]===c&&(delete s[u],Object.keys(s).forEach(function(e){h.parents[e]=!0}));continue}s[u]=c;var p=h.value;"string"!=typeof p?p=a(p):c.fmt&&(p=this.tmStrFormat(p,c,e)),o.splice.apply(o,[l+1,Math.max(0,d-l)].concat(p,c)),-1===h.indexOf(c)&&h.push(c)}}var f=0,m=0,y="";return o.forEach(function(e){if("string"==typeof e){var n=e.split("\n");n.length>1?(m=n[n.length-1].length,f+=n.length-1):m+=e.length,y+=e}else e&&(e.start?e.end={row:f,column:m}:e.start={row:f,column:m})}),{text:y,tabstops:g,tokens:o}},p=function(){function e(e){if(this.index=0,this.ranges=[],this.tabstops=[],e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=r.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)}return e.prototype.attach=function(e){this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.session=e.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},e.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},e.prototype.onChange=function(e){for(var n="r"==e.action[0],D=this.selectedTabstop||{},t=D.parents||{},S=this.tabstops.slice(),i=0;i<S.length;i++){var r=S[i],o=r==D||t[r.index];if(r.rangeList.$bias=+!o,"remove"==e.action&&r!==D){var g=r.parents&&r.parents[D.index],s=r.rangeList.pointIndex(e.start,g);s=s<0?-s-1:s+1;var a=r.rangeList.pointIndex(e.end,g);a=a<0?-a-1:a-1;for(var l=r.rangeList.ranges.slice(s,a),c=0;c<l.length;c++)this.removeRange(l[c])}r.rangeList.$onChange(e)}var u=this.session;this.$inChange||!n||1!=u.getLength()||u.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var D=this.session,t=D.getTextRange(e.firstNonLinked),S=0;S<e.length;S++){var i=e[S];if(i.linked){var r=i.original,o=n.snippetManager.tmStrFormat(t,r,this.editor);D.replace(i,o)}}this.$inChange=!1}},e.prototype.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},e.prototype.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,n=this.editor.selection.anchor,D=this.editor.selection.isEmpty(),t=0;t<this.ranges.length;t++)if(!this.ranges[t].linked){var S=this.ranges[t].contains(e.row,e.column),i=D||this.ranges[t].contains(n.row,n.column);if(S&&i)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var n=this.tabstops.length,D=this.index+(e||1);(D=Math.min(Math.max(D,1),n))==n&&(D=0),this.selectTabstop(D),this.updateTabstopMarkers(),0===D&&this.detach()},e.prototype.selectTabstop=function(e){this.$openTabstops=null;var n=this.tabstops[this.index];if(n&&this.addTabstopMarkers(n),this.index=e,(n=this.tabstops[this.index])&&n.length){this.selectedTabstop=n;var D=n.firstNonLinked||n;if(n.choices&&(D.cursor=D.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(D);else{var t=this.editor.multiSelect;t.toSingleRange(D);for(var S=0;S<n.length;S++)n.hasLinkedRanges&&n[S].linked||t.addRange(n[S].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},e.prototype.addTabstops=function(e,n,D){var t=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var S=o.fromPoints(D,D);m(S.start,n),m(S.end,n),e[0]=[S],e[0].index=0}var i=[this.index+1,0],r=this.ranges,s=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,D){var S=this.$openTabstops[D]||e;S.snippetId=s;for(var a=0;a<e.length;a++){var l=e[a],c=o.fromPoints(l.start,l.end||l.start);f(c.start,n),f(c.end,n),c.original=l,c.tabstop=S,r.push(c),S!=e?S.unshift(c):S[a]=c,l.fmtString||S.firstNonLinked&&t?(c.linked=!0,S.hasLinkedRanges=!0):S.firstNonLinked||(S.firstNonLinked=c)}S.firstNonLinked||(S.hasLinkedRanges=!1),S===e&&(i.push(S),this.$openTabstops[D]=S),this.addTabstopMarkers(S),S.rangeList=S.rangeList||new g,S.rangeList.$bias=0,S.rangeList.addList(S)},this),i.length>2&&(this.tabstops.length&&i.push(i.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,i))},e.prototype.addTabstopMarkers=function(e){var n=this.session;e.forEach(function(e){e.markerId||(e.markerId=n.addMarker(e,"ace_snippet-marker","text"))})},e.prototype.removeTabstopMarkers=function(e){var n=this.session;e.forEach(function(e){n.removeMarker(e.markerId),e.markerId=null})},e.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var e=this.selectedTabstop.snippetId;0===this.selectedTabstop.index&&e--,this.tabstops.forEach(function(n){n.snippetId===e?this.addTabstopMarkers(n):this.removeTabstopMarkers(n)},this)}},e.prototype.removeRange=function(e){var n=e.tabstop.indexOf(e);-1!=n&&e.tabstop.splice(n,1),-1!=(n=this.ranges.indexOf(e))&&this.ranges.splice(n,1),-1!=(n=e.tabstop.rangeList.ranges.indexOf(e))&&e.tabstop.splice(n,1),this.session.removeMarker(e.markerId),!e.tabstop.length&&(-1!=(n=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(n,1),this.tabstops.length||this.detach())},e}();p.prototype.keyboardHandler=new s,p.prototype.keyboardHandler.bindKeys({Tab:function(e){n.snippetManager&&n.snippetManager.expandWithTab(e)||(e.tabstopManager.tabNext(1),e.renderer.scrollCursorIntoView())},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1),e.renderer.scrollCursorIntoView()},Esc:function(e){e.tabstopManager.detach()}});var f=function(e,n){0==e.row&&(e.column+=n.column),e.row+=n.row},m=function(e,n){e.row==n.row&&(e.column-=n.column),e.row-=n.row};t.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}","snippets.css",!1),n.snippetManager=new h,(function(){this.insertSnippet=function(e,D){return n.snippetManager.insertSnippet(this,e,D)},this.expandSnippet=function(e){return n.snippetManager.expandWithTab(this,e)}}).call(e("./editor").Editor.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(e,n,D){"use strict";var t=e("../virtual_renderer").VirtualRenderer,S=e("../editor").Editor,i=e("../range").Range,r=e("../lib/event"),o=e("../lib/lang"),g=e("../lib/dom"),s=e("../config").nls,a=e("./../lib/useragent"),l=function(e){return"suggest-aria-id:".concat(e)},c=a.isSafari?"menu":"listbox",u=a.isSafari?"menuitem":"option",h=a.isSafari?"aria-current":"aria-selected",d=function(e){var n=new t(e);n.$maxLines=4;var D=new S(n);return D.setHighlightActiveLine(!1),D.setShowPrintMargin(!1),D.renderer.setShowGutter(!1),D.renderer.setHighlightGutterLine(!1),D.$mouseHandler.$focusTimeout=0,D.$highlightTagPending=!0,D},p=function(){return function(e){var n,D=g.createElement("div"),t=d(D);e&&e.appendChild(D),D.style.display="none",t.renderer.content.style.cursor="default",t.renderer.setStyle("ace_autocomplete"),t.renderer.$textLayer.element.setAttribute("role",c),t.renderer.$textLayer.element.setAttribute("aria-roledescription",s("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),t.renderer.$textLayer.element.setAttribute("aria-label",s("autocomplete.popup.aria-label","Autocomplete suggestions")),t.renderer.textarea.setAttribute("aria-hidden","true"),t.setOption("displayIndentGuides",!1),t.setOption("dragDelay",150);var S=function(){};t.focus=S,t.$isFocused=!0,t.renderer.$cursorLayer.restartTimer=S,t.renderer.$cursorLayer.element.style.opacity="0",t.renderer.$maxLines=8,t.renderer.$keepTextAreaAtCursor=!1,t.setHighlightActiveLine(!1),t.session.highlight(""),t.session.$searchHighlight.clazz="ace_highlight-marker",t.on("mousedown",function(e){var n=e.getDocumentPosition();t.selection.moveToPosition(n),p.start.row=p.end.row=n.row,e.stop()});var a=new i(-1,0,-1,1/0),p=new i(-1,0,-1,1/0);p.id=t.session.addMarker(p,"ace_active-line","fullLine"),t.setSelectOnHover=function(e){e?a.id&&(t.session.removeMarker(a.id),a.id=null):a.id=t.session.addMarker(a,"ace_line-hover","fullLine")},t.setSelectOnHover(!1),t.on("mousemove",function(e){if(!n){n=e;return}if(n.x!=e.x||n.y!=e.y){n=e,n.scrollTop=t.renderer.scrollTop,t.isMouseOver=!0;var D=n.getDocumentPosition().row;a.start.row!=D&&(a.id||t.setRow(D),m(D))}}),t.renderer.on("beforeRender",function(){if(n&&-1!=a.start.row){n.$pos=null;var e=n.getDocumentPosition().row;a.id||t.setRow(e),m(e,!0)}}),t.renderer.on("afterRender",function(){var e=t.getRow(),n=t.renderer.$textLayer,D=n.element.childNodes[e-n.config.firstRow],S=document.activeElement;if(D!==t.selectedNode&&t.selectedNode&&(g.removeCssClass(t.selectedNode,"ace_selected"),S.removeAttribute("aria-activedescendant"),t.selectedNode.removeAttribute(h),t.selectedNode.removeAttribute("id")),t.selectedNode=D,D){g.addCssClass(D,"ace_selected");var i=l(e);D.id=i,n.element.setAttribute("aria-activedescendant",i),S.setAttribute("aria-activedescendant",i),D.setAttribute("role",u),D.setAttribute("aria-roledescription",s("autocomplete.popup.item.aria-roledescription","item")),D.setAttribute("aria-label",t.getData(e).caption||t.getData(e).value),D.setAttribute("aria-setsize",t.data.length),D.setAttribute("aria-posinset",e+1),D.setAttribute("aria-describedby","doc-tooltip"),D.setAttribute(h,"true")}});var f=function(){m(-1)},m=function(e,n){e!==a.start.row&&(a.start.row=a.end.row=e,n||t.session._emit("changeBackMarker"),t._emit("changeHoverMarker"))};t.getHoveredRow=function(){return a.start.row},r.addListener(t.container,"mouseout",function(){t.isMouseOver=!1,f()}),t.on("hide",f),t.on("changeSelection",f),t.session.doc.getLength=function(){return t.data.length},t.session.doc.getLine=function(e){var n=t.data[e];return"string"==typeof n?n:n&&n.value||""};var y=t.session.bgTokenizer;return y.$tokenizeRow=function(e){var n=t.data[e],D=[];if(!n)return D;"string"==typeof n&&(n={value:n});var S=n.caption||n.value||n.name;function i(e,t){e&&D.push({type:(n.className||"")+(t||""),value:e})}for(var r=S.toLowerCase(),o=(t.filterText||"").toLowerCase(),g=0,s=0,a=0;a<=o.length;a++)if(a!=s&&(n.matchMask&1<<a||a==o.length)){var l=o.slice(s,a);s=a;var c=r.indexOf(l,g);if(-1==c)continue;i(S.slice(g,c),""),g=c+l.length,i(S.slice(c,g),"completion-highlight")}return i(S.slice(g,S.length),""),D.push({type:"completion-spacer",value:" "}),n.meta&&D.push({type:"completion-meta",value:n.meta}),n.message&&D.push({type:"completion-message",value:n.message}),D},y.$updateOnChange=S,y.start=S,t.session.$computeWidth=function(){return this.screenWidth=0},t.isOpen=!1,t.isTopdown=!1,t.autoSelect=!0,t.filterText="",t.isMouseOver=!1,t.data=[],t.setData=function(e,n){t.filterText=n||"",t.setValue(o.stringRepeat("\n",e.length),-1),t.data=e||[],t.setRow(0)},t.getData=function(e){return t.data[e]},t.getRow=function(){return p.start.row},t.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),p.start.row!=e&&(t.selection.clearSelection(),p.start.row=p.end.row=e||0,t.session._emit("changeBackMarker"),t.moveCursorTo(e||0,0),t.isOpen&&t._signal("select"))},t.on("changeSelection",function(){t.isOpen&&t.setRow(t.selection.lead.row),t.renderer.scrollCursorIntoView()}),t.hide=function(){this.container.style.display="none",t.anchorPos=null,t.anchor=null,t.isOpen&&(t.isOpen=!1,this._signal("hide"))},t.tryShow=function(e,D,S,i){if(!i&&t.isOpen&&t.anchorPos&&t.anchor&&t.anchorPos.top===e.top&&t.anchorPos.left===e.left&&t.anchor===S)return!0;var r=this.container,o=window.innerHeight,g=window.innerWidth,s=this.renderer,a=s.$maxLines*D*1.4,l={top:0,bottom:0},c=o-e.top-3*this.$borderSize-D,u=e.top-3*this.$borderSize;S||(S=u<=c||c>=a?"bottom":"top"),"top"===S?(l.bottom=e.top-this.$borderSize,l.top=l.bottom-a):"bottom"===S&&(l.top=e.top+D+this.$borderSize,l.bottom=l.top+a);var h=l.top>=0&&l.bottom<=o;if(!i&&!h)return!1;h?s.$maxPixelHeight=null:"top"===S?s.$maxPixelHeight=u:s.$maxPixelHeight=c,"top"===S?(r.style.top="",r.style.bottom=o-l.bottom+"px",t.isTopdown=!1):(r.style.top=l.top+"px",r.style.bottom="",t.isTopdown=!0),r.style.display="";var d=e.left;return d+r.offsetWidth>g&&(d=g-r.offsetWidth),r.style.left=d+"px",r.style.right="",t.isOpen||(t.isOpen=!0,this._signal("show"),n=null),t.anchorPos=e,t.anchor=S,!0},t.show=function(e,n,D){this.tryShow(e,n,D?"bottom":void 0,!0)},t.goTo=function(e){var n=this.getRow(),D=this.session.getLength()-1;switch(e){case"up":n=n<=0?D:n-1;break;case"down":n=n>=D?-1:n+1;break;case"start":n=0;break;case"end":n=D}this.setRow(n)},t.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},t.$imageSize=0,t.$borderSize=1,t}}();g.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: "";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n',"autocompletion.css",!1),n.AcePopup=p,n.$singleLineEditor=d,n.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,n,D){"use strict";n.AceInlineScreenReader=function(){function e(e){this.editor=e,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return e.prototype.setScreenReaderContent=function(e){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",(function(){var e=this.popup.getRow(),n=this.popup.renderer.$textLayer,D=n.element.childNodes[e-n.config.firstRow];if(D){for(var t="doc-tooltip ",S=0;S<this._lines.length;S++)t+="ace-inline-screenreader-line-".concat(S," ");D.setAttribute("aria-describedby",t)}}).bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=e.split(/\r\n|\r|\n/);var n=this.createCodeBlock();this.screenReaderDiv.appendChild(n)},e.prototype.destroy=function(){this.screenReaderDiv.remove()},e.prototype.createCodeBlock=function(){var e=document.createElement("pre");e.setAttribute("id","ace-inline-screenreader");for(var n=0;n<this._lines.length;n++){var D=document.createElement("code");D.setAttribute("id","ace-inline-screenreader-line-".concat(n));var t=document.createTextNode(this._lines[n]);D.appendChild(t),e.appendChild(D)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,n,D){"use strict";var t=e("../snippets").snippetManager,S=e("./inline_screenreader").AceInlineScreenReader;n.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,n,D){if(D=D||"",e&&this.editor&&this.editor!==e&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!e||!n)return!1;this.inlineScreenReader||(this.inlineScreenReader=new S(e));var i=n.snippet?t.getDisplayTextForSnippet(e,n.snippet):n.value;return!n.hideInlinePreview&&!!i&&!!i.startsWith(D)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(i),""===(i=i.slice(D.length))?e.removeGhostText():e.setGhostText(i),!0)},e.prototype.isOpen=function(){return!!this.editor&&!!this.editor.renderer.$ghostText},e.prototype.hide=function(){return!!this.editor&&(this.editor.removeGhostText(),!0)},e.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},e}()}),ace.define("ace/autocomplete/util",["require","exports","module"],function(e,n,D){"use strict";n.parForEach=function(e,n,D){var t=0,S=e.length;0===S&&D();for(var i=0;i<S;i++)n(e[i],function(e,n){++t===S&&D(e,n)})};var t=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(e,n,D){D=D||t;for(var S=[],i=n-1;i>=0;i--)if(D.test(e[i]))S.push(e[i]);else break;return S.reverse().join("")},n.retrieveFollowingIdentifier=function(e,n,D){D=D||t;for(var S=[],i=n;i<e.length;i++)if(D.test(e[i]))S.push(e[i]);else break;return S},n.getCompletionPrefix=function(e){var n,D=e.getCursorPosition(),t=e.session.getLine(D.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!n&&e&&(n=this.retrievePrecedingIdentifier(t,D.column,e))}).bind(this))}).bind(this)),n||this.retrievePrecedingIdentifier(t,D.column)},n.triggerAutocomplete=function(e,n){var n=null==n?e.session.getPrecedingCharacter():n;return e.completers.some(function(e){if(e.triggerCharacters&&Array.isArray(e.triggerCharacters))return e.triggerCharacters.includes(n)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(e,n,D){"use strict";var t=e("./keyboard/hash_handler").HashHandler,S=e("./autocomplete/popup").AcePopup,i=e("./autocomplete/inline").AceInline,r=e("./autocomplete/popup").getAriaId,o=e("./autocomplete/util"),g=e("./lib/lang"),s=e("./lib/dom"),a=e("./snippets").snippetManager,l=e("./config"),c=e("./lib/event"),u=e("./lib/scroll").preventParentScroll,h=function(e,n){n.completer&&n.completer.destroy()},d=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new t,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=g.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=g.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=g.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=g.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=g.delayedCall((function(){var n=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!n||0===this.editor.completers.length||(this.completions=new f(e.completionsForLoading),this.openPopup(this.editor,n.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}).bind(this),this.stickySelectionDelay)}return Object.defineProperty(e,"completionsForLoading",{get:function(){return[{caption:l.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),e.prototype.$init=function(){return this.popup=new S(this.parentNode||document.body||document.documentElement),this.popup.on("click",(function(e){this.insertMatch(),e.stop()}).bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),c.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},e.prototype.$initInline=function(){if(this.inlineEnabled&&!this.inlineRenderer)return this.inlineRenderer=new i,this.inlineRenderer},e.prototype.getPopup=function(){return this.popup||this.$init()},e.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},e.prototype.$seen=function(e){!this.hasSeen.has(e)&&e&&e.completer&&e.completer.onSeen&&"function"==typeof e.completer.onSeen&&(e.completer.onSeen(this.editor,e),this.hasSeen.add(e))},e.prototype.$onPopupChange=function(e){if(this.inlineRenderer&&this.inlineEnabled){var n=e?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(n),this.popup.isMouseOver&&this.setSelectOnHover)return void this.tooltipTimer.call(null,null);this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},e.prototype.$updateGhostText=function(e){var n=this.base.row,D=this.base.column,t=this.editor.getCursorPosition().column,S=this.editor.session.getLine(n).slice(D,t);this.inlineRenderer.show(this.editor,e,S)?this.$seen(e):this.inlineRenderer.hide()},e.prototype.$onPopupRender=function(){var e=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var n=this.popup.getFirstVisibleRow();n<=this.popup.getLastVisibleRow();n++){var D=this.popup.getData(n);D&&(!e||D.hideInlinePreview)&&this.$seen(D)}},e.prototype.$onPopupShow=function(e){this.$onPopupChange(e),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},e.prototype.observeLayoutChanges=function(){if(!this.$elements&&this.editor){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var e=this.editor.container.parentNode,n=[];e;)n.push(e),e.addEventListener("scroll",this.onLayoutChange,{passive:!0}),e=e.parentNode;this.$elements=n}},e.prototype.unObserveLayoutChanges=function(){var e=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(n){n.removeEventListener("scroll",e.onLayoutChange,{passive:!0})}),this.$elements=null},e.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},e.prototype.$updatePopupPosition=function(){var e=this.editor,n=e.renderer,D=n.layerConfig.lineHeight,t=n.$cursorLayer.getPixelPosition(this.base,!0);t.left-=this.popup.getTextLeftOffset();var S=e.container.getBoundingClientRect();t.top+=S.top-n.layerConfig.offset,t.left+=S.left-e.renderer.scrollLeft,t.left+=n.gutterWidth;var i={top:t.top,left:t.left};n.$ghostText&&n.$ghostTextWidget&&this.base.row===n.$ghostText.position.row&&(i.top+=n.$ghostTextWidget.el.offsetHeight);var r=e.container.getBoundingClientRect().bottom-D,o=r<i.top?{top:r,left:i.left}:i;this.popup.tryShow(o,D,"bottom")||this.popup.tryShow(t,D,"top")||this.popup.show(t,D)},e.prototype.openPopup=function(e,n,D){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var t,S=this.popup.getRow(),i=this.popup.data[S];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:r(this.popup.getRow()),inline:this.inlineEnabled}),e.keyBinding.addKeyboardHandler(this.keyboardHandler),this.stickySelection&&(t=this.popup.data.indexOf(i)),t&&-1!==t||(t=0),this.popup.setRow(this.autoSelect?t:-1),t===S&&i!==this.completions.filtered[t]&&this.$onPopupChange();var o=this.inlineRenderer&&this.inlineEnabled;if(t===S&&o){var g=this.popup.getData(this.popup.getRow());this.$updateGhostText(g)}!D&&(this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},e.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},e.prototype.changeListener=function(e){var n=this.editor.selection.lead;(n.row!=this.base.row||n.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},e.prototype.blurListener=function(e){var n=document.activeElement,D=this.editor.textInput.getElement(),t=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),S=this.popup&&this.popup.container;n==D||n.parentNode==S||t||n==this.tooltipNode||e.relatedTarget==D||this.detach()},e.prototype.mousedownListener=function(e){this.detach()},e.prototype.mousewheelListener=function(e){this.popup&&!this.popup.isMouseOver&&this.detach()},e.prototype.mouseOutListener=function(e){this.popup.isOpen&&this.$updatePopupPosition()},e.prototype.goTo=function(e){this.popup.goTo(e)},e.prototype.insertMatch=function(e,n){if(e||(e=this.popup.getData(this.popup.getRow())),!e)return!1;if(""===e.value)return this.detach();var D=this.completions,t=this.getCompletionProvider().insertMatch(this.editor,e,D.filterText,n);return this.completions==D&&this.detach(),t},e.prototype.showPopup=function(e,n){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,n)},e.prototype.getCompletionProvider=function(e){return this.completionProvider||(this.completionProvider=new p(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,n){return this.getCompletionProvider().gatherCompletions(e,n)},e.prototype.updateCompletions=function(n,D){if(n&&this.base&&this.completions){var t=this.editor.getCursorPosition(),S=this.editor.session.getTextRange({start:this.base,end:t});return S==this.completions.filterText?void 0:(this.completions.setFilter(S),this.completions.filtered.length&&(1!=this.completions.filtered.length||this.completions.filtered[0].value!=S||this.completions.filtered[0].snippet))?void this.openPopup(this.editor,S,n):this.detach()}if(D&&D.matches){var t=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(t.row,t.column),this.base.$insertRight=!0,this.completions=new f(D.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",n)}var i=this.editor.getSession(),t=this.editor.getCursorPosition(),S=o.getCompletionPrefix(this.editor);this.base=i.doc.createAnchor(t.row,t.column-S.length),this.base.$insertRight=!0;var r={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:S,pos:t}).provideCompletions(this.editor,r,(function(D,t,S){var i=t.filtered,r=o.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),S){if(!i.length){var g=!this.autoShown&&this.emptyMessage;if("function"==typeof g&&(g=this.emptyMessage(r)),g){var s=[{caption:g,value:""}];this.completions=new f(s),this.openPopup(this.editor,r,n),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(1==i.length&&i[0].value==r&&!i[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==i.length)return this.insertMatch(i[0])}this.completions=!S&&this.showLoadingState?new f(e.completionsForLoading.concat(i),t.filterText):t,this.openPopup(this.editor,r,n),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!S)}).bind(this)),!this.showLoadingState||this.autoShown||this.popup&&this.popup.isOpen||this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},e.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},e.prototype.updateDocTooltip=function(){var e=this.popup,n=this.completions.filtered,D=n&&(n[e.getHoveredRow()]||n[e.getRow()]),t=null;if(!D||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var S=this.editor.completers.length,i=0;i<S;i++){var r=this.editor.completers[i];if(r.getDocTooltip&&D.completerId===r.id){t=r.getDocTooltip(D);break}}if(t||"string"==typeof D||(t=D),"string"==typeof t&&(t={docText:t}),!t||!(t.docHTML||t.docText))return this.hideDocTooltip();this.showDocTooltip(t)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=s.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",u));var n=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(n.isDark?"ace_dark ":"")+(n.cssClass||"");var D=this.tooltipNode;e.docHTML?D.innerHTML=e.docHTML:e.docText&&(D.textContent=e.docText),D.parentNode||this.popup.container.appendChild(this.tooltipNode);var t=this.popup,S=t.container.getBoundingClientRect();D.style.top=t.container.style.top,D.style.bottom=t.container.style.bottom,D.style.display="block",window.innerWidth-S.right<320?S.left<320?(t.isTopdown?D.style.top=S.bottom+"px":D.style.top=t.container.offsetTop-D.offsetHeight+"px",D.style.left=S.left+"px",D.style.right="",D.style.bottom=""):(D.style.right=window.innerWidth-S.left+"px",D.style.left=""):(D.style.left=S.right+1+"px",D.style.right="")},e.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),this.tooltipNode){var e=this.tooltipNode;this.editor.isFocused()||document.activeElement!=e||this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}},e.prototype.onTooltipClick=function(e){for(var n=e.target;n&&n!=this.tooltipNode;){if("A"==n.nodeName&&n.href){n.rel="noreferrer",n.target="_blank";break}n=n.parentNode}},e.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var e=this.popup.container;e&&e.parentNode&&e.parentNode.removeChild(e)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",h),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();d.prototype.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var n=e.completer.insertMatch();if(n||e.tabstopManager)return n;e.completer.goTo("down")},Backspace:function(e){e.execCommand("backspace"),!o.getCompletionPrefix(e)&&e.completer&&e.completer.detach()},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},d.for=function(e){return e.completer instanceof d||(e.completer&&(e.completer.destroy(),e.completer=null),l.get("sharedPopups")?(d.$sharedInstance||(d.$sharedInstance=new d),e.completer=d.$sharedInstance):(e.completer=new d,e.once("destroy",h))),e.completer},d.startCommand={name:"startAutocomplete",exec:function(e,n){var D=d.for(e);D.autoInsert=!1,D.autoSelect=!0,D.autoShown=!1,D.showPopup(e,n),D.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var p=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,n,D){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[n],D)},e.prototype.insertMatch=function(e,n,D){if(!n)return!1;if(e.startOperation({command:{name:"insertMatch"}}),n.completer&&n.completer.insertMatch)n.completer.insertMatch(e,n);else{if(!this.completions)return!1;var t=this.completions.filterText.length,S=0;if(n.range&&n.range.start.row===n.range.end.row&&(t-=this.initialPosition.prefix.length,t+=this.initialPosition.pos.column-n.range.start.column,S+=n.range.end.column-this.initialPosition.pos.column),t||S){i=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var i,r,o=0;r=i[o];o++)r.start.column-=t,r.end.column+=S,e.session.remove(r)}n.snippet?a.insertSnippet(e,n.snippet):this.$insertString(e,n),n.completer&&n.completer.onInsert&&"function"==typeof n.completer.onInsert&&n.completer.onInsert(e,n),n.command&&"startAutocomplete"===n.command&&e.execCommand(n.command)}return e.endOperation(),!0},e.prototype.$insertString=function(e,n){var D=n.value||n;e.execCommand("insertstring",D)},e.prototype.gatherCompletions=function(e,n){var D=e.getSession(),t=e.getCursorPosition(),S=o.getCompletionPrefix(e),i=[];this.completers=e.completers;var r=e.completers.length;return e.completers.forEach(function(g,s){g.getCompletions(e,D,t,S,function(D,t){g.hideInlinePreview&&(t=t.map(function(e){return Object.assign(e,{hideInlinePreview:g.hideInlinePreview})})),!D&&t&&(i=i.concat(t)),n(null,{prefix:o.getCompletionPrefix(e),matches:i,finished:0==--r})})}),!0},e.prototype.provideCompletions=function(e,n,D){var t=(function(e){var t=e.prefix,S=e.matches;this.completions=new f(S),n.exactMatch&&(this.completions.exactMatch=!0),n.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(t),(e.finished||this.completions.filtered.length)&&D(null,this.completions,e.finished)}).bind(this),S=!0,i=null;if(this.gatherCompletions(e,(function(e,n){if(this.active&&(e&&(D(e,[],!0),this.detach()),0===n.prefix.indexOf(n.prefix))){if(S){i=n;return}t(n)}}).bind(this)),S=!1,i){var r=i;i=null,t(r)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),f=function(){function e(e,n){this.all=e,this.filtered=e,this.filterText=n||"",this.exactMatch=!1,this.ignoreCaption=!1}return e.prototype.setFilter=function(e){if(e.length>this.filterText&&0===e.lastIndexOf(this.filterText,0))var n=this.filtered;else var n=this.all;this.filterText=e;var D=null;n=(n=(n=this.filterCompletions(n,this.filterText)).sort(function(e,n){return n.exactMatch-e.exactMatch||n.$score-e.$score||(e.caption||e.value).localeCompare(n.caption||n.value)})).filter(function(e){var n=e.snippet||e.caption||e.value;return n!==D&&(D=n,!0)}),this.filtered=n},e.prototype.filterCompletions=function(e,n){var D=[],t=n.toUpperCase(),S=n.toLowerCase();n:for(var i,r=0;i=e[r];r++){var o,g,s=!this.ignoreCaption&&i.caption||i.value||i.snippet;if(s){var a=-1,l=0,c=0;if(this.exactMatch){if(n!==s.substr(0,n.length))continue}else{var u=s.toLowerCase().indexOf(S);if(u>-1)c=u;else for(var h=0;h<n.length;h++){var d=s.indexOf(S[h],a+1),p=s.indexOf(t[h],a+1);if((o=d>=0&&(p<0||d<p)?d:p)<0)continue n;(g=o-a-1)>0&&(-1===a&&(c+=10),c+=g,l|=1<<h),a=o}}i.matchMask=l,i.exactMatch=+!c,i.$score=(i.score||0)-c,D.push(i)}}return D},e}();n.Autocomplete=d,n.CompletionProvider=p,n.FilteredList=f}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,n,D){var t=e("../range").Range,S=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function i(e,n){return e.getTextRange(t.fromPoints({row:0,column:0},n)).split(S).length-1}function r(e,n){var D=i(e,n),t=e.getValue().split(S),r=Object.create(null),o=t[D];return t.forEach(function(e,n){if(e&&e!==o){var S=Math.abs(D-n),i=t.length-S;r[e]?r[e]=Math.max(i,r[e]):r[e]=i}}),r}n.getCompletions=function(e,n,D,t,S){var i=r(n,D);S(null,Object.keys(i).map(function(e){return{caption:e,value:e,score:i[e],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(e,n,D){"use strict";var t,S=e("../snippets").snippetManager,i=e("../autocomplete").Autocomplete,r=e("../config"),o=e("../lib/lang"),g=e("../autocomplete/util"),s=e("../autocomplete/text_completer"),a={getCompletions:function(e,n,D,t,S){if(n.$mode.completer)return n.$mode.completer.getCompletions(e,n,D,t,S);var i=e.session.getState(D.row),r=n.$mode.getCompletions(i,n,D,t);S(null,r=r.map(function(e){return e.completerId=a.id,e}))},id:"keywordCompleter"},l=function(e){var n={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,D,t,S){return n[D]=S||""}).replace(/\$(\d+?)/g,function(e,D){return n[D]})},c={getCompletions:function(e,n,D,t,i){var r=[],o=n.getTokenAt(D.row,D.column);o&&o.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?r.push("html-tag"):r=S.getActiveScopes(e);var g=S.snippetMap,s=[];r.forEach(function(e){for(var n=g[e]||[],D=n.length;D--;){var t=n[D],S=t.name||t.tabTrigger;S&&s.push({caption:S,snippet:t.content,meta:t.tabTrigger&&!t.name?t.tabTrigger+"⇥ ":"snippet",completerId:c.id})}},this),i(null,s)},getDocTooltip:function(e){e.snippet&&!e.docHTML&&(e.docHTML=["<b>",o.escapeHTML(e.caption),"</b>","<hr></hr>",o.escapeHTML(l(e.snippet))].join(""))},id:"snippetCompleter"},u=[c,s,a];n.setCompleters=function(e){u.length=0,e&&u.push.apply(u,e)},n.addCompleter=function(e){u.push(e)},n.textCompleter=s,n.keyWordCompleter=a,n.snippetCompleter=c;var h={name:"expandSnippet",exec:function(e){return S.expandWithTab(e)},bindKey:"Tab"},d=function(e,n){p(n.session.$mode)},p=function(e){"string"==typeof e&&(e=r.$modes[e]),e&&(S.files||(S.files={}),f(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(p))},f=function(e,n){n&&e&&!S.files[e]&&(S.files[e]={},r.loadModule(n,function(n){n&&(S.files[e]=n,!n.snippets&&n.snippetText&&(n.snippets=S.parseSnippetFile(n.snippetText)),S.register(n.snippets||[],n.scope),n.includeScopes&&(S.snippetMap[n.scope].includeScopes=n.includeScopes,n.includeScopes.forEach(function(e){p("ace/mode/"+e)})))}))},m=function(e){var n=e.editor,D=n.completer&&n.completer.activated;if("backspace"===e.command.name)D&&!g.getCompletionPrefix(n)&&n.completer.detach();else if("insertstring"===e.command.name&&!D){t=e;var S=e.editor.$liveAutocompletionDelay;S?y.delay(S):v(e)}},y=o.delayedCall(function(){v(t)},0),v=function(e){var n=e.editor,D=g.getCompletionPrefix(n),t=e.args,S=g.triggerAutocomplete(n,t);if(D&&D.length>=n.$liveAutocompletionThreshold||S){var r=i.for(n);r.autoShown=!0,r.showPopup(n)}},b=e("../editor").Editor;e("../config").defineOptions(b.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.on("afterExec",m)):this.commands.off("afterExec",m)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(e){e?(this.commands.addCommand(h),this.on("changeMode",d),d(null,this)):(this.commands.removeCommand(h),this.off("changeMode",d))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(n){e&&(e.exports=n)})}()},20009(e,n,D){e=D.nmd(e),ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,n,D){"use strict";var t,S=e("./lib/oop");e("./lib/lang");var i=e("./lib/event_emitter").EventEmitter,r=e("./editor").Editor,o=e("./virtual_renderer").VirtualRenderer,g=e("./edit_session").EditSession;(function(){S.implement(this,i),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var n=new r(new o(e,this.$theme));return n.on("focus",(function(){this._emit("focus",n)}).bind(this)),this.$editors.push(n),n.setFontSize(this.$fontSize),n},this.setSplits=function(e){var n;if(e<1)throw"The number of splits have to be > 0!";if(e!=this.$splits){if(e>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<e;)n=this.$editors[this.$splits],this.$container.appendChild(n.container),n.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<e;)this.$createEditor(),this.$splits++}else for(;this.$splits>e;)n=this.$editors[this.$splits-1],this.$container.removeChild(n.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(n){n.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(n){n.setKeyboardHandler(e)})},this.forEach=function(e,n){this.$editors.forEach(e,n)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(n){n.setFontSize(e)})},this.$cloneSession=function(e){var n=new g(e.getDocument(),e.getMode()),D=e.getUndoManager();return n.setUndoManager(D),n.setTabSize(e.getTabSize()),n.setUseSoftTabs(e.getUseSoftTabs()),n.setOverwrite(e.getOverwrite()),n.setBreakpoints(e.getBreakpoints()),n.setUseWrapMode(e.getUseWrapMode()),n.setUseWorker(e.getUseWorker()),n.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),n.$foldData=e.$cloneFoldData(),n},this.setSession=function(e,n){var D=null==n?this.$cEditor:this.$editors[n];return this.$editors.some(function(n){return n.session===e})&&(e=this.$cloneSession(e)),D.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){this.$orientation!=e&&(this.$orientation=e,this.resize())},this.resize=function(){var e,n=this.$container.clientWidth,D=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var t=n/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=t+"px",e.container.style.top="0px",e.container.style.left=S*t+"px",e.container.style.height=D+"px",e.resize();else for(var i=D/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=n+"px",e.container.style.top=S*i+"px",e.container.style.left="0px",e.container.style.height=i+"px",e.resize()}}).call((t=function(e,n,D){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=n,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(D||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),n.Split=t}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,n,D){"use strict";D.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(n){e&&(e.exports=n)})}()},62432(e,n,D){ace.config.setModuleUrl("ace/ext/beautify",D(1853)),ace.config.setModuleUrl("ace/ext/code_lens",D(42836)),ace.config.setModuleUrl("ace/ext/command_bar",D(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",D(40275)),ace.config.setModuleUrl("ace/ext/emmet",D(25962)),ace.config.setModuleUrl("ace/ext/error_marker",D(377)),ace.config.setModuleUrl("ace/ext/hardwrap",D(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",D(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",D(97188)),ace.config.setModuleUrl("ace/ext/language_tools",D(10194)),ace.config.setModuleUrl("ace/ext/linking",D(43794)),ace.config.setModuleUrl("ace/ext/modelist",D(71739)),ace.config.setModuleUrl("ace/ext/options",D(43804)),ace.config.setModuleUrl("ace/ext/prompt",D(20706)),ace.config.setModuleUrl("ace/ext/rtl",D(27480)),ace.config.setModuleUrl("ace/ext/searchbox",D(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",D(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",D(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",D(51834)),ace.config.setModuleUrl("ace/ext/split",D(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",D(99729)),ace.config.setModuleUrl("ace/ext/statusbar",D(86397)),ace.config.setModuleUrl("ace/ext/textarea",D(36454)),ace.config.setModuleUrl("ace/ext/themelist",D(85107)),ace.config.setModuleUrl("ace/ext/whitespace",D(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",D(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",D(1832)),ace.config.setModuleUrl("ace/keyboard/vim",D(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",D(98557)),ace.config.setModuleUrl("ace/mode/abap",D(48208)),ace.config.setModuleUrl("ace/mode/abc",D(22128)),ace.config.setModuleUrl("ace/mode/actionscript",D(3871)),ace.config.setModuleUrl("ace/mode/ada",D(87272)),ace.config.setModuleUrl("ace/mode/alda",D(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",D(70029)),ace.config.setModuleUrl("ace/mode/apex",D(24266)),ace.config.setModuleUrl("ace/mode/applescript",D(78831)),ace.config.setModuleUrl("ace/mode/aql",D(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",D(36417)),ace.config.setModuleUrl("ace/mode/asl",D(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",D(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",D(9319)),ace.config.setModuleUrl("ace/mode/astro",D(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",D(5215)),ace.config.setModuleUrl("ace/mode/batchfile",D(182)),ace.config.setModuleUrl("ace/mode/bibtex",D(54316)),ace.config.setModuleUrl("ace/mode/c9search",D(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",D(69563)),ace.config.setModuleUrl("ace/mode/cirru",D(25995)),ace.config.setModuleUrl("ace/mode/clojure",D(81384)),ace.config.setModuleUrl("ace/mode/cobol",D(12307)),ace.config.setModuleUrl("ace/mode/coffee",D(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",D(82540)),ace.config.setModuleUrl("ace/mode/crystal",D(70162)),ace.config.setModuleUrl("ace/mode/csharp",D(86173)),ace.config.setModuleUrl("ace/mode/csound_document",D(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",D(54722)),ace.config.setModuleUrl("ace/mode/csound_score",D(48055)),ace.config.setModuleUrl("ace/mode/csp",D(61634)),ace.config.setModuleUrl("ace/mode/css",D(59119)),ace.config.setModuleUrl("ace/mode/curly",D(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",D(34379)),ace.config.setModuleUrl("ace/mode/d",D(48656)),ace.config.setModuleUrl("ace/mode/dart",D(1647)),ace.config.setModuleUrl("ace/mode/diff",D(30365)),ace.config.setModuleUrl("ace/mode/django",D(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",D(62136)),ace.config.setModuleUrl("ace/mode/dot",D(40631)),ace.config.setModuleUrl("ace/mode/drools",D(36363)),ace.config.setModuleUrl("ace/mode/edifact",D(19906)),ace.config.setModuleUrl("ace/mode/eiffel",D(61933)),ace.config.setModuleUrl("ace/mode/ejs",D(78924)),ace.config.setModuleUrl("ace/mode/elixir",D(91429)),ace.config.setModuleUrl("ace/mode/elm",D(98664)),ace.config.setModuleUrl("ace/mode/erlang",D(18885)),ace.config.setModuleUrl("ace/mode/flix",D(98513)),ace.config.setModuleUrl("ace/mode/forth",D(50379)),ace.config.setModuleUrl("ace/mode/fortran",D(87166)),ace.config.setModuleUrl("ace/mode/fsharp",D(55288)),ace.config.setModuleUrl("ace/mode/fsl",D(96369)),ace.config.setModuleUrl("ace/mode/ftl",D(5474)),ace.config.setModuleUrl("ace/mode/gcode",D(39264)),ace.config.setModuleUrl("ace/mode/gherkin",D(67942)),ace.config.setModuleUrl("ace/mode/gitignore",D(37898)),ace.config.setModuleUrl("ace/mode/glsl",D(2474)),ace.config.setModuleUrl("ace/mode/gobstones",D(70154)),ace.config.setModuleUrl("ace/mode/golang",D(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",D(75542)),ace.config.setModuleUrl("ace/mode/groovy",D(50436)),ace.config.setModuleUrl("ace/mode/haml",D(63920)),ace.config.setModuleUrl("ace/mode/handlebars",D(51526)),ace.config.setModuleUrl("ace/mode/haskell",D(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",D(67784)),ace.config.setModuleUrl("ace/mode/haxe",D(81690)),ace.config.setModuleUrl("ace/mode/hjson",D(44406)),ace.config.setModuleUrl("ace/mode/html",D(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",D(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",D(76542)),ace.config.setModuleUrl("ace/mode/ini",D(88110)),ace.config.setModuleUrl("ace/mode/io",D(91930)),ace.config.setModuleUrl("ace/mode/ion",D(24958)),ace.config.setModuleUrl("ace/mode/jack",D(42901)),ace.config.setModuleUrl("ace/mode/jade",D(55300)),ace.config.setModuleUrl("ace/mode/java",D(29750)),ace.config.setModuleUrl("ace/mode/javascript",D(80437)),ace.config.setModuleUrl("ace/mode/jexl",D(62115)),ace.config.setModuleUrl("ace/mode/json",D(46544)),ace.config.setModuleUrl("ace/mode/json5",D(17965)),ace.config.setModuleUrl("ace/mode/jsoniq",D(78118)),ace.config.setModuleUrl("ace/mode/jsp",D(41705)),ace.config.setModuleUrl("ace/mode/jssm",D(22901)),ace.config.setModuleUrl("ace/mode/jsx",D(73937)),ace.config.setModuleUrl("ace/mode/julia",D(941)),ace.config.setModuleUrl("ace/mode/kotlin",D(86571)),ace.config.setModuleUrl("ace/mode/latex",D(30808)),ace.config.setModuleUrl("ace/mode/latte",D(2986)),ace.config.setModuleUrl("ace/mode/less",D(72799)),ace.config.setModuleUrl("ace/mode/liquid",D(95630)),ace.config.setModuleUrl("ace/mode/lisp",D(85950)),ace.config.setModuleUrl("ace/mode/livescript",D(74703)),ace.config.setModuleUrl("ace/mode/logiql",D(72094)),ace.config.setModuleUrl("ace/mode/logtalk",D(39512)),ace.config.setModuleUrl("ace/mode/lsl",D(94275)),ace.config.setModuleUrl("ace/mode/lua",D(46890)),ace.config.setModuleUrl("ace/mode/luapage",D(81029)),ace.config.setModuleUrl("ace/mode/lucene",D(7616)),ace.config.setModuleUrl("ace/mode/makefile",D(77882)),ace.config.setModuleUrl("ace/mode/markdown",D(21459)),ace.config.setModuleUrl("ace/mode/mask",D(54050)),ace.config.setModuleUrl("ace/mode/matlab",D(35907)),ace.config.setModuleUrl("ace/mode/maze",D(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",D(72268)),ace.config.setModuleUrl("ace/mode/mel",D(66018)),ace.config.setModuleUrl("ace/mode/mips",D(20617)),ace.config.setModuleUrl("ace/mode/mixal",D(98667)),ace.config.setModuleUrl("ace/mode/mushcode",D(61026)),ace.config.setModuleUrl("ace/mode/mysql",D(21630)),ace.config.setModuleUrl("ace/mode/nasal",D(23523)),ace.config.setModuleUrl("ace/mode/nginx",D(16788)),ace.config.setModuleUrl("ace/mode/nim",D(31900)),ace.config.setModuleUrl("ace/mode/nix",D(6135)),ace.config.setModuleUrl("ace/mode/nsis",D(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",D(51481)),ace.config.setModuleUrl("ace/mode/objectivec",D(75466)),ace.config.setModuleUrl("ace/mode/ocaml",D(49088)),ace.config.setModuleUrl("ace/mode/odin",D(5610)),ace.config.setModuleUrl("ace/mode/partiql",D(76557)),ace.config.setModuleUrl("ace/mode/pascal",D(80694)),ace.config.setModuleUrl("ace/mode/perl",D(7135)),ace.config.setModuleUrl("ace/mode/pgsql",D(55707)),ace.config.setModuleUrl("ace/mode/php",D(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",D(49935)),ace.config.setModuleUrl("ace/mode/pig",D(7124)),ace.config.setModuleUrl("ace/mode/plain_text",D(92868)),ace.config.setModuleUrl("ace/mode/plsql",D(24808)),ace.config.setModuleUrl("ace/mode/powershell",D(77823)),ace.config.setModuleUrl("ace/mode/praat",D(46124)),ace.config.setModuleUrl("ace/mode/prisma",D(18114)),ace.config.setModuleUrl("ace/mode/prolog",D(35061)),ace.config.setModuleUrl("ace/mode/properties",D(56059)),ace.config.setModuleUrl("ace/mode/protobuf",D(86305)),ace.config.setModuleUrl("ace/mode/prql",D(58317)),ace.config.setModuleUrl("ace/mode/puppet",D(85804)),ace.config.setModuleUrl("ace/mode/python",D(51652)),ace.config.setModuleUrl("ace/mode/qml",D(11038)),ace.config.setModuleUrl("ace/mode/r",D(438)),ace.config.setModuleUrl("ace/mode/raku",D(4847)),ace.config.setModuleUrl("ace/mode/razor",D(67300)),ace.config.setModuleUrl("ace/mode/rdoc",D(6430)),ace.config.setModuleUrl("ace/mode/red",D(85347)),ace.config.setModuleUrl("ace/mode/redshift",D(36975)),ace.config.setModuleUrl("ace/mode/rhtml",D(7047)),ace.config.setModuleUrl("ace/mode/robot",D(66276)),ace.config.setModuleUrl("ace/mode/rst",D(8781)),ace.config.setModuleUrl("ace/mode/ruby",D(334)),ace.config.setModuleUrl("ace/mode/rust",D(43292)),ace.config.setModuleUrl("ace/mode/sac",D(26329)),ace.config.setModuleUrl("ace/mode/sass",D(52748)),ace.config.setModuleUrl("ace/mode/scad",D(46193)),ace.config.setModuleUrl("ace/mode/scala",D(19366)),ace.config.setModuleUrl("ace/mode/scheme",D(81413)),ace.config.setModuleUrl("ace/mode/scrypt",D(70877)),ace.config.setModuleUrl("ace/mode/scss",D(55146)),ace.config.setModuleUrl("ace/mode/sh",D(77105)),ace.config.setModuleUrl("ace/mode/sjs",D(16042)),ace.config.setModuleUrl("ace/mode/slim",D(58715)),ace.config.setModuleUrl("ace/mode/smarty",D(48146)),ace.config.setModuleUrl("ace/mode/smithy",D(75144)),ace.config.setModuleUrl("ace/mode/snippets",D(33124)),ace.config.setModuleUrl("ace/mode/soy_template",D(23446)),ace.config.setModuleUrl("ace/mode/space",D(29582)),ace.config.setModuleUrl("ace/mode/sparql",D(4911)),ace.config.setModuleUrl("ace/mode/sql",D(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",D(19771)),ace.config.setModuleUrl("ace/mode/stylus",D(60940)),ace.config.setModuleUrl("ace/mode/svg",D(68506)),ace.config.setModuleUrl("ace/mode/swift",D(39215)),ace.config.setModuleUrl("ace/mode/tcl",D(54987)),ace.config.setModuleUrl("ace/mode/terraform",D(31372)),ace.config.setModuleUrl("ace/mode/tex",D(63609)),ace.config.setModuleUrl("ace/mode/text",D(12585)),ace.config.setModuleUrl("ace/mode/textile",D(29541)),ace.config.setModuleUrl("ace/mode/toml",D(69774)),ace.config.setModuleUrl("ace/mode/tsx",D(53135)),ace.config.setModuleUrl("ace/mode/turtle",D(12476)),ace.config.setModuleUrl("ace/mode/twig",D(71255)),ace.config.setModuleUrl("ace/mode/typescript",D(5397)),ace.config.setModuleUrl("ace/mode/vala",D(98124)),ace.config.setModuleUrl("ace/mode/vbscript",D(70801)),ace.config.setModuleUrl("ace/mode/velocity",D(33189)),ace.config.setModuleUrl("ace/mode/verilog",D(36982)),ace.config.setModuleUrl("ace/mode/vhdl",D(98256)),ace.config.setModuleUrl("ace/mode/visualforce",D(7335)),ace.config.setModuleUrl("ace/mode/vue",D(2256)),ace.config.setModuleUrl("ace/mode/wollok",D(29446)),ace.config.setModuleUrl("ace/mode/xml",D(93489)),ace.config.setModuleUrl("ace/mode/xquery",D(27174)),ace.config.setModuleUrl("ace/mode/yaml",D(32113)),ace.config.setModuleUrl("ace/mode/zeek",D(38035)),ace.config.setModuleUrl("ace/mode/zig",D(86882)),ace.config.setModuleUrl("ace/theme/ambiance",D(7890)),ace.config.setModuleUrl("ace/theme/chaos",D(40156)),ace.config.setModuleUrl("ace/theme/chrome",D(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",D(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",D(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",D(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",D(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",D(93008)),ace.config.setModuleUrl("ace/theme/clouds",D(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",D(54131)),ace.config.setModuleUrl("ace/theme/cobalt",D(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",D(63553)),ace.config.setModuleUrl("ace/theme/dawn",D(58732)),ace.config.setModuleUrl("ace/theme/dracula",D(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",D(71791)),ace.config.setModuleUrl("ace/theme/eclipse",D(28409)),ace.config.setModuleUrl("ace/theme/github",D(28573)),ace.config.setModuleUrl("ace/theme/github_dark",D(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",D(50836)),ace.config.setModuleUrl("ace/theme/gob",D(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",D(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",D(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",D(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",D(46925)),ace.config.setModuleUrl("ace/theme/iplastic",D(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",D(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",D(67773)),ace.config.setModuleUrl("ace/theme/kuroir",D(78990)),ace.config.setModuleUrl("ace/theme/merbivore",D(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",D(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",D(61343)),ace.config.setModuleUrl("ace/theme/monokai",D(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",D(63554)),ace.config.setModuleUrl("ace/theme/one_dark",D(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",D(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",D(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",D(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",D(14995)),ace.config.setModuleUrl("ace/theme/terminal",D(91493)),ace.config.setModuleUrl("ace/theme/textmate",D(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",D(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",D(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",D(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",D(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",D(59069)),ace.config.setModuleUrl("ace/theme/twilight",D(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",D(26689)),ace.config.setModuleUrl("ace/theme/xcode",D(26433)),ace.config.setModuleUrl("ace/mode/base_worker",D(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",D(74901)),ace.config.setModuleUrl("ace/mode/css_worker",D(88494)),ace.config.setModuleUrl("ace/mode/html_worker",D(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",D(7182)),ace.config.setModuleUrl("ace/mode/json_worker",D(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",D(55639)),ace.config.setModuleUrl("ace/mode/php_worker",D(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",D(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",D(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",D(67782)),ace.config.setModuleUrl("ace/snippets/abap",D(57909)),ace.config.setModuleUrl("ace/snippets/abc",D(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",D(63178)),ace.config.setModuleUrl("ace/snippets/ada",D(70563)),ace.config.setModuleUrl("ace/snippets/alda",D(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",D(53290)),ace.config.setModuleUrl("ace/snippets/apex",D(64691)),ace.config.setModuleUrl("ace/snippets/applescript",D(86568)),ace.config.setModuleUrl("ace/snippets/aql",D(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",D(64428)),ace.config.setModuleUrl("ace/snippets/asl",D(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",D(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",D(54726)),ace.config.setModuleUrl("ace/snippets/astro",D(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",D(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",D(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",D(34929)),ace.config.setModuleUrl("ace/snippets/c9search",D(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",D(51824)),ace.config.setModuleUrl("ace/snippets/cirru",D(90368)),ace.config.setModuleUrl("ace/snippets/clojure",D(70819)),ace.config.setModuleUrl("ace/snippets/cobol",D(10232)),ace.config.setModuleUrl("ace/snippets/coffee",D(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",D(71241)),ace.config.setModuleUrl("ace/snippets/crystal",D(94925)),ace.config.setModuleUrl("ace/snippets/csharp",D(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",D(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",D(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",D(46326)),ace.config.setModuleUrl("ace/snippets/csp",D(3029)),ace.config.setModuleUrl("ace/snippets/css",D(21452)),ace.config.setModuleUrl("ace/snippets/curly",D(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",D(46790)),ace.config.setModuleUrl("ace/snippets/d",D(32803)),ace.config.setModuleUrl("ace/snippets/dart",D(48138)),ace.config.setModuleUrl("ace/snippets/diff",D(54060)),ace.config.setModuleUrl("ace/snippets/django",D(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",D(58661)),ace.config.setModuleUrl("ace/snippets/dot",D(38180)),ace.config.setModuleUrl("ace/snippets/drools",D(53542)),ace.config.setModuleUrl("ace/snippets/edifact",D(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",D(71020)),ace.config.setModuleUrl("ace/snippets/ejs",D(78027)),ace.config.setModuleUrl("ace/snippets/elixir",D(81672)),ace.config.setModuleUrl("ace/snippets/elm",D(20259)),ace.config.setModuleUrl("ace/snippets/erlang",D(80564)),ace.config.setModuleUrl("ace/snippets/flix",D(38984)),ace.config.setModuleUrl("ace/snippets/forth",D(50528)),ace.config.setModuleUrl("ace/snippets/fortran",D(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",D(60317)),ace.config.setModuleUrl("ace/snippets/fsl",D(60470)),ace.config.setModuleUrl("ace/snippets/ftl",D(64093)),ace.config.setModuleUrl("ace/snippets/gcode",D(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",D(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",D(51069)),ace.config.setModuleUrl("ace/snippets/glsl",D(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",D(19433)),ace.config.setModuleUrl("ace/snippets/golang",D(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",D(90933)),ace.config.setModuleUrl("ace/snippets/groovy",D(28101)),ace.config.setModuleUrl("ace/snippets/haml",D(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",D(63083)),ace.config.setModuleUrl("ace/snippets/haskell",D(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",D(11831)),ace.config.setModuleUrl("ace/snippets/haxe",D(71443)),ace.config.setModuleUrl("ace/snippets/hjson",D(70389)),ace.config.setModuleUrl("ace/snippets/html",D(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",D(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",D(42201)),ace.config.setModuleUrl("ace/snippets/ini",D(36453)),ace.config.setModuleUrl("ace/snippets/io",D(93307)),ace.config.setModuleUrl("ace/snippets/ion",D(4345)),ace.config.setModuleUrl("ace/snippets/jack",D(37832)),ace.config.setModuleUrl("ace/snippets/jade",D(17469)),ace.config.setModuleUrl("ace/snippets/java",D(44967)),ace.config.setModuleUrl("ace/snippets/javascript",D(64472)),ace.config.setModuleUrl("ace/snippets/jexl",D(63542)),ace.config.setModuleUrl("ace/snippets/json",D(50165)),ace.config.setModuleUrl("ace/snippets/json5",D(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",D(60927)),ace.config.setModuleUrl("ace/snippets/jsp",D(36142)),ace.config.setModuleUrl("ace/snippets/jssm",D(44592)),ace.config.setModuleUrl("ace/snippets/jsx",D(33158)),ace.config.setModuleUrl("ace/snippets/julia",D(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",D(94158)),ace.config.setModuleUrl("ace/snippets/latex",D(1075)),ace.config.setModuleUrl("ace/snippets/latte",D(46769)),ace.config.setModuleUrl("ace/snippets/less",D(52466)),ace.config.setModuleUrl("ace/snippets/liquid",D(27191)),ace.config.setModuleUrl("ace/snippets/lisp",D(63635)),ace.config.setModuleUrl("ace/snippets/livescript",D(41122)),ace.config.setModuleUrl("ace/snippets/logiql",D(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",D(27299)),ace.config.setModuleUrl("ace/snippets/lsl",D(38552)),ace.config.setModuleUrl("ace/snippets/lua",D(67401)),ace.config.setModuleUrl("ace/snippets/luapage",D(57030)),ace.config.setModuleUrl("ace/snippets/lucene",D(95437)),ace.config.setModuleUrl("ace/snippets/makefile",D(63275)),ace.config.setModuleUrl("ace/snippets/markdown",D(81586)),ace.config.setModuleUrl("ace/snippets/mask",D(49087)),ace.config.setModuleUrl("ace/snippets/matlab",D(65946)),ace.config.setModuleUrl("ace/snippets/maze",D(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",D(29999)),ace.config.setModuleUrl("ace/snippets/mel",D(17417)),ace.config.setModuleUrl("ace/snippets/mips",D(74332)),ace.config.setModuleUrl("ace/snippets/mixal",D(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",D(31539)),ace.config.setModuleUrl("ace/snippets/mysql",D(59577)),ace.config.setModuleUrl("ace/snippets/nasal",D(49224)),ace.config.setModuleUrl("ace/snippets/nginx",D(82227)),ace.config.setModuleUrl("ace/snippets/nim",D(93243)),ace.config.setModuleUrl("ace/snippets/nix",D(72152)),ace.config.setModuleUrl("ace/snippets/nsis",D(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",D(58755)),ace.config.setModuleUrl("ace/snippets/objectivec",D(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",D(96183)),ace.config.setModuleUrl("ace/snippets/odin",D(91983)),ace.config.setModuleUrl("ace/snippets/partiql",D(78106)),ace.config.setModuleUrl("ace/snippets/pascal",D(79323)),ace.config.setModuleUrl("ace/snippets/perl",D(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",D(98692)),ace.config.setModuleUrl("ace/snippets/php",D(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",D(43416)),ace.config.setModuleUrl("ace/snippets/pig",D(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",D(91365)),ace.config.setModuleUrl("ace/snippets/plsql",D(18423)),ace.config.setModuleUrl("ace/snippets/powershell",D(41273)),ace.config.setModuleUrl("ace/snippets/praat",D(8711)),ace.config.setModuleUrl("ace/snippets/prisma",D(87915)),ace.config.setModuleUrl("ace/snippets/prolog",D(58432)),ace.config.setModuleUrl("ace/snippets/properties",D(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",D(93932)),ace.config.setModuleUrl("ace/snippets/prql",D(79240)),ace.config.setModuleUrl("ace/snippets/puppet",D(35129)),ace.config.setModuleUrl("ace/snippets/python",D(54309)),ace.config.setModuleUrl("ace/snippets/qml",D(31005)),ace.config.setModuleUrl("ace/snippets/r",D(55961)),ace.config.setModuleUrl("ace/snippets/raku",D(42950)),ace.config.setModuleUrl("ace/snippets/razor",D(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",D(62535)),ace.config.setModuleUrl("ace/snippets/red",D(13500)),ace.config.setModuleUrl("ace/snippets/redshift",D(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",D(84064)),ace.config.setModuleUrl("ace/snippets/robot",D(61111)),ace.config.setModuleUrl("ace/snippets/rst",D(43530)),ace.config.setModuleUrl("ace/snippets/ruby",D(35148)),ace.config.setModuleUrl("ace/snippets/rust",D(36729)),ace.config.setModuleUrl("ace/snippets/sac",D(37506)),ace.config.setModuleUrl("ace/snippets/sass",D(82737)),ace.config.setModuleUrl("ace/snippets/scad",D(35400)),ace.config.setModuleUrl("ace/snippets/scala",D(92945)),ace.config.setModuleUrl("ace/snippets/scheme",D(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",D(64128)),ace.config.setModuleUrl("ace/snippets/scss",D(48387)),ace.config.setModuleUrl("ace/snippets/sh",D(13176)),ace.config.setModuleUrl("ace/snippets/sjs",D(68801)),ace.config.setModuleUrl("ace/snippets/slim",D(93390)),ace.config.setModuleUrl("ace/snippets/smarty",D(67831)),ace.config.setModuleUrl("ace/snippets/smithy",D(34577)),ace.config.setModuleUrl("ace/snippets/snippets",D(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",D(93779)),ace.config.setModuleUrl("ace/snippets/space",D(50673)),ace.config.setModuleUrl("ace/snippets/sparql",D(38842)),ace.config.setModuleUrl("ace/snippets/sql",D(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",D(56420)),ace.config.setModuleUrl("ace/snippets/stylus",D(3309)),ace.config.setModuleUrl("ace/snippets/svg",D(82161)),ace.config.setModuleUrl("ace/snippets/swift",D(41200)),ace.config.setModuleUrl("ace/snippets/tcl",D(32384)),ace.config.setModuleUrl("ace/snippets/terraform",D(75607)),ace.config.setModuleUrl("ace/snippets/tex",D(6874)),ace.config.setModuleUrl("ace/snippets/text",D(54012)),ace.config.setModuleUrl("ace/snippets/textile",D(93878)),ace.config.setModuleUrl("ace/snippets/toml",D(49599)),ace.config.setModuleUrl("ace/snippets/tsx",D(22028)),ace.config.setModuleUrl("ace/snippets/turtle",D(86333)),ace.config.setModuleUrl("ace/snippets/twig",D(11078)),ace.config.setModuleUrl("ace/snippets/typescript",D(40344)),ace.config.setModuleUrl("ace/snippets/vala",D(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",D(5368)),ace.config.setModuleUrl("ace/snippets/velocity",D(4896)),ace.config.setModuleUrl("ace/snippets/verilog",D(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",D(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",D(82036)),ace.config.setModuleUrl("ace/snippets/vue",D(36751)),ace.config.setModuleUrl("ace/snippets/wollok",D(12463)),ace.config.setModuleUrl("ace/snippets/xml",D(65690)),ace.config.setModuleUrl("ace/snippets/xquery",D(84835)),ace.config.setModuleUrl("ace/snippets/yaml",D(46716)),ace.config.setModuleUrl("ace/snippets/zeek",D(51174)),ace.config.setModuleUrl("ace/snippets/zig",D(64865))},63282(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv=void 0;let t=D(4042),S=D(86144),i=D(36653),r=D(72079),o=["/properties"],g="http://json-schema.org/draft-07/schema";class s extends t.default{_addVocabularies(){super._addVocabularies(),S.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(r,o):r;this.addMetaSchema(e,g,!1),this.refs["http://json-schema.org/schema"]=g}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(g)?g:void 0)}}n.Ajv=s,e.exports=n=s,e.exports.Ajv=s,Object.defineProperty(n,"__esModule",{value:!0}),n.default=s;var a=D(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var l=D(99029);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(n,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var c=D(13558);Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return c.default}});var u=D(34551);Object.defineProperty(n,"MissingRefError",{enumerable:!0,get:function(){return u.default}})},41520(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class D{}n._CodeOrName=D,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class t extends D{constructor(e){if(super(),!n.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}n.Name=t;class S extends D{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,n)=>`${e}${n}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,n)=>(n instanceof t&&(e[n.str]=(e[n.str]||0)+1),e),{})}}function i(e,...n){let D=[e[0]],t=0;for(;t<n.length;)g(D,n[t]),D.push(e[++t]);return new S(D)}n._Code=S,n.nil=new S(""),n._=i;let r=new S("+");function o(e,...n){let D=[c(e[0])],t=0;for(;t<n.length;)D.push(r),g(D,n[t]),D.push(r,c(e[++t]));return s(D),new S(D)}function g(e,n){n instanceof S?e.push(...n._items):n instanceof t?e.push(n):e.push(l(n))}function s(e){let n=1;for(;n<e.length-1;){if(e[n]===r){let D=a(e[n-1],e[n+1]);if(void 0!==D){e.splice(n-1,3,D);continue}e[n++]="+"}n++}}function a(e,n){return'""'===n?e:'""'===e?n:"string"==typeof e?n instanceof t||'"'!==e[e.length-1]?void 0:"string"!=typeof n?`${e.slice(0,-1)}${n}"`:'"'===n[0]?e.slice(0,-1)+n.slice(1):void 0:"string"!=typeof n||'"'!==n[0]||e instanceof t?void 0:`"${e}${n.slice(1)}`}function l(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:c(Array.isArray(e)?e.join(","):e)}function c(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function u(e){return"string"==typeof e&&n.IDENTIFIER.test(e)?new S(`.${e}`):i`[${e}]`}function h(e){if("string"==typeof e&&n.IDENTIFIER.test(e))return new S(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}n.str=o,n.addCodeArg=g,n.strConcat=function(e,n){return n.emptyStr()?e:e.emptyStr()?n:o`${e}${n}`},n.stringify=function(e){return new S(c(e))},n.safeStringify=c,n.getProperty=u,n.getEsmExportName=h,n.regexpCode=function(e){return new S(e.toString())}},99029(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;let t=D(41520),S=D(57845);var i=D(41520);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(n,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(n,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(n,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return i.Name}});var r=D(57845);Object.defineProperty(n,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(n,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(n,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(n,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),n.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,n){return this}}class g extends o{constructor(e,n,D){super(),this.varKind=e,this.name=n,this.rhs=D}render({es5:e,_n:n}){let D=e?S.varKinds.var:this.varKind,t=void 0===this.rhs?"":` = ${this.rhs}`;return`${D} ${this.name}${t};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=T(this.rhs,e,n)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(e,n,D){super(),this.lhs=e,this.rhs=n,this.sideEffects=D}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=T(this.rhs,e,n),this}get names(){return A(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(e,n,D,t){super(e,D,t),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class c extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let n=this.label?` ${this.label}`:"";return`break${n};`+e}}class u extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=T(this.code,e,n),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class d extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,D)=>n+D.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let D=e[n].optimizeNodes();Array.isArray(D)?e.splice(n,1,...D):D?e[n]=D:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:D}=this,t=D.length;for(;t--;){let S=D[t];S.optimizeNames(e,n)||(O(e,S.names),D.splice(t,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>k(e,n.names),{})}}class p extends d{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class f extends d{}class m extends p{}m.kind="else";class y extends p{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new m(e):e}return n?!1===e?n instanceof y?n:n.nodes:this.nodes.length?this:new y(R(e),n instanceof y?[n]:n.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,n){var D;if(this.else=null==(D=this.else)?void 0:D.optimizeNames(e,n),super.optimizeNames(e,n)||this.else)return this.condition=T(this.condition,e,n),this}get names(){let e=super.names;return A(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class v extends p{}v.kind="for";class b extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=T(this.iteration,e,n),this}get names(){return k(super.names,this.iteration.names)}}class w extends v{constructor(e,n,D,t){super(),this.varKind=e,this.name=n,this.from=D,this.to=t}render(e){let n=e.es5?S.varKinds.var:this.varKind,{name:D,from:t,to:i}=this;return`for(${n} ${D}=${t}; ${D}<${i}; ${D}++)`+super.render(e)}get names(){let e=A(super.names,this.from);return A(e,this.to)}}class M extends v{constructor(e,n,D,t){super(),this.loop=e,this.varKind=n,this.name=D,this.iterable=t}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=T(this.iterable,e,n),this}get names(){return k(super.names,this.iterable.names)}}class L extends p{constructor(e,n,D){super(),this.name=e,this.args=n,this.async=D}render(e){let n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(e)}}L.kind="func";class $ extends d{render(e){return"return "+super.render(e)}}$.kind="return";class _ extends p{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(n=this.finally)||n.optimizeNodes(),this}optimizeNames(e,n){var D,t;return super.optimizeNames(e,n),null==(D=this.catch)||D.optimizeNames(e,n),null==(t=this.finally)||t.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class x extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class C extends p{render(e){return"finally"+super.render(e)}}C.kind="finally";class E{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?"\n":""},this._extScope=e,this._scope=new S.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let D=this._extScope.value(e,n);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,D,t){let S=this._scope.toName(n);return void 0!==D&&t&&(this._constants[S.str]=D),this._leafNode(new g(e,S,D)),S}const(e,n,D){return this._def(S.varKinds.const,e,n,D)}let(e,n,D){return this._def(S.varKinds.let,e,n,D)}var(e,n,D){return this._def(S.varKinds.var,e,n,D)}assign(e,n,D){return this._leafNode(new s(e,n,D))}add(e,D){return this._leafNode(new a(e,n.operators.ADD,D))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){let n=["{"];for(let[D,S]of e)n.length>1&&n.push(","),n.push(D),(D!==S||this.opts.es5)&&(n.push(":"),(0,t.addCodeArg)(n,S));return n.push("}"),new t._Code(n)}if(e,n,D){if(this._blockNode(new y(e)),n&&D)this.code(n).else().code(D).endIf();else if(n)this.code(n).endIf();else if(D)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(y,m)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new b(e),n)}forRange(e,n,D,t,i=this.opts.es5?S.varKinds.var:S.varKinds.let){let r=this._scope.toName(e);return this._for(new w(i,r,n,D),()=>t(r))}forOf(e,n,D,i=S.varKinds.const){let r=this._scope.toName(e);if(this.opts.es5){let e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,t._)`${e}.length`,n=>{this.var(r,(0,t._)`${e}[${n}]`),D(r)})}return this._for(new M("of",i,r,n),()=>D(r))}forIn(e,n,D,i=this.opts.es5?S.varKinds.var:S.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${n})`,D);let r=this._scope.toName(e);return this._for(new M("in",i,r,n),()=>D(r))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new c(e))}return(e){let n=new $;if(this._blockNode(n),this.code(e),1!==n.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode($)}try(e,n,D){if(!n&&!D)throw Error('CodeGen: "try" without "catch" and "finally"');let t=new _;if(this._blockNode(t),this.code(e),n){let e=this.name("e");this._currNode=t.catch=new x(e),n(e)}return D&&(this._currNode=t.finally=new C,this.code(D)),this._endBlockNode(x,C)}throw(e){return this._leafNode(new u(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(void 0===n)throw Error("CodeGen: not in self-balancing block");let D=this._nodes.length-n;if(D<0||void 0!==e&&D!==e)throw Error(`CodeGen: wrong number of nodes: ${D} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=t.nil,D,S){return this._blockNode(new L(e,n,D)),S&&this.code(S).endFunc(),this}endFunc(){return this._endBlockNode(L)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,n){let D=this._currNode;if(D instanceof e||n&&D instanceof n)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}}function k(e,n){for(let D in n)e[D]=(e[D]||0)+(n[D]||0);return e}function A(e,n){return n instanceof t._CodeOrName?k(e,n.names):e}function T(e,n,D){if(e instanceof t.Name)return S(e);if(!i(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=S(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function S(e){let t=D[e.str];return void 0===t||1!==n[e.str]?e:(delete n[e.str],t)}function i(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&1===n[e.str]&&void 0!==D[e.str])}}function O(e,n){for(let D in n)e[D]=(e[D]||0)-(n[D]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${P(e)}`}n.CodeGen=E,n.not=R;let I=N(n.operators.AND);n.and=function(...e){return e.reduce(I)};let j=N(n.operators.OR);function N(e){return(n,D)=>n===t.nil?D:D===t.nil?n:(0,t._)`${P(n)} ${e} ${P(D)}`}function P(e){return e instanceof t.Name?e:(0,t._)`(${e})`}n.or=function(...e){return e.reduce(j)}},57845(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;let S=D(41520);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(t||(n.UsedValueState=t={})),n.varKinds={const:new S.Name("const"),let:new S.Name("let"),var:new S.Name("var")};class r{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof S.Name?e:this.name(e)}name(e){return new S.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,D;if((null==(D=null==(n=this._parent)?void 0:n._prefixes)?void 0:D.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}n.Scope=r;class o extends S.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:D}){this.value=e,this.scopePath=(0,S._)`.${new S.Name(n)}[${D}]`}}n.ValueScopeName=o;let g=(0,S._)`\n`;class s extends r{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?g:S.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,n){var D;if(void 0===n.ref)throw Error("CodeGen: ref must be passed in value");let t=this.toName(e),{prefix:S}=t,i=null!=(D=n.key)?D:n.ref,r=this._values[S];if(r){let e=r.get(i);if(e)return e}else r=this._values[S]=new Map;r.set(i,t);let o=this._scope[S]||(this._scope[S]=[]),g=o.length;return o[g]=n.ref,t.setValue(n,{property:S,itemIndex:g}),t}getValue(e,n){let D=this._values[e];if(D)return D.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(void 0===n.scopePath)throw Error(`CodeGen: name "${n}" has no value`);return(0,S._)`${e}${n.scopePath}`})}scopeCode(e=this._values,n,D){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},n,D)}_reduceValues(e,D,r={},o){let g=S.nil;for(let s in e){let a=e[s];if(!a)continue;let l=r[s]=r[s]||new Map;a.forEach(e=>{if(l.has(e))return;l.set(e,t.Started);let r=D(e);if(r){let D=this.opts.es5?n.varKinds.var:n.varKinds.const;g=(0,S._)`${g}${D} ${e} = ${r};${this.opts._n}`}else if(r=null==o?void 0:o(e))g=(0,S._)`${g}${r}${this.opts._n}`;else throw new i(e);l.set(e,t.Completed)})}return g}}n.ValueScope=s},48708(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;let t=D(99029),S=D(94227),i=D(42023);function r(e,D=n.keywordError,S,i){let{it:o}=e,{gen:a,compositeRule:c,allErrors:u}=o,h=l(e,D,S);(null!=i?i:c||u)?g(a,h):s(o,(0,t._)`[${h}]`)}function o(e,D=n.keywordError,t){let{it:S}=e,{gen:r,compositeRule:a,allErrors:c}=S;g(r,l(e,D,t)),a||c||s(S,i.default.vErrors)}function g(e,n){let D=e.const("err",n);e.if((0,t._)`${i.default.vErrors} === null`,()=>e.assign(i.default.vErrors,(0,t._)`[${D}]`),(0,t._)`${i.default.vErrors}.push(${D})`),e.code((0,t._)`${i.default.errors}++`)}function s(e,n){let{gen:D,validateName:S,schemaEnv:i}=e;i.$async?D.throw((0,t._)`new ${e.ValidationError}(${n})`):(D.assign((0,t._)`${S}.errors`,n),D.return(!1))}n.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},n.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},n.reportError=r,n.reportExtraError=o,n.resetErrorsCount=function(e,n){e.assign(i.default.errors,n),e.if((0,t._)`${i.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${i.default.vErrors}.length`,n),()=>e.assign(i.default.vErrors,null)))},n.extendErrors=function({gen:e,keyword:n,schemaValue:D,data:S,errsCount:r,it:o}){if(void 0===r)throw Error("ajv implementation error");let g=e.name("err");e.forRange("i",r,i.default.errors,r=>{e.const(g,(0,t._)`${i.default.vErrors}[${r}]`),e.if((0,t._)`${g}.instancePath === undefined`,()=>e.assign((0,t._)`${g}.instancePath`,(0,t.strConcat)(i.default.instancePath,o.errorPath))),e.assign((0,t._)`${g}.schemaPath`,(0,t.str)`${o.errSchemaPath}/${n}`),o.opts.verbose&&(e.assign((0,t._)`${g}.schema`,D),e.assign((0,t._)`${g}.data`,S))})};let a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function l(e,n,D){let{createErrors:S}=e.it;return!1===S?(0,t._)`{}`:c(e,n,D)}function c(e,n,D={}){let{gen:t,it:S}=e,i=[u(S,D),h(e,D)];return d(e,n,i),t.object(...i)}function u({errorPath:e},{instancePath:n}){let D=n?(0,t.str)`${e}${(0,S.getErrorPath)(n,S.Type.Str)}`:e;return[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,D)]}function h({keyword:e,it:{errSchemaPath:n}},{schemaPath:D,parentSchema:i}){let r=i?n:(0,t.str)`${n}/${e}`;return D&&(r=(0,t.str)`${r}${(0,S.getErrorPath)(D,S.Type.Str)}`),[a.schemaPath,r]}function d(e,{params:n,message:D},S){let{keyword:r,data:o,schemaValue:g,it:s}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:h}=s;S.push([a.keyword,r],[a.params,"function"==typeof n?n(e):n||(0,t._)`{}`]),l.messages&&S.push([a.message,"function"==typeof D?D(e):D]),l.verbose&&S.push([a.schema,g],[a.parentSchema,(0,t._)`${u}${h}`],[i.default.data,o]),c&&S.push([a.propertyName,c])}},73835(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;let t=D(99029),S=D(13558),i=D(42023),r=D(66939),o=D(94227),g=D(62586);class s{constructor(e){var n;let D;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(D=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(n=e.baseId)?n:(0,r.normalizeId)(null==D?void 0:D[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==D?void 0:D.$async,this.refs={}}}function a(e){let n,D,o=c.call(this,e);if(o)return o;let s=(0,r.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:l}=this.opts.code,{ownProperties:u}=this.opts,h=new t.CodeGen(this.scope,{es5:a,lines:l,ownProperties:u});e.$async&&(n=h.scopeValue("Error",{ref:S.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let d=h.scopeName("validate");e.validateName=d;let p={gen:h,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,g.validateFunctionCode)(p),h.optimize(this.opts.code.optimize);let n=h.toString();D=`${h.scopeRefs(i.default.scope)}return ${n}`,this.opts.code.process&&(D=this.opts.code.process(D,e));let S=Function(`${i.default.self}`,`${i.default.scope}`,D)(this,this.scope.get());if(this.scope.value(d,{ref:S}),S.errors=null,S.schema=e.schema,S.schemaEnv=e,e.$async&&(S.$async=!0),!0===this.opts.code.source&&(S.source={validateName:d,validateCode:n,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:n}=p;S.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},S.source&&(S.source.evaluated=(0,t.stringify)(S.evaluated))}return e.validate=S,e}catch(n){throw delete e.validate,delete e.validateName,D&&this.logger.error("Error compiling schema, function code:",D),n}finally{this._compilations.delete(e)}}function l(e){return(0,r.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:a.call(this,e)}function c(e){for(let n of this._compilations)if(u(n,e))return n}function u(e,n){return e.schema===n.schema&&e.root===n.root&&e.baseId===n.baseId}function h(e,n){let D;for(;"string"==typeof(D=this.refs[n]);)n=D;return D||this.schemas[n]||d.call(this,e,n)}function d(e,n){let D=this.opts.uriResolver.parse(n),t=(0,r._getFullPath)(this.opts.uriResolver,D),S=(0,r.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&t===S)return f.call(this,D,e);let i=(0,r.normalizeId)(t),o=this.refs[i]||this.schemas[i];if("string"==typeof o){let n=d.call(this,e,o);if("object"!=typeof(null==n?void 0:n.schema))return;return f.call(this,D,n)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||a.call(this,o),i===(0,r.normalizeId)(n)){let{schema:n}=o,{schemaId:D}=this.opts,t=n[D];return t&&(S=(0,r.resolveUrl)(this.opts.uriResolver,S,t)),new s({schema:n,schemaId:D,root:e,baseId:S})}return f.call(this,D,o)}}n.SchemaEnv=s,n.compileSchema=a,n.resolveRef=function(e,n,D){var t;D=(0,r.resolveUrl)(this.opts.uriResolver,n,D);let S=e.refs[D];if(S)return S;let i=h.call(this,e,D);if(void 0===i){let S=null==(t=e.localRefs)?void 0:t[D],{schemaId:r}=this.opts;S&&(i=new s({schema:S,schemaId:r,root:e,baseId:n}))}if(void 0!==i)return e.refs[D]=l.call(this,i)},n.getCompilingSchema=c,n.resolveSchema=d;let p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(e,{baseId:n,schema:D,root:t}){var S;let i;if((null==(S=e.fragment)?void 0:S[0])!=="/")return;for(let t of e.fragment.slice(1).split("/")){if("boolean"==typeof D)return;let e=D[(0,o.unescapeFragment)(t)];if(void 0===e)return;let S="object"==typeof(D=e)&&D[this.opts.schemaId];!p.has(t)&&S&&(n=(0,r.resolveUrl)(this.opts.uriResolver,n,S))}if("boolean"!=typeof D&&D.$ref&&!(0,o.schemaHasRulesButRef)(D,this.RULES)){let e=(0,r.resolveUrl)(this.opts.uriResolver,n,D.$ref);i=d.call(this,t,e)}let{schemaId:g}=this.opts;if((i=i||new s({schema:D,schemaId:g,root:t,baseId:n})).schema!==i.root.schema)return i}},42023(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(99029);n.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}},34551(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(66939);class S extends Error{constructor(e,n,D,S){super(S||`can't resolve reference ${D} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,D),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}n.default=S},66939(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;let t=D(94227),S=D(32017),i=D(7106),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);n.inlineRef=function(e,n=!0){return"boolean"==typeof e||(!0===n?!g(e):!!n&&s(e)<=n)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function g(e){for(let n in e){if(o.has(n))return!0;let D=e[n];if(Array.isArray(D)&&D.some(g)||"object"==typeof D&&g(D))return!0}return!1}function s(e){let n=0;for(let D in e)if("$ref"===D||(n++,!r.has(D)&&("object"==typeof e[D]&&(0,t.eachItem)(e[D],e=>n+=s(e)),n===1/0)))return 1/0;return n}function a(e,n="",D){!1!==D&&(n=u(n));let t=e.parse(n);return l(e,t)}function l(e,n){return e.serialize(n).split("#")[0]+"#"}n.getFullPath=a,n._getFullPath=l;let c=/#\/?$/;function u(e){return e?e.replace(c,""):""}n.normalizeId=u,n.resolveUrl=function(e,n,D){return D=u(D),e.resolve(n,D)};let h=/^[a-z_][-a-z0-9._]*$/i;n.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};let{schemaId:D,uriResolver:t}=this.opts,r=u(e[D]||n),o={"":r},g=a(t,r,!1),s={},l=new Set;return i(e,{allKeys:!0},(e,n,t,S)=>{if(void 0===S)return;let i=g+n,r=o[S];function a(n){let D=this.opts.uriResolver.resolve;if(n=u(r?D(r,n):n),l.has(n))throw d(n);l.add(n);let t=this.refs[n];return"string"==typeof t&&(t=this.refs[t]),"object"==typeof t?c(e,t.schema,n):n!==u(i)&&("#"===n[0]?(c(e,s[n],n),s[n]=e):this.refs[n]=i),n}function p(e){if("string"==typeof e){if(!h.test(e))throw Error(`invalid anchor "${e}"`);a.call(this,`#${e}`)}}"string"==typeof e[D]&&(r=a.call(this,e[D])),p.call(this,e.$anchor),p.call(this,e.$dynamicAnchor),o[n]=r}),s;function c(e,n,D){if(void 0!==n&&!S(e,n))throw d(D)}function d(e){return Error(`reference "${e}" resolves to more than one schema`)}}},10396(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getRules=n.isJSONType=void 0;let D=new Set(["string","number","integer","boolean","null","object","array"]);n.isJSONType=function(e){return"string"==typeof e&&D.has(e)},n.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},94227(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.checkStrictMode=n.getErrorPath=n.Type=n.useFunc=n.setEvaluated=n.evaluatedPropsToName=n.mergeEvaluated=n.eachItem=n.unescapeJsonPointer=n.escapeJsonPointer=n.escapeFragment=n.unescapeFragment=n.schemaRefOrVal=n.schemaHasRulesButRef=n.schemaHasRules=n.checkUnknownRules=n.alwaysValidSchema=n.toHash=void 0;let S=D(99029),i=D(41520);function r(e,n=e.schema){let{opts:D,self:t}=e;if(!D.strictSchema||"boolean"==typeof n)return;let S=t.RULES.keywords;for(let D in n)S[D]||h(e,`unknown keyword: "${D}"`)}function o(e,n){if("boolean"==typeof e)return!e;for(let D in e)if(n[D])return!0;return!1}function g(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:e,mergeToName:n,mergeValues:D,resultToName:t}){return(i,r,o,g)=>{let s=void 0===o?r:o instanceof S.Name?(r instanceof S.Name?e(i,r,o):n(i,r,o),o):r instanceof S.Name?(n(i,o,r),r):D(r,o);return g!==S.Name||s instanceof S.Name?s:t(i,s)}}function l(e,n){if(!0===n)return e.var("props",!0);let D=e.var("props",(0,S._)`{}`);return void 0!==n&&c(e,D,n),D}function c(e,n,D){Object.keys(D).forEach(D=>e.assign((0,S._)`${n}${(0,S.getProperty)(D)}`,!0))}n.toHash=function(e){let n={};for(let D of e)n[D]=!0;return n},n.alwaysValidSchema=function(e,n){return"boolean"==typeof n?n:0===Object.keys(n).length||(r(e,n),!o(n,e.self.RULES.all))},n.checkUnknownRules=r,n.schemaHasRules=o,n.schemaHasRulesButRef=function(e,n){if("boolean"==typeof e)return!e;for(let D in e)if("$ref"!==D&&n.all[D])return!0;return!1},n.schemaRefOrVal=function({topSchemaRef:e,schemaPath:n},D,t,i){if(!i){if("number"==typeof D||"boolean"==typeof D)return D;if("string"==typeof D)return(0,S._)`${D}`}return(0,S._)`${e}${n}${(0,S.getProperty)(t)}`},n.unescapeFragment=function(e){return s(decodeURIComponent(e))},n.escapeFragment=function(e){return encodeURIComponent(g(e))},n.escapeJsonPointer=g,n.unescapeJsonPointer=s,n.eachItem=function(e,n){if(Array.isArray(e))for(let D of e)n(D);else n(e)},n.mergeEvaluated={props:a({mergeNames:(e,n,D)=>e.if((0,S._)`${D} !== true && ${n} !== undefined`,()=>{e.if((0,S._)`${n} === true`,()=>e.assign(D,!0),()=>e.assign(D,(0,S._)`${D} || {}`).code((0,S._)`Object.assign(${D}, ${n})`))}),mergeToName:(e,n,D)=>e.if((0,S._)`${D} !== true`,()=>{!0===n?e.assign(D,!0):(e.assign(D,(0,S._)`${D} || {}`),c(e,D,n))}),mergeValues:(e,n)=>!0===e||{...e,...n},resultToName:l}),items:a({mergeNames:(e,n,D)=>e.if((0,S._)`${D} !== true && ${n} !== undefined`,()=>e.assign(D,(0,S._)`${n} === true ? true : ${D} > ${n} ? ${D} : ${n}`)),mergeToName:(e,n,D)=>e.if((0,S._)`${D} !== true`,()=>e.assign(D,!0===n||(0,S._)`${D} > ${n} ? ${D} : ${n}`)),mergeValues:(e,n)=>!0===e||Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})},n.evaluatedPropsToName=l,n.setEvaluated=c;let u={};function h(e,n,D=e.opts.strictSchema){if(D){if(n=`strict mode: ${n}`,!0===D)throw Error(n);e.self.logger.warn(n)}}n.useFunc=function(e,n){return e.scopeValue("func",{ref:n,code:u[n.code]||(u[n.code]=new i._Code(n.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(t||(n.Type=t={})),n.getErrorPath=function(e,n,D){if(e instanceof S.Name){let i=n===t.Num;return D?i?(0,S._)`"[" + ${e} + "]"`:(0,S._)`"['" + ${e} + "']"`:i?(0,S._)`"/" + ${e}`:(0,S._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,S.getProperty)(e).toString():"/"+g(e)},n.checkStrictMode=h},7887(e,n){"use strict";function D(e,n){return n.rules.some(n=>t(e,n))}function t(e,n){var D;return void 0!==e[n.keyword]||(null==(D=n.definition.implements)?void 0:D.some(n=>void 0!==e[n]))}Object.defineProperty(n,"__esModule",{value:!0}),n.shouldUseRule=n.shouldUseGroup=n.schemaHasRulesForType=void 0,n.schemaHasRulesForType=function({schema:e,self:n},t){let S=n.RULES.types[t];return S&&!0!==S&&D(e,S)},n.shouldUseGroup=D,n.shouldUseRule=t},28727(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;let t=D(48708),S=D(99029),i=D(42023),r={message:"boolean schema is false"};function o(e,n){let{gen:D,data:S}=e,i={gen:D,keyword:"false schema",data:S,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(i,r,void 0,n)}n.topBoolOrEmptySchema=function(e){let{gen:n,schema:D,validateName:t}=e;!1===D?o(e,!1):"object"==typeof D&&!0===D.$async?n.return(i.default.data):(n.assign((0,S._)`${t}.errors`,null),n.return(!0))},n.boolOrEmptySchema=function(e,n){let{gen:D,schema:t}=e;!1===t?(D.var(n,!1),o(e)):D.var(n,!0)}},10208(e,n,D){"use strict";var t;Object.defineProperty(n,"__esModule",{value:!0}),n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;let S=D(10396),i=D(7887),r=D(48708),o=D(99029),g=D(94227);function s(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(S.isJSONType))return n;throw Error("type must be JSONType or JSONType[]: "+n.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(t||(n.DataType=t={})),n.getSchemaTypes=function(e){let n=s(e.type);if(n.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!n.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&n.push("null")}return n},n.getJSONTypes=s,n.coerceAndCheckDataType=function(e,n){let{gen:D,data:S,opts:r}=e,o=l(n,r.coerceTypes),g=n.length>0&&!(0===o.length&&1===n.length&&(0,i.schemaHasRulesForType)(e,n[0]));if(g){let i=d(n,S,r.strictNumbers,t.Wrong);D.if(i,()=>{o.length?c(e,n,o):f(e)})}return g};let a=new Set(["string","number","integer","boolean","null"]);function l(e,n){return n?e.filter(e=>a.has(e)||"array"===n&&"array"===e):[]}function c(e,n,D){let{gen:t,data:S,opts:i}=e,r=t.let("dataType",(0,o._)`typeof ${S}`),g=t.let("coerced",(0,o._)`undefined`);for(let e of("array"===i.coerceTypes&&t.if((0,o._)`${r} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>t.assign(S,(0,o._)`${S}[0]`).assign(r,(0,o._)`typeof ${S}`).if(d(n,S,i.strictNumbers),()=>t.assign(g,S))),t.if((0,o._)`${g} !== undefined`),D))(a.has(e)||"array"===e&&"array"===i.coerceTypes)&&s(e);function s(e){switch(e){case"string":t.elseIf((0,o._)`${r} == "number" || ${r} == "boolean"`).assign(g,(0,o._)`"" + ${S}`).elseIf((0,o._)`${S} === null`).assign(g,(0,o._)`""`);return;case"number":t.elseIf((0,o._)`${r} == "boolean" || ${S} === null
|
|
6
6
|
|| (${r} == "string" && ${S} && ${S} == +${S})`).assign(g,(0,o._)`+${S}`);return;case"integer":t.elseIf((0,o._)`${r} === "boolean" || ${S} === null
|
|
7
7
|
|| (${r} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(g,(0,o._)`+${S}`);return;case"boolean":t.elseIf((0,o._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(g,!1).elseIf((0,o._)`${S} === "true" || ${S} === 1`).assign(g,!0);return;case"null":t.elseIf((0,o._)`${S} === "" || ${S} === 0 || ${S} === false`),t.assign(g,null);return;case"array":t.elseIf((0,o._)`${r} === "string" || ${r} === "number"
|
|
8
8
|
|| ${r} === "boolean" || ${S} === null`).assign(g,(0,o._)`[${S}]`)}}t.else(),f(e),t.endIf(),t.if((0,o._)`${g} !== undefined`,()=>{t.assign(S,g),u(e,g)})}function u({gen:e,parentData:n,parentDataProperty:D},t){e.if((0,o._)`${n} !== undefined`,()=>e.assign((0,o._)`${n}[${D}]`,t))}function h(e,n,D,S=t.Correct){let i,r=S===t.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${n} ${r} null`;case"array":i=(0,o._)`Array.isArray(${n})`;break;case"object":i=(0,o._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`;break;case"integer":i=g((0,o._)`!(${n} % 1) && !isNaN(${n})`);break;case"number":i=g();break;default:return(0,o._)`typeof ${n} ${r} ${e}`}return S===t.Correct?i:(0,o.not)(i);function g(e=o.nil){return(0,o.and)((0,o._)`typeof ${n} == "number"`,e,D?(0,o._)`isFinite(${n})`:o.nil)}}function d(e,n,D,t){let S;if(1===e.length)return h(e[0],n,D,t);let i=(0,g.toHash)(e);if(i.array&&i.object){let e=(0,o._)`typeof ${n} != "object"`;S=i.null?e:(0,o._)`!${n} || ${e}`,delete i.null,delete i.array,delete i.object}else S=o.nil;for(let e in i.number&&delete i.integer,i)S=(0,o.and)(S,h(e,n,D,t));return S}n.checkDataType=h,n.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:n})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${n}}`};function f(e){let n=m(e);(0,r.reportError)(n,p)}function m(e){let{gen:n,data:D,schema:t}=e,S=(0,g.schemaRefOrVal)(e,t,"type");return{gen:n,keyword:"type",data:D,schema:t.type,schemaCode:S,schemaValue:S,parentSchema:t,params:{},it:e}}n.reportTypeError=f},7870(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.assignDefaults=void 0;let t=D(99029),S=D(94227);function i(e,n,D){let{gen:i,compositeRule:r,data:o,opts:g}=e;if(void 0===D)return;let s=(0,t._)`${o}${(0,t.getProperty)(n)}`;if(r)return void(0,S.checkStrictMode)(e,`default is ignored for: ${s}`);let a=(0,t._)`${s} === undefined`;"empty"===g.useDefaults&&(a=(0,t._)`${a} || ${s} === null || ${s} === ""`),i.if(a,(0,t._)`${s} = ${(0,t.stringify)(D)}`)}n.assignDefaults=function(e,n){let{properties:D,items:t}=e.schema;if("object"===n&&D)for(let n in D)i(e,n,D[n].default);else"array"===n&&Array.isArray(t)&&t.forEach((n,D)=>i(e,D,n.default))}},62586(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getData=n.KeywordCxt=n.validateFunctionCode=void 0;let t=D(28727),S=D(10208),i=D(7887),r=D(10208),o=D(7870),g=D(33673),s=D(24495),a=D(99029),l=D(42023),c=D(66939),u=D(94227),h=D(48708);function d({gen:e,validateName:n,schema:D,schemaEnv:t,opts:S},i){S.code.es5?e.func(n,(0,a._)`${l.default.data}, ${l.default.valCxt}`,t.$async,()=>{e.code((0,a._)`"use strict"; ${v(D,S)}`),f(e,S),e.code(i)}):e.func(n,(0,a._)`${l.default.data}, ${p(S)}`,t.$async,()=>e.code(v(D,S)).code(i))}function p(e){return(0,a._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,a._)`, ${l.default.dynamicAnchors}={}`:a.nil}}={}`}function f(e,n){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,a._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,a._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,a._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,a._)`${l.default.valCxt}.${l.default.rootData}`),n.dynamicRef&&e.var(l.default.dynamicAnchors,(0,a._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,a._)`""`),e.var(l.default.parentData,(0,a._)`undefined`),e.var(l.default.parentDataProperty,(0,a._)`undefined`),e.var(l.default.rootData,l.default.data),n.dynamicRef&&e.var(l.default.dynamicAnchors,(0,a._)`{}`)})}function m(e){let{schema:n,opts:D,gen:t}=e;d(e,()=>{D.$comment&&n.$comment&&A(e),C(e),t.let(l.default.vErrors,null),t.let(l.default.errors,0),D.unevaluated&&y(e),_(e),T(e)})}function y(e){let{gen:n,validateName:D}=e;e.evaluated=n.const("evaluated",(0,a._)`${D}.evaluated`),n.if((0,a._)`${e.evaluated}.dynamicProps`,()=>n.assign((0,a._)`${e.evaluated}.props`,(0,a._)`undefined`)),n.if((0,a._)`${e.evaluated}.dynamicItems`,()=>n.assign((0,a._)`${e.evaluated}.items`,(0,a._)`undefined`))}function v(e,n){let D="object"==typeof e&&e[n.schemaId];return D&&(n.code.source||n.code.process)?(0,a._)`/*# sourceURL=${D} */`:a.nil}function b(e,n){M(e)&&($(e),w(e))?L(e,n):(0,t.boolOrEmptySchema)(e,n)}function w({schema:e,self:n}){if("boolean"==typeof e)return!e;for(let D in e)if(n.RULES.all[D])return!0;return!1}function M(e){return"boolean"!=typeof e.schema}function L(e,n){let{schema:D,gen:t,opts:S}=e;S.$comment&&D.$comment&&A(e),E(e),k(e);let i=t.const("_errs",l.default.errors);_(e,i),t.var(n,(0,a._)`${i} === ${l.default.errors}`)}function $(e){(0,u.checkUnknownRules)(e),x(e)}function _(e,n){if(e.opts.jtd)return R(e,[],!1,n);let D=(0,S.getSchemaTypes)(e.schema),t=(0,S.coerceAndCheckDataType)(e,D);R(e,D,!t,n)}function x(e){let{schema:n,errSchemaPath:D,opts:t,self:S}=e;n.$ref&&t.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(n,S.RULES)&&S.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function C(e){let{schema:n,opts:D}=e;void 0!==n.default&&D.useDefaults&&D.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}function E(e){let n=e.schema[e.opts.schemaId];n&&(e.baseId=(0,c.resolveUrl)(e.opts.uriResolver,e.baseId,n))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function A({gen:e,schemaEnv:n,schema:D,errSchemaPath:t,opts:S}){let i=D.$comment;if(!0===S.$comment)e.code((0,a._)`${l.default.self}.logger.log(${i})`);else if("function"==typeof S.$comment){let D=(0,a.str)`${t}/$comment`,S=e.scopeValue("root",{ref:n.root});e.code((0,a._)`${l.default.self}.opts.$comment(${i}, ${D}, ${S}.schema)`)}}function T(e){let{gen:n,schemaEnv:D,validateName:t,ValidationError:S,opts:i}=e;D.$async?n.if((0,a._)`${l.default.errors} === 0`,()=>n.return(l.default.data),()=>n.throw((0,a._)`new ${S}(${l.default.vErrors})`)):(n.assign((0,a._)`${t}.errors`,l.default.vErrors),i.unevaluated&&O(e),n.return((0,a._)`${l.default.errors} === 0`))}function O({gen:e,evaluated:n,props:D,items:t}){D instanceof a.Name&&e.assign((0,a._)`${n}.props`,D),t instanceof a.Name&&e.assign((0,a._)`${n}.items`,t)}function R(e,n,D,t){let{gen:S,schema:o,data:g,allErrors:s,opts:c,self:h}=e,{RULES:d}=h;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(o,d)))return void S.block(()=>B(e,"$ref",d.all.$ref.definition));function p(u){(0,i.shouldUseGroup)(o,u)&&(u.type?(S.if((0,r.checkDataType)(u.type,g,c.strictNumbers)),I(e,u),1===n.length&&n[0]===u.type&&D&&(S.else(),(0,r.reportTypeError)(e)),S.endIf()):I(e,u),s||S.if((0,a._)`${l.default.errors} === ${t||0}`))}c.jtd||j(e,n),S.block(()=>{for(let e of d.rules)p(e);p(d.post)})}function I(e,n){let{gen:D,schema:t,opts:{useDefaults:S}}=e;S&&(0,o.assignDefaults)(e,n.type),D.block(()=>{for(let D of n.rules)(0,i.shouldUseRule)(t,D)&&B(e,D.keyword,D.definition,n.type)})}function j(e,n){!e.schemaEnv.meta&&e.opts.strictTypes&&(N(e,n),e.opts.allowUnionTypes||P(e,n),F(e,e.dataTypes))}function N(e,n){if(n.length){if(!e.dataTypes.length){e.dataTypes=n;return}n.forEach(n=>{V(e.dataTypes,n)||z(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),H(e,n)}}function P(e,n){n.length>1&&!(2===n.length&&n.includes("null"))&&z(e,"use allowUnionTypes to allow union type keyword")}function F(e,n){let D=e.self.RULES.all;for(let t in D){let S=D[t];if("object"==typeof S&&(0,i.shouldUseRule)(e.schema,S)){let{type:D}=S.definition;D.length&&!D.some(e=>U(n,e))&&z(e,`missing type "${D.join(",")}" for keyword "${t}"`)}}}function U(e,n){return e.includes(n)||"number"===n&&e.includes("integer")}function V(e,n){return e.includes(n)||"integer"===n&&e.includes("number")}function H(e,n){let D=[];for(let t of e.dataTypes)V(n,t)?D.push(t):n.includes("integer")&&"number"===t&&D.push("integer");e.dataTypes=D}function z(e,n){let D=e.schemaEnv.baseId+e.errSchemaPath;n+=` at "${D}" (strictTypes)`,(0,u.checkStrictMode)(e,n,e.opts.strictTypes)}n.validateFunctionCode=function(e){M(e)&&($(e),w(e))?m(e):d(e,()=>(0,t.topBoolOrEmptySchema)(e))};class W{constructor(e,n,D){if((0,g.validateKeywordUsage)(e,n,D),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=D,this.data=e.data,this.schema=e.schema[D],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(e,this.schema,D,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",K(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,g.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw Error(`${D} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:!1!==n.errors)&&(this.errsCount=e.gen.const("_errs",l.default.errors))}result(e,n,D){this.failResult((0,a.not)(e),n,D)}failResult(e,n,D){this.gen.if(e),D?D():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,a.not)(e),void 0,n)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:n}=this;this.fail((0,a._)`${n} !== undefined && (${(0,a.or)(this.invalid$data(),e)})`)}error(e,n,D){if(n){this.setParams(n),this._error(e,D),this.setParams({});return}this._error(e,D)}_error(e,n){(e?h.reportExtraError:h.reportError)(this,this.def.error,n)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,D=a.nil){this.gen.block(()=>{this.check$data(e,D),n()})}check$data(e=a.nil,n=a.nil){if(!this.$data)return;let{gen:D,schemaCode:t,schemaType:S,def:i}=this;D.if((0,a.or)((0,a._)`${t} === undefined`,n)),e!==a.nil&&D.assign(e,!0),(S.length||i.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),e!==a.nil&&D.assign(e,!1)),D.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:D,def:t,it:S}=this;return(0,a.or)(i(),o());function i(){if(D.length){if(!(n instanceof a.Name))throw Error("ajv implementation error");let e=Array.isArray(D)?D:[D];return(0,a._)`${(0,r.checkDataTypes)(e,n,S.opts.strictNumbers,r.DataType.Wrong)}`}return a.nil}function o(){if(t.validateSchema){let D=e.scopeValue("validate$data",{ref:t.validateSchema});return(0,a._)`!${D}(${n})`}return a.nil}}subschema(e,n){let D=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(D,this.it,e),(0,s.extendSubschemaMode)(D,e);let t={...this.it,...D,items:void 0,props:void 0};return b(t,n),t}mergeEvaluated(e,n){let{it:D,gen:t}=this;D.opts.unevaluated&&(!0!==D.props&&void 0!==e.props&&(D.props=u.mergeEvaluated.props(t,e.props,D.props,n)),!0!==D.items&&void 0!==e.items&&(D.items=u.mergeEvaluated.items(t,e.items,D.items,n)))}mergeValidEvaluated(e,n){let{it:D,gen:t}=this;if(D.opts.unevaluated&&(!0!==D.props||!0!==D.items))return t.if(n,()=>this.mergeEvaluated(e,a.Name)),!0}}function B(e,n,D,t){let S=new W(e,D,n);"code"in D?D.code(S,t):S.$data&&D.validate?(0,g.funcKeywordCode)(S,D):"macro"in D?(0,g.macroKeywordCode)(S,D):(D.compile||D.validate)&&(0,g.funcKeywordCode)(S,D)}n.KeywordCxt=W;let q=/^\/(?:[^~]|~0|~1)*$/,G=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function K(e,{dataLevel:n,dataNames:D,dataPathArr:t}){let S,i;if(""===e)return l.default.rootData;if("/"===e[0]){if(!q.test(e))throw Error(`Invalid JSON-pointer: ${e}`);S=e,i=l.default.rootData}else{let r=G.exec(e);if(!r)throw Error(`Invalid JSON-pointer: ${e}`);let g=+r[1];if("#"===(S=r[2])){if(g>=n)throw Error(o("property/index",g));return t[n-g]}if(g>n)throw Error(o("data",g));if(i=D[n-g],!S)return i}let r=i;for(let e of S.split("/"))e&&(i=(0,a._)`${i}${(0,a.getProperty)((0,u.unescapeJsonPointer)(e))}`,r=(0,a._)`${r} && ${i}`);return r;function o(e,D){return`Cannot access ${e} ${D} levels up, current level is ${n}`}}n.getData=K},33673(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateKeywordUsage=n.validSchemaType=n.funcKeywordCode=n.macroKeywordCode=void 0;let t=D(99029),S=D(42023),i=D(15765),r=D(48708);function o(e){let{gen:n,data:D,it:S}=e;n.if(S.parentData,()=>n.assign(D,(0,t._)`${S.parentData}[${S.parentDataProperty}]`))}function g(e,n){let{gen:D}=e;D.if((0,t._)`Array.isArray(${n})`,()=>{D.assign(S.default.vErrors,(0,t._)`${S.default.vErrors} === null ? ${n} : ${S.default.vErrors}.concat(${n})`).assign(S.default.errors,(0,t._)`${S.default.vErrors}.length`),(0,r.extendErrors)(e)},()=>e.error())}function s({schemaEnv:e},n){if(n.async&&!e.$async)throw Error("async keyword in sync schema")}function a(e,n,D){if(void 0===D)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue("keyword","function"==typeof D?{ref:D}:{ref:D,code:(0,t.stringify)(D)})}n.macroKeywordCode=function(e,n){let{gen:D,keyword:S,schema:i,parentSchema:r,it:o}=e,g=n.macro.call(o.self,i,r,o),s=a(D,S,g);!1!==o.opts.validateSchema&&o.self.validateSchema(g,!0);let l=D.name("valid");e.subschema({schema:g,schemaPath:t.nil,errSchemaPath:`${o.errSchemaPath}/${S}`,topSchemaRef:s,compositeRule:!0},l),e.pass(l,()=>e.error(!0))},n.funcKeywordCode=function(e,n){var D;let{gen:r,keyword:l,schema:c,parentSchema:u,$data:h,it:d}=e;s(d,n);let p=a(r,l,!h&&n.compile?n.compile.call(d.self,c,u,d):n.validate),f=r.let("valid");function m(){if(!1===n.errors)b(),n.modifying&&o(e),w(()=>e.error());else{let D=n.async?y():v();n.modifying&&o(e),w(()=>g(e,D))}}function y(){let e=r.let("ruleErrs",null);return r.try(()=>b((0,t._)`await `),n=>r.assign(f,!1).if((0,t._)`${n} instanceof ${d.ValidationError}`,()=>r.assign(e,(0,t._)`${n}.errors`),()=>r.throw(n))),e}function v(){let e=(0,t._)`${p}.errors`;return r.assign(e,null),b(t.nil),e}function b(D=n.async?(0,t._)`await `:t.nil){let o=d.opts.passContext?S.default.this:S.default.self,g=!("compile"in n&&!h||!1===n.schema);r.assign(f,(0,t._)`${D}${(0,i.callValidateCode)(e,p,o,g)}`,n.modifying)}function w(e){var D;r.if((0,t.not)(null!=(D=n.valid)?D:f),e)}e.block$data(f,m),e.ok(null!=(D=n.valid)?D:f)},n.validSchemaType=function(e,n,D=!1){return!n.length||n.some(n=>"array"===n?Array.isArray(e):"object"===n?e&&"object"==typeof e&&!Array.isArray(e):typeof e==n||D&&void 0===e)},n.validateKeywordUsage=function({schema:e,opts:n,self:D,errSchemaPath:t},S,i){if(Array.isArray(S.keyword)?!S.keyword.includes(i):S.keyword!==i)throw Error("ajv implementation error");let r=S.dependencies;if(null==r?void 0:r.some(n=>!Object.prototype.hasOwnProperty.call(e,n)))throw Error(`parent schema must have dependencies of ${i}: ${r.join(",")}`);if(S.validateSchema&&!S.validateSchema(e[i])){let e=`keyword "${i}" value is invalid at path "${t}": `+D.errorsText(S.validateSchema.errors);if("log"===n.validateSchema)D.logger.error(e);else throw Error(e)}}},24495(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendSubschemaMode=n.extendSubschemaData=n.getSubschema=void 0;let t=D(99029),S=D(94227);n.getSubschema=function(e,{keyword:n,schemaProp:D,schema:i,schemaPath:r,errSchemaPath:o,topSchemaRef:g}){if(void 0!==n&&void 0!==i)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){let i=e.schema[n];return void 0===D?{schema:i,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${n}`}:{schema:i[D],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(n)}${(0,t.getProperty)(D)}`,errSchemaPath:`${e.errSchemaPath}/${n}/${(0,S.escapeFragment)(D)}`}}if(void 0!==i){if(void 0===r||void 0===o||void 0===g)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:r,topSchemaRef:g,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},n.extendSubschemaData=function(e,n,{dataProp:D,dataPropType:i,data:r,dataTypes:o,propertyName:g}){if(void 0!==r&&void 0!==D)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=n;if(void 0!==D){let{errorPath:r,dataPathArr:o,opts:g}=n;a(s.let("data",(0,t._)`${n.data}${(0,t.getProperty)(D)}`,!0)),e.errorPath=(0,t.str)`${r}${(0,S.getErrorPath)(D,i,g.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${D}`,e.dataPathArr=[...o,e.parentDataProperty]}function a(D){e.data=D,e.dataLevel=n.dataLevel+1,e.dataTypes=[],n.definedProperties=new Set,e.parentData=n.data,e.dataNames=[...n.dataNames,D]}void 0!==r&&(a(r instanceof t.Name?r:s.let("data",r,!0)),void 0!==g&&(e.propertyName=g)),o&&(e.dataTypes=o)},n.extendSubschemaMode=function(e,{jtdDiscriminator:n,jtdMetadata:D,compositeRule:t,createErrors:S,allErrors:i}){void 0!==t&&(e.compositeRule=t),void 0!==S&&(e.createErrors=S),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=n,e.jtdMetadata=D}},4042(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=void 0;var t=D(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var S=D(99029);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return S._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return S.str}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return S.stringify}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return S.nil}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return S.Name}}),Object.defineProperty(n,"CodeGen",{enumerable:!0,get:function(){return S.CodeGen}});let i=D(13558),r=D(34551),o=D(10396),g=D(73835),s=D(99029),a=D(66939),l=D(10208),c=D(94227),u=D(63837),h=D(55944),d=(e,n)=>new RegExp(e,n);d.code="new RegExp";let p=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function b(e){var n,D,t,S,i,r,o,g,s,a,l,c,u,p,f,m,y,b,w,M,L,$,_,x,C;let E=e.strict,k=null==(n=e.code)?void 0:n.optimize,A=!0===k||void 0===k?1:k||0,T=null!=(t=null==(D=e.code)?void 0:D.regExp)?t:d,O=null!=(S=e.uriResolver)?S:h.default;return{strictSchema:null==(r=null!=(i=e.strictSchema)?i:E)||r,strictNumbers:null==(g=null!=(o=e.strictNumbers)?o:E)||g,strictTypes:null!=(a=null!=(s=e.strictTypes)?s:E)?a:"log",strictTuples:null!=(c=null!=(l=e.strictTuples)?l:E)?c:"log",strictRequired:null!=(p=null!=(u=e.strictRequired)?u:E)&&p,code:e.code?{...e.code,optimize:A,regExp:T}:{optimize:A,regExp:T},loopRequired:null!=(f=e.loopRequired)?f:v,loopEnum:null!=(m=e.loopEnum)?m:v,meta:null==(y=e.meta)||y,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=(M=e.schemaId)?M:"$id",addUsedSchema:null==(L=e.addUsedSchema)||L,validateSchema:null==($=e.validateSchema)||$,validateFormats:null==(_=e.validateFormats)||_,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(C=e.int32range)||C,uriResolver:O}}class w{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};const{es5:n,lines:D}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:f,es5:n,lines:D}),this.logger=k(e.logger);const t=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),M.call(this,m,e,"NOT SUPPORTED"),M.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=C.call(this),e.formats&&_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),$.call(this),e.validateFormats=t}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:D}=this.opts,t=u;"id"===D&&((t={...u}).id=t.$id,delete t.$id),n&&e&&this.addMetaSchema(t,t[D],!1)}defaultMeta(){let{meta:e,schemaId:n}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[n]||e:void 0}validate(e,n){let D;if("string"==typeof e){if(!(D=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else D=this.compile(e);let t=D(n);return"$async"in D||(this.errors=D.errors),t}compile(e,n){let D=this._addSchema(e,n);return D.validate||this._compileSchemaEnv(D)}compileAsync(e,n){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:D}=this.opts;return t.call(this,e,n);async function t(e,n){await S.call(this,e.$schema);let D=this._addSchema(e,n);return D.validate||i.call(this,D)}async function S(e){e&&!this.getSchema(e)&&await t.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(n){if(!(n instanceof r.default))throw n;return o.call(this,n),await g.call(this,n.missingSchema),i.call(this,e)}}function o({missingSchema:e,missingRef:n}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${n} cannot be resolved`)}async function g(e){let D=await s.call(this,e);this.refs[e]||await S.call(this,D.$schema),this.refs[e]||this.addSchema(D,e,n)}async function s(e){let n=this._loading[e];if(n)return n;try{return await (this._loading[e]=D(e))}finally{delete this._loading[e]}}}addSchema(e,n,D,t=this.opts.validateSchema){let S;if(Array.isArray(e)){for(let n of e)this.addSchema(n,void 0,D,t);return this}if("object"==typeof e){let{schemaId:n}=this.opts;if(void 0!==(S=e[n])&&"string"!=typeof S)throw Error(`schema ${n} must be string`)}return n=(0,a.normalizeId)(n||S),this._checkUnique(n),this.schemas[n]=this._addSchema(e,D,n,t,!0),this}addMetaSchema(e,n,D=this.opts.validateSchema){return this.addSchema(e,n,!0,D),this}validateSchema(e,n){let D;if("boolean"==typeof e)return!0;if(void 0!==(D=e.$schema)&&"string"!=typeof D)throw Error("$schema must be a string");if(!(D=D||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let t=this.validate(D,e);if(!t&&n){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return t}getSchema(e){let n;for(;"string"==typeof(n=L.call(this,e));)e=n;if(void 0===n){let{schemaId:D}=this.opts,t=new g.SchemaEnv({schema:{},schemaId:D});if(!(n=g.resolveSchema.call(this,t,e)))return;this.refs[e]=n}return n.validate||this._compileSchemaEnv(n)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let n=L.call(this,e);return"object"==typeof n&&this._cache.delete(n.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let n=e;this._cache.delete(n);let D=e[this.opts.schemaId];return D&&(D=(0,a.normalizeId)(D),delete this.schemas[D],delete this.refs[D]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let D;if("string"==typeof e)D=e,"object"==typeof n&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=D);else if("object"==typeof e&&void 0===n){if(Array.isArray(D=(n=e).keyword)&&!D.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(T.call(this,D,n),!n)return(0,c.eachItem)(D,e=>O.call(this,e)),this;I.call(this,n);let t={...n,type:(0,l.getJSONTypes)(n.type),schemaType:(0,l.getJSONTypes)(n.schemaType)};return(0,c.eachItem)(D,0===t.type.length?e=>O.call(this,e,t):e=>t.type.forEach(n=>O.call(this,e,t,n))),this}getKeyword(e){let n=this.RULES.all[e];return"object"==typeof n?n.definition:!!n}removeKeyword(e){let{RULES:n}=this;for(let D of(delete n.keywords[e],delete n.all[e],n.rules)){let n=D.rules.findIndex(n=>n.keyword===e);n>=0&&D.rules.splice(n,1)}return this}addFormat(e,n){return"string"==typeof n&&(n=new RegExp(n)),this.formats[e]=n,this}errorsText(e=this.errors,{separator:n=", ",dataVar:D="data"}={}){return e&&0!==e.length?e.map(e=>`${D}${e.instancePath} ${e.message}`).reduce((e,D)=>e+n+D):"No errors"}$dataMetaSchema(e,n){let D=this.RULES.all;for(let t of(e=JSON.parse(JSON.stringify(e)),n)){let n=t.split("/").slice(1),S=e;for(let e of n)S=S[e];for(let e in D){let n=D[e];if("object"!=typeof n)continue;let{$data:t}=n.definition,i=S[e];t&&i&&(S[e]=N(i))}}return e}_removeAllSchemas(e,n){for(let D in e){let t=e[D];(!n||n.test(D))&&("string"==typeof t?delete e[D]:t&&!t.meta&&(this._cache.delete(t.schema),delete e[D]))}}_addSchema(e,n,D,t=this.opts.validateSchema,S=this.opts.addUsedSchema){let i,{schemaId:r}=this.opts;if("object"==typeof e)i=e[r];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;D=(0,a.normalizeId)(i||D);let s=a.getSchemaRefs.call(this,e,D);return o=new g.SchemaEnv({schema:e,schemaId:r,meta:n,baseId:D,localRefs:s}),this._cache.set(o.schema,o),S&&!D.startsWith("#")&&(D&&this._checkUnique(D),this.refs[D]=o),t&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):g.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let n=this.opts;this.opts=this._metaOpts;try{g.compileSchema.call(this,e)}finally{this.opts=n}}}function M(e,n,D,t="error"){for(let S in e){let i=S;i in n&&this.logger[t](`${D}: option ${S}. ${e[i]}`)}}function L(e){return e=(0,a.normalizeId)(e),this.schemas[e]||this.refs[e]}function $(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let n in e)this.addSchema(e[n],n)}function _(){for(let e in this.opts.formats){let n=this.opts.formats[e];n&&this.addFormat(e,n)}}function x(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let n in this.logger.warn("keywords option as map is deprecated, pass array"),e){let D=e[n];D.keyword||(D.keyword=n),this.addKeyword(D)}}function C(){let e={...this.opts};for(let n of p)delete e[n];return e}w.ValidationError=i.default,w.MissingRefError=r.default,n.default=w;let E={log(){},warn(){},error(){}};function k(e){if(!1===e)return E;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}let A=/^[a-z_$][a-z0-9_$:-]*$/i;function T(e,n){let{RULES:D}=this;if((0,c.eachItem)(e,e=>{if(D.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),n&&n.$data&&!("code"in n||"validate"in n))throw Error('$data keyword must have "code" or "validate" function')}function O(e,n,D){var t;let S=null==n?void 0:n.post;if(D&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,r=S?i.post:i.rules.find(({type:e})=>e===D);if(r||(r={type:D,rules:[]},i.rules.push(r)),i.keywords[e]=!0,!n)return;let o={keyword:e,definition:{...n,type:(0,l.getJSONTypes)(n.type),schemaType:(0,l.getJSONTypes)(n.schemaType)}};n.before?R.call(this,r,o,n.before):r.rules.push(o),i.all[e]=o,null==(t=n.implements)||t.forEach(e=>this.addKeyword(e))}function R(e,n,D){let t=e.rules.findIndex(e=>e.keyword===D);t>=0?e.rules.splice(t,0,n):(e.rules.push(n),this.logger.warn(`rule ${D} is not defined`))}function I(e){let{metaSchema:n}=e;void 0!==n&&(e.$data&&this.opts.$data&&(n=N(n)),e.validateSchema=this.compile(n,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(e){return{anyOf:[e,j]}}},76250(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(32017);t.code='require("ajv/dist/runtime/equal").default',n.default=t},53853(e,n){"use strict";function D(e){let n,D=e.length,t=0,S=0;for(;S<D;)t++,(n=e.charCodeAt(S++))>=55296&&n<=56319&&S<D&&(64512&(n=e.charCodeAt(S)))==56320&&S++;return t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=D,D.code='require("ajv/dist/runtime/ucs2length").default'},55944(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(48343);t.code='require("ajv/dist/runtime/uri").default',n.default=t},13558(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});class D extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}n.default=D},15457(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateAdditionalItems=void 0;let t=D(99029),S=D(94227),i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:n,it:D}=e,{items:t}=n;Array.isArray(t)?r(e,t):(0,S.checkStrictMode)(D,'"additionalItems" is ignored when "items" is not an array of schemas')}};function r(e,n){let{gen:D,schema:i,data:r,keyword:o,it:g}=e;g.items=!0;let s=D.const("len",(0,t._)`${r}.length`);if(!1===i)e.setParams({len:n.length}),e.pass((0,t._)`${s} <= ${n.length}`);else if("object"==typeof i&&!(0,S.alwaysValidSchema)(g,i)){let S=D.var("valid",(0,t._)`${s} <= ${n.length}`);D.if((0,t.not)(S),()=>a(S)),e.ok(S)}function a(i){D.forRange("i",n.length,s,n=>{e.subschema({keyword:o,dataProp:n,dataPropType:S.Type.Num},i),g.allErrors||D.if((0,t.not)(i),()=>D.break())})}}n.validateAdditionalItems=r,n.default=i},38660(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(15765),S=D(99029),i=D(42023),r=D(94227);n.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,S._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:n,schema:D,parentSchema:o,data:g,errsCount:s,it:a}=e;if(!s)throw Error("ajv implementation error");let{allErrors:l,opts:c}=a;if(a.props=!0,"all"!==c.removeAdditional&&(0,r.alwaysValidSchema)(a,D))return;let u=(0,t.allSchemaProperties)(o.properties),h=(0,t.allSchemaProperties)(o.patternProperties);function d(D){let i;if(u.length>8){let e=(0,r.schemaRefOrVal)(a,o.properties,"properties");i=(0,t.isOwnProperty)(n,e,D)}else i=u.length?(0,S.or)(...u.map(e=>(0,S._)`${D} === ${e}`)):S.nil;return h.length&&(i=(0,S.or)(i,...h.map(n=>(0,S._)`${(0,t.usePattern)(e,n)}.test(${D})`))),(0,S.not)(i)}function p(e){n.code((0,S._)`delete ${g}[${e}]`)}function f(t){if("all"===c.removeAdditional||c.removeAdditional&&!1===D)return void p(t);if(!1===D){e.setParams({additionalProperty:t}),e.error(),l||n.break();return}if("object"==typeof D&&!(0,r.alwaysValidSchema)(a,D)){let D=n.name("valid");"failing"===c.removeAdditional?(m(t,D,!1),n.if((0,S.not)(D),()=>{e.reset(),p(t)})):(m(t,D),l||n.if((0,S.not)(D),()=>n.break()))}}function m(n,D,t){let S={keyword:"additionalProperties",dataProp:n,dataPropType:r.Type.Str};!1===t&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,D)}(function e(){n.forIn("key",g,e=>{u.length||h.length?n.if(d(e),()=>f(e)):f(e)})})(),e.ok((0,S._)`${s} === ${i.default.errors}`)}}},15844(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(94227);n.default={keyword:"allOf",schemaType:"array",code(e){let{gen:n,schema:D,it:S}=e;if(!Array.isArray(D))throw Error("ajv implementation error");let i=n.name("valid");D.forEach((n,D)=>{if((0,t.alwaysValidSchema)(S,n))return;let r=e.subschema({keyword:"allOf",schemaProp:D},i);e.ok(i),e.mergeEvaluated(r)})}}},16505(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:D(15765).validateUnion,error:{message:"must match a schema in anyOf"}}},12661(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let t=D(99029),S=D(94227);n.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:n}})=>void 0===n?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>void 0===n?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let n,D,{gen:i,schema:r,parentSchema:o,data:g,it:s}=e,{minContains:a,maxContains:l}=o;s.opts.next?(n=void 0===a?1:a,D=l):n=1;let c=i.const("len",(0,t._)`${g}.length`);if(e.setParams({min:n,max:D}),void 0===D&&0===n)return void(0,S.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==D&&n>D){(0,S.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,S.alwaysValidSchema)(s,r)){let S=(0,t._)`${c} >= ${n}`;void 0!==D&&(S=(0,t._)`${S} && ${c} <= ${D}`),e.pass(S);return}s.items=!0;let u=i.name("valid");function h(){let e=i.name("_valid"),n=i.let("count",0);d(e,()=>i.if(e,()=>p(n)))}function d(n,D){i.forRange("i",0,c,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:S.Type.Num,compositeRule:!0},n),D()})}function p(e){i.code((0,t._)`${e}++`),void 0===D?i.if((0,t._)`${e} >= ${n}`,()=>i.assign(u,!0).break()):(i.if((0,t._)`${e} > ${D}`,()=>i.assign(u,!1).break()),1===n?i.assign(u,!0):i.if((0,t._)`${e} >= ${n}`,()=>i.assign(u,!0)))}void 0===D&&1===n?d(u,()=>i.if(u,()=>i.break())):0===n?(i.let(u,!0),void 0!==D&&i.if((0,t._)`${g}.length > 0`,h)):(i.let(u,!1),h()),e.result(u,()=>e.reset())}}},83025(e,n,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateSchemaDeps=n.validatePropertyDeps=n.error=void 0;let t=D(99029),S=D(94227),i=D(15765);n.error={message:({params:{property:e,depsCount:n,deps:D}})=>{let S=1===n?"property":"properties";return(0,t.str)`must have ${S} ${D} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:D,missingProperty:S}})=>(0,t._)`{property: ${e},
|