@openmrs/esm-form-builder-app 3.4.2-pre.3481 → 3.4.2-pre.3486
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/4538.js +1 -1
- package/dist/4538.js.map +1 -1
- package/dist/5491.js +1 -1
- package/dist/5491.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +8 -8
- package/dist/routes.json +1 -1
- package/package.json +1 -1
package/dist/5491.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
failing expression: ${e}`)}return null}async function n4(e,n,t,D,S){if(!e?.trim())return null;let a=n9(e);n7(a,n,t);try{return(0,o.evaluateAsTypeAsync)(a,n8(n,t,D,S),n2)}catch(n){console.error(`Error: ${n}
|
|
4
4
|
|
|
5
|
-
failing expression: ${e}`)}return null}function n8(e,n,t,D){let{myValue:S,patient:a}=D,{sex:r,age:o}=a??{};"field"===e.type&&void 0===S&&e.value&&(S=t[e.value.id]);let i=new n1;i.putObject("prevEnc",{value:D.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(n=>n.concept.uuid==e)}});let g=D?.visit??{},s=g?.visitType||{uuid:""},l=s.uuid??"",d={isEmpty:n_.A};return{...new nQ(e,a,n,t),...rt(),...D,...t,patient:a,myValue:S,sex:r,age:o,HD:i,visit:g,visitType:s,visitTypeUuid:l,_:d}}function n9(e){let n=nZ(e);if(n0.has(n))return n0.get(n);let t=(0,o.compile)(e);return n0.set(n,t),t}function n7(e,n,t){for(let D of(0,o.extractVariableNames)(e)){let e=t.find(e=>e.id===D);e&&nJ(n,e)}}function n6(e,n,t,D){return"embedded-view"==D||("automatic"==e?"maximized"==t&&n.endsWith("desktop"):"single-line"==e)}function n5(e,n){let t=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,D=n.find(e=>e.id==t);D&&(D.fieldDependents||(D.fieldDependents=new Set)).add(e.id)}function te(e,n,t){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:D,referenceQuestionId:S}=e.required,a=n.find(e=>e.id==S);return!!a&&((a.fieldDependents||(a.fieldDependents=new Set)).add(e.id),D?.includes(t[S]))}function tn(e,n,t,D,S,a){let{value:r}=e;return a(r.disabled?.disableWhenExpression,e,n,t,{mode:D,patient:S})}function tt(e,n,t,D,S,a,r){let{value:o,type:i}=e,g=a(o.hide?.hideWhenExpression,e,n,t,{mode:D,patient:S});e.value.isHidden=g,"field"==i&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=g}),"page"==i&&o.sections.forEach(e=>{e.isParentHidden=g,tD(g,e,n,r)}),"section"==i&&tD(g,o,n,r)}function tD(e,n,t,D){let S=n.questions.map(e=>e.id);t.filter(e=>S.includes(e.id)).forEach(n=>{n.isParentHidden=e,"group"==n.questionOptions.rendering&&n.questions.forEach(n=>{n.isParentHidden=e}),D?.(n)})}function tS(e,n){if(!e?.includes(":"))return n?.find(n=>n.uuid===e);{let[t,D]=e.split(":");return n?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===t.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===D.toUpperCase()))}}function ta(e,n=!1){let t=document.getElementById(e);t?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),n&&t?.focus()}let tr=(e,n)=>{let t=e.questionOptions.rendering;if("object"!=typeof n)return{value:n,display:n};let D="Observation"===n.resourceType?ti(n,t):n;if(!D)return{value:null,display:null};if("string"==typeof D.value||"number"==typeof D.value){if("date"===t||"datetime"===t){let e=nb(`${D.value}`);return{value:e,display:nr()(e).format("YYYY-MM-DD HH:mm")}}return{value:D.value,display:D.value}}return["toggle","checkbox"].includes(t)?{value:D.value?.uuid,display:D.value?.name?.name}:{value:D.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===D.value?.uuid)?.label}};function to(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function ti(e,n){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:tg(e,n)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function tg(e,n){switch(n){case"toggle":return e.valueBoolean?{uuid:i.t$}:{uuid:i.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 ts(e,n){return e.pages.find(e=>n.meta.pageId===e.id).sections.find(e=>e.questions.find(e=>e.id===n.id))}var tl=t(10578);function td(e,n){let{methods:{getValues:t}}=n,D=t();i.FU.includes(e.questionOptions.rendering)&&tc(e,D,n),tu(e,D,n)}function tc(e,n,t){let{sessionMode:D,formFields:S,patient:a,visit:r}=t;e.questionOptions.answers.forEach(t=>{let o=t.disable?.disableWhenExpression;o&&o.includes("myValue")&&(t.disable.isDisabled=n3(t.disable?.disableWhenExpression,{value:e,type:"field"},S,n,{mode:D,patient:a,visit:r}))})}function tu(e,n,t){let{sessionMode:D,formFields:S,patient:a,formFieldValidators:r,formJson:o,methods:{setValue:i},updateFormField:g,setForm:s,visit:l}=t,d=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let s=S.find(n=>n.id==e);if(s.questionOptions.calculate?.calculateExpression&&n4(s.questionOptions.calculate.calculateExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l}).then(e=>{i(s.id,e);let{errors:r,warnings:o}=tf(s,e,t.formFieldValidators,{formFields:S,values:n,expressionContext:{patient:a,mode:D}});s.meta.submission||(s.meta.submission={}),s.meta.submission.errors=r,s.meta.submission.warnings=o,r.length||t.formFieldAdapters[s.type].transformFieldValue(s,e,t),g(s)}).catch(e=>{(0,tl.N)(e,"Error evaluating calculate expression")}),s.hide){let e=ts(o,s),t=e?.questions.some(e=>!e.isHidden);if(tt({value:s,type:"field"},S,n,D,a,n3,g),e){e.questions=e?.questions.map(e=>e.id===s.id?s:e);let n=s.isHidden,D=[...e.questions,s].some(e=>!e.isHidden);t||n?t&&!D&&(e.isHidden=!0,d=!0):(e.isHidden=!1,d=!0)}}if("object"==typeof s.disabled&&s.disabled.disableWhenExpression&&(s.isDisabled=tn({value:s,type:"field"},S,n,D,a,n3)),"object"==typeof s.required&&s.required?.type==="conditionalRequired"&&(s.isRequired=te(s,S,n)),s.validators?.some(e=>"conditionalAnswered"===e.type)){let e=s.validators?.find(e=>"conditionalAnswered"===e.type),t=r.conditionalAnswered.validate(s,s.meta.submission?.newValue,{...e,expressionContext:{patient:a,mode:D},values:n,formFields:S});s.meta.submission={...s.meta.submission,errors:t}}s?.questionOptions.answers?.filter(e=>!nl(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=n3(e.hide?.hideWhenExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})}),s?.questionOptions.answers?.filter(e=>!nl(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=n3(e.disable?.disableWhenExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})}),!s.isHidden&&s.meta.readonlyExpression&&(s.readonly=n3(s.meta.readonlyExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})),nf(s,"repeating")&&!nl(s.questionOptions.repeatOptions?.limitExpression)&&(s.questionOptions.repeatOptions.limit=n3(s.questionOptions.repeatOptions?.limitExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})),g(s)}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let t=0;t<o.pages.length;t++){let r=o.pages[t].sections.find(n=>n.label==e);if(r){tt({value:r,type:"section"},S,n,D,a,n3,g),d=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{tt({value:o.pages.find(n=>n.label==e),type:"page"},S,n,D,a,n3,g),d=!0}),d&&s(o)}function tf(e,n,t,D){let S=[],a=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(r=>{let o=t[r.type]?.validate?.(e,n,{...r,...D});o&&o.forEach(e=>{"error"===e.resultType?S.push(e):"warning"===e.resultType&&a.push(e)})})}catch(e){console.error(e)}return{errors:S,warnings:a}}var th=t(6232);let tp=s().createContext(void 0),tm=({methods:e,children:n,...t})=>s().createElement(tp.Provider,{value:{...t,methods:e}},n),ty=()=>{let e=s().useContext(tp);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e};var tb=t(7521),tv={};tv.styleTagTransform=_(),tv.setAttributes=b(),tv.insert=m().bind(null,"head"),tv.domAPI=h(),tv.insertStyleElement=$(),u()(tb.A,tv);let t$=tb.A&&tb.A.locals?tb.A.locals:void 0,tw=()=>{let{t:e}=(0,nD.useTranslation)();return s().createElement("div",null,s().createElement("span",{className:t$.empty},"(",e("blank","Blank"),")"))},t_=({value:e})=>Array.isArray(e)?s().createElement(tA,{valueArray:e}):s().createElement("div",{className:t$.value},e),tA=({valueArray:e})=>s().createElement("ul",null,e.map(e=>s().createElement("li",{className:t$.item},e)));var tM=t(50793),tx={};tx.styleTagTransform=_(),tx.setAttributes=b(),tx.insert=m().bind(null,"head"),tx.domAPI=h(),tx.insertStyleElement=$(),u()(tM.A,tx);let tL=tM.A&&tM.A.locals?tM.A.locals:void 0,tC=({previousValue:e,displayText:n,field:t,hideHeader:D,onAfterChange:S})=>{let{t:a}=(0,nD.useTranslation)(),{methods:{setValue:r}}=ty(),o=n=>{n.preventDefault(),r(t.id,e),S(e)};return s().createElement("div",{className:tL.formField},s().createElement("div",{className:tL.row},!D&&s().createElement("div",null,a("previousValue","Previous value:")),s().createElement("div",{className:tL.value},s().createElement(t_,{value:n}))),s().createElement("div",{className:tL.reuseButton,role:"button",tabIndex:0,onClick:o},a("reuseValue","Reuse value")))};var tk=t(50847),tE={};tE.styleTagTransform=_(),tE.setAttributes=b(),tE.insert=m().bind(null,"head"),tE.domAPI=h(),tE.insertStyleElement=$(),u()(tk.A,tE);let tT=tk.A&&tk.A.locals?tk.A.locals:void 0,tO=({field:e,fieldValue:n,setFieldValue:t,onAfterChange:D})=>{let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)(!1),{sessionMode:o,updateFormField:i}=ty();(0,g.useEffect)(()=>{nl(n)&&"edit"===o&&(r(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,g.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!nl(n))&&(r(!1),e.meta.submission.unspecified=!1,i(e))},[e.meta?.submission,n]);let l=(0,g.useCallback)(n=>{let S=e.questionOptions.rendering;if(n.target.checked){r(!0);let n="checkbox"===S?[]:"";nh(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],i(e),t(n),D(n)}else r(!1),e.meta.submission.unspecified=!1,i(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,th.H)(e.readonly)&&!ny(o)&&s().createElement("div",{className:tT.unspecified},s().createElement(L.Sc0,{id:`${e.id}-unspecified`,labelText:S("unspecified","Unspecified"),value:S("unspecified","Unspecified"),onChange:l,checked:a,disabled:e.isDisabled}))};function tR(e,n,t,D){return!("embedded-view"===e&&t&&(n||D))}var tI=t(54880),tN={};tN.styleTagTransform=_(),tN.setAttributes=b(),tN.insert=m().bind(null,"head"),tN.domAPI=h(),tN.insertStyleElement=$(),u()(tI.A,tN);let tj=tI.A&&tI.A.locals?tI.A.locals:void 0,tP=({fieldId:e,valueAdapter:n,repeatOptions:t})=>{let[D,S]=(0,g.useState)(null),[a,r]=(0,g.useState)([]),[i,l]=(0,g.useState)([]),[d,c]=(0,g.useState)(null),u=ty(),f=!1;try{let e=(0,o.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});f=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:h,getValues:p,getFieldState:m},patient:y,sessionMode:b,formFields:v,formFieldValidators:$,addInvalidField:w,removeInvalidField:_,updateFormField:A}=u,M=ey({control:h,name:e,exact:!0}),x=()=>{},L=(0,g.useMemo)(()=>v.find(n=>n.id===e),[e,v]);(0,g.useEffect)(()=>{if(nf(L,"repeating")&&t?.targetRendering?a8(t.targetRendering).then(e=>{e&&S({value:e})}):a9(L).then(e=>{e&&S({value:e})}),"enter"===b&&(L.historicalExpression||u.previousDomainObjectValue))try{u.processor.getHistoricalValue(L,u).then(e=>{c(e)})}catch(e){console.error(e)}},[]),(0,g.useEffect)(()=>{let{isDirty:e,isTouched:t}=m(L.id),{submission:D,unspecified:S}=L.meta,{calculate:a,defaultValue:r}=L.questionOptions;!nl(M)&&!D?.newValue&&!e&&!S&&(a?.calculateExpression||r)&&n.transformFieldValue(L,M,u),(e||t)&&C(M)},[M]),(0,g.useEffect)(()=>{L.meta.submission?.errors&&r(L.meta.submission.errors),L.meta.submission?.warnings&&l(L.meta.submission.warnings),L.meta.submission?.unspecified&&(r([]),_(L.id))},[L.meta.submission]);let C=e=>{let{errors:t,warnings:D}=tf(L,e,$,{formFields:v,values:p(),expressionContext:{patient:y,mode:b}});if(L.meta.submission&&(L.meta.submission.errors=void 0,L.meta.submission.warnings=void 0),a.length&&!t.length?(_(L.id),r([])):t.length&&(r(t),w(L)),t.length||n.transformFieldValue(L,e,u),l(D),td(L,u),L.meta.groupId){let e=v.find(e=>e.id===L.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===L.id?L:e),A(e))}};if(!D)return null;let k=D.value;return!t?.targetRendering&&tB(L.questionOptions.rendering)?s().createElement(k,{key:L.id,field:L,value:null,errors:a,warnings:i,setFieldValue:null}):tR(b,!!L.questionOptions.isTransient,nl(M),f)?s().createElement(nS.tH,{FallbackComponent:tF,onReset:x},s().createElement(ev,{control:h,name:L.id,render:({field:{value:e,onChange:n,onBlur:t}})=>s().createElement("div",null,s().createElement(k,{key:`${L.id}-input-component`,field:L,value:e,errors:a,warnings:i,setFieldValue:e=>{n(e),C(e),t()}}),tU(L)&&s().createElement("div",{className:tj.unspecifiedContainer},L.unspecified&&s().createElement(tO,{key:`${L.id}-unspecified`,field:L,setFieldValue:n,onAfterChange:C,fieldValue:e})),d?.value&&s().createElement("div",null,s().createElement(tC,{key:`${L.id}-previous-value-review`,previousValue:d.value,displayText:d.display,onAfterChange:C,field:L})))})):null};function tF({error:e}){let{t:n}=(0,nD.useTranslation)();return s().createElement(L.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 tU(e){let{rendering:n}=e.questionOptions;return(0,th.H)(e.unspecified)&&"toggle"!=n&&"group"!=n&&"repeating"!=n&&"markdown"!=n&&"extension-widget"!=n&&"workspace-launcher"!=n}function tB(e){return"group"===e||"repeating"===e}let tz=({field:e,...n})=>{let{t}=(0,nD.useTranslation)(),{formFieldAdapters:D,formFields:S}=ty(),a=(0,g.useMemo)(()=>e.questions.map(e=>S.find(n=>n.id===e.id)).filter(e=>!e.isHidden).map((t,S)=>{let a=`${t.id}_${S}`;return t.id===e.id?s().createElement(tF,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===t.type&&tB(t.questionOptions.rendering)?s().createElement("div",{key:a,className:x.nestedGroupContainer},s().createElement(tz,{field:t,...n})):D[t.type]?s().createElement("div",{className:d()(x.flexColumn),key:a},s().createElement("div",{className:x.groupContainer},s().createElement(tP,{fieldId:t.id,valueAdapter:D[t.type]}))):void 0}),[e,S]);return s().createElement("div",{className:x.groupContainer},a.length>1?s().createElement(L.gE_,{legendText:t(e.label),className:x.boldLegend},a):a)},tV=tz;var tH=t(89817),tW={};tW.styleTagTransform=_(),tW.setAttributes=b(),tW.insert=m().bind(null,"head"),tW.domAPI=h(),tW.insertStyleElement=$(),u()(tH.A,tW);let tq=tH.A&&tH.A.locals?tH.A.locals:void 0,tG=({value:e,tooltipText:n})=>s().createElement("div",{className:tq.label},s().createElement(L.lrh,{autoAlign:!0,tabIndex:0,definition:n??""},s().createElement("span",{className:"cds--label"},`${e}:`)));var tK=t(51364),tY={};tY.styleTagTransform=_(),tY.setAttributes=b(),tY.insert=m().bind(null,"head"),tY.domAPI=h(),tY.insertStyleElement=$(),u()(tK.A,tY);let tQ=tK.A&&tK.A.locals?tK.A.locals:void 0,tZ=({label:e,conceptName:n,value:t,isInline:D})=>s().createElement(s().Fragment,null,D?s().createElement("div",{className:tQ.inlineFlexRow},s().createElement("div",{className:tQ.inlineFlexColumn},s().createElement(tG,{value:e,tooltipText:n})),s().createElement("div",{className:tQ.inlineFlexColumn},nl(t)?s().createElement(tw,null):s().createElement(t_,{value:t}))):s().createElement("div",{className:tQ.readonly},s().createElement("div",{className:tQ.formField},s().createElement(tG,{value:e,tooltipText:n}),s().createElement("div",{className:tQ.value},nl(t)?s().createElement(tw,null):s().createElement(t_,{value:t})))));var tJ=t(71671),tX={};tX.styleTagTransform=_(),tX.setAttributes=b(),tX.insert=m().bind(null,"head"),tX.domAPI=h(),tX.insertStyleElement=$(),u()(tJ.A,tX);let t1=tJ.A&&tJ.A.locals?tJ.A.locals:void 0;var t0=t(31362),t2=t(30357),t3={};t3.styleTagTransform=_(),t3.setAttributes=b(),t3.insert=m().bind(null,"head"),t3.domAPI=h(),t3.insertStyleElement=$(),u()(t2.A,t3);let t4=t2.A&&t2.A.locals?t2.A.locals:void 0,t8=({field:e,children:n})=>{let{t}=(0,nD.useTranslation)();return e.questionInfo?s().createElement(L.m_M,{autoAlign:!0,label:t(e.questionInfo)},s().createElement("div",null,n)):s().createElement(s().Fragment,null,n)},t9=({field:e,customLabel:n})=>{let{t}=(0,nD.useTranslation)(),D=!!e.questionInfo,S=n||t(e.label);return s().createElement(t8,{field:e},s().createElement("div",{className:t4.questionLabel,"data-testid":`${e.id}-label`},s().createElement("span",null,S),e.isRequired&&s().createElement("span",{title:t("required","Required"),className:t4.required},"*"),D&&s().createElement(t0.$$,{size:16,"aria-hidden":"true",className:t4.tooltipIcon,"data-testid":`${e.id}-information-icon`})))},t7=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),c=(0,g.useCallback)(e=>{S(e.name)},[S]),u=(0,g.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),f=(0,g.useMemo)(()=>u.findIndex(e=>e.concept==n),[n,u]),h=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o||(0,th.H)(e.readonly)?s().createElement("div",{className:t1.formField},s().createElement(tZ,{label:a(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:h})):!e.isHidden&&s().createElement(L.gE_,{legendText:s().createElement("div",{className:t1.boldedLegend},s().createElement(t9,{field:e})),className:d()({[t1.errorLegend]:t.length>0,[t1.boldedLegend]:0===t.length})},s().createElement(L.Tps,{onChange:c,selectedIndex:f,className:t1.selectedOption,size:"md"},u.map((n,t)=>s().createElement(L.dOG,{name:n.concept||n.value,text:a(n.label),key:t,disabled:e.isDisabled}))))};var t6=t(63769),t5={};t5.styleTagTransform=_(),t5.setAttributes=b(),t5.insert=m().bind(null,"head"),t5.domAPI=h(),t5.insertStyleElement=$(),u()(t6.A,t5);let De=t6.A&&t6.A.locals?t6.A.locals:void 0,Dn=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),[r,i]=(0,g.useState)(""),{layoutType:l,sessionMode:c,workspaceLayout:u}=ty(),f=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(c)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,l,u,c),[c,e.readonly,e.inlineRendering,l,u]),h=(0,g.useCallback)(e=>{p(e,r),S(e)},[S,r]),p=(0,g.useCallback)((e,n)=>{if(!nl(n)){let[t,D]=n.split(":").map(Number);e.setHours(t??0,D??0)}},[]),m=(0,g.useCallback)(t=>{let D=t.target.value;i(D);let a="timer"===e.datePickerFormat?new Date:new Date(n);p(a,D),S(a)},[S,p,n]);(0,g.useEffect)(()=>{n&&n instanceof Date&&i([10>n.getHours()?`0${n.getHours()}`:`${n.getHours()}`,10>n.getMinutes()?`0${n.getMinutes()}`:`${n.getMinutes()}`].join(":"))},[n]);let y=(0,g.useMemo)(()=>"timer"===e.datePickerFormat?s().createElement(t9,{field:e}):s().createElement(t9,{field:e,customLabel:a("time","Time")}),[e.datePickerFormat,e.label,a]);return"view"==c||"embedded-view"==c||(0,th.H)(e.readonly)?s().createElement(tZ,{label:a(e.label),value:n instanceof Date?nv(e,n):n,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&s().createElement("div",{className:De.datetime},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&s().createElement("div",{className:De.datePickerSpacing},s().createElement(L.Wdr,null,s().createElement(o.OpenmrsDatePicker,{id:e.id,onChange:h,labelText:s().createElement("span",{className:De.datePickerLabel},s().createElement(t9,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,th.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:t.length>0,invalidText:t[0]?.message,value:n})),D.length>0?s().createElement("div",{className:De.datePickerWarn},D[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?s().createElement("div",null,s().createElement(L.Wdr,null,s().createElement(L.AG,{className:d()(De.boldedLabel,De.timeInput),id:e.id,labelText:y,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!n,invalid:t.length>0,invalidText:t[0]?.message,readOnly:(0,th.H)(e.readonly),warning:D.length>0,warningText:D[0]?.message,value:r||(n instanceof Date?n.toLocaleDateString(window.navigator.language):n),onChange:m}))):null)},Dt=({field:e,setFieldValue:n})=>{let t=ty();return(0,g.useEffect)(()=>{e.meta?.initialValue?.omrsObject||nl(e.meta.fixedValue)||(n(e.meta.fixedValue),t.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,t))},[]),s().createElement(s().Fragment,null)};var DD=t(29012),DS=t(19697),Da={};Da.styleTagTransform=_(),Da.setAttributes=b(),Da.insert=m().bind(null,"head"),Da.domAPI=h(),Da.insertStyleElement=$(),u()(DS.A,Da);let Dr=DS.A&&DS.A.locals?DS.A.locals:void 0,Do={a:({node:e,...n})=>s().createElement("a",{...n,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},Di=({markdown:e})=>s().createElement("div",{className:Dr.markdownWrapper},s().createElement(DD.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:Do})),Dg=({field:e})=>{let{t:n}=(0,nD.useTranslation)(),t=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&&s().createElement(Di,{markdown:t(e.value)})};var Ds=t(59793),Dl={};Dl.styleTagTransform=_(),Dl.setAttributes=b(),Dl.insert=m().bind(null,"head"),Dl.domAPI=h(),Dl.insertStyleElement=$(),u()(Ds.A,Dl);let Dd=Ds.A&&Ds.A.locals?Ds.A.locals:void 0,Dc=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),[d,c]=(0,g.useState)(0),[u,f]=(0,g.useState)([]),h=(0,g.useRef)(!0),p=e.questionOptions.answers.filter(e=>!e.isHidden).map((n,t)=>({id:`${e.id}-${n.concept}`,concept:n.concept,label:a(n.label),key:t,disabled:n.disable?.isDisabled,readonly:(0,th.H)(e.readonly)})),m=(0,g.useMemo)(()=>n?.length&&d<1?(c(d+1),p.filter(e=>n?.includes(e.concept))):[],[n]),y=({selectedItems:e})=>{S(e.map(e=>e.concept))},b=(0,g.useMemo)(()=>(0,th.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,g.useEffect)(()=>{h.current&&1===d&&(f(m.map(e=>e.concept)),h.current=!1)},[m,h]);let v=e=>{let n,t=e.concept;f(n=u.some(e=>e===t)?u.filter(e=>e!==t):u.some(e=>e===t)?u.filter(e=>e!==t):[...u,t]),S(n)},$=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o?s().createElement("div",{className:Dd.formField},s().createElement(tZ,{label:a(e.label),value:n?l[e.type]?.getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:$})):!e.isHidden&&s().createElement(s().Fragment,null,s().createElement("div",{className:Dd.boldedLabel},s().createElement(L.Wdr,null,b?s().createElement(L.Qp5,{disabled:e.isDisabled,id:e.id,initialSelectedItems:m,invalid:t.length>0,invalidText:t[0]?.message,items:p,itemToString:e=>e?a(e.label):" ",key:e.id,onChange:y,placeholder:a("search","Search")+"...",readOnly:(0,th.H)(e.readonly),titleText:s().createElement(t9,{field:e}),warn:D.length>0,warnText:D[0]?.message}):s().createElement(L.$QX,{legendText:s().createElement(t9,{field:e}),readOnly:(0,th.H)(e.readonly)},p?.map((n,t)=>s().createElement(L.Sc0,{className:Dd.checkbox,checked:u.some(e=>e===n.concept),disabled:n.disabled,id:`${e.id}-${n.concept}`,key:`${e.id}-${n.concept}-${t}`,labelText:a(n.label),name:n.concept,onChange:()=>v(n),readOnly:(0,th.H)(e.readonly)}))))),b&&s().createElement("div",{className:Dd.selectionDisplay},n?.length?s().createElement("div",{className:Dd.tagContainer},l[e.type]?.getDisplayValue(e,n)?.map((e,n)=>s().createElement(L.vwO,{key:n,type:"cool-gray"},a(e)))):s().createElement(tw,null)))};var Du=t(41287),Df={};Df.styleTagTransform=_(),Df.setAttributes=b(),Df.insert=m().bind(null,"head"),Df.domAPI=h(),Df.insertStyleElement=$(),u()(Du.A,Df);let Dh=Du.A&&Du.A.locals?Du.A.locals:void 0,Dp=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i}=ty(),l=(0,g.useMemo)(()=>isNaN(n)?"":n??"",[n]),c=(0,g.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),u=(0,g.useCallback)((e,{value:n})=>{let t=c(n);S(isNaN(t)?void 0:t)},[S,c]),f=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]),h=c(e.questionOptions.max),p=c(e.questionOptions.min);return"view"==o||"embedded-view"==o?s().createElement("div",{className:Dh.formField},s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:f})):!e.isHidden&&s().createElement(L.Wdr,null,s().createElement(L.Q7x,{id:e.id,invalid:t.length>0,invalidText:t[0]?.message,label:s().createElement(t9,{field:e}),max:h,min:p,name:e.id,value:l,onChange:u,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),className:d()(Dh.controlWidthConstrained,Dh.boldedLabel),warn:D.length>0,warnText:D[0]?.message,step:e.questionOptions.step??.01}))};var Dm=t(12),Dy={};Dy.styleTagTransform=_(),Dy.setAttributes=b(),Dy.insert=m().bind(null,"head"),Dy.domAPI=h(),Dy.insertStyleElement=$(),u()(Dm.A,Dy);let Db=Dm.A&&Dm.A.locals?Dm.A.locals:void 0,Dv=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),d=e=>{S(e)},c=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o||(0,th.H)(e.readonly)?s().createElement(tZ,{label:a(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:c}):!e.isHidden&&s().createElement(L.gE_,{legendText:s().createElement(t9,{field:e}),className:Db.boldedLegend,disabled:e.isDisabled,invalid:t?.length>0},s().createElement(L.zWQ,{name:e.id,valueSelected:n,onChange:d,readOnly:(0,th.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((t,D)=>s().createElement(L.aaP,{id:`${e.id}-${t.label}`,labelText:a(t.label)??"",value:t.concept,key:D,onClick:e=>{n&&e.target.checked?(e.target.checked=!1,e.preventDefault(),d(null)):d(t.concept)}}))),(t?.length>0||D?.length>0)&&s().createElement("div",null,s().createElement("div",{className:Db.errorMessage},t.length>0?t[0].message:D.length>0?D[0].message:null)))};var D$=t(55256),Dw={};Dw.styleTagTransform=_(),Dw.setAttributes=b(),Dw.insert=m().bind(null,"head"),Dw.domAPI=h(),Dw.insertStyleElement=$(),u()(D$.A,Dw);let D_=D$.A&&D$.A.locals?D$.A.locals:void 0,DA=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:l,formFieldAdapters:d}=ty(),c=(0,g.useCallback)(({selectedItem:e})=>{S(e===i.ZA?null:e)},[S]),u=(0,g.useCallback)(n=>{let t=e.questionOptions.answers.find(e=>e.value?e.value==n:e.concept==n);return t?a(t.label):""},[e.questionOptions.answers,a]),f=(0,g.useMemo)(()=>{let n=e.questionOptions.answers;return n.some(e=>e.value===i.ZA)||n.unshift({value:i.ZA,label:a("chooseAnOption","Choose an option")}),n.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),h=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,l,o),[o,e.readonly,e.inlineRendering,r,l]);return"view"==o||"embedded-view"==o?s().createElement(tZ,{label:a(e.label),value:n?d[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:h}):!e.isHidden&&s().createElement("div",{className:D_.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.msM,{"aria-label":a(e.label),disabled:e.isDisabled,id:e.id,invalid:t.length>0,invalidText:t[0]?.message,items:f,itemToString:u,label:"",onChange:c,readOnly:(0,th.H)(e.readonly),selectedItem:nl(n)?i.ZA:n,titleText:s().createElement(t9,{field:e}),warn:D.length>0,warnText:D[0]?.message})))};var DM=t(1495),Dx={};Dx.styleTagTransform=_(),Dx.setAttributes=b(),Dx.insert=m().bind(null,"head"),Dx.domAPI=h(),Dx.insertStyleElement=$(),u()(DM.A,Dx);let DL=DM.A&&DM.A.locals?DM.A.locals:void 0,DC=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),[r,o]=(0,g.useState)(n),{layoutType:i,sessionMode:l,workspaceLayout:d}=ty(),c=e=>{e.preventDefault(),r!==n&&o(n)},u=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(l)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,i,d,l),[l,e.readonly,e.inlineRendering,i,d]);return"view"==l||"embedded-view"==l?s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&s().createElement("div",{className:DL.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.fs1,{id:e.id,labelText:s().createElement(t9,{field:e}),name:e.id,onChange:S,onBlur:c,value:n||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),invalid:t.length>0,invalidText:t[0]?.message,warn:D.length>0,warnText:D[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))};var Dk=t(30303),DE={};DE.styleTagTransform=_(),DE.setAttributes=b(),DE.insert=m().bind(null,"head"),DE.domAPI=h(),DE.insertStyleElement=$(),u()(Dk.A,DE);let DT=Dk.A&&Dk.A.locals?Dk.A.locals:void 0,DO=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i}=ty(),[l,d]=(0,g.useState)(null),c=e=>{e.preventDefault(),l!==n&&d(n)},u=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o?s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&s().createElement("div",{className:DT.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.ksK,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:t.length>0,invalidText:t[0]?.message,labelText:s().createElement(t9,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:c,onChange:e=>{S(e.target.value)},readOnly:(0,th.H)(e.readonly),value:n??"",warn:D.length>0,warnText:D.length>0?D[0].message:void 0})))};var DR=t(47557),DI={};DI.styleTagTransform=_(),DI.setAttributes=b(),DI.insert=m().bind(null,"head"),DI.domAPI=h(),DI.insertStyleElement=$(),u()(DR.A,DI);let DN=DR.A&&DR.A.locals?DR.A.locals:void 0,Dj=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),r=ty(),o=e=>{S(e)};(0,g.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=r.sessionMode||r.formFieldAdapters[e.type].transformFieldValue(e,n??!1,r)},[]);let i=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(r.sessionMode)||(0,th.H)(e.readonly))&&n6(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?s().createElement(tZ,{label:a(e.label),value:nl(n)?n:r.formFieldAdapters[e.type].getDisplayValue(e,n),conceptName:e.meta?.concept?.display,isInline:i}):!e.isHidden&&s().createElement("div",{className:DN.boldedLabel},s().createElement(L.lMk,{labelText:a(e.label),className:DN.boldedLabel,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:o,toggled:!!n,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly)}))};var DP=t(44861);let DF=[{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"]}}}],DU=e=>DF.find(n=>n.name===e),DB=e=>{let n=e.questionOptions.config?.referencedField,{methods:{control:t}}=ty();return ey({control:t,name:n,exact:!0,disabled:!n})};var Dz=t(51711),DV={};DV.styleTagTransform=_(),DV.setAttributes=b(),DV.insert=m().bind(null,"head"),DV.domAPI=h(),DV.insertStyleElement=$(),u()(Dz.A,DV);let DH=Dz.A&&Dz.A.locals?Dz.A.locals:void 0,DW=({field:e,errors:n,warnings:t,setFieldValue:D})=>{let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)([]),[o,i]=(0,g.useState)(!1),[l,d]=(0,g.useState)(!1),[c,u]=(0,g.useState)(""),f=(0,g.useRef)(!1),[h,p]=(0,g.useState)(null),[m,y]=(0,g.useState)({}),b=DB(e),v=(0,th.H)(e.questionOptions.isSearchable),{layoutType:$,sessionMode:w,workspaceLayout:_,methods:{control:A,getFieldState:M}}=ty(),x=ey({control:A,name:e.id,exact:!0}),{isDirty:C}=M(e.id),k=(0,g.useMemo)(()=>!!(ny(w)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,$,_,w),[w,e.readonly,e.inlineRendering,$,_]),E=(0,g.useMemo)(()=>a.find(e=>e.uuid==x)||null,[a,x]),T=(0,DP.A)((e,n)=>{d(!0),n.fetchData(e,m).then(e=>{if(e.length){let t=a.find(e=>e.uuid==x),D=e.map(n.toUuidAndDisplay);t&&!D.some(e=>e.uuid==t.uuid)&&D.unshift(t),r(D)}d(!1)}).catch(e=>{console.error(e),d(!1)})},300),O=(0,g.useCallback)(e=>a.some(n=>n.display?.toLowerCase().includes(e.toLowerCase())),[a]);return((0,g.useEffect)(()=>{let n=e.questionOptions?.datasource?.name;y(n?e.questionOptions.datasource?.config:DU(e.questionOptions.rendering)?.datasource?.config),rn(n||e.questionOptions.rendering).then(e=>p(e))},[e.questionOptions?.datasource]),(0,g.useEffect)(()=>{let n=!1;return h&&!(0,th.H)(e.questionOptions.isSearchable)&&(r([]),i(!0),h.fetchData(null,{...m,referencedValue:b}).then(e=>{n||(r(e.map(h.toUuidAndDisplay)),i(!1))}).catch(e=>{n||(console.error(e),i(!1),r([]))})),()=>{n=!0}},[h,m,b]),(0,g.useEffect)(()=>{h&&v&&!nl(c)&&!O(c)&&T(c,h)},[h,c,m]),(0,g.useEffect)(()=>{let e=!1;if(x&&!C&&h&&v&&"enter"!==w&&!a.length){i(!0);try{h.fetchSingleItem(x).then(n=>{e||(r([h.toUuidAndDisplay(n)]),i(!1))})}catch(n){e||(console.error(n),i(!1))}}return()=>{e=!0}},[x,C,w,h,v,a]),o)?s().createElement(L.dF7,null):ny(w)||(0,th.H)(e.readonly)?s().createElement(tZ,{label:S(e.label),value:x?a.find(e=>e.uuid==x)?.display:x,conceptName:e.meta?.concept?.display,isInline:k}):!e.isHidden&&s().createElement("div",{className:DH.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.a32,{id:e.id,titleText:s().createElement(t9,{field:e}),items:a,itemToString:e=>e?.display,selectedItem:E,placeholder:v?S("search","Search")+"...":null,onChange:({selectedItem:e})=>{f.current=!0,D(e?.uuid)},disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),invalid:n.length>0,invalidText:n.length&&n[0].message,onInputChange:n=>{if(f.current){f.current=!1;return}e.questionOptions.isSearchable&&u(n)},onBlur:e=>{e.target.value||D(null)}}),l&&s().createElement(L.OuH,{className:DH.loader,description:S("searching","Searching")+"..."})))};var Dq=t(89953),DG={};DG.styleTagTransform=_(),DG.setAttributes=b(),DG.insert=m().bind(null,"head"),DG.domAPI=h(),DG.insertStyleElement=$(),u()(Dq.A,DG);let DK=Dq.A&&Dq.A.locals?Dq.A.locals:void 0,DY=({field:e})=>{let{t:n}=(0,nD.useTranslation)(),{sessionMode:t,patient:D,visit:S}=ty(),a=async()=>{let t=e.questionOptions?.workspaceName;if(!t)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 a=e.questionOptions?.workspaceProps??{},r={patient:D,patientUuid:D?.id,visitContext:S};try{await (0,o.launchWorkspace2)(t,a,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||ny(t)?null:s().createElement("div",null,s().createElement("div",{className:DK.label},s().createElement(t9,{field:e})),s().createElement("div",{className:DK.workspaceButton},s().createElement(L.$nd,{disabled:(0,th.H)(e.readonly??!1)||!D,onClick:a},e.questionOptions.buttonLabel?n(e.questionOptions.buttonLabel):n("launchWorkspace","Launch Workspace")),!D&&s().createElement(L.jeF,{className:DK.noPatientNotification,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 DQ=t(20903);function DZ(e,n,t){let D=[],S=(0,DQ.A)(e);return S.questionOptions.repeatOptions={...S.questionOptions.repeatOptions??{}},S.meta={repeat:{...S.meta??{},isClone:!0},initialValue:{omrsObject:n}},S.id=`${S.id}_${t}`,S.questions?.forEach(e=>{D.push(e.id),e.id=`${e.id}_${t}`,e.meta.groupId=S.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,nh(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=DJ(e.hide.hideWhenExpression,t,D)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=DJ(e.failsWhenExpression,t,D))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=DJ(e.questionOptions.calculate?.calculateExpression,t,D))}),S}function DJ(e,n,t){let D=[...new Set(t)];if(!D.length)return e;let S=D.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 DX(e,n){let t=Number(e);return!(nl(e)||isNaN(t))&&n>=t}let D1=[],D0={async getInitialValue(e,n,t){let D=Se(nu((n??t.domainObjectValue).obs),D1,e);return nf(e,"file")&&D?.length?Sn(e,D):D2(e,D,!0)},async getPreviousValue(e,n,t){let D=n??t.previousDomainObjectValue;if(D){let n=D2(e,Se(nu(D.obs),D1,e),!0);if(!nl(n))return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:(e,n)=>{let t=e.questionOptions.rendering;return nl(n)?n:n instanceof Date?nv(e,n):"checkbox"===t?n.map(n=>e.questionOptions.answers?.find(e=>e.concept==n)?.label):"toggle"===t?n?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:i.FU.includes(t)?e.questionOptions.answers?.find(e=>e.concept==n)?.label:n},transformFieldValue:(e,n,t)=>(nh(e),!e.meta.initialValue?.omrsObject&&nl(n))?null:nf(e,"checkbox")?D6(e,Array.isArray(n)?n:[n]):nf(e,"file")?D5(e,n):!nl(n)&&D7(e,n)?np(e,D8(e,n),void 0):e.meta.initialValue?.omrsObject&&nl(n)?np(e,void 0,D4(e.meta.initialValue.omrsObject)):nl(n)?null:np(e,D3(e,n),void 0),tearDown:function(){D1=[]}};function D2(e,n=[],t=!1){let D=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),n.length){if("checkbox"==D)return D1.push(...n.map(e=>e.uuid)),e.meta.initialValue.omrsObject=t?n:null,n.map(e=>e.value.uuid);let S=n[0];if(t&&(e.meta.initialValue.omrsObject={...S}),D1.push(S.uuid),"string"==typeof S.value||"number"==typeof S.value){if(D.startsWith("date")){let n=nb(S.value);return t&&(e.meta.initialValue.omrsObject.value=nr()(n).format("YYYY-MM-DD HH:mm")),n}return S.value}return"toggle"==D?S.value.uuid===i.t$:"fixed-value"==D?e.fixedValue:S.value?.uuid}return""}function D3(e,n){return nl(n)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?D9(e,n):n},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function D4(e){return{uuid:e.uuid,voided:!0}}function D8(e,n){let t=e.meta.initialValue?.omrsObject,D=e.questionOptions.rendering.startsWith("date")?D9(e,n):n;return{uuid:t.uuid,value:D,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function D9(e,n){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return nr()(n).format("YYYY-MM-DD");case"timer":return nr()(n).format("HH:mm");case"both":return nr()(n).format("YYYY-MM-DD HH:mm")}return n}function D7(e,n){let t=e.meta.initialValue?.omrsObject;return!nl(t)&&(i.FU.includes(e.questionOptions.rendering)?t.value.uuid!==n:nf(e,"date")?0!==nr()(n).diff(nr()(t.value),"D"):nf(e,"datetime")||"both"===e.datePickerFormat?0!==nr()(n).diff(nr()(t.value),"minute"):nf(e,"toggle")?t.value.uuid===i.t$!==n:t.value!==n)}function D6(e,n=[]){let t=e.meta.initialValue?.omrsObject;if(t?.length&&nl(n))return np(e,null,t.map(e=>D4(e)));if(t?.length&&!nl(n)){let D=t.filter(e=>!n.includes(e.value.uuid));return np(e,n.filter(e=>!t.some(n=>n.value.uuid===e)).map(n=>D3(e,n)),D.map(e=>D4(e)))}return np(e,n.map(n=>D3(e,n)),void 0)}function D5(e,n=[]){let t=n.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),D=e.meta.submission.newValue=n.filter(e=>!e.uuid).map(n=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...n}));return np(e,D,t)}function Se(e,n,t){let D=e.filter(e=>!!nf(t,"file")&&e.formFieldPath==`rfe-forms-${t.id}`||e.formFieldPath==`rfe-forms-${t.id}`&&e.concept.uuid==t.questionOptions.concept);if(!D?.length){let D=e.filter(e=>e.concept.uuid==t.questionOptions.concept);return n?.length?D.filter(e=>!n.includes(e.uuid)):D}return D}async function Sn(e,n){let t=new AbortController,D=await Promise.all(n.map(e=>(0,o.getAttachmentByUuid)(e.uuid,t).then(e=>e.data).catch(n=>(console.error(`Failed to fetch attachment ${e.uuid}:`,n),null))));return e.meta.initialValue={omrsObject:n},D.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 St={validate:(e,n)=>!nl(n)&&i.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"}]:nl(n)||"date"!=e.questionOptions.rendering||nr()(n).isValid()?!nl(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}'`}]},SD=[],SS="testorder",Sa="6f0c9a92-6f24-11e3-af88-005056821db0",Sr={transformFieldValue:function(e,n,t){if("edit"==t.sessionMode&&e.meta.initialValue?.omrsObject)return Si(n,e,t.currentProvider.uuid);let D=So(n,e,t.currentProvider.uuid);return np(e,D,null),D},getInitialValue:function(e,n,t){let D=e.questionOptions.answers?.map(e=>e.concept)||[],S=n?.orders.filter(e=>!SD.includes(e.uuid)&&!e.voided).find(e=>D.includes(e.concept.uuid));return S?(e.meta={...e.meta||{},initialValue:{omrsObject:S,refinedValue:S.concept.uuid}},SD.push(S.uuid),S.concept.uuid):null},getPreviousValue:function(e,n,t){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){SD=[]}};function So(e,n,t){return e?{action:"NEW",concept:e,type:n?.questionOptions?.orderType||SS,careSetting:n?.questionOptions?.orderSettingUuid||Sa,orderer:t}:null}function Si(e,n,t){let D=n.meta.initialValue?.omrsObject;if(e===D?.concept?.uuid)return nh(n),null;let S={uuid:D?.uuid,voided:!0};return np(n,So(e,n,t),S),n.meta.submission.newValue||null}let Sg=[],Ss={transformFieldValue:function(e,n,t){if(e.meta.initialValue?.omrsObject&&nl(n))return np(e,void 0,Su(e.meta.initialValue.omrsObject));if(!nl(n)){let D=e.meta.initialValue?.omrsObject;if(Sc(D,n))return np(e,Sd(n,e,D,t.patient.id),void 0)}let D=Sl(n,e,t.patient.id);return np(e,D,null),D},getInitialValue:function(e,n,t){let D=(n??t.domainObjectValue).diagnoses.find(n=>n.formFieldPath===`rfe-forms-${e.id}`);return D?(e.meta={...e.meta||{},initialValue:{omrsObject:D,refinedValue:D.diagnosis?.coded.uuid}},Sg.includes(D.diagnosis?.coded?.uuid)||Sg.push(D.diagnosis?.coded?.uuid),D.diagnosis?.coded.uuid):null},getPreviousValue:function(e,n,t){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){Sg=[]}},Sl=(e,n,t)=>e?{patient:t,condition:null,diagnosis:{coded:e},certainty:(0,th.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms"}:null;function Sd(e,n,t,D){return{patient:D,condition:null,diagnosis:{coded:e},certainty:(0,th.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms",uuid:t.uuid}}function Sc(e,n){return!nl(e)&&e.value!==n}function Su(e){return{uuid:e.uuid,voided:!0}}function Sf(e,n,t,D,S){let{patient:a,formJson:r,domainObjectValue:o,formFields:i,visit:g,deletedFields:s}=e,l=[...i,...s],d=[];S_(d,l);let c=Sx(l),u=ST(l),f={};return o?(Object.assign(f,o),-1===f.encounterProviders.findIndex(e=>e.provider.uuid==D)&&(f.encounterProviders=[...f.encounterProviders,{provider:D,encounterRole:t}]),f.encounterDatetime=n,f.location=S,f.form={uuid:r.uuid},g&&(f.visit=g.uuid),f.obs=d,f.orders=c,f.diagnoses=u):f={patient:a.id,encounterDatetime:n,location:S,encounterType:r.encounterType,encounterProviders:[{provider:D,encounterRole:t}],obs:d,form:{uuid:r.uuid},visit:g?.uuid,orders:c,diagnoses:u},f}function Sh(e,n){return e.filter(e=>"patientIdentifier"===e.type&&nm(e)).map(e=>e.meta.submission.newValue)}function Sp(e,n){return n.map(n=>(0,nj.savePatientIdentifier)(n,e.id))}function Sm(e){return e.filter(e=>"personAttribute"===e.type&&nm(e)).map(e=>e.meta.submission.newValue)}function Sy(e,n){return n.map(n=>(0,nj.savePersonAttribute)(n,e.id))}function Sb(e,n,t){let D=e.filter(e=>"programState"===e.type&&nm(e)),S=new Map;return D.forEach(e=>{let D=e.questionOptions.programUuid,a=e.meta.submission.newValue,r=t.find(e=>e.program.uuid===D);r?S.has(D)?S.get(D).states.push(a):S.set(D,{uuid:r.uuid,states:[a]}):S.has(D)?S.get(D).states.push(a):S.set(D,{patient:n.id,program:D,states:[a],dateEnrolled:nr()().format()})}),Array.from(S.values())}function Sv(e){let n=new AbortController;return Promise.all(e.map(e=>(0,nj.saveProgramEnrollment)(e,n)))}function S$(e,n,t){let D=e?.filter(e=>e?.questionOptions.rendering==="file"&&nm(e));return D?.length?Promise.all(D.flatMap(e=>{let t="string"==typeof n?.patient?n?.patient:n?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,nj.createAttachment)(t,n.uuid,e))})):[]}function Sw(e){let{formFields:n,location:t,currentProvider:D,customDependencies:S,domainObjectValue:a}=e,{defaultEncounterRole:r}=S;return{encounterRole:n.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||r?.uuid,encounterProvider:n.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||D.uuid,encounterDate:n.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,encounterLocation:n.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||a?.location?.uuid||t.uuid}}function S_(e,n){n.filter(e=>SC(e)).forEach(n=>SA(e,n))}function SA(e,n){(n.isHidden||n.isParentHidden)&&n.meta.initialValue.omrsObject?SL(e,(Array.isArray(n.meta.initialValue.omrsObject)?n.meta.initialValue.omrsObject:[n.meta.initialValue.omrsObject]).map(e=>D4(e))):"obsGroup"===n.type?SM(e,n):(nf(n,"file")||SL(e,n.meta.submission.newValue),SL(e,n.meta.submission.voidedValue))}function SM(e,n){if(n.meta.submission?.voidedValue)return void SL(e,n.meta.submission.voidedValue);let t=D3(n,null);n.meta.initialValue?.omrsObject&&(t.uuid=n.meta.initialValue.omrsObject.uuid),n.questions.forEach(e=>{if("obsGroup"===e.type){let n=[];SM(n,e),SL(t.groupMembers,n)}else nm(e)&&(SL(t.groupMembers,e.meta.submission.newValue),SL(t.groupMembers,e.meta.submission.voidedValue))}),(t.groupMembers?.length||t.voided)&&SL(e,t)}function Sx(e){return e.filter(e=>"testOrder"===e.type&&nm(e)).flatMap(e=>[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function SL(e,n){n&&(Array.isArray(n)?e.push(...n):e.push(n))}function SC(e){let{questionOptions:{isTransient:n},type:t}=e;return!n&&!!["obs","obsGroup"].includes(t)&&!e.meta.groupId&&(!!((e.isHidden||e.isParentHidden)&&e.meta.initialValue?.omrsObject)||!e.isHidden&&!e.isParentHidden&&("obsGroup"===t||nm(e)))}function Sk(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==i.t$;let n=St.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 SE(e,n,t,D){let S=1,{formFieldAdapters:a}=D,r=n.obs.filter(n=>n.concept.uuid===e.questionOptions.concept&&n.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!D1.includes(n.uuid)),o=n.orders.filter(n=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(n.concept?.uuid)&&!SD.includes(n.uuid));if("testOrder"===e.type)return Promise.all(o.filter(e=>!e.voided).map(async n=>{let r=DZ(e,n,S++);return t[r.id]=await a[e.type].getInitialValue(r,{orders:[n]},D),r}));let i=n.diagnoses.filter(n=>!n.voided&&!Sg.includes(n?.diagnosis?.coded.uuid)&&n.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(i.map(async n=>{let S=parseInt(n.formFieldPath.split("_")[1]),r=DZ(e,n,S);return t[r.id]=await a[e.type].getInitialValue(r,{diagnoses:[n]},D),Sg.includes(n.diagnosis.coded.uuid)||Sg.push(n.diagnosis.coded.uuid),r})):Promise.all(r.map(async n=>{let r=DZ(e,n,S++);return await Promise.all(r.questions.map(async S=>{t[S.id]=await a[e.type].getInitialValue(S,{obs:[n]},D)})),D1.push(n.uuid),[r,...r.questions]})).then(e=>e.flat())}function ST(e){return e.filter(e=>"diagnosis"===e.type&&nm(e)).map(e=>e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function SO(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class SR{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,n){return Promise.resolve({})}constructor(e){SO(this,"formJson",void 0),SO(this,"domainObjectValue",void 0),this.formJson=e}}var SI=t(45278),SN=t(18348),Sj=t(92049),SP=t(53098),SF="[object String]";let SU=function(e){return"string"==typeof e||!(0,Sj.A)(e)&&(0,SP.A)(e)&&(0,SN.A)(e)==SF};function SB(e){let[n,t]=(0,g.useState)(null),[D,S]=(0,g.useState)(!0),[a,r]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=new AbortController;return!nl(e.encounter)&&SU(e.encounter)?(0,o.openmrsFetch)(`${o.restBaseUrl}/encounter/${e.encounter}?v=${i.RZ}`,{signal:n.signal}).then(e=>{t(e.data),S(!1)}).catch(e=>{r(e)}):(nl(e.encounter)||t(e.encounter),S(!1)),()=>{n.abort()}},[e.encounter]),{encounter:n,error:a,isLoading:D}}var Sz=t(54225);function SV(){let{data:e,error:n,isLoading:t}=(0,Sz.A)(`${o.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,o.openmrsFetch),D=e?.data.results.find(e=>"Clinician"===e.name);return D?{encounterRole:D,error:n,isLoading:t}:{encounterRole:e?.data.results[0],error:n,isLoading:t}}var SH=t(59324);let SW=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)))",t=`${o.restBaseUrl}/programenrollment?patient=${e}&v=${n}`,{data:D,error:S,isLoading:a}=(0,SH.Ay)(e?t:null,o.openmrsFetch),r=D?.data?.results.length>0?D?.data.results.sort((e,n)=>n.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:r?.filter(e=>!e.dateCompleted),error:S,isLoading:a}},Sq=(e,n)=>{let{activePrograms:t,error:D,isLoading:S}=SW(n.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:t,errorFetchingPatientPrograms:D,isLoadingPatientPrograms:S}};function SG(e){let[n,t]=(0,g.useState)(!0),{encounter:D,isLoading:S}=SB(e.formJson),{encounterRole:a,isLoading:r}=SV(),{isLoadingPatientPrograms:o,patientPrograms:i}=Sq(e.patient?.id,e.formJson);return(0,g.useEffect)(()=>{t(o||S||r)},[o,S,r]),{data:{encounter:D,patientPrograms:i,encounterRole:a},isLoading:n,error:null,updateContext:e=>{e(e=>(e.processor.domainObjectValue=D,{...e,domainObjectValue:D,customDependencies:{...e.customDependencies,patientPrograms:i,defaultEncounterRole:a}}))}}}let SK={checkbox:[],toggle:!1,text:""},SY=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class SQ extends SR{prepareFormSchema(e){let n=new Set;function t(e,D,S,a){e.id&&n.add(e.id),e.inlineRendering=e.inlineRendering??D.inlineRendering??S.inlineRendering??a.inlineRendering,e.readonly=e.readonly??D.readonly??S.readonly??a.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,t(n,D,S,a)))}return e.pages.forEach(n=>{n.sections.forEach(D=>{D.questions.forEach(S=>{t(S,D,n,e)})})}),SJ(e,n),e}async processSubmission(e,n){let{encounterRole:t,encounterProvider:D,encounterDate:S,encounterLocation:a}=Sw(e),r=(e,n,t)=>(0,o.translateFrom)(SI.L,e,n,t),i=Sh(e.formFields,a),g=Sf(e,S,t,D,a);try{await Promise.all(Sp(e.patient,i)),i?.length&&(0,o.showSnackbar)({title:r("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let n=Sm(e.formFields);await Promise.all(Sy(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,tl.j)(n);return Promise.reject({title:r("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let n=Sb(e.formFields,e.patient,e.customDependencies.patientPrograms),t=await await Sv(n);t?.length&&(0,o.showSnackbar)({title:r("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:t}=await (0,nj.saveEncounter)(n,g,g.uuid),D=t.orders.map(e=>e.orderNumber),S=t.diagnoses.map(e=>e.display);D.length&&(0,o.showSnackbar)({title:r("ordersSaved","Order(s) saved successfully"),subtitle:D.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 D=await S$(e.formFields,t,n);D?.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,tl.j)(n);return Promise.reject({title:r("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return t}catch(n){console.error("Error saving encounter",n);let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:SG}}async getInitialValues(e){let{domainObjectValue:n,formFields:t,formFieldAdapters:D}=e,S={},a=[];if(n){await Promise.all(t.map(async t=>{let r=D[t.type];if(t.meta.initialValue?.omrsObject&&!nl(t.meta.initialValue.refinedValue)){S[t.id]=t.meta.initialValue.refinedValue;return}if(r){nf(t,"repeating")&&!t.meta?.repeat?.isClone&&a.push(t);let D=null;try{D=await r.getInitialValue(t,n,e),t.meta.initialValue.refinedValue=D}catch(e){console.error(e)}if("obsGroup"===t.type)return;if(nl(D)?nl(t.questionOptions.defaultValue)?S[t.id]=SK[t.questionOptions.rendering]??"":S[t.id]=Sk(t):S[t.id]=D,t.questionOptions.calculate?.calculateExpression)try{await SZ(t,S,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${t.type}`)}));let r=await Promise.all(a.flatMap(t=>SE(t,n,S,e))).then(e=>e.flat());t.push(...r)}else{let n=t.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),a=[];await Promise.all(n.map(async n=>{let t=D[n.type];if(S[n.id]=SK[n.questionOptions.rendering]??null,nl(S[n.id])&&SY.includes(n.type))try{S[n.id]=await t.getInitialValue(n,null,e)}catch(e){console.error(e)}n.questionOptions.defaultValue&&(S[n.id]=Sk(n)),n.questionOptions.calculate?.calculateExpression&&a.push(n)})),await Promise.all(a.map(async n=>{try{await SZ(n,S,e)}catch(e){console.error(e)}}))}return S}async loadDependencies(e,n){let{patient:t,formJson:D}=e,S=await (0,nj.getPreviousEncounter)(t?.id,D.encounterType);return n(e=>({...e,previousDomainObjectValue:S})),e}async getHistoricalValue(e,n){let{formFields:t,sessionMode:D,patient:S,methods:{getValues:a},formFieldAdapters:r,previousDomainObjectValue:o,visit:i}=n,g={value:e,type:"field"},s=r[e.type];if(e.historicalExpression){let n=await n4(e.historicalExpression,g,t,a(),{mode:D,patient:S,previousEncounter:o,visit:i});return n?tr(e,n):null}return o&&e.questionOptions.enablePreviousValue?await s.getPreviousValue(e,o,n):null}}async function SZ(e,n,t){let{formFields:D,sessionMode:S,patient:a,visit:r}=t,o=e.questionOptions.calculate.calculateExpression,i={value:e,type:"field"},g={mode:S,patient:a,visit:r},s=await n4(o,i,D,n,g);nl(s)||(n[e.id]=s)}function SJ(e,n){let t=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function D(e,D){for(let S of e.matchAll(t)){let e=S[2];n.has(e)&&console.error(`The calculateExpression for the field '${D}' 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&&D(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 SX=t(77541);function S1(e){let{formFields:n,formFieldValidators:t,patient:D,sessionMode:S,addInvalidField:a,updateFormField:r,methods:{getValues:o,trigger:i}}=e,g=o();return 0===n.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(o=>{let i=t[o.type];if(i){let t=i.validate(e,g[e.id],{formFields:n,values:g,expressionContext:{patient:D,mode:S},...o}).filter(e=>"error"===e.resultType);return t.length&&(e.meta.submission={...e.meta.submission,errors:t},r(e),a(e)),t}})).filter(e=>!!e).length}async function S0(e,n,t,D,S){return Promise.all(e.map(async({postAction:e,config:a,actionId:r,enabled:i})=>{try{let S=[];if(n)if(n.forEach(e=>{e?.data&&S.push(e.data),e?.uuid&&S.push(e)}),S.length)(!i||(0,SX.g)(i,S))&&await e.applyAction({patient:t,sessionMode:D,encounters:S},a);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,tl.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 S2({patientUuid:e,formUuid:n,setIsSubmitting:t,setIsValidating:D}){let{t:S}=(0,nD.useTranslation)();(0,g.useEffect)(()=>{let a=a=>{let{formUuid:r,patientUuid:o,action:i}=a.detail;if(!i||!r||!o)return void(0,tl.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(i){case"onSubmit":t(!0);break;case"validateForm":D(!0);break;default:(0,tl.N)(Error(`Unsupported form action: "${i}"`),S("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",a),()=>{window.removeEventListener("ampath-form-action",a)}},[t,D,n,e])}function S3(e){let[n,t]=(0,g.useState)([]);return(0,g.useEffect)(()=>{let n=[];e?.length&&e.map(e=>{let t="string"==typeof e?e:e.actionId;a5(t)?.then(D=>n.push({postAction:D,config:e.config,actionId:t,enabled:e.enabled}))}),t(n)},[e]),n}let S4=(0,g.createContext)(void 0),S8=({patient:e,patientUUID:n,sessionMode:t,sessionDate:D,formJson:S,workspaceLayout:a,location:r,provider:i,visit:l,isFormExpanded:d=!0,children:c,formSubmissionProps:u,hideFormCollapseToggle:f,handleConfirmQuestionDeletion:h,setIsFormDirty:p})=>{let{t:m}=(0,nD.useTranslation)(),y=(0,g.useRef)(),b=(0,g.useRef)({}),v=(0,o.useLayoutType)(),{isSubmitting:$,setIsSubmitting:w,onSubmit:_,onError:A,handleClose:M}=u,[x,L]=(0,g.useState)(!1),C=S3(S.postSubmissionActions),k=new AbortController,E=(0,g.useCallback)((e,n,t)=>{n?b.current[e]=t:y.current=t},[]),T=(0,g.useRef)({EncounterFormProcessor:SQ}),O=(0,g.useCallback)(()=>{let e=[y.current,...Object.values(b.current)],n=e.every(e=>S1(e));return{forms:e,isValid:n}},[]);return S2({patientUuid:n,formUuid:S?.uuid,setIsSubmitting:w,setIsValidating:L}),(0,g.useEffect)(()=>{x&&(O(),L(!1))},[x,O]),(0,g.useEffect)(()=>{if($){let{forms:n,isValid:D}=O();D?Promise.all(n.map(e=>e.processor.processSubmission(e,k))).then(async n=>{u.setIsSubmitting(!1),"edit"===t?(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}),C&&await S0(C,n,e,t,m),f(),_?_(n):M()}).catch(e=>{w(!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)}):w(!1)}return()=>{k.abort()}},[$,O]),s().createElement(S4.Provider,{value:{patient:e,sessionMode:t,sessionDate:D,formJson:S,formProcessors:T.current,layoutType:v,workspaceLayout:a,visit:l,location:r,provider:i,isFormExpanded:d,registerForm:E,handleConfirmQuestionDeletion:h,setIsFormDirty:p}},T.current&&c)},S9=()=>{let e=(0,g.useContext)(S4);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e};var S7=t(49530),S6={};S6.styleTagTransform=_(),S6.setAttributes=b(),S6.insert=m().bind(null,"head"),S6.domAPI=h(),S6.insertStyleElement=$(),u()(S7.A,S6);let S5=S7.A&&S7.A.locals?S7.A.locals:void 0,ae=function({question:e,rows:n,handleDelete:t,handleAdd:D,questionIndex:S}){let{t:a}=(0,nD.useTranslation)();return s().createElement("div",{className:S5.actionButtons},S>0&&s().createElement(L.$nd,{className:S5.button,kind:"danger",onClick:t},s().createElement("span",null,a("remove","Remove"))),S===n.length-1&&s().createElement(L.$nd,{className:S5.button,iconDescription:a("add","Add"),kind:"primary",disabled:DX(e.questionOptions.repeatOptions?.limit,n.length),onClick:D},s().createElement("span",null,e.questionOptions.repeatOptions?.addText||a("add","Add"))))};var an=t(54357),at={};at.styleTagTransform=_(),at.setAttributes=b(),at.insert=m().bind(null,"head"),at.domAPI=h(),at.insertStyleElement=$(),u()(an.A,at);let aD=an.A&&an.A.locals?an.A.locals:void 0,aS={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function aa(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function ar(e){return{...e,questionOptions:{...e.questionOptions,rendering:aS[e.type]||null}}}let ao=({field:e})=>{let[n,t]=(0,g.useState)([]),D=ty(),{handleConfirmQuestionDeletion:S}=S9(),{patient:a,sessionMode:r,formFieldAdapters:i,formFields:l,methods:{getValues:d,setValue:c,unregister:u},addFormField:f,removeFormField:h,deletedFields:p,setDeletedFields:m,visit:y}=D;(0,g.useEffect)(()=>{t(l.filter(n=>n.questionOptions.concept===e.questionOptions.concept&&n.id.startsWith(e.id)&&!n.meta?.repeat?.wasDeleted))},[l,e]);let b=(0,g.useCallback)(S=>{let o=[];function g(e){e.hide?.hideWhenExpression&&(e.isHidden=n3(e.hide.hideWhenExpression,{value:e,type:"field"},[...l,...o],d(),{mode:r,patient:a,visit:y})),e.questionOptions.calculate?.calculateExpression&&n4(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...l,...o],d(),{mode:r,patient:a,visit:y}).then(n=>{nl(n)||(c(e.id,n),i[e.type]?.transformFieldValue(e,n,D))})}let s=DZ(e,null,S);o.push(s),"obsGroup"===s.type&&s.questions?.forEach(e=>{o.push(e)}),o.forEach(e=>{g(e),f(e)}),t([...n,s])},[l,e,n,D]),v=e=>{e.meta.initialValue?.omrsObject?(i[e.type]?.transformFieldValue(e,null,D),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(n=>{n.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},i[n.type]?.transformFieldValue(n,null,D)})):(nh(e),u(e.id),e.questions?.forEach(e=>u(e.id))),t(n.filter(n=>n.id!==e.id)),m([...p,e]),h(e.id)},$=e=>{if(S&&"function"==typeof S){let n=S(e);n&&"function"==typeof n.then&&"function"==typeof n.catch?n.then(()=>v(e)).catch(()=>(0,o.createErrorHandler)()):"boolean"==typeof n?n&&v(e):v(e)}else v(e)},w=(0,g.useMemo)(()=>n.map((t,D)=>{let S=s().createElement(tP,{fieldId:t.id,valueAdapter:i[t.type],repeatOptions:{targetRendering:ar(t).questionOptions.rendering}});return s().createElement("div",{key:t.id+"_wrapper"},0!==D&&s().createElement("div",null,s().createElement("hr",{className:aD.divider})),s().createElement("div",{className:aD.nodeContainer},S),!ny(r)&&s().createElement(ae,{question:t,rows:n,questionIndex:D,handleDelete:()=>{$(t)},handleAdd:()=>{b(n.reduce((n,t)=>{let D=Number(t.id.slice(e.id.length+1));return Number.isFinite(D)?Math.max(n,D):n},0)+1)}}))}),[n]);return!e.isHidden&&w&&aa(e)?s().createElement(s().Fragment,null,s().createElement("div",null,w)):null};var ai=t(92137),ag=t(18401),as={};as.styleTagTransform=_(),as.setAttributes=b(),as.insert=m().bind(null,"head"),as.domAPI=h(),as.insertStyleElement=$(),u()(ag.A,as);let al=ag.A&&ag.A.locals?ag.A.locals:void 0;var ad=t(10272),ac={};ac.styleTagTransform=_(),ac.setAttributes=b(),ac.insert=m().bind(null,"head"),ac.domAPI=h(),ac.insertStyleElement=$(),u()(ad.A,ac);let au=ad.A&&ad.A.locals?ad.A.locals:void 0;var af=t(59184),ah=t(63654);function ap({bytesContentFamily:e,removeFileCb:n,...t}){let D=(0,g.useMemo)(()=>{switch(e){case"image":return am;case"pdf":return ay;default:return ab}},[]);return s().createElement("div",{className:au.thumbnail},s().createElement(D,t),s().createElement(L.$nd,{kind:"ghost",className:au.removeButton,onClick:n},s().createElement(af.R9,{size:16,className:au.closeIcon})))}function am(e){return s().createElement("img",{className:au.imageThumbnail,src:e.src,alt:e.title})}function ay(e){return s().createElement("div",{className:au.pdfThumbnail,role:"button",tabIndex:0},s().createElement(ah.aD,{size:24}))}function ab(e){return s().createElement("div",{className:au.pdfThumbnail,role:"button",tabIndex:0},s().createElement(ah.WZ,{size:24}))}let av=[{name:"drug",baseControlComponent:DW},{name:"problem",baseControlComponent:DW},{name:"encounter-provider",baseControlComponent:DW},{name:"encounter-location",baseControlComponent:DW},{name:"select-concept-answers",baseControlComponent:DW},{name:"encounter-role",baseControlComponent:DW}],a$=[{name:"text",component:DO},{name:"textarea",component:DC},{name:"select",component:DA},{name:"checkbox",component:Dc},{name:"radio",component:Dv},{name:"date",component:Dn},{name:"datetime",component:Dn},{name:"number",component:Dp},{name:"content-switcher",component:t7},{name:"toggle",component:Dj},{name:"workspace-launcher",component:DY},{name:"group",component:tV},{name:"repeating",component:ao},{name:"markdown",component:Dg},{name:"fixed-value",component:Dt},{name:"ui-select-extended",component:DW},{name:"file",component:({field:e,value:n,setFieldValue:t})=>{let{t:D}=(0,nD.useTranslation)(),{sessionMode:S}=ty(),a="tablet"===(0,o.useLayoutType)(),r=(0,g.useCallback)(()=>{let D=(0,o.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),t([...n||[],e]),D(),Promise.resolve()),closeModal:()=>{D()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[n,e]),i=(0,g.useCallback)(e=>{let D=[...n],S=D[e];S.uuid?D[e]={...S,voided:!0}:D.splice(e,1),t(D)},[n]);return ny(S)&&!n?s().createElement(tZ,{label:D(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):s().createElement("div",null,s().createElement("div",{className:d()(al.label,"cds--label")},s().createElement(t9,{field:e})),!ny(S)&&s().createElement("div",null,s().createElement(L.$nd,{className:al.uploadButton,kind:a?"ghost":"tertiary",onClick:r,renderIcon:e=>s().createElement(ai.OM,{size:16,...e})},e.questionOptions.buttonLabel?D(e.questionOptions.buttonLabel):D("addFile","Add file"))),s().createElement("div",{className:al.thumbnailGrid},n&&n.filter(e=>!e.voided).map((e,n)=>s().createElement("div",{className:al.thumbnailContainer},s().createElement(ap,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>i(n)})))))}},...DF.map(e=>({name:e.name,component:av.find(n=>n.name===e.name).baseControlComponent}))],aw={validate:(e,n,t)=>{let D=new Date,S=n?[]:ng.validate(e,n);return S.length?S:n&&!(0,th.H)(t?.allowFutureDates)&&n.getTime&&n.getTime()>D.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},a_=[{name:"default_value",component:St},{name:"form_field",component:ng},{name:"date",component:aw},{name:"js_expression",component:{validate:function(e,n,t){let D="value.invalid",S="Invalid value",a="Field has warnings";return t.expressionContext.myValue=n,Object.keys(t).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(r=>{let o="failsWhenExpression"===r;return n3(t[r],{value:e,type:"field"},t.formFields,{...t.values,[e.id]:n},t.expressionContext)?[{resultType:o?"error":"warning",errCode:o?D:null,message:t.message?t.message:o?S:a}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,n,t){let{referenceQuestionId:D,referenceQuestionAnswers:S,values:a,formFields:r,message:o}=t,i=a[r.find(e=>e.id===D).id];return nl(n)||S.includes(i)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:o}]}}}];function aA(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class aM{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 t=n.split("?");n=`${t[0]}/${e}?${t[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){aA(this,"url",void 0),this.url=e}}class ax extends aM{fetchData(e,n){if(nl(n?.class)&&nl(n?.concept)&&!n?.useSetMembersByConcept&&nl(e))return Promise.resolve([]);let t=`${o.restBaseUrl}/concept?name=&searchType=fuzzy&v=custom:(uuid,display,conceptClass:(uuid,display))`;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=");return t=`${D[0]}/${n.concept}?v=custom:(uuid,setMembers:(uuid,display))`,(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)}constructor(){super(`${o.restBaseUrl}/concept?v=custom:(uuid,display,conceptClass:(uuid,display))`)}}class aL extends aM{fetchData(e,n,t){let D=this.url,S=D.split("?");return n?.tag&&(D=`${S[0]}?tag=${n.tag}&${S[1]}`),t&&(D=`${S[0]}/${t}?${S[1]}`),(0,o.openmrsFetch)(e?`${D}&q=${e}`:D).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${o.restBaseUrl}/location?v=custom:(uuid,display)`)}}class aC extends aM{async fetchData(e,n){let t="v=custom:(uuid,display)",D=`${o.restBaseUrl}/provider?${t}`,{data:S}=await (0,o.openmrsFetch)(e?`${D}&q=${e}`:D);return S?.results}constructor(){super(null)}}class ak extends aM{fetchSingleItem(e){return(0,o.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,n){let t=this.buildUrl(n.referencedValue||n.concept);return(0,o.openmrsFetch)(t).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 aE extends aM{async fetchData(e,n){let t="v=custom:(uuid,display,name)",D=`${o.restBaseUrl}/encounterrole?${t}`,{data:S}=await (0,o.openmrsFetch)(e?`${D}&q=${e}`:D);return S?.results}constructor(){super(null)}}let aT=[{name:"location_datasource",component:new aL},{name:"drug_datasource",component:new ax},{name:"problem_datasource",component:new ax},{name:"select_concept_answers_datasource",component:new ak},{name:"provider_datasource",component:new aC},{name:"encounter_role_datasource",component:new aE}],aO=[{name:"ProgramEnrollmentSubmissionAction",load:()=>t.e("4831").then(t.bind(t,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>t.e("7484").then(t.bind(t,26679))}];function aR(e,n,t){if("programState"===e.type){let e=t.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},t.meta=e}try{aN(e),aP(e),aF(e),aU(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>aR(e,n,t)):e.questions.forEach(e=>aR(e,n,t))),e.meta.pageId=n.id}catch(e){console.error(e)}}function aI(e){let n=[];return e?.forEach(e=>{if(n.push(e),"inlineDate"!==e.type&&(0,th.H)(e.questionOptions?.showDate)){let t={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(t)}}),n}function aN(e){aj(e,"readonly"),aj(e,"required"),aj(e,"unspecified"),aj(e.questionOptions,"disallowDecimals"),aj(e.questionOptions,"isSearchable"),aj(e.questionOptions,"isTransient"),aj(e.questionOptions,"enablePreviousValue"),aj(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function aj(e,n){if(e&&"string"==typeof e[n]){let t=e[n].trim().toLowerCase();("true"===t||"false"===t)&&(e[n]="true"===t)}return e}function aP(e){!nf(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 aF(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=nf(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":aq(e)}}function aU(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":aB(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":aV(e);break;case"repeating":case"group":az(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 aB(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,th.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),nf(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function az(e){nf(e,"group")&&e.questions?.length&&e.questions.forEach(az),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function aV(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function aH(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 aW(e){let n=[];return e?.forEach(e=>{if(n.push(e),"obsComment"!==e.type&&(0,th.H)(e.questionOptions?.showComment)){let t={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(t)}}),n}function aq(e){("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type)&&(e.questionOptions.datasource={name:"problem_datasource",config:{class:e.questionOptions.diagnosis?.conceptClasses}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource)}function aG(e,n){Object.entries(n).forEach(([n,t])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===n?e.questionOptions.defaultValue=t:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===n&&(e.questionOptions.defaultValue=t)})})})})})}let aK=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,n)=>(aj(e,"readonly"),e.pages.forEach((n,t)=>{let D=n.label??"";n.id=`page-${D.replace(/\s/g,"")}-${t}`,aj(n,"readonly"),n.sections&&n.sections.forEach(t=>{t.questions=aI(t.questions),t.questions=aW(t.questions),aj(t,"readonly"),aj(t,"isExpanded"),t?.questions?.forEach((t,D)=>aR(t,n,e))})}),n&&"object"==typeof n&&aG(e,n),e.meta?.programs&&aH(e),e)}}];function aY(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].provider}return null}function aQ(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].encounterRole}return null}function aZ(e,n){return D7(e,n)||!nl(e.meta.submission.newValue.obsDatetime)}let aJ=[{type:"obs",component:D0},{type:"control",component:{getDisplayValue:(e,n)=>n,transformFieldValue:function(e,n,t){return null},getInitialValue:function(e,n,t){return null},getPreviousValue:function(e,n,t){return null},tearDown:function(){}}},{type:"obsGroup",component:D0},{type:"testOrder",component:Sr},{type:"programState",component:{transformFieldValue:function(e,n,t){if(nh(e),e.meta?.initialValue?.omrsObject?.uuid===n||nl(n))return null;e.meta.submission.newValue={state:n,startDate:nr()().format()}},getInitialValue:function(e,n,t){let D=t.customDependencies.patientPrograms?.find(n=>n.program.uuid===e.questionOptions.programUuid);if(D?.states?.length>0){let n=D.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,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){return n&&n.location?.uuid?n.location.uuid:t.location.uuid},getPreviousValue:function(e,n,t){let D=n??t.previousDomainObjectValue;return{value:D?.location?.uuid,display:D?.location?.name}},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){let D=n??t.previousDomainObjectValue;return aY(D)?.uuid},getPreviousValue:function(e,n,t){let D=aY(n??t.previousDomainObjectValue);return{value:D?.uuid,display:D?.name}},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){let D=n??t.domainObjectValue;return D?aQ(D)?.uuid:t.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,n,t){let D=n??t.previousDomainObjectValue;if(D){let e=aQ(D);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,t){let D=t.getFormField(e.meta.targetField),S=t.methods.getValues(D.id),a=D.meta.initialValue?.omrsObject;if(D.meta.submission?.newValue)nl(n)&&!aZ(D,S)?D.meta.submission.newValue=null:D.meta.submission.newValue.comment=n;else if(!nm(D)&&a){if(nl(n)&&nl(a.comment))return null;let e=D8(D,S);D.meta.submission={newValue:{...e,comment:n}}}return null},getInitialValue:function(e,n,t){if(n??t.domainObjectValue){let n=e.id.split("_obs_comment")[0],D=t.formFields.find(e=>e.id===n);return D?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){return n?.encounterDatetime?new Date(n.encounterDatetime):t.sessionDate},getPreviousValue:function(e,n,t){if(n?.encounterDatetime){let t=new Date(n.encounterDatetime);return{value:t,display:this.getDisplayValue(e,t)}}return null},getDisplayValue:function(e,n){return(0,o.formatDate)(n)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,n,t){let D=t.getFormField(e.meta.targetField),S=t.methods.getValues(D.id),a=n instanceof Date?(0,o.toOmrsIsoString)(n):n;if(D.meta.submission?.newValue)nl(a)&&!aZ(D,S)?D.meta.submission.newValue=null:D.meta.submission.newValue.obsDatetime=a;else if(!nm(D)&&D.meta.initialValue?.omrsObject){if(nl(n)&&nl(D.meta.initialValue.omrsObject?.obsDatetime))return null;let e=D8(D,S);D.meta.submission={newValue:{...e,obsDatetime:a}}}},getInitialValue:function(e,n,t){if(n??t.domainObjectValue){let n=e.id.split("_inline_date")[0],D=t.formFields.find(e=>e.id===n),S=D?.meta.initialValue?.omrsObject;if(S?.obsDatetime)return(0,o.parseDate)(S.obsDatetime)}return null},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?(0,o.formatDate)(n):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,n,t){return(nh(e),e.meta.initialValue?.refinedValue===n||nl(n))?null:(e.meta.submission.newValue={identifier:n,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:t.location},e.meta.submission.newValue)},getInitialValue:function(e,n,t){let D=t.patient?.identifier?.find(n=>n.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:D,refinedValue:D?.value}},D?.value},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,n,t){return(nh(e),e.meta.initialValue?.refinedValue===n||nl(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,t){let D=t.patient?.extension?.find(n=>n.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:D,refinedValue:D?.valueString||D?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"diagnosis",component:Ss}],aX={},a1={},a0={},a2={},a3={},a4={};async function a8(e){if(a1[e])return a1[e];let n=a$.find(n=>n.name===e||n?.alias===e)?.component;if(!n){let t=await rD().controls.find(n=>n.name===e||n?.alias===e)?.load?.();n=t?.default}return a1[e]=n,n}function a9(e){return rS(e)&&!nf(e,"file")?(e.disabled=!0,e.isDisabled=!0,a8("text")):a8(e.questionOptions.rendering)}async function a7(e){if(a0[e])return a0[e];let n=aJ.find(n=>n.type===e)?.component;if(!n){let t=await rD().fieldValueAdapters.find(n=>n.type===e)?.load?.();n=t?.default}return a0[e]=n,n}async function a6(){let e=[],n=a4;if(Object.keys(n).length)return Object.values(n);let t=rD().formSchemaTransformers||[];return e.push(...(await Promise.all(t.map(async e=>{let n=await e.load?.();return n?.default}))).filter(e=>void 0!==e)),e.push(...aK.map(e=>e.component)),e.forEach(e=>{a4[aK.find(n=>n.component===e).name]=e}),e}async function a5(e){let n=a2[e];if(n)return n;let t=aO.find(n=>n.name===e);if(t){let n=t.load,D=await n();return a2[e]=D.default,D.default}let D=rD().postSubmissionActions.find(n=>n.name===e);if(D){let n=D.load,t=await n();return a2[e]=t.default,t.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function re(e){if(aX[e])return aX[e];let n=a_.find(n=>n.name===e)?.component;if(!n){let t=await rD().fieldValidators.find(n=>n.name===e)?.load?.();n=t?.default}return aX[e]=n,n}async function rn(e){if(a3[e])return a3[e];let n=aT.find(n=>n.name===e)?.component;if(!n){let t=DU(e);if(t)n=aT.find(e=>e.name===t.datasource.name)?.component;else{let t=await rD().dataSources.find(n=>n.name===e)?.load?.();if(!t)throw Error("Datasource not found");n=t.default}}return a3[e]=n,n}function rt(){return rD().expressionHelpers}function rD(){return(0,o.getGlobalStore)(i.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function rS(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function ra(e,n,t,D,S){let[a,r]=(0,g.useState)(null),[o,i]=(0,g.useState)(rs(e,n));return(0,g.useEffect)(()=>{let a=new AbortController,o=e=>{if(e?.translations){let n=window.i18next.language;window.i18next.addResourceBundle(n,SI.L,e.translations,!0,!0)}r(e)};return rr(e,n,D,S).then(e=>{o({...e,encounter:t})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),i(Error("Error loading form JSON: "+e.message)))}),()=>{a.abort()}},[D,e,n,t]),{formJson:a,isLoading:!a&&!o,formError:o}}async function rr(e,n,t,D){let S=await (0,nj.fetchOpenMRSForm)(e),a=await (0,nj.fetchClobData)(S),r=await a6(),o=a?{...a,uuid:S.uuid}:rd(n),i=ro(o);rg(o,await ri(i,t));let g=rf(o),s=await rh(g),l=g.reduce((e,n)=>(e[n.formName]=n.alias,e),{});return rm(o,rp(s),l),rl(o,r,t,D)}function ro(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function ri(e,n){return Promise.all(e.map(e=>rr(e,null,n)))}function rg(e,n){n.forEach(n=>{let t=e.pages.find(e=>e.subform?.name===n.name);t&&(t.subform.form=n)})}function rs(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 rl(e,n=[],t,S){return rc(e,t),n.reduce((e,n)=>n.transform(e,S),e),ru(e),D(t,e)}function rd(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function rc(e,n){for(let t=e.pages.length-1;t>=0;t--){let D=e.pages[t];(0,th.H)(D.isSubform)&&!(0,th.H)(D.isHidden)&&D.subform?.form?.encounterType===e.encounterType&&(D.subform.form.pages.filter(e=>!(0,th.H)(e.isSubform)),e.pages.splice(t,1,...rl(D.subform.form,[],n).pages))}}function ru(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function rf(e){let n=e?.referencedForms;return n||[]}async function rh(e){return Promise.all(e.map(e=>rr(e.formName,null,null)))}function rp(e){let n=new Map;return e.forEach(e=>{n.set(e.name,e)}),n}function rm(e,n,t){n.forEach((n,D)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===D||e.reference.form===t[D])){let t=ry(e,n);Object.assign(e,t)}})})})}function ry(e,n){let t,D=n.pages.filter(n=>n.label===e.reference.page);if(D.length>0){let n=D[0].sections.filter(n=>n.label===e.reference.section);n.length>0&&(t=n[0])}return rb(t,e.reference)}function rb(e,n){if(n?.excludeQuestions){let t=n.excludeQuestions;e.questions=e.questions.filter(e=>!t.includes(e.id))}return e}var rv=t(76922);function r$(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class rw{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(){r$(this,"scrollablePagesSubject",new rv.BehaviorSubject([])),r$(this,"pagesWithErrorsSubject",new rv.BehaviorSubject(new Set)),r$(this,"activePagesSubject",new rv.BehaviorSubject(new Set)),r$(this,"evaluatedPagesVisibilitySubject",new rv.BehaviorSubject(null))}}let r_=new rw,rA=new Set;function rM(e){e&&Object.values(e).forEach(e=>{rA.add(e)})}function rx(){rA.forEach(e=>{try{e.tearDown()}catch(e){}}),rA.clear(),r_.clear()}function rL(e){let[n,t]=(0,g.useState)(void 0),D=(0,g.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),S=(0,g.useCallback)(e=>{t(e.detail.value)},[]);return(0,g.useEffect)(()=>{let n=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(n)},[e]),(0,g.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",S),()=>{window.removeEventListener("openmrs:form-collapse-toggle",S)}),[]),{isFormExpanded:n,hideFormCollapseToggle:D}}let rC=26.25,rk=32.25,rE=48.25;function rT(e){let[n,t]=(0,g.useState)(0),D=(0,g.useMemo)(()=>n<=rC?"narrow":n<=rk?"wider":n<=rE?"extra-wide":"ultra-wide",[n]);return(0,g.useLayoutEffect)(()=>{let n=()=>{let n=e.current?.parentElement?.offsetWidth,D=parseInt(getComputedStyle(document.documentElement).fontSize);n&&t(nw(n,D))};n();let D=new ResizeObserver(e=>{n()});return e.current?.parentElement&&D.observe(e.current?.parentElement),()=>{D.disconnect()}},[e]),D}let rO=()=>{let[e,n]=(0,g.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,g.useEffect)(()=>{let e=[r_.getScrollablePagesObservable().subscribe(e=>{n(n=>({...n,pages:e,hasMultiplePages:e.length>1}))}),r_.getPagesWithErrorsObservable().subscribe(e=>{n(n=>({...n,pagesWithErrors:Array.from(e)}))}),r_.getActivePagesObservable().subscribe(e=>{n(n=>({...n,activePages:Array.from(e)}))}),r_.getEvaluatedPagesVisibilityObservable().subscribe(e=>{n(n=>({...n,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function rR(e){let n=new Date,t=n.getFullYear()-e.getFullYear();return n.getMonth()<e.getMonth()||n.getMonth()===e.getMonth()&&n.getDate()<e.getDate()?t-1:t}let rI={female:"F",male:"M",other:"O",unknown:"U"},rN=e=>{let{patient:n,isLoading:t,error:D}=(0,o.usePatient)(e);return n&&!t&&(n.age=rR(new Date(n?.birthDate)),n.sex=rI[n.gender]??"U"),{patient:n,isLoadingPatient:t,patientError:D}},rj=(e,n,t)=>{let[D,S]=(0,g.useState)(!1),[a,r]=(0,g.useState)(""),{loadDependencies:o}=e;return(0,g.useEffect)(()=>{let e=!1;return o&&(S(!0),o(n,t).then(()=>{e||S(!1)}).catch(n=>{e||(r(n),(0,tl.N)(n,"Encountered error while loading dependencies"))})),()=>{e=!0}},[o]),{isLoading:D,error:a}},rP=(e,n,t)=>{let[D,S]=(0,g.useState)(!0),[a,r]=(0,g.useState)({}),[o,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{e&&!n&&t.formFields?.length&&Object.keys(t.formFieldAdapters).length&&!Object.keys(a).length&&e.getInitialValues(t).then(e=>{r(e),S(!1)}).catch(e=>{console.error(e),i(e),S(!1)})},[e,n,t,a]),{isLoadingInitialValues:D,initialValues:a,error:o}};var rF=t(20767),rU={};rU.styleTagTransform=_(),rU.setAttributes=b(),rU.insert=m().bind(null,"head"),rU.domAPI=h(),rU.insertStyleElement=$(),u()(rF.A,rU);let rB=rF.A&&rF.A.locals?rF.A.locals:void 0,rz=({section:e})=>{let{formFieldAdapters:n}=ty(),t=(0,g.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return s().createElement("div",{className:rB.section},e.questions.map(e=>n[e.type]?s().createElement("div",{key:`${t}-${e.id}`,className:rB.sectionBody},s().createElement(tP,{key:e.id,fieldId:e.id,valueAdapter:n[e.type]})):null))};var rV=t(20594),rH=!!("u">typeof window&&window.document&&window.document.createElement);function rW(){if(!rH||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),t=function(){};window.addEventListener("testPassiveEventSupport",t,n),window.removeEventListener("testPassiveEventSupport",t,n)}catch(e){}return e}var rq=void 0;function rG(){return void 0===rq&&(rq=rW()),rq}function rK(e){if(e)return rG()?e:!!e.capture}function rY(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function rQ(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function rZ(e){this.target=e,this.events={}}rZ.prototype.getEventHandlers=function(){return function(e,n){var t=String(e)+" "+String(rY(n));return this.events[t]||(this.events[t]={handlers:[],handleEvent:void 0},this.events[t].nextHandlers=this.events[t].handlers),this.events[t]}}(),rZ.prototype.handleEvent=function(){return function(e,n,t){var D=this.getEventHandlers(e,n);D.handlers=D.nextHandlers,D.handlers.forEach(function(e){e&&e(t)})}}(),rZ.prototype.add=function(){return function(e,n,t){var D=this,S=this.getEventHandlers(e,t);rQ(S),0===S.nextHandlers.length&&(S.handleEvent=this.handleEvent.bind(this,e,t),this.target.addEventListener(e,S.handleEvent,t)),S.nextHandlers.push(n);var a=!0;return function(){return function(){if(a){a=!1,rQ(S);var r=S.nextHandlers.indexOf(n);S.nextHandlers.splice(r,1),0===S.nextHandlers.length&&(D.target&&D.target.removeEventListener(e,S.handleEvent,t),S.handleEvent=void 0)}}}()}}();var rJ="__consolidated_events_handlers__";function rX(e,n,t,D){e[rJ]||(e[rJ]=new rZ(e));var S=rK(D);return e[rJ].add(n,t,S)}var r1=t(23286);function r0(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function r2(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function r3(e,n){var t=r2(e);if("number"==typeof t)return t;var D=r0(e);if("number"==typeof D)return D*n}var r4="above",r8="inside",r9="below",r7="invisible";function r6(e){return"string"==typeof e.type}var r5="<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 oe(e,n){if(e&&!r6(e)&&!n)throw Error(r5)}function on(e){return e.viewportBottom-e.viewportTop==0?r7:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?r8:e.viewportBottom<e.waypointTop?r9:e.waypointTop<e.viewportTop?r4:r7}var ot=[];function oD(e){ot.push(e),r||(r=setTimeout(function(){var e;for(r=null;e=ot.shift();)e()},0));var n=!0;return function(){if(n){n=!1;var t=ot.indexOf(e);-1!==t&&(ot.splice(t,1),!ot.length&&r&&(clearTimeout(r),r=null))}}}function oS(e){return"window"===e?t.g.window:e}var oa="u">typeof window,or={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},oo=function(e){function n(n){var t;return(t=e.call(this,n)||this).refElement=function(e){t._ref=e},t}(0,rV.A)(n,e);var t=n.prototype;return t.componentDidMount=function(){var e=this;oa&&(this.cancelOnNextTick=oD(function(){e.cancelOnNextTick=null;var n=e.props,t=n.children;n.debug,oe(t,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=rX(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=rX(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},t.componentDidUpdate=function(){var e=this;oa&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=oD(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},t.componentWillUnmount=function(){oa&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},t._findScrollableAncestor=function(){var e=this.props,n=e.horizontal,t=e.scrollableAncestor;if(t)return oS(t);for(var D=this._ref;D.parentNode&&(D=D.parentNode)!==document.body;){var S=window.getComputedStyle(D),a=(n?S.getPropertyValue("overflow-x"):S.getPropertyValue("overflow-y"))||S.getPropertyValue("overflow");if("auto"===a||"scroll"===a||"overlay"===a)return D}return window},t._handleScroll=function(e){if(this._ref){var n=this._getBounds(),t=on(n),D=this._previousPosition,S=this.props,a=(S.debug,S.onPositionChange),r=S.onEnter,o=S.onLeave,i=S.fireOnRapidScroll;if(this._previousPosition=t,D!==t){var g={currentPosition:t,previousPosition:D,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom};a.call(this,g),t===r8?r.call(this,g):D===r8&&o.call(this,g);var s=D===r9&&t===r4,l=D===r4&&t===r9;i&&(s||l)&&(r.call(this,{currentPosition:r8,previousPosition:D,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}),o.call(this,{currentPosition:t,previousPosition:r8,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}))}}},t._getBounds=function(){var e,n,t=this.props,D=t.horizontal;t.debug;var S=this._ref.getBoundingClientRect(),a=S.left,r=S.top,o=S.right,i=S.bottom,g=D?a:r,s=D?o:i;this.scrollableAncestor===window?(e=D?window.innerWidth:window.innerHeight,n=0):(e=D?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,n=D?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var l=this.props,d=l.bottomOffset,c=r3(l.topOffset,e),u=r3(d,e),f=n+e;return{waypointTop:g,waypointBottom:s,viewportTop:n+c,viewportBottom:f-u}},t.render=function(){var e=this,n=this.props.children;if(!n)return s().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(r6(n)||(0,r1.isForwardRef)(n)){var t=function(t){e.refElement(t),n.ref&&("function"==typeof n.ref?n.ref(t):n.ref.current=t)};return s().cloneElement(n,{ref:t})}return s().cloneElement(n,{innerRef:this.refElement})},n}(s().PureComponent);oo.above=r4,oo.below=r9,oo.inside=r8,oo.invisible=r7,oo.defaultProps=or,oo.displayName="Waypoint";var oi=t(38374),og={};og.styleTagTransform=_(),og.setAttributes=b(),og.insert=m().bind(null,"head"),og.domAPI=h(),og.insertStyleElement=$(),u()(oi.A,og);let os=oi.A&&oi.A.locals?oi.A.locals:void 0;function ol({section:e,sectionIndex:n,visibleSections:t,isFormExpanded:D}){let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)(D);return(0,g.useEffect)(()=>{r(D)},[D]),s().createElement(L.AsP,{title:S(e.label),open:a,className:d()(os.sectionContainer,{[os.firstSection]:0===n,[os.lastSection]:n===t.length-1})},s().createElement("div",{className:os.formSection},s().createElement(rz,{section:e})))}let od=function({page:e,isFormExpanded:n}){let{t}=(0,nD.useTranslation)(),[D,S]=(0,g.useState)(!1),a=(0,g.useMemo)(()=>e.sections.filter(e=>{let n=e.questions.some(e=>!(0,th.H)(e.isHidden));return!(0,th.H)(e.isHidden)&&n}),[e.sections]),r=()=>S(!D);return(0,g.useEffect)(()=>(S(!n),()=>{r_.removeInactivePage(e.id)}),[n]),s().createElement("div",null,s().createElement(oo,{key:e.id,onEnter:()=>r_.addActivePage(e.id),onLeave:()=>r_.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},s().createElement("div",{id:e.id,className:os.pageContent},s().createElement("div",{className:os.pageHeader,onClick:r},s().createElement("p",{className:os.pageTitle},t(e.label),s().createElement("span",{className:os.collapseIconWrapper},D?s().createElement(o.ChevronDownIcon,{className:os.collapseIcon,"aria-label":"Expand"}):s().createElement(o.ChevronUpIcon,{className:os.collapseIcon,"aria-label":"Collapse"})))),s().createElement("div",{className:d()({[os.hiddenAccordion]:D,[os.accordionContainer]:!D})},s().createElement(L.nD3,null,a.map((e,t)=>s().createElement(ol,{key:`section-${e.label}`,section:e,sectionIndex:t,visibleSections:a,isFormExpanded:n})))))))},oc={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},ou=(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}},of=(e,n)=>{let{formFields:t,patient:D,sessionMode:S,visit:a}=n,[r,o]=(0,g.useState)(n.formJson),[i,s]=(0,g.useState)(!1),l=(0,g.useMemo)(()=>t?.map(n=>{let r={value:n,type:"field"},o={patient:D,mode:S,visit:a};if(n.hide?.hideWhenExpression){let D=n3(n.hide.hideWhenExpression,r,t,e,o);n.isHidden=D,Array.isArray(n.questions)&&n.questions.forEach(e=>{e.isHidden=D})}else n.isHidden=!1;"object"==typeof n.required&&"conditionalRequired"===n.required.type?n.isRequired=te(n,t,e):n.isRequired=(0,th.H)(n.required),"object"==typeof n.disabled&&n.disabled.disableWhenExpression?n.isDisabled=n3(n.disabled.disableWhenExpression,r,t,e,o):n.isDisabled=(0,th.H)(n.disabled),n.validators?.some(e=>"conditionalAnswered"===e.type)&&n5(n,t),n.questionOptions.answers?.filter(e=>!nl(e.hide?.hideWhenExpression)).forEach(n=>{n.isHidden=n3(n.hide.hideWhenExpression,r,t,e,o)}),n.questionOptions.answers?.filter(e=>!nl(e.disable?.disableWhenExpression)).forEach(n=>{n.disable.isDisabled=n3(n.disable?.disableWhenExpression,r,t,e,o)}),"string"==typeof n.readonly&&oh(n.readonly)&&(n.meta.readonlyExpression=n.readonly,n.readonly=n3(n.readonly,r,t,e,o));let i=n.questionOptions.repeatOptions?.limitExpression;return"repeating"!==n.questionOptions.rendering||nl(i)||(n.questionOptions.repeatOptions.limit=n3(i,r,t,e,o)),n}),[e,t,D,S]);return(0,g.useEffect)(()=>{n.formJson?.pages?.forEach(n=>{n.hide?tt({value:n,type:"page"},t,e,S,D,n3,null):n.isHidden=!1,n?.sections?.forEach(n=>{n.hide?tt({value:n,type:"section"},t,e,S,D,n3,null):n.isHidden=!1})}),o(n$(n.formJson)),s(!0)},[n.formJson,t]),{evaluatedFormJson:r,evaluatedFields:l,evaluatedPagesVisibility:i}};function oh(e){return"true"!==e&&"false"!==e}function op(e,n){let t=(0,g.useCallback)(n=>{e({type:"ADD_FORM_FIELD",value:n})},[]),D=(0,g.useCallback)(t=>{if(t.meta.groupId){let e=n.find(e=>e.id===t.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===t.id?t:e),D(e))}e({type:"UPDATE_FORM_FIELD",value:(0,DQ.A)(t)})},[n]),S=(0,g.useCallback)(e=>n.find(n=>n.id===e),[n.length]),a=(0,g.useCallback)(n=>{e({type:"REMOVE_FORM_FIELD",value:n})},[]),r=(0,g.useCallback)(n=>{e({type:"SET_INVALID_FIELDS",value:n})},[]),o=(0,g.useCallback)(n=>{e({type:"ADD_INVALID_FIELD",value:n})},[]),i=(0,g.useCallback)(n=>{e({type:"REMOVE_INVALID_FIELD",value:n})},[]);return{addFormField:t,updateFormField:D,getFormField:S,removeFormField:a,setInvalidFields:r,addInvalidField:o,removeInvalidField:i,setForm:(0,g.useCallback)(n=>{e({type:"SET_FORM_JSON",value:n$(n)})},[]),setDeletedFields:(0,g.useCallback)(n=>{e({type:"SET_DELETED_FIELDS",value:n})},[])}}let om=({processorContext:e,initialValues:n,isSubForm:t,setIsLoadingFormDependencies:D})=>{let{evaluatedFields:S,evaluatedFormJson:a,evaluatedPagesVisibility:r}=of(n,e),{registerForm:o,setIsFormDirty:i,workspaceLayout:l,isFormExpanded:d}=S9(),c=nt({defaultValues:n,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:u}}=c,[{formFields:f,invalidFields:h,formJson:p,deletedFields:m},y]=(0,g.useReducer)(ou,{...oc,formFields:S,formJson:a}),{addFormField:b,updateFormField:v,getFormField:$,removeFormField:w,setInvalidFields:_,addInvalidField:A,removeInvalidField:M,setForm:x,setDeletedFields:L}=op(y,f);(0,g.useEffect)(()=>{let e=p.pages.filter(e=>!e.isSubform).map(e=>e);r_.updateScrollablePages(e)},[p.pages]),(0,g.useEffect)(()=>{r_.setEvaluatedPagesVisibility(r)},[r]),(0,g.useEffect)(()=>{r_.updatePagesWithErrors(h.map(e=>e.meta.pageId))},[h]);let C=(0,g.useMemo)(()=>({...e,workspaceLayout:l,methods:c,formFields:f,formJson:p,invalidFields:h,deletedFields:m,addFormField:b,updateFormField:v,getFormField:$,removeFormField:w,setInvalidFields:_,addInvalidField:A,removeInvalidField:M,setForm:x,setDeletedFields:L}),[e,l,c,f,p,h,m]);return(0,g.useEffect)(()=>{o(p.name,t,C)},[p.name,t,C]),(0,g.useEffect)(()=>{i(u)},[u]),s().createElement(tm,C,p.pages.map(e=>e.isSubform||to(e)?e.isSubform&&e.subform?.form?s().createElement(ok,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:D}):s().createElement(od,{key:e.label,page:e,isFormExpanded:d}):null))},oy=({context:e,setContext:n,useCustomHooks:t,setIsLoadingCustomHooks:D})=>{let{isLoading:S=!1,error:a=null,data:r,updateContext:o}=t(e);return(0,g.useEffect)(()=>{!S&&o&&(o(n),D(!1))},[S]),null};function ob(e){let[n,t]=(0,g.useMemo)(()=>{let n=[],t=new Set,D=e=>{let n=[],t=new Set,D=(e,S)=>{let a=S?{...e,meta:{...e.meta,groupId:S}}:e;n.push(a),a.questionOptions?.concept&&t.add(a.questionOptions.concept),a.questionOptions?.answers?.forEach(e=>{e.concept&&t.add(e.concept)}),"obsGroup"===a.type&&a.questions&&a.questions.forEach(e=>{D(e,a.id)})};return e.forEach(e=>D(e)),{flattenedFields:n,conceptReferences:t}};return e.pages?.forEach(e=>e.sections?.forEach(e=>{if(e.questions){let{flattenedFields:S,conceptReferences:a}=D(e.questions);n.push(...S),a.forEach(e=>t.add(e))}})),[n,t]},[e]);return{formFields:n,conceptReferences:t}}let ov="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function o$(e){let{data:n,error:t,isLoading:D}=(0,SH.Ay)([`${o.restBaseUrl}/conceptreferences?v=${ov}`,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,g.useMemo)(()=>n?.data?Object.values(n.data):void 0,[n]),isLoading:D,error:t}}function ow(e){let[n,t]=(0,g.useState)();return(0,g.useEffect)(()=>{let n=new Set;e.forEach(e=>{e.validators?.forEach(e=>n.add(e.type))});let D=Array.from(n);Promise.all(D.map(e=>re(e))).then(e=>{t(Object.assign({},...e.map((e,n)=>({[D[n]]:e}))))})},[e]),n}function o_(e,n){return(0,g.useMemo)(()=>e.length&&n?.length?e.map(e=>{let t=tS(e.questionOptions.concept,n);return e.questionOptions.concept=t?t.uuid:e.questionOptions.concept,e.label=e.label?e.label:t?.display,i.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&t?.conceptClass?.display==="Question"&&t?.answers?.length&&(e.questionOptions.answers=t.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:t},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let t=tS(e.concept,n);return{...e,concept:t?t.uuid:e.concept,label:e.label?e.label:t?.display}})),e}):e??[],[n,e])}let oA=e=>{let[n,t]=(0,g.useState)({});return(0,g.useEffect)(()=>{let n=new Set;e.forEach(e=>{n.add(e.type)});let D=Array.from(n);Promise.all(D.map(e=>a7(e))).then(e=>{t(Object.assign({},...D.map((n,t)=>({[n]:e[t]}))))})},[e]),n};var oM=t(24464),ox={};ox.styleTagTransform=_(),ox.setAttributes=b(),ox.insert=m().bind(null,"head"),ox.domAPI=h(),ox.insertStyleElement=$(),u()(oM.A,ox);let oL=oM.A&&oM.A.locals?oM.A.locals:void 0,oC=()=>{let{t:e}=(0,nD.useTranslation)();return s().createElement("div",{className:oL.loaderContainer},s().createElement(L.OuH,{className:oL.loader,description:`${e("loading","Loading")} ...`}))},ok=({formJson:e,isSubForm:n=!1,setIsLoadingFormDependencies:t})=>{let{patient:D,sessionMode:S,formProcessors:a,layoutType:r,location:o,provider:i,sessionDate:l,visit:d}=S9(),c=(0,g.useMemo)(()=>{let n,t=a[e.processor];return t?n=new t(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),n=new SQ(e)),n.prepareFormSchema(e),n},[a,e.processor]),[u,f]=(0,g.useState)({patient:D,formJson:e,sessionMode:S,layoutType:r,location:o,currentProvider:i,processor:c,sessionDate:l,visit:d,formFields:[],formFieldAdapters:{},formFieldValidators:{}}),{t:h}=(0,nD.useTranslation)(),{formFields:p,conceptReferences:m}=ob(e),{concepts:y,isLoading:b}=o$(Array.from(m)),v=o_(p,y),$=oA(p),w=ow(p),{isLoading:_}=rj(c,u,f),A=c.getCustomHooks().useCustomHooks,[M,x]=(0,g.useState)(!!A),[L,C]=(0,g.useState)(!0),{isLoadingInitialValues:k,initialValues:E,error:T}=rP(c,_||M||b,u);return(0,g.useEffect)(()=>{let e=_||M||b||k;t(e),C(e)},[_,M,b,k]),(0,g.useEffect)(()=>{f(e=>({...e,...$&&{formFieldAdapters:$},...w&&{formFieldValidators:w},...v?.length?{formFields:v}:p?.length?{formFields:p}:{}}))},[$,w,p,v]),(0,g.useEffect)(()=>{(0,tl.N)(T,h("errorLoadingInitialValues","Error loading initial values"))},[T]),(0,g.useEffect)(()=>{$&&rM($)},[$]),s().createElement(s().Fragment,null,A&&s().createElement(oy,{context:u,setContext:f,useCustomHooks:A,setIsLoadingCustomHooks:x}),L&&!n?s().createElement(oC,null):s().createElement(om,{processorContext:u,initialValues:E,isSubForm:n,setIsLoadingFormDependencies:t}))};var oE=t(94963),oT={};oT.styleTagTransform=_(),oT.setAttributes=b(),oT.insert=m().bind(null,"head"),oT.domAPI=h(),oT.insertStyleElement=$(),u()(oE.A,oT);let oO=oE.A&&oE.A.locals?oE.A.locals:void 0,oR=({patient:e,hideActionsOverflow:n})=>s().createElement("div",{className:oO.patientBannerContainer},s().createElement(o.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:n}})),oI=({pages:e,defaultPage:n,activePages:t,evaluatedPagesVisibility:D})=>{let[S,a]=(0,g.useState)(null),[r,o]=(0,g.useState)(!1),[i,s]=(0,g.useState)(null),l=(0,g.useRef)(!0);return(0,g.useEffect)(()=>{r||!D||((()=>{let t=e.find(({label:e})=>e===n);if(t&&!t.isHidden)a(t.id),ta(t.id);else{let n=e.find(e=>!e.isHidden);n&&a(n.id)}})(),o(!0))},[e,n,D,r]),(0,g.useEffect)(()=>{let e=null;return r&&(e=setTimeout(()=>{l.current=!1},200)),()=>{e&&clearTimeout(e)}},[r]),(0,g.useEffect)(()=>{if(l.current)return;let n=null;if(i&&t.includes(i)){a(i),n=setTimeout(()=>{s(null)},100);return}return!i&&t.length>0&&a(t.reduce((n,t)=>e.findIndex(e=>e.id===n)<e.findIndex(e=>e.id===t)?n:t)),()=>{n&&clearTimeout(n)}},[t,i,e]),{currentActivePage:S,requestPage:(0,g.useCallback)(e=>{l.current=!1,s(e),a(e),ta(e)},[])}};var oN=t(16265),oj={};oj.styleTagTransform=_(),oj.setAttributes=b(),oj.insert=m().bind(null,"head"),oj.domAPI=h(),oj.insertStyleElement=$(),u()(oN.A,oj);let oP=oN.A&&oN.A.locals?oN.A.locals:void 0;function oF({page:e,currentActivePage:n,pagesWithErrors:t,requestPage:D}){let{t:S}=(0,nD.useTranslation)(),a=e.id===n,r=t.includes(e.id),i="tablet"===(0,o.useLayoutType)();return s().createElement("div",{className:d()(oP.pageLink,{[oP.activePage]:a&&!r,[oP.errorPage]:r&&!a,[oP.activeErrorPage]:r&&a,[oP.pageLinkTablet]:i})},s().createElement("button",{onClick:n=>{n.preventDefault(),D(e.id)}},s().createElement("span",null,S(e.label))))}let oU=({defaultPage:e,isFormSubmitting:n,sessionMode:t,onCancel:D,handleClose:S,hideFormCollapseToggle:a,hideControls:r})=>{let{t:i}=(0,nD.useTranslation)(),{pages:l,pagesWithErrors:c,activePages:u,evaluatedPagesVisibility:f}=rO(),{currentActivePage:h,requestPage:p}=oI({pages:l,defaultPage:e,activePages:u,evaluatedPagesVisibility:f}),m=(0,o.useLayoutType)(),y=(0,g.useMemo)(()=>"tablet"===m?"lg":"sm",[m]);return s().createElement("div",{className:oP.sidebar},l.filter(e=>to(e)).map(e=>s().createElement(oF,{key:e.id,page:e,currentActivePage:h,pagesWithErrors:c,requestPage:p})),"view"!==t&&!r&&s().createElement("hr",{className:oP.divider}),!r&&s().createElement("div",{className:oP.sideNavActions},"view"!==t&&s().createElement(L.$nd,{className:oP.saveButton,disabled:n,type:"submit",size:y},n?s().createElement(L.OuH,{description:i("submitting","Submitting")+"..."}):s().createElement("span",null,`${i("save","Save")}`)),s().createElement(L.$nd,{className:d()(oP.closeButton,{[oP.topMargin]:"view"===t}),kind:"tertiary",onClick:()=>{D?.(),S?.(),a()},size:y},"view"===t?i("close","Close"):i("cancel","Cancel"))))};var oB=t(7356),oz={};oz.styleTagTransform=_(),oz.setAttributes=b(),oz.insert=m().bind(null,"head"),oz.domAPI=h(),oz.insertStyleElement=$(),u()(oB.A,oz);let oV=oB.A&&oB.A.locals?oB.A.locals:void 0,oH=({formJson:e,patientUUID:n,formUUID:t,encounterUUID:D,visit:S,formSessionIntent:a,mode:r,onSubmit:i,onCancel:l,handleClose:c,handleConfirmQuestionDeletion:u,markFormAsDirty:f,hideControls:h=!1,hidePatientBanner:p=!1,preFilledQuestions:m})=>{let{t:y}=(0,nD.useTranslation)(),b=(0,o.useSession)(),v=(0,g.useRef)(null),$=(0,g.useMemo)(()=>new Date,[]),w=rT(v),{patient:_,isLoadingPatient:A}=rN(n),[M,x]=(0,g.useState)(!1),[C,k]=(0,g.useState)(!1),[E,T]=(0,g.useState)(!1),O=nl(r)?nl(D)?"enter":"edit":r,{isFormExpanded:R,hideFormCollapseToggle:I}=rL(O),{hasMultiplePages:N}=rO(),{formJson:j,isLoading:P,formError:F}=ra(t,e,D,a,m),U=(0,g.useMemo)(()=>!p&&_&&"ultra-wide"===w&&"embedded-view"!==r,[_,r,w,p]),B=(0,g.useMemo)(()=>["narrow"].includes(w),[w]),z=(0,g.useMemo)(()=>"embedded-view"!==r&&!M&&null!==N&&(B||!N),[r,B,M,N]),V=(0,g.useMemo)(()=>"embedded-view"!==r&&!M&&null!==N&&!B&&N,[B,M,N]);(0,g.useEffect)(()=>{(0,tl.N)(F,y("errorLoadingFormSchema","Error loading form schema"))},[F]),(0,g.useEffect)(()=>()=>{rx()},[]),(0,g.useEffect)(()=>{f?.(E)},[E]);let H=(0,g.useCallback)(e=>{e.preventDefault(),k(!0)},[]);return s().createElement("form",{ref:v,noValidate:!0,className:d()("cds--form",oV.form),onSubmit:H},A||P?s().createElement(oC,null):s().createElement(S8,{patient:_,patientUUID:n,sessionMode:O,sessionDate:$,formJson:j,workspaceLayout:"ultra-wide"===w?"maximized":"minimized",location:b?.sessionLocation,provider:b?.currentProvider,visit:S,handleConfirmQuestionDeletion:u,isFormExpanded:R,formSubmissionProps:{isSubmitting:C,setIsSubmitting:k,onSubmit:i,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:I,setIsFormDirty:T},s().createElement("div",{className:oV.formContainer},M&&s().createElement("div",{className:oV.linearActivity},s().createElement("div",{className:oV.indeterminate})),s().createElement("div",{className:oV.formContent},V&&s().createElement(oU,{isFormSubmitting:C,sessionMode:r,defaultPage:j.defaultPage,onCancel:l,handleClose:c,hideFormCollapseToggle:I,hideControls:h}),s().createElement("div",{className:oV.formContentInner},U&&s().createElement(oR,{patient:_,hideActionsOverflow:!0}),j.markdown&&s().createElement("div",{className:oV.markdownContainer},s().createElement(Di,{markdown:j.markdown})),s().createElement("div",{className:oV.formBody},s().createElement(ok,{formJson:j,setIsLoadingFormDependencies:x})),z&&!h&&s().createElement(L.Te$,{className:oV.minifiedButtons},s().createElement(L.$nd,{kind:"secondary",onClick:()=>{l&&l(),c&&c(),I()}},"view"===r?y("close","Close"):y("cancel","Cancel")),s().createElement(L.$nd,{className:oV.saveButton,disabled:M||C||"view"===r,kind:"primary",type:"submit"},C?s().createElement(L.OuH,{description:y("submitting","Submitting")+"..."}):s().createElement("span",null,`${y("save","Save")}`))))))))},oW=function(e){return s().createElement(nD.I18nextProvider,{i18n:window.i18next,defaultNS:SI.L},s().createElement(oH,e))}},6232(e,n,t){"use strict";function D(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)}t.d(n,{H:()=>D,O:()=>S})},10578(e,n,t){"use strict";t.d(n,{N:()=>S,j:()=>a});var D=t(53870);function S(e,n){if(e){let t=a(e).join(", ");console.error(e),(0,D.showSnackbar)({subtitle:t,title:n,kind:"error",isLowContrast:!1})}}function a(e){let n=e?.responseBody?.error?.fieldErrors,t=e?.responseBody?.error?.globalErrors;return n&&0!==Object.keys(n).length||t?t?.length?t.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 t={};return e.forEach(e=>{let D=n.obs?.find(n=>n.formFieldPath.includes(e))?.value;"object"==typeof D&&(D=D.uuid),D&&(D=formatValue(D)),t[e]=D}),t}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,t){e=t.nmd(e),function(){var e="ace",n=function(){return this}();if(!n&&"u">typeof window&&(n=window),e||"u"<typeof requirejs){var t=function(e,n,D){"string"!=typeof e?t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(D=n),t.modules[e]||(t.payloads[e]=D,t.modules[e]=null))};t.modules={},t.payloads={};var D=function(e,n,t){if("string"==typeof n){var D=r(e,n);if(void 0!=D)return t&&t(),D}else if("[object Array]"===Object.prototype.toString.call(n)){for(var a=[],o=0,i=n.length;o<i;++o){var g=r(e,n[o]);if(void 0==g&&S.original)return;a.push(g)}return t&&t.apply(null,a)||!0}},S=function(e,n){var t=D("",e,n);return void 0==t&&S.original?S.original.apply(this,arguments):t},a=function(e,n){if(-1!==n.indexOf("!")){var t=n.split("!");return a(e,t[0])+"!"+a(e,t[1])}if("."==n.charAt(0))for(n=e.split("/").slice(0,-1).join("/")+"/"+n;-1!==n.indexOf(".")&&D!=n;){var D=n;n=n.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return n},r=function(e,n){n=a(e,n);var S=t.modules[n];if(!S){if("function"==typeof(S=t.payloads[n])){var r={},o={id:n,uri:"",exports:r,packaged:!0};r=S(function(e,t){return D(n,e,t)},r,o)||o.exports,t.modules[n]=r,delete t.payloads[n]}S=t.modules[n]=r||S}return S};o(e)}function o(e){var D=n;e&&(n[e]||(n[e]={}),D=n[e]),D.define&&D.define.packaged||(t.original=D.define,D.define=t,D.define.packaged=!0),D.require&&D.require.packaged||(S.original=D.require,D.require=S,D.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,n,t){function D(e,n,t){Object.defineProperty(e,n,{value:t,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||D(String.prototype,"startsWith",function(e,n){return n=n||0,this.lastIndexOf(e,n)===n}),String.prototype.endsWith||D(String.prototype,"endsWith",function(e,n){var t=this;(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var D=t.indexOf(e,n);return -1!==D&&D===n}),String.prototype.repeat||D(String.prototype,"repeat",function(e){for(var n="",t=this;e>0;)1&e&&(n+=t),(e>>=1)&&(t+=t);return n}),String.prototype.includes||D(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),t=1;t<arguments.length;t++){var D=arguments[t];null!=D&&Object.keys(D).forEach(function(e){n[e]=D[e]})}return n}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(n){return e[n]})}),Array.prototype.find||D(Array.prototype,"find",function(e){for(var n=this.length,t=arguments[1],D=0;D<n;D++){var S=this[D];if(e.call(t,S,D,this))return S}}),Array.prototype.findIndex||D(Array.prototype,"findIndex",function(e){for(var n=this.length,t=arguments[1],D=0;D<n;D++){var S=this[D];if(e.call(t,S,D,this))return D}}),Array.prototype.includes||D(Array.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Array.prototype.fill||D(Array.prototype,"fill",function(e){for(var n=this,t=n.length>>>0,D=arguments[1],S=0|D,a=S<0?Math.max(t+S,0):Math.min(S,t),r=arguments[2],o=void 0===r?t:0|r,i=o<0?Math.max(t+o,0):Math.min(o,t);a<i;)n[a]=e,a++;return n}),Array.of||D(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,n,t){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,n,t){n.deepCopy=function e(n){if("object"!=typeof n||!n)return n;if(Array.isArray(n)){t=[];for(var t,D=0;D<n.length;D++)t[D]=e(n[D]);return t}if("[object Object]"!==Object.prototype.toString.call(n))return n;for(var D in t={},n)t[D]=e(n[D]);return t}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,n,t){"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 t="";n>0;)1&n&&(t+=e),(n>>=1)&&(e+=e);return t};var D=/^\s\s*/,S=/\s\s*$/;n.stringTrimLeft=function(e){return e.replace(D,"")},n.stringTrimRight=function(e){return e.replace(S,"")},n.copyObject=function(e){var n={};for(var t in e)n[t]=e[t];return n},n.copyArray=function(e){for(var n=[],t=0,D=e.length;t<D;t++)e[t]&&"object"==typeof e[t]?n[t]=this.copyObject(e[t]):n[t]=e[t];return n},n.deepCopy=e("./deep_copy").deepCopy,n.arrayToMap=function(e){for(var n={},t=0;t<e.length;t++)n[e[t]]=1;return n},n.createMap=function(e){var n=Object.create(null);for(var t in e)n[t]=e[t];return n},n.arrayRemove=function(e,n){for(var t=0;t<=e.length;t++)n===e[t]&&e.splice(t,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 t=[];return e.replace(n,function(e){t.push({offset:arguments[arguments.length-2],length:e.length})}),t},n.deferredCall=function(e){var n=null,t=function(){n=null,e()},D=function(e){return D.cancel(),n=setTimeout(t,e||0),D};return D.schedule=D,D.call=function(){return this.cancel(),e(),D},D.cancel=function(){return clearTimeout(n),n=null,D},D.isPending=function(){return n},D},n.delayedCall=function(e,n){var t=null,D=function(){t=null,e()},S=function(e){null==t&&(t=setTimeout(D,e||n))};return S.delay=function(e){t&&clearTimeout(t),t=setTimeout(D,e||n)},S.schedule=S,S.call=function(){this.cancel(),e()},S.cancel=function(){t&&clearTimeout(t),t=null},S.isPending=function(){return t},S},n.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},n.skipEmptyMatch=function(e,n,t){return t&&e.codePointAt(n)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,n,t){"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 D="object"==typeof navigator?navigator:{},S=(/mac|win|linux/i.exec(D.platform)||["other"])[0].toLowerCase(),a=D.userAgent||"",r=D.appName||"";n.isWin="win"==S,n.isMac="mac"==S,n.isLinux="linux"==S,n.isIE="Microsoft Internet Explorer"==r||r.indexOf("MSAppHost")>=0?parseFloat((a.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((a.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),n.isOldIE=n.isIE&&n.isIE<9,n.isGecko=n.isMozilla=a.match(/ Gecko\/\d+/),n.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),n.isWebKit=parseFloat(a.split("WebKit/")[1])||void 0,n.isChrome=parseFloat(a.split(" Chrome/")[1])||void 0,n.isSafari=parseFloat(a.split(" Safari/")[1])&&!n.isChrome||void 0,n.isEdge=parseFloat(a.split(" Edge/")[1])||void 0,n.isAIR=a.indexOf("AdobeAIR")>=0,n.isAndroid=a.indexOf("Android")>=0,n.isChromeOS=a.indexOf(" CrOS ")>=0,n.isIOS=/iPad|iPhone|iPod/.test(a)&&!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,t){"use strict";var D,S=e("./useragent"),a="http://www.w3.org/1999/xhtml";n.buildDom=function e(n,t,D){if("string"==typeof n&&n){var S=document.createTextNode(n);return t&&t.appendChild(S),S}if(!Array.isArray(n))return n&&n.appendChild&&t&&t.appendChild(n),n;if("string"!=typeof n[0]||!n[0]){for(var a=[],r=0;r<n.length;r++){var o=e(n[r],t,D);o&&a.push(o)}return a}var i=document.createElement(n[0]),g=n[1],s=1;g&&"object"==typeof g&&!Array.isArray(g)&&(s=2);for(var r=s;r<n.length;r++)e(n[r],i,D);return 2==s&&Object.keys(g).forEach(function(e){var n=g[e];"class"===e?i.className=Array.isArray(n)?n.join(" "):n:"function"==typeof n||"value"==e||"$"==e[0]?i[e]=n:"ref"===e?D&&(D[n]=i):"style"===e?"string"==typeof n&&(i.style.cssText=n):null!=n&&i.setAttribute(e,n)}),t&&t.appendChild(i),i},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||a,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,t){n.hasCssClass(e,t)||(e.className+=" "+t)},n.removeCssClass=function(e,n){for(var t=e.className.split(/\s+/g);;){var D=t.indexOf(n);if(-1==D)break;t.splice(D,1)}e.className=t.join(" ")},n.toggleCssClass=function(e,n){for(var t=e.className.split(/\s+/g),D=!0;;){var S=t.indexOf(n);if(-1==S)break;D=!1,t.splice(S,1)}return D&&t.push(n),e.className=t.join(" "),D},n.setCssClass=function(e,t,D){D?n.addCssClass(e,t):n.removeCssClass(e,t)},n.hasCssString=function(e,n){var t,D=0;if(t=(n=n||document).querySelectorAll("style")){for(;D<t.length;)if(t[D++].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){i(e[0],e[1])})}function i(e,t,S){if(!("u"<typeof document)){if(r){if(S)o();else if(!1===S)return r.push([e,t])}if(!D){var a=S;S&&S.getRootNode&&(a=S.getRootNode())&&a!=S||(a=document);var i=a.ownerDocument||a;if(t&&n.hasCssString(t,a))return null;t&&(e+="\n/*# sourceURL=ace/css/"+t+" */");var g=n.createElement("style");g.appendChild(i.createTextNode(e)),t&&(g.id=t),a==i&&(a=n.getDocumentHead(i)),a.insertBefore(g,a.firstChild)}}}if(n.useStrictCSP=function(e){D=e,!1==e?o():r||(r=[])},n.importCssString=i,n.importCssStylsheet=function(e,t){n.buildDom(["link",{rel:"stylesheet",href:e}],n.getDocumentHead(t))},n.scrollbarWidth=function(e){var t=n.createElement("ace_inner");t.style.width="100%",t.style.minWidth="0px",t.style.height="200px",t.style.display="block";var D=n.createElement("ace_outer"),S=D.style;S.position="absolute",S.left="-10000px",S.overflow="hidden",S.width="200px",S.minWidth="0px",S.height="150px",S.display="block",D.appendChild(t);var a=e&&e.documentElement||document&&document.documentElement;if(!a)return 0;a.appendChild(D);var r=t.offsetWidth;S.overflow="scroll";var o=t.offsetWidth;return r===o&&(o=D.clientWidth),a.removeChild(D),r-o},n.computedStyle=function(e,n){return window.getComputedStyle(e,"")||{}},n.setStyle=function(e,n,t){e[n]!==t&&(e[n]=t)},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 g=document.createElement("div");n.HI_DPI&&void 0!==g.style.transform&&(n.HAS_CSS_TRANSFORMS=!0),S.isEdge||void 0===g.style.animationName||(n.HAS_CSS_ANIMATION=!0),g=null}n.HAS_CSS_TRANSFORMS?n.translate=function(e,n,t){e.style.transform="translate("+Math.round(n)+"px, "+Math.round(t)+"px)"}:n.translate=function(e,n,t){e.style.top=Math.round(t)+"px",e.style.left=Math.round(n)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=e("./dom");n.get=function(e,n){var t=new XMLHttpRequest;t.open("GET",e,!0),t.onreadystatechange=function(){4===t.readyState&&n(t.responseText)},t.send(null)},n.loadScript=function(e,n){var t=D.getDocumentHead(),S=document.createElement("script");S.src=e,t.appendChild(S),S.onload=S.onreadystatechange=function(e,t){(t||!S.readyState||"loaded"==S.readyState||"complete"==S.readyState)&&(S=S.onload=S.onreadystatechange=null,t||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,t){"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 t in n)e[t]=n[t];return e},n.implement=function(e,t){n.mixin(e,t)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,n,t){"use strict";var D={},S=function(){this.propagationStopped=!0},a=function(){this.defaultPrevented=!0};D._emit=D._dispatchEvent=function(e,n){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var t=this._eventRegistry[e]||[],D=this._defaultHandlers[e];if(t.length||D){"object"==typeof n&&n||(n={}),n.type||(n.type=e),n.stopPropagation||(n.stopPropagation=S),n.preventDefault||(n.preventDefault=a),t=t.slice();for(var r=0;r<t.length&&(t[r](n,this),!n.propagationStopped);r++);if(D&&!n.defaultPrevented)return D(n,this)}},D._signal=function(e,n){var t=(this._eventRegistry||{})[e];if(t){t=t.slice();for(var D=0;D<t.length;D++)t[D](n,this)}},D.once=function(e,n){var t=this;if(this.on(e,function D(){t.off(e,D),n.apply(null,arguments)}),!n)return new Promise(function(e){n=e})},D.setDefaultHandler=function(e,n){var t=this._defaultHandlers;if(t||(t=this._defaultHandlers={_disabled_:{}}),t[e]){var D=t[e],S=t._disabled_[e];S||(t._disabled_[e]=S=[]),S.push(D);var a=S.indexOf(n);-1!=a&&S.splice(a,1)}t[e]=n},D.removeDefaultHandler=function(e,n){var t=this._defaultHandlers;if(t){var D=t._disabled_[e];if(t[e]==n)D&&this.setDefaultHandler(e,D.pop());else if(D){var S=D.indexOf(n);-1!=S&&D.splice(S,1)}}},D.on=D.addEventListener=function(e,n,t){this._eventRegistry=this._eventRegistry||{};var D=this._eventRegistry[e];return D||(D=this._eventRegistry[e]=[]),-1==D.indexOf(n)&&D[t?"unshift":"push"](n),n},D.off=D.removeListener=D.removeEventListener=function(e,n){this._eventRegistry=this._eventRegistry||{};var t=this._eventRegistry[e];if(t){var D=t.indexOf(n);-1!==D&&t.splice(D,1)}},D.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=D}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,n,t){n.reportError=function(e,n){var t=Error(e);t.data=n,"object"==typeof console&&console.error&&console.error(t),setTimeout(function(){throw t})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,n,t){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,t){var D,S,a=e("./oop"),r=e("./event_emitter").EventEmitter,o=e("./report_error").reportError,i=e("./default_english_messages").defaultEnglishMessages,g={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 t=this.$options;e=Object.keys(t).filter(function(e){return!t[e].hidden})}return e.forEach(function(e){n[e]=this.getOption(e)},this),n},setOption:function(e,n){if(this["$"+e]!==n){var t=this.$options[e];if(!t)return s('misspelled option "'+e+'"');if(t.forwardTo)return this[t.forwardTo]&&this[t.forwardTo].setOption(e,n);t.handlesSet||(this["$"+e]=n),t&&t.set&&t.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]:s('misspelled option "'+e+'"')}};function s(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var l=function(){function e(){this.$defaultOptions={},D=i,S="dollarSigns"}return e.prototype.defineOptions=function(e,n,t){return e.$options||(this.$defaultOptions[n]=e.$options={}),Object.keys(t).forEach(function(n){var D=t[n];"string"==typeof D&&(D={forwardTo:D}),D.name||(D.name=n),e.$options[D.name]=D,"initialValue"in D&&(e["$"+D.name]=D.initialValue)}),a.implement(e,g),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(n){var t=e.$options[n];"value"in t&&e.setOption(n,t.value)})},e.prototype.setDefaultValue=function(e,n,t){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][n])break;if(!this.$defaultOptions[e][n])return!1}var D=this.$defaultOptions[e]||(this.$defaultOptions[e]={});D[n]&&(D.forwardTo?this.setDefaultValue(D.forwardTo,n,t):D[n].value=t)},e.prototype.setDefaultValues=function(e,n){Object.keys(n).forEach(function(t){this.setDefaultValue(e,t,n[t])},this)},e.prototype.setMessages=function(e,n){D=e,n&&n.placeholders&&(S=n.placeholders)},e.prototype.nls=function(e,n,t){!D[e]&&(s("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+n+"'."),D[n]||s("No message found for the default string '"+n+"' in the provided messages. Falling back to the default English message."));var a=D[e]||D[n]||n;return t&&("dollarSigns"===S&&(a=a.replace(/\$(\$|[\d]+)/g,function(e,n){return"$"==n?"$":t[n]})),"curlyBrackets"===S&&(a=a.replace(/\{([^\}]+)\}/g,function(e,n){return t[n]}))),a},e}();l.prototype.warn=s,l.prototype.reportError=o,a.implement(l.prototype,r),n.AppConfig=l}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,n,t){t.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,t){"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,t){var D,S=e("./lib/lang"),a=e("./lib/net"),r=e("./lib/dom");t.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 t=e.split("/"),D="snippets"==(n=n||t[t.length-2]||"")?"/":"-",S=t[t.length-1];if("worker"==n&&"-"==D){var a=RegExp("^"+n+"[\\-_]|[\\-_]"+n+"$","g");S=S.replace(a,"")}(!S||S==n)&&t.length>1&&(S=t[t.length-2]);var r=o[n+"Path"];return null==r?r=o.basePath:"/"==D&&(n=D=""),r&&"/"!=r.slice(-1)&&(r+="/"),r+n+D+S+this.get("suffix")},n.setModuleUrl=function(e,n){return o.$moduleUrls[e]=n};var i=function(n,t){return"ace/theme/textmate"===n||"./theme/textmate"===n?t(null,e("./theme/textmate")):D?D(n,t):void console.error("loader is not configured")};n.setLoader=function(e){D=e},n.dynamicModules=Object.create(null),n.$loading={},n.$loaded={},n.loadModule=function(e,t){if(Array.isArray(e))var D,S=e[0],r=e[1];else if("string"==typeof e)var r=e;var o=function(e){if(e&&!n.$loading[r])return t&&t(e);if(n.$loading[r]||(n.$loading[r]=[]),n.$loading[r].push(t),!(n.$loading[r].length>1)){var D=function(){i(r,function(e,t){t&&(n.$loaded[r]=t),n._emit("load.module",{name:r,module:t});var D=n.$loading[r];n.$loading[r]=null,D.forEach(function(e){e&&e(t)})})};if(!n.get("packaged"))return D();a.loadScript(n.moduleUrl(r,S),D),g()}};if(n.dynamicModules[r])n.dynamicModules[r]().then(function(e){e.default?o(e.default):o(e)});else{try{D=this.$require(r)}catch(e){}o(D||n.$loaded[r])}},n.$require=function(e){if("function"==typeof t.require)return t.require(e)},n.setModuleLoader=function(e,t){n.dynamicModules[e]=t};var g=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"),g=function(){})};n.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,n,t){"use strict";e("./lib/fixoldbrowsers");var D=e("./config");D.setLoader(function(n,t){e([n],function(e){t(null,e)})});var S=function(){return this||"u">typeof window&&window}();function a(n){if(S&&S.document){D.set("packaged",n||e.packaged||t.packaged||S.define&&define.packaged);var a={},o="",i=document.currentScript||document._currentScript,g=i&&i.ownerDocument||document;i&&i.src&&(o=i.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var s=g.getElementsByTagName("script"),l=0;l<s.length;l++){var d=s[l],c=d.src||d.getAttribute("src");if(c){for(var u=d.attributes,f=0,h=u.length;f<h;f++){var p=u[f];0===p.name.indexOf("data-ace-")&&(a[r(p.name.replace(/^data-ace-/,""))]=p.value)}var m=c.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);m&&(o=m[1])}}for(var y in o&&(a.base=a.base||o,a.packaged=!0),a.basePath=a.base,a.workerPath=a.workerPath||a.base,a.modePath=a.modePath||a.base,a.themePath=a.themePath||a.base,delete a.base,a)void 0!==a[y]&&D.set(y,a[y])}}function r(e){return e.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}t.exports=function(n){D.init=a,D.$require=e,n.require=e,"function"==typeof define&&(n.define=define)},a(!0)}),ace.define("ace/range",["require","exports","module"],function(e,n,t){"use strict";var D=function(){function e(e,n,t,D){this.start={row:e,column:n},this.end={row:t,column:D}}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,t=e.end,D=e.start;return 1==(n=this.compare(t.row,t.column))?1==(n=this.compare(D.row,D.column))?2:+(0==n):-1==n?-2:-1==(n=this.compare(D.row,D.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,t){if(this.end.row>t)var D={row:t+1,column:0};else if(this.end.row<n)var D={row:n,column:0};if(this.start.row>t)var S={row:t+1,column:0};else if(this.start.row<n)var S={row:n,column:0};return e.fromPoints(S||this.start,D||this.end)},e.prototype.extend=function(n,t){var D=this.compare(n,t);if(0==D)return this;if(-1==D)var S={row:n,column:t};else var a={row:n,column:t};return e.fromPoints(S||this.start,a||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 t=n.documentToScreenPosition(this.start),D=n.documentToScreenPosition(this.end);return new e(t.row,t.column,D.row,D.column)},e.prototype.moveBy=function(e,n){this.start.row+=e,this.start.column+=n,this.end.row+=e,this.end.column+=n},e}();D.fromPoints=function(e,n){return new D(e.row,e.column,n.row,n.column)},D.comparePoints=function(e,n){return e.row-n.row||e.column-n.column},n.Range=D}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,n,t){"use strict";for(var D=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:"*"}},a={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++)a["Digit"+r]=48+r,a["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);a["Key"+o.toUpperCase()]=r,S.PRINTABLE_KEYS[r]=o}for(var r=1;r<13;r++)a["F"+r]=111+r,S.FUNCTION_KEYS[111+r]="F"+r;var i={Shift:16,Control:17,Alt:18,Meta:224};for(var g in i)a[g]=a[g+"Left"]=a[g+"Right"]=i[g];for(var s in n.$codeToKeyCode=a,S.PRINTABLE_KEYS[173]="-",S.FUNCTION_KEYS){var l=S.FUNCTION_KEYS[s].toLowerCase();S[l]=parseInt(s,10)}for(var s in S.PRINTABLE_KEYS){var l=S.PRINTABLE_KEYS[s].toLowerCase();S[l]=parseInt(s,10)}D.mixin(S,S.MODIFIER_KEYS),D.mixin(S,S.PRINTABLE_KEYS),D.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-",D.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,t){"use strict";var D,S=e("./keys"),a=e("./useragent"),r=null,o=0;function i(){D=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return D={passive:!1},!0}})}catch(e){}}function g(){return void 0==D&&i(),D}function s(e,n,t){this.elem=e,this.type=n,this.callback=t}s.prototype.destroy=function(){d(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var l=n.addListener=function(e,n,t,D){e.addEventListener(n,t,g()),D&&D.$toDestroy.push(new s(e,n,t))},d=n.removeListener=function(e,n,t){e.removeEventListener(n,t,g())};function c(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function u(e,n,t){var D=c(n);if(!t&&n.code&&(t=S.$codeToKeyCode[n.code]||t),!a.isMac&&r){if(n.getModifierState&&(n.getModifierState("OS")||n.getModifierState("Win"))&&(D|=8),r.altGr)if((3&D)==3)return;else r.altGr=0;if(18===t||17===t){var i=n.location;17===t&&1===i?1==r[t]&&(o=n.timeStamp):18===t&&3===D&&2===i&&n.timeStamp-o<50&&(r.altGr=!0)}}if(t in S.MODIFIER_KEYS&&(t=-1),D||13!==t||3!==n.location||(e(n,D,-t),!n.defaultPrevented)){if(a.isChromeOS&&8&D){if(e(n,D,t),n.defaultPrevented)return;D&=-9}return(!!D||t in S.FUNCTION_KEYS||t in S.PRINTABLE_KEYS)&&e(n,D,t)}}function f(){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||a.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},n.capture=function(e,n,t){var D=e&&e.ownerDocument||document;function S(e){n&&n(e),t&&t(e),d(D,"mousemove",n),d(D,"mouseup",S),d(D,"dragstart",S)}return l(D,"mousemove",n),l(D,"mouseup",S),l(D,"dragstart",S),S},n.addMouseWheelListener=function(e,n,t){l(e,"wheel",function(e){var t=.15,D=e.deltaX||0,S=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=D*t,e.wheelY=S*t;break;case e.DOM_DELTA_LINE:var a=15;e.wheelX=15*D,e.wheelY=S*a;break;case e.DOM_DELTA_PAGE:var r=150;e.wheelX=150*D,e.wheelY=S*r}n(e)},t)},n.addMultiMouseDownListener=function(e,t,D,S,r){var o,i,g,s=0,d={2:"dblclick",3:"tripleclick",4:"quadclick"};function c(e){if(0!==n.getButton(e)?s=0:e.detail>1?++s>4&&(s=1):s=1,a.isIE){var r=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-i)>5;(!g||r)&&(s=1),g&&clearTimeout(g),g=setTimeout(function(){g=null},t[s-1]||600),1==s&&(o=e.clientX,i=e.clientY)}if(e._clicks=s,D[S]("mousedown",e),s>4)s=0;else if(s>1)return D[S](d[s],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){l(e,"mousedown",c,r)})},n.getModifierString=function(e){return S.KEY_MODS[c(e)]},n.addCommandKeyListener=function(e,t,D){var S=null;l(e,"keydown",function(e){r[e.keyCode]=(r[e.keyCode]||0)+1;var n=u(t,e,e.keyCode);return S=e.defaultPrevented,n},D),l(e,"keypress",function(e){S&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(n.stopEvent(e),S=null)},D),l(e,"keyup",function(e){r[e.keyCode]=null},D),r||(f(),l(window,"focus",f))},"object"==typeof window&&window.postMessage&&!a.isOldIE){var h=1;n.nextTick=function(e,t){t=t||window;var D="zero-timeout-message-"+h++,S=function(a){a.data==D&&(n.stopPropagation(a),d(t,"message",S),e())};l(t,"message",S),t.postMessage(D,"*")}}n.$idleBlocked=!1,n.onIdle=function(e,t){return setTimeout(function t(){n.$idleBlocked?setTimeout(t,100):e()},t)},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,t){"use strict";var D;t.exports={lineMode:!1,pasteCancelled:function(){return!!(D&&D>Date.now()-50)||(D=!1)},cancel:function(){D=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,t){"use strict";var D=e("../lib/event"),S=e("../config").nls,a=e("../lib/useragent"),r=e("../lib/dom"),o=e("../lib/lang"),i=e("../clipboard"),g=a.isChrome<18,s=a.isIE,l=a.isChrome>63,d=400,c=e("../lib/keys"),u=c.KEY_MODS,f=a.isIOS,h=f?/\s/:/\n/,p=a.isMobile;n.TextInput=function(e,n){var t,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,b=!1,v=!1,$=!1,w="";p||(m.style.fontSize="1px");var _=!1,A=!1,M="",x=0,L=0,C=0,k=Number.MAX_SAFE_INTEGER,E=Number.MIN_SAFE_INTEGER,T=0;try{var O=document.activeElement===m}catch(e){}this.setNumberOfExtraLines=function(e){if(k=Number.MAX_SAFE_INTEGER,E=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 t="";n.$textInputAriaLabel&&(t+="".concat(n.$textInputAriaLabel,", ")),n.session&&(t+=S("text-input.aria-label","Cursor at row $0",[n.session.selection.cursor.row+1])),m.setAttribute("aria-label",t)}},this.setAriaOptions({role:"textbox"}),D.addListener(m,"blur",function(e){A||(n.onBlur(e),O=!1)},n),D.addListener(m,"focus",function(e){if(!A){if(O=!0,a.isEdge)try{if(!document.hasFocus())return}catch(e){}n.onFocus(e),a.isEdge?setTimeout(I):I()}},n),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:n.renderer.enableKeyboardAccessibility}),w||l||"browser"==this.$focusScroll)return m.focus({preventScroll:!0});var e=m.style.top;m.style.position="fixed",m.style.top="0px";try{var t=0!=m.getBoundingClientRect().top}catch(e){return}var D=[];if(t)for(var S=m.parentElement;S&&1==S.nodeType;)D.push(S),S.setAttribute("ace_nocontext","true"),S=!S.parentElement&&S.getRootNode?S.getRootNode().host:S.parentElement;m.focus({preventScroll:!0}),t&&D.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,t=e&&e.command&&e.command.name;if("insertstring"!=t){var D=t&&(e.docChanged||e.selectionChanged);v&&D&&(M=m.value="",Y()),I()}});var R=function(e,t){for(var D=t,S=1;S<=e-k&&S<2*T+1;S++)D+=n.session.getLine(e-S).length+1;return D},I=f?function(e){if(O&&(!y||e)&&!$){e||(e="");var t="\n ab"+e+"cde fg\n";t!=m.value&&(m.value=M=t);var D=4,S=4+(e.length||+!n.selection.isEmpty());(x!=D||L!=S)&&m.setSelectionRange(D,S),x=D,L=S}}:function(){if(!v&&!$&&(O||F)){v=!0;var e=0,t=0,D="";if(n.session){var S=n.selection,a=S.getRange(),r=S.cursor.row;r===E+1?E=(k=E+1)+2*T:r===k-1?k=(E=k-1)-2*T:(r<k-1||r>E+1)&&(k=r>T?r-T:0,E=r>T?r+T:2*T);for(var o=[],i=k;i<=E;i++)o.push(n.session.getLine(i));if(D=o.join("\n"),e=R(a.start.row,a.start.column),t=R(a.end.row,a.end.column),a.start.row<k){var g=n.session.getLine(k-1);e=a.start.row<k-1?0:e,t+=g.length+1,D=g+"\n"+D}else if(a.end.row>E){var s=n.session.getLine(E+1);t=(a.end.row>E+1?s.length:a.end.column)+(D.length+1),D=D+"\n"+s}else p&&r>0&&(D="\n"+D,t+=1,e+=1);D.length>d&&(e<d&&t<d?D=D.slice(0,d):(D="\n",e==t?e=t=0:(e=0,t=1)));var l=D+"\n\n";l!=M&&(m.value=M=l,x=L=l.length)}if(F&&(x=m.selectionStart,L=m.selectionEnd),L!=t||x!=e||m.selectionEnd!=L)try{m.setSelectionRange(e,t),x=e,L=t}catch(e){}v=!1}};this.resetSelection=I,O&&n.onFocus();var N=function(e){return 0===e.selectionStart&&e.selectionEnd>=M.length&&e.value===M&&M&&e.selectionEnd!==L},j=function(e){!v&&(y?y=!1:N(m)?(n.selectAll(),I()):p&&m.selectionStart!=x&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,t){if(F&&(F=!1),b)return I(),e&&n.onPaste(e),b=!1,"";for(var D=m.selectionStart,S=m.selectionEnd,r=x,o=M.length-L,i=e,g=e.length-D,s=e.length-S,l=0;r>0&&M[l]==e[l];)l++,r--;for(i=i.slice(l),l=1;o>0&&M.length-l>x-1&&M[M.length-l]==e[e.length-l];)l++,o--;g-=l-1,s-=l-1;var d=i.length-l+1;if(d<0&&(r=-d,d=0),i=i.slice(0,d),!t&&!i&&!g&&!r&&!o&&!s)return"";$=!0;var c=!1;return a.isAndroid&&". "==i&&(i=" ",c=!0),(!i||r||o||g||s)&&!_?n.onTextInput(i,{extendLeft:r,extendRight:o,restoreStart:g,restoreEnd:s}):n.onTextInput(i),$=!1,M=e,x=D,L=S,C=s,c?"\n":i},B=function(e){if(v)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return n.execCommand("undo");if("historyRedo"==e.inputType)return n.execCommand("redo")}var t=m.value,D=U(t,!0);(t.length>d+100||h.test(D)||p&&x<1&&x==L)&&I()},z=function(e,n,t){var D=e.clipboardData||window.clipboardData;if(D&&!g){var S=s||t?"Text":"text/plain";try{if(n)return!1!==D.setData(S,n);return D.getData(S)}catch(e){if(!t)return z(e,n,!0)}}},V=function(e,t){var S=n.getCopyText();if(!S)return D.preventDefault(e);z(e,S)?(f&&(I(S),y=S,setTimeout(function(){y=!1},10)),t?n.onCut():n.onCopy(),D.preventDefault(e)):(y=!0,m.value=S,m.select(),setTimeout(function(){y=!1,I(),t?n.onCut():n.onCopy()}))},H=function(e){V(e,!0)},W=function(e){V(e,!1)},q=function(e){var t=z(e);i.pasteCancelled()||("string"==typeof t?(t&&n.onPaste(t,e),a.isIE&&setTimeout(I),D.preventDefault(e)):(m.value="",b=!0))};D.addCommandKeyListener(m,function(e,t,D){if(!v)return n.onCommandKey(e,t,D)},n),D.addListener(m,"select",j,n),D.addListener(m,"input",B,n),D.addListener(m,"cut",H,n),D.addListener(m,"copy",W,n),D.addListener(m,"paste",q,n),"oncut"in m&&"oncopy"in m&&"onpaste"in m||D.addListener(e,"keydown",function(e){if((!a.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:W(e);break;case 86:q(e);break;case 88:H(e)}},n);var G=function(e){if(!v&&n.onCompositionStart&&!n.$readOnly&&(v={},!_)){e.data&&(v.useTextareaForIME=!1),setTimeout(K,0),n._signal("compositionStart"),n.on("mousedown",Q);var t=n.getSelectionRange();t.end.row=t.start.row,t.end.column=t.start.column,v.markerRange=t,v.selectionStart=x,n.onCompositionStart(v),v.useTextareaForIME?(M=m.value="",x=0,L=0):(m.msGetInputContext&&(v.context=m.msGetInputContext()),m.getInputContext&&(v.context=m.getInputContext()))}},K=function(){if(v&&n.onCompositionUpdate&&!n.$readOnly){if(_)return Q();v.useTextareaForIME?n.onCompositionUpdate(m.value):(U(m.value),v.markerRange&&(v.context&&(v.markerRange.start.column=v.selectionStart=v.context.compositionStartOffset),v.markerRange.end.column=v.markerRange.start.column+L-v.selectionStart+C))}},Y=function(e){n.onCompositionEnd&&!n.$readOnly&&(v=!1,n.onCompositionEnd(),n.off("mousedown",Q),e&&B())};function Q(){A=!0,m.blur(),m.focus(),A=!1}var Z=o.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&m.value.length<m.selectionStart&&(v||(M=m.value),x=L=-1,I()),Z()}function X(){clearTimeout(t),t=setTimeout(function(){w&&(m.style.cssText=w,w=""),n.renderer.$isMousePressed=!1,n.renderer.$keepTextAreaAtCursor&&n.renderer.$moveTextAreaToCursor()},0)}D.addListener(m,"compositionstart",G,n),D.addListener(m,"compositionupdate",K,n),D.addListener(m,"keyup",J,n),D.addListener(m,"keydown",Z,n),D.addListener(m,"compositionend",Y,n),this.getElement=function(){return m},this.setCommandMode=function(e){_=e,m.readOnly=!1},this.setReadOnly=function(e){_||(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){w||(w=m.style.cssText),m.style.cssText=(S?"z-index:100000;":"")+(a.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+L)*n.renderer.characterWidth*.5+"px;";var o=n.container.getBoundingClientRect(),i=r.computedStyle(n.container),g=o.top+(parseInt(i.borderTopWidth)||0),s=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-g-m.clientHeight-2,d=function(e){r.translate(m,e.clientX-s-2,Math.min(e.clientY-g-2,l))};d(e),"mousedown"==e.type&&(n.renderer.$isMousePressed=!0,clearTimeout(t),a.isWin&&D.capture(n.container,d,X))},this.onContextMenuClose=X;var ee=function(e){n.textInput.onContextMenu(e),X()};function en(e,n,t){var D=null,S=!1;t.addEventListener("keydown",function(e){D&&clearTimeout(D),S=!0},!0),t.addEventListener("keyup",function(e){D=setTimeout(function(){S=!1},100)},!0);var a=function(e){if(document.activeElement===t&&!S&&!v&&!n.$mouseHandler.isMousePressed&&!y){var D=t.selectionStart,a=t.selectionEnd,r=null,o=0;if(0==D?r=c.up:1==D?r=c.home:a>L&&"\n"==M[a]?r=c.end:D<x&&" "==M[D-1]?(r=c.left,o=u.option):D<x||D==x&&L!=x&&D==a?r=c.left:a>L&&M.slice(0,a).split("\n").length>2?r=c.down:a>L&&" "==M[a-1]?(r=c.right,o=u.option):(a>L||a==L&&L!=x&&D==a)&&(r=c.right),D!==a&&(o|=u.shift),r){if(!n.onCommandKey({},o,r)&&n.commands){r=c.keyCodeToString(r);var i=n.commands.findKeyCommand(o,r);i&&n.execCommand(i)}x=D,L=a,I("")}}};document.addEventListener("selectionchange",a),n.on("destroy",function(){document.removeEventListener("selectionchange",a)})}D.addListener(m,"mouseup",ee,n),D.addListener(m,"mousedown",function(e){e.preventDefault(),X()},n),D.addListener(n.renderer.scroller,"contextmenu",ee,n),D.addListener(m,"contextmenu",ee,n),f&&en(e,n,m),this.destroy=function(){m.parentElement&&m.parentElement.removeChild(m)}},n.$setUserAgentForTests=function(e,n){p=e,f=n}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,n,t){"use strict";var D=e("../lib/useragent"),S=0,a=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(),t=e.getDocumentPosition();this.mousedownEvent=e;var S=this.editor,a=e.getButton();if(0!==a){(S.getSelectionRange().isEmpty()||1==a)&&S.selection.moveToPosition(t),2==a&&(S.textInput.onContextMenu(e.domEvent),D.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(t,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,n){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var t=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?t.selection.selectToPosition(e):n||t.selection.moveToPosition(e),n||this.select(),t.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,n=this.editor,t=n.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var D=this.$clickSelection.comparePoint(t);if(-1==D)e=this.$clickSelection.end;else if(1==D)e=this.$clickSelection.start;else{var S=i(this.$clickSelection,t);t=S.cursor,e=S.anchor}n.selection.setSelectionAnchor(e.row,e.column)}n.selection.selectToPosition(t),n.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var n,t=this.editor,D=t.renderer.screenToTextCoordinates(this.x,this.y),S=t.selection[e](D.row,D.column);if(this.$clickSelection){var a=this.$clickSelection.comparePoint(S.start),r=this.$clickSelection.comparePoint(S.end);if(-1==a&&r<=0)n=this.$clickSelection.end,(S.end.row!=D.row||S.end.column!=D.column)&&(D=S.start);else if(1==r&&a>=0)n=this.$clickSelection.start,(S.start.row!=D.row||S.start.column!=D.column)&&(D=S.end);else if(-1==a&&1==r)D=S.end,n=S.start;else{var o=i(this.$clickSelection,D);D=o.cursor,n=o.anchor}t.selection.setSelectionAnchor(n.row,n.column)}t.selection.selectToPosition(D),t.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(),t=this.editor,D=t.session.getBracketRange(n);D?(D.isEmpty()&&(D.start.column--,D.end.column++),this.setState("select")):(D=t.selection.getWordRange(n.row,n.column),this.setState("selectByWords")),this.$clickSelection=D,this.select()},e.prototype.onTripleClick=function(e){var n=e.getDocumentPosition(),t=this.editor;this.setState("selectByLines");var D=t.getSelectionRange();D.isMultiLine()&&D.contains(n.row,n.column)?(this.$clickSelection=t.selection.getLineRange(D.start.row),this.$clickSelection.end=t.selection.getLineRange(D.end.row).end):this.$clickSelection=t.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 t=this.$lastScroll,D=e.domEvent.timeStamp,S=D-t.t,r=S?e.wheelX/S:t.vx,o=S?e.wheelY/S:t.vy;S<a&&(r=(r+t.vx)/2,o=(o+t.vy)/2);var i=Math.abs(r/o),g=!1;if(i>=1&&n.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(g=!0),i<=1&&n.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(g=!0),g?t.allowed=D:D-t.allowed<a&&(Math.abs(r)<=1.5*Math.abs(t.vx)&&Math.abs(o)<=1.5*Math.abs(t.vy)?(g=!0,t.allowed=D):t.allowed=0),t.t=D,t.vx=r,t.vy=o,g)return n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function o(e,n,t,D){return Math.sqrt(Math.pow(t-e,2)+Math.pow(D-n,2))}function i(e,n){if(e.start.row==e.end.row)var t=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 t=2*n.row-e.start.row-e.end.row;else var t=n.column-4;return t<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,t){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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},a=e("./lib/dom");e("./lib/event");var r=e("./range").Range,o=e("./lib/scroll").preventParentScroll,i="ace_tooltip",g=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=a.createElement("div"),this.$element.className=i,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){a.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=i+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,n,t){null!=e&&this.setText(e),null!=n&&null!=t&&this.setPosition(n,t),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=i,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}(),s=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,t,D,a=[];try{for(var r=S(this.popups),o=r.next();!o.done;o=r.next()){var i=o.value,g=!0;try{for(var s=(t=void 0,S(a)),l=s.next();!l.done;l=s.next()){var d=l.value;if(this.doPopupsOverlap(d,i)){g=!1;break}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(D=s.return)&&D.call(s)}finally{if(t)throw t.error}}g?a.push(i):i.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 t=e.getElement().getBoundingClientRect(),D=n.getElement().getBoundingClientRect();return t.left<D.right&&t.right>D.left&&t.top<D.bottom&&t.bottom>D.top},e}());n.popupManager=s,n.Tooltip=g,n.HoverTooltip=function(e){function n(n){void 0===n&&(n=document.body);var t=e.call(this,n)||this;t.timeout=void 0,t.lastT=0,t.idleTime=350,t.lastEvent=void 0,t.onMouseOut=t.onMouseOut.bind(t),t.onMouseMove=t.onMouseMove.bind(t),t.waitForHover=t.waitForHover.bind(t),t.hide=t.hide.bind(t);var D=t.getElement();return D.style.whiteSpace="pre-wrap",D.style.pointerEvents="auto",D.addEventListener("mouseout",t.onMouseOut),D.tabIndex=-1,D.addEventListener("blur",(function(){D.contains(document.activeElement)||this.hide()}).bind(t)),D.addEventListener("wheel",o),t}return D(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 t=n.$mouseHandler.isMousePressed;if(this.isOpen){var D=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(D.row,D.column)||t||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||t||(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,t=e.getDocumentPosition(),D=n.session.getLine(t.row);if(t.column==D.length){var S=n.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),a=n.session.documentToScreenPosition(t.row,t.column);if(a.column!=S.column||a.row!=S.row)return!0}return!1},n.prototype.setDataProvider=function(e){this.$gatherData=e},n.prototype.showForRange=function(e,n,t,D){var S=10;if((!D||D==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var a=e.renderer;this.isOpen||(s.addPopup(this),this.$registerCloseEvents(),this.setTheme(a.theme)),this.isOpen=!0,this.addMarker(n,e.session),this.range=r.fromPoints(n.start,n.end);var o=a.textToScreenCoordinates(n.start.row,n.start.column),i=a.scroller.getBoundingClientRect();o.pageX<i.left&&(o.pageX=i.left);var g=this.getElement();g.innerHTML="",g.appendChild(t),g.style.maxHeight="",g.style.display="block";var l=g.clientHeight,d=g.clientWidth,c=window.innerHeight-o.pageY-a.lineHeight,u=!0;o.pageY-l<0&&o.pageY<c&&(u=!1),g.style.maxHeight=(u?o.pageY:c)-S+"px",g.style.top=u?"":o.pageY+a.lineHeight+"px",g.style.bottom=u?window.innerHeight-o.pageY+"px":"",g.style.left=Math.min(o.pageX,window.innerWidth-d-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,s.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}(g)}),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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},a=e("../lib/dom"),r=e("../lib/event"),o=e("../tooltip").Tooltip,i=e("../config").nls;e("../lib/lang"),n.GutterHandler=function(e){var n,t,D=e.editor,S=D.renderer.$gutterLayer,o=new g(D);function i(){var n=t.getDocumentPosition().row;if(n==D.session.getLength()){var a=D.renderer.pixelToScreenCoordinates(0,t.y).row,r=t.$pos;if(a>D.session.documentToScreenRow(r.row,r.column))return s()}if(o.showTooltip(n),o.isOpen)if(D.on("mousewheel",s),e.$tooltipFollowsMouse)l(t);else{var i=t.getGutterRow(),g=S.$lines.get(i);if(g){var d=g.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),c=o.getElement().style;c.left=d.right+"px",c.top=d.bottom+"px"}else l(t)}}function s(){n&&(n=clearTimeout(n)),o.isOpen&&(o.hideTooltip(),D.off("mousewheel",s))}function l(e){o.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(n){if(D.isFocused()&&0==n.getButton()&&"foldWidgets"!=S.getRegion(n)){var t=n.getDocumentPosition().row,a=D.session.selection;if(n.getShiftKey())a.selectTo(t,0);else{if(2==n.domEvent.detail)return D.selectAll(),n.preventDefault();e.$clickSelection=D.selection.getLineRange(t)}return e.setState("selectByLines"),e.captureMouse(n),n.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(D){var S=D.domEvent.target||D.domEvent.srcElement;if(a.hasCssClass(S,"ace_fold-widget"))return s();o.isOpen&&e.$tooltipFollowsMouse&&l(D),t=D,n||(n=setTimeout(function(){n=null,t&&!e.isMousePressed?i():s()},50))}),r.addListener(D.renderer.$gutter,"mouseout",function(e){t=null,o.isOpen&&!n&&(n=setTimeout(function(){n=null,s()},50))},D),D.on("changeSession",s),D.on("input",s)};var g=function(e){function n(n){var t=e.call(this,n.container)||this;return t.editor=n,t}return D(n,e),n.prototype.setPosition=function(e,n){var t=window.innerWidth||document.documentElement.clientWidth,D=window.innerHeight||document.documentElement.clientHeight,S=this.getWidth(),a=this.getHeight();n+=15,(e+=15)+S>t&&(e-=e+S-t),n+a>D&&(n-=20+a),o.prototype.setPosition.call(this,e,n)},Object.defineProperty(n,"annotationLabels",{get:function(){return{error:{singular:i("gutter-tooltip.aria-label.error.singular","error"),plural:i("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:i("gutter-tooltip.aria-label.security.singular","security finding"),plural:i("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:i("gutter-tooltip.aria-label.warning.singular","warning"),plural:i("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:i("gutter-tooltip.aria-label.info.singular","information message"),plural:i("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:i("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:i("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),n.prototype.showTooltip=function(e){var t=this.editor.renderer.$gutterLayer,D=t.$annotations[e];o=D?{displayText:Array.from(D.displayText),type:Array.from(D.type)}:{displayText:[],type:[]};var S=t.session.getFoldLine(e);if(S&&t.$showFoldedAnnotations){for(var r,o,i,g={error:[],security:[],warning:[],info:[],hint:[]},s={error:1,security:2,warning:3,info:4,hint:5},l=e+1;l<=S.end.row;l++)if(t.$annotations[l])for(var d=0;d<t.$annotations[l].text.length;d++){var c=t.$annotations[l].type[d];g[c].push(t.$annotations[l].text[d]),(!i||s[c]<s[i])&&(i=c)}if(["error","security","warning"].includes(i)){var u="".concat(n.annotationsToSummaryString(g)," in folded code.");o.displayText.push(u),o.type.push(i+"_fold")}}if(0===o.displayText.length)return this.hide();for(var f={error:[],security:[],warning:[],info:[],hint:[]},h=t.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",l=0;l<o.displayText.length;l++){var p=a.createElement("span"),m=a.createElement("span");(r=m.classList).add.apply(r,["ace_".concat(o.type[l]),h]),m.setAttribute("aria-label","".concat(n.annotationLabels[o.type[l].replace("_fold","")].singular)),m.setAttribute("role","img"),m.appendChild(a.createTextNode(" ")),p.appendChild(m),p.appendChild(a.createTextNode(o.displayText[l])),p.appendChild(a.createElement("br")),f[o.type[l].replace("_fold","")].push(p)}var y=this.getElement();a.removeChildren(y),f.error.forEach(function(e){return y.appendChild(e)}),f.security.forEach(function(e){return y.appendChild(e)}),f.warning.forEach(function(e){return y.appendChild(e)}),f.info.forEach(function(e){return y.appendChild(e)}),f.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 t,D,a=[],r=["error","security","warning","info","hint"];try{for(var o=S(r),i=o.next();!i.done;i=o.next()){var g=i.value;if(e[g].length){var s=1===e[g].length?n.annotationLabels[g].singular:n.annotationLabels[g].plural;a.push("".concat(e[g].length," ").concat(s))}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(D=o.return)&&D.call(o)}finally{if(t)throw t.error}}return a.join(", ")},n}(o);n.GutterTooltip=g}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,t){"use strict";var D=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(){D.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){D.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 D.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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/event"),a=e("../lib/useragent"),r=200,o=200,i=5;function g(e){var n,t,g,l,d,c=e.editor,u=D.createElement("div");u.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",u.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(n){e[n]=this[n]},this),c.on("mousedown",this.onMouseDown.bind(e));var f,h,p,m,y,b,v=c.container,$=0;function w(e,n){var t=Date.now(),D=!n||e.row!=n.row,S=!n||e.column!=n.column;!l||D||S?(c.moveCursorToPosition(e),l=t,d={x:h,y:p}):s(d.x,d.y,h,p)>i?l=null:t-l>=o&&(c.renderer.scrollCursorIntoView(),l=null)}function _(e,n){var t=Date.now(),D=c.renderer.layerConfig.lineHeight,S=c.renderer.layerConfig.characterWidth,a=c.renderer.scroller.getBoundingClientRect(),o={x:{left:h-a.left,right:a.right-h},y:{top:p-a.top,bottom:a.bottom-p}},i=Math.min(o.x.left,o.x.right),s=Math.min(o.y.top,o.y.bottom),l={row:e.row,column:e.column};i/S<=2&&(l.column+=o.x.left<o.x.right?-3:2),s/D<=1&&(l.row+=o.y.top<o.y.bottom?-1:1);var d=e.row!=l.row,u=e.column!=l.column,f=!n||e.row!=n.row;d||u&&!f?g?t-g>=r&&c.renderer.scrollCursorIntoView(l):g=t:g=null}function A(){var e=b;w(b=c.renderer.screenToTextCoordinates(h,p),e),_(b,e)}function M(){y=c.selection.toOrientedRange(),f=c.session.addMarker(y,"ace_selection",c.getSelectionStyle()),c.clearSelection(),c.isFocused()&&c.renderer.$cursorLayer.setBlinking(!1),clearInterval(m),A(),m=setInterval(A,20),$=0,S.addListener(document,"mousemove",C)}function x(){clearInterval(m),c.session.removeMarker(f),f=null,c.selection.fromOrientedRange(y),c.isFocused()&&!t&&c.$resetCursorStyle(),y=null,b=null,$=0,g=null,l=null,S.removeListener(document,"mousemove",C)}this.onDragStart=function(e){if(this.cancelDrag||!v.draggable){var n=this;return setTimeout(function(){n.startSelect(),n.captureMouse(e)},0),e.preventDefault()}y=c.getSelectionRange();var D=e.dataTransfer;D.effectAllowed=c.getReadOnly()?"copy":"copyMove",c.container.appendChild(u),D.setDragImage&&D.setDragImage(u,0,0),setTimeout(function(){c.container.removeChild(u)}),D.clearData(),D.setData("Text",c.session.getTextRange()),t=!0,this.setState("drag")},this.onDragEnd=function(e){if(v.draggable=!1,t=!1,this.setState(null),!c.getReadOnly()){var D=e.dataTransfer.dropEffect;n||"move"!=D||c.session.remove(c.getSelectionRange()),c.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!c.getReadOnly()&&k(e.dataTransfer))return h=e.clientX,p=e.clientY,f||M(),$++,e.dataTransfer.dropEffect=n=E(e),S.preventDefault(e)},this.onDragOver=function(e){if(!c.getReadOnly()&&k(e.dataTransfer))return h=e.clientX,p=e.clientY,!f&&(M(),$++),null!==L&&(L=null),e.dataTransfer.dropEffect=n=E(e),S.preventDefault(e)},this.onDragLeave=function(e){if(--$<=0&&f)return x(),n=null,S.preventDefault(e)},this.onDrop=function(e){if(b){var D=e.dataTransfer;if(t)switch(n){case"move":y=y.contains(b.row,b.column)?{start:b,end:b}:c.moveText(y,b);break;case"copy":y=c.moveText(y,b,!0)}else{var a=D.getData("Text");y={start:b,end:c.session.insert(b,a)},c.focus(),n=null}return x(),S.preventDefault(e)}},S.addListener(v,"dragstart",this.onDragStart.bind(e),c),S.addListener(v,"dragend",this.onDragEnd.bind(e),c),S.addListener(v,"dragenter",this.onDragEnter.bind(e),c),S.addListener(v,"dragover",this.onDragOver.bind(e),c),S.addListener(v,"dragleave",this.onDragLeave.bind(e),c),S.addListener(v,"drop",this.onDrop.bind(e),c);var L=null;function C(){null==L&&(L=setTimeout(function(){null!=L&&f&&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 E(e){var n=["copy","copymove","all","uninitialized"],t=["move","copymove","linkmove","all","uninitialized"],D=a.isMac?e.altKey:e.ctrlKey,S="uninitialized";try{S=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return D&&n.indexOf(S)>=0?r="copy":t.indexOf(S)>=0?r="move":n.indexOf(S)>=0&&(r="copy"),r}}function s(e,n,t,D){return Math.sqrt(Math.pow(t-e,2)+Math.pow(D-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=a.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var n=this.editor.container;if(a.isIE&&"dragReady"==this.state){var t=s(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>3&&n.dragDrop()}if("dragWait"===this.state){var t=s(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>0&&(n.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var n=this.editor,t=e.inSelection(),D=e.getButton(),S=e.domEvent.detail||1;if(1===S&&0===D&&t){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()?(a.isWebKit&&(this.cancelDrag=!0,n.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(g.prototype),n.DragdropHandler=g}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,n,t){"use strict";var D=e("./mouse_event").MouseEvent,S=e("../lib/event"),a=e("../lib/dom");n.addTouchListeners=function(e,n){var t,r,o,i,g,s,l,d,c,u="scroll",f=0,h=0,p=0,m=0;function y(){var e=window.navigator&&window.navigator.clipboard,t=!1,D=function(){var D=n.getCopyText(),r=n.session.getUndoManager().hasUndo();c.replaceChild(a.buildDom(t?["span",!D&&S("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],D&&S("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],D&&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"]),c.firstChild)},S=function(e){return n.commands.canExecute(e,n)},r=function(S){var a=S.target.getAttribute("action");if("more"==a||!t)return t=!t,D();"paste"==a?e.readText().then(function(e){n.execCommand(a,e)}):a&&(("cut"==a||"copy"==a)&&(e?e.writeText(n.getCopyText()):document.execCommand("copy")),n.execCommand(a)),c.firstChild.style.display="none",t=!1,"openCommandPalette"!=a&&n.focus()};c=a.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){u="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 b(){if(!n.getOption("enableMobileMenu")){c&&v();return}c||y();var e=n.selection.cursor,t=n.renderer.textToScreenCoordinates(e.row,e.column),D=n.renderer.textToScreenCoordinates(0,0).pageX,S=n.renderer.scrollLeft,a=n.container.getBoundingClientRect();c.style.top=t.pageY-a.top-3+"px",t.pageX-a.left<a.width-70?(c.style.left="",c.style.right="10px"):(c.style.right="",c.style.left=D+S-a.left+"px"),c.style.display="",c.firstChild.style.display="none",n.on("input",v)}function v(e){c&&(c.style.display="none"),n.off("input",v)}function $(){clearTimeout(g=null);var e=n.selection.getRange(),t=e.contains(l.row,l.column);(e.isEmpty()||!t)&&(n.selection.moveToPosition(l),n.selection.selectWord()),u="wait",b()}function w(){clearTimeout(g=null),n.selection.moveToPosition(l);var e=h>=2?n.selection.getLineRange(l.row):n.session.getBracketRange(l);e&&!e.isEmpty()?n.selection.setRange(e):n.selection.selectWord(),u="wait"}function _(){f+=60,s=setInterval(function(){f--<=0&&(clearInterval(s),s=null),.01>Math.abs(p)&&(p=0),.01>Math.abs(m)&&(m=0),f<20&&(p*=.9),f<20&&(m*=.9);var e=n.session.getScrollTop();n.renderer.scrollBy(10*p,10*m),e==n.session.getScrollTop()&&(f=0)},10)}S.addListener(e,"contextmenu",function(e){if(d){var t=n.textInput.getElement();t.focus()}},n),S.addListener(e,"touchstart",function(e){var S=e.touches;if(g||S.length>1){clearTimeout(g),g=null,o=-1,u="zoom";return}d=n.$mouseHandler.isMousePressed=!0;var a=n.renderer.layerConfig.lineHeight,s=n.renderer.layerConfig.lineHeight,c=e.timeStamp;i=c;var y=S[0],b=y.clientX,v=y.clientY;if(Math.abs(t-b)+Math.abs(r-v)>a&&(o=-1),t=e.clientX=b,r=e.clientY=v,p=m=0,l=new D(e,n).getDocumentPosition(),c-o<500&&1==S.length&&!f)h++,e.preventDefault(),e.button=0,w();else{h=0;var _=n.selection.cursor,A=n.selection.isEmpty()?_:n.selection.anchor,M=n.renderer.$cursorLayer.getPixelPosition(_,!0),x=n.renderer.$cursorLayer.getPixelPosition(A,!0),L=n.renderer.scroller.getBoundingClientRect(),C=n.renderer.layerConfig.offset,k=n.renderer.scrollLeft,E=function(e,n){return(e/=s)*e+(n=n/a-.75)*n};if(e.clientX<L.left){u="zoom";return}var T=E(e.clientX-L.left-M.left+k,e.clientY-L.top-M.top+C),O=E(e.clientX-L.left-x.left+k,e.clientY-L.top-x.top+C);T<3.5&&O<3.5&&(u=T>O?"cursor":"anchor"),u=O<3.5?"anchor":T<3.5?"cursor":"scroll",g=setTimeout($,450)}o=c},n),S.addListener(e,"touchend",function(e){d=n.$mouseHandler.isMousePressed=!1,s&&clearInterval(s),"zoom"==u?(u="",f=0):g?(n.selection.moveToPosition(l),f=0,b()):"scroll"==u?(_(),v()):b(),clearTimeout(g),g=null},n),S.addListener(e,"touchmove",function(e){g&&(clearTimeout(g),g=null);var S=e.touches;if(!(S.length>1)&&"zoom"!=u){var a=S[0],o=t-a.clientX,s=r-a.clientY;if("wait"==u)if(!(o*o+s*s>4))return e.preventDefault();else u="cursor";t=a.clientX,r=a.clientY,e.clientX=a.clientX,e.clientY=a.clientY;var l=e.timeStamp,d=l-i;if(i=l,"scroll"==u){var c=new D(e,n);c.speed=1,c.wheelX=o,c.wheelY=s,10*Math.abs(o)<Math.abs(s)&&(o=0),10*Math.abs(s)<Math.abs(o)&&(s=0),0!=d&&(p=o/d,m=s/d),n._emit("mousewheel",c),c.propagationStopped||(p=m=0)}else{var f=new D(e,n).getDocumentPosition();"cursor"==u?n.selection.moveCursorToPosition(f):"anchor"==u&&n.selection.setSelectionAnchor(f.row,f.column),n.renderer.scrollCursorIntoView(f),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,t){"use strict";var D=e("../lib/event"),S=e("../lib/useragent"),a=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,o=e("./mouse_event").MouseEvent,i=e("./dragdrop_handler").DragdropHandler,g=e("./touch_handler").addTouchListeners,s=e("../config"),l=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var n=this;this.editor=e,new a(this),new r(this),new i(this);var t=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();D.addListener(o,"click",this.onMouseEvent.bind(this,"click"),e),D.addListener(o,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),D.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),D.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),g(e.container,e);var s=e.renderer.$gutter;D.addListener(s,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),D.addListener(s,"click",this.onMouseEvent.bind(this,"gutterclick"),e),D.addListener(s,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),D.addListener(s,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),D.addListener(o,"mousedown",t,e),D.addListener(s,"mousedown",t,e),S.isIE&&e.renderer.scrollBarV&&(D.addListener(e.renderer.scrollBarV.element,"mousedown",t,e),D.addListener(e.renderer.scrollBarH.element,"mousedown",t,e)),e.on("mousemove",function(t){if(!n.state&&!n.$dragDelay&&n.$dragEnabled){var D=e.renderer.screenToTextCoordinates(t.x,t.y),S=e.session.selection.getRange(),a=e.renderer;!S.isEmpty()&&S.insideStart(D.row,D.column)?a.setCursorStyle("default"):a.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 t=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;t&&t.length&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseWheel=function(e,n){var t=new o(n,this.editor);t.speed=2*this.$scrollSpeed,t.wheelX=n.wheelX,t.wheelY=n.wheelY,this.editor._emit(e,t)},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 t=this.editor,a=this.editor.renderer;a.$isMousePressed=!0;var r=this,i=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}},g=function(e){t.off("beforeEndOperation",l),clearInterval(d),t.session&&s(),r[r.state+"End"]&&r[r.state+"End"](e),r.state="",r.isMousePressed=a.$isMousePressed=!1,a.$keepTextAreaAtCursor&&a.$moveTextAreaToCursor(),r.$onCaptureMouseMove=r.releaseMouse=null,e&&r.onMouseEvent("mouseup",e),t.endOperation()},s=function(){r[r.state]&&r[r.state](),r.$mouseMoved=!1};if(S.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){g(e)});var l=function(e){r.releaseMouse&&t.curOp.command.name&&t.curOp.selectionChanged&&(r[r.state+"End"]&&r[r.state+"End"](),r.state="",r.releaseMouse())};t.on("beforeEndOperation",l),t.startOperation({command:{name:"mouse"}}),r.$onCaptureMouseMove=i,r.releaseMouse=D.capture(this.editor.container,i,g);var d=setInterval(s,20)},e.prototype.cancelContextMenu=function(){var e=(function(n){(!n||!n.domEvent||"contextmenu"==n.domEvent.type)&&(this.editor.off("nativecontextmenu",e),n&&n.domEvent&&D.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,s.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,t){"use strict";var D=e("../lib/dom");n.FoldHandler=function(){return function(e){e.on("click",function(n){var t=n.getDocumentPosition(),S=e.session,a=S.getFoldAt(t.row,t.column,1);a&&(n.getAccelKey()?S.removeFold(a):S.expandFold(a),n.stop());var r=n.domEvent&&n.domEvent.target;r&&D.hasCssClass(r,"ace_inline_button")&&D.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 t=n.getDocumentPosition().row,D=e.session;D.foldWidgets&&D.foldWidgets[t]&&e.session.onFoldWidgetClick(t,n),e.isFocused()||e.focus(),n.stop()}}),e.on("gutterdblclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var t=n.getDocumentPosition().row,D=e.session,S=D.getParentFoldRangeData(t,!0),a=S.range||S.firstRange;if(a){t=a.start.row;var r=D.getFoldAt(t,D.getLine(t).length,1);r?D.removeFold(r):(D.addFold("...",a),e.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}n.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,n,t){"use strict";var D=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 t=this.$handlers.indexOf(e);-1!=t&&this.$handlers.splice(t,1),void 0==n?this.$handlers.push(e):this.$handlers.splice(n,0,e),-1==t&&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(t){return t.getStatusText&&t.getStatusText(n,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,n,t,D){for(var a,r=!1,o=this.$editor.commands,i=this.$handlers.length;i--&&(!(a=this.$handlers[i].handleKeyboard(this.$data,e,n,t,D))||!a.command||((r="null"==a.command||o.exec(a.command,this.$editor,a.args,D))&&D&&-1!=e&&!0!=a.passEvent&&!0!=a.command.passEvent&&S.stopEvent(D),!r)););return r||-1!=e||(a={command:"insertstring"},r=o.exec("insertstring",this.$editor,n)),r&&this.$editor._signal&&this.$editor._signal("keyboardActivity",a),r},e.prototype.onCommandKey=function(e,n,t){var S=D.keyCodeToString(t);return this.$callKeyboardHandlers(n,S,t,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,n,t){"use strict";var D=0,S=0,a=!1,r=!1,o=!1,i=[[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]],g=[[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]],s=0,l=1,d=0,c=1,u=2,f=3,h=4,p=5,m=6,y=7,b=8,v=9,$=10,w=11,_=12,A=13,M=14,x=15,L=16,C=17,k=18,E=[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,t,s){var l=D?g:i,d=null,c=null,u=null,f=0,h=null,y=null,v=-1,$=null,w=null,_=[];if(!s)for($=0,s=[];$<t;$++)s[$]=N(e[$]);for(w=0,S=D,a=!1,r=!1,o=!1;w<t;w++){if(d=f,_[w]=c=I(e,s,_,w),h=240&(f=l[d][c]),f&=15,n[w]=u=l[f][5],h>0)if(16==h){for($=v;$<w;$++)n[$]=1;v=-1}else v=-1;if(y=l[f][6])-1==v&&(v=w);else if(v>-1){for($=v;$<w;$++)n[$]=u;v=-1}s[w]==p&&(n[w]=0),S|=u}if(o){for($=0;$<t;$++)if(s[$]==m){n[$]=D;for(var A=$-1;A>=0;A--)if(s[A]==b)n[A]=D;else break}}}function R(e,n,t){if(!(S<e)){if(1==e&&D==l&&!r)return void t.reverse();for(var a,o,i,g,s=t.length,d=0;d<s;){if(n[d]>=e){for(a=d+1;a<s&&n[a]>=e;)a++;for(o=d,i=a-1;o<i;o++,i--)g=t[o],t[o]=t[i],t[i]=g;d=a}d++}}}function I(e,n,t,S){var i,g,s,l,E=n[S];switch(E){case d:case c:a=!1;case h:case f:return E;case u:return a?f:u;case y:return a=!0,c;case b:return h;case v:if(S<1||S+1>=n.length||(i=t[S-1])!=u&&i!=f||(g=n[S+1])!=u&&g!=f)return h;return a&&(g=f),g==i?g:h;case $:if((i=S>0?t[S-1]:p)==u&&S+1<n.length&&n[S+1]==u)return u;return h;case w:if(S>0&&t[S-1]==u)return u;if(a)return h;for(l=S+1,s=n.length;l<s&&n[l]==w;)l++;if(l<s&&n[l]==u)return u;return h;case _:for(s=n.length,l=S+1;l<s&&n[l]==_;)l++;if(l<s){var T=e[S],O=T>=1425&&T<=2303||64286==T;if(i=n[l],O&&(i==c||i==y))return c}if(S<1||(i=n[S-1])==p)return h;return t[S-1];case p:return a=!1,r=!0,D;case m:return o=!0,h;case A:case M:case L:case C:case x:a=!1;case k:return h}}function N(e){var n=e.charCodeAt(0),t=n>>8;if(0==t)return n>191?d:E[n];if(5==t)return/[\u0591-\u05f4]/.test(e)?c:d;if(6==t)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return _;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return f;else if(1642==n)return w;else if(/[\u06f0-\u06f9]/.test(e))return u;else return y;if(32==t&&n<=8287)return T[255&n];if(254==t)return n>=65136?y:h;return h}n.L=0,n.R=c,n.EN=u,n.ON_R=3,n.AN=4,n.R_H=5,n.B=6,n.RLE=7,n.DOT="\xb7",n.doBidiReorder=function(e,t,S){if(e.length<2)return{};var a=e.split(""),r=Array(a.length),o=Array(a.length),i=[];D=S?l:s,O(a,i,a.length,t);for(var g=0;g<r.length;r[g]=g,g++);R(2,i,r),R(1,i,r);for(var g=0;g<r.length-1;g++)t[g]===f?i[g]=n.AN:i[g]===c&&(t[g]>y&&t[g]<A||t[g]===h||t[g]===k)?i[g]=n.ON_R:g>0&&"ل"===a[g-1]&&/\u0622|\u0623|\u0625|\u0627/.test(a[g])&&(i[g-1]=i[g]=n.R_H,g++);a[a.length-1]===n.DOT&&(i[a.length-1]=n.B),""===a[0]&&(i[0]=n.RLE);for(var g=0;g<r.length;g++)o[g]=i[r[g]];return{logicalFromVisual:r,bidiLevels:o}},n.hasBidiCharacters=function(e,n){for(var t=!1,D=0;D<e.length;D++)n[D]=N(e.charAt(D)),t||n[D]!=c&&n[D]!=y&&n[D]!=f||(t=!0);return t},n.getVisualFromLogicalIdx=function(e,n){for(var t=0;t<n.logicalFromVisual.length;t++)if(n.logicalFromVisual[t]==e)return t;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,n,t){"use strict";var D=e("./lib/bidiutil"),S=e("./lib/lang"),a=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;n.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=D,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=a.test(e.getValue())}return e.prototype.isBidiRow=function(e,n,t){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(n,t),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&a.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 t=this.session.$getRowCacheIndex(n,this.currentRow);t>=0&&(e=this.session.$docRowCache[t])}return e},e.prototype.getSplitIndex=function(){var e=0,n=this.session.$screenRowCache;if(n.length)for(var t,D=this.session.$getRowCacheIndex(n,this.currentRow);this.currentRow-e>0&&(t=this.session.$getRowCacheIndex(n,this.currentRow-e-1))===D;)D=t,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,n){void 0===e&&(e=this.getDocumentRow());var t=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 a=this.session.$wrapData[e];a&&(void 0===n&&(n=this.getSplitIndex()),n>0&&a.length?(this.wrapIndent=a.indent,this.wrapOffset=this.wrapIndent*this.charWidths[D.L],this.line=n<a.length?this.line.substring(a[n-1],a[n]):this.line.substring(a[a.length-1])):this.line=this.line.substring(0,a[n]),n==a.length&&(this.line+=this.showInvisibles?t:D.DOT))}else this.line+=this.showInvisibles?t:D.DOT;var r,o=this.session,i=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+i):2,i+=r-1,S.stringRepeat(D.DOT,r)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==D.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=[];D.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=D.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,t=e.$measureCharWidth("ה");this.charWidths[D.L]=this.charWidths[D.EN]=this.charWidths[D.ON_R]=n,this.charWidths[D.R]=this.charWidths[D.AN]=t,this.charWidths[D.R_H]=.45*t,this.charWidths[D.B]=this.charWidths[D.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 t=e.getCursorPosition(),D=e.selection.getSelectionAnchor().row;D<=t.row;D++)n||e.session.getLine(D).charAt(0)!==e.session.$bidiHandler.RLE?n&&e.session.getLine(D).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:D},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(D,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var n=+(this.line.charAt(0)===this.RLE),t=e>n?this.session.getOverwrite()?e:e-1:n,S=D.getVisualFromLogicalIdx(t,this.bidiMap),a=this.bidiMap.bidiLevels,r=0;!this.session.getOverwrite()&&e<=n&&a[S]%2!=0&&S++;for(var o=0;o<S;o++)r+=this.charWidths[a[o]];return!this.session.getOverwrite()&&e>n&&a[S]%2==0&&(r+=this.charWidths[a[S]]),this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(r+=this.rtlLineOffset),r},e.prototype.getSelections=function(e,n){var t,D=this.bidiMap,S=D.bidiLevels,a=[],r=0,o=Math.min(e,n)-this.wrapIndent,i=Math.max(e,n)-this.wrapIndent,g=!1,s=!1,l=0;this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var d,c=0;c<S.length;c++)d=D.logicalFromVisual[c],t=S[c],(g=d>=o&&d<i)&&!s?l=r:!g&&s&&a.push({left:l,width:r-l}),r+=this.charWidths[t],s=g;if(g&&c===S.length&&a.push({left:l,width:r-l}),this.isRtlDir)for(var u=0;u<a.length;u++)a[u].left+=this.rtlLineOffset;return a},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var n=0,e=Math.max(e,0),t=0,D=0,S=this.bidiMap.bidiLevels,a=this.charWidths[S[D]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>t+a/2;){if(t+=a,D===S.length-1){a=0;break}a=this.charWidths[S[++D]]}return D>0&&S[D-1]%2!=0&&S[D]%2==0?(e<t&&D--,n=this.bidiMap.logicalFromVisual[D]):D>0&&S[D-1]%2==0&&S[D]%2!=0?n=1+(e>t?this.bidiMap.logicalFromVisual[D]:this.bidiMap.logicalFromVisual[D-1]):this.isRtlDir&&D===S.length-1&&0===a&&S[D-1]%2==0||!this.isRtlDir&&0===D&&S[D]%2!=0?n=1+this.bidiMap.logicalFromVisual[D]:(D>0&&S[D-1]%2!=0&&0!==a&&D--,n=this.bidiMap.logicalFromVisual[D]),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/lang"),a=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 t=n?e.end:e.start,D=n?e.start:e.end;this.$setSelection(t.row,t.column,D.row,D.column)},e.prototype.$setSelection=function(e,n,t,D){if(!this.$silent){var S=this.$isEmpty,a=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,n),this.cursor.setPosition(t,D),this.$isEmpty=!r.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||S!=this.$isEmpty||a)&&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 t=e||this.lead;e=t.row,n=t.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 t,D="number"==typeof e?e:this.lead.row,S=this.session.getFoldLine(D);return(S?(D=S.start.row,t=S.end.row):t=D,!0===n)?new r(D,0,t,this.session.getLine(t).length):new r(D,0,t+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,t){var D=e.column,S=e.column+n;return t<0&&(D=e.column-n,S=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(D,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 t=this.session.getTabSize();this.wouldMoveIntoSoftTab(n,t,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-t):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 t=this.session.getTabSize(),n=this.lead;this.wouldMoveIntoSoftTab(n,t,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,t):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,n=this.lead.column,t=this.session.documentToScreenRow(e,n),D=this.session.screenToDocumentPosition(t,0),S=this.session.getDisplayLine(e,null,D.row,D.column).match(/^\s*/);S[0].length==n||this.session.$useEmacsStyleLineStart||(D.column+=S[0].length),this.moveCursorToPosition(D)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,n=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==n.column){var t=this.session.getLine(n.row);if(n.column==t.length){var D=t.search(/\s+$/);D>0&&(n.column=D)}}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,t=this.doc.getLine(e),D=t.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(D)&&(n+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,D=t.substring(n)),n>=t.length){this.moveCursorTo(e,t.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(D)&&(n+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,n)},e.prototype.moveCursorLongWordLeft=function(){var e,n=this.lead.row,t=this.lead.column;if(e=this.session.getFoldAt(n,t,-1))return void this.moveCursorTo(e.start.row,e.start.column);var D=this.session.getFoldStringAt(n,t,-1);null==D&&(D=this.doc.getLine(n).substring(0,t));var a=S.stringReverse(D);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(a)&&(t-=this.session.nonTokenRe.lastIndex,a=a.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),t<=0){this.moveCursorTo(n,0),this.moveCursorLeft(),n>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(a)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(n,t)},e.prototype.$shortWordEndIndex=function(e){var n,t=0,D=/\s/,S=this.session.tokenRe;if(S.lastIndex=0,this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{for(;(n=e[t])&&D.test(n);)t++;if(t<1){for(S.lastIndex=0;(n=e[t])&&!S.test(n);)if(S.lastIndex=0,t++,D.test(n))if(t>2){t--;break}else{for(;(n=e[t])&&D.test(n);)t++;if(t>2)break}}}return S.lastIndex=0,t},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,n=this.lead.column,t=this.doc.getLine(e),D=t.substring(n),S=this.session.getFoldAt(e,n,1);if(S)return this.moveCursorTo(S.end.row,S.end.column);if(n==t.length){var a=this.doc.getLength();do e++,D=this.doc.getLine(e);while(e<a&&/^\s*$/.test(D));/^\s+/.test(D)||(D=""),n=0}var r=this.$shortWordEndIndex(D);this.moveCursorTo(e,n+r)},e.prototype.moveCursorShortWordLeft=function(){var e,n=this.lead.row,t=this.lead.column;if(e=this.session.getFoldAt(n,t,-1))return this.moveCursorTo(e.start.row,e.start.column);var D=this.session.getLine(n).substring(0,t);if(0===t){do n--,D=this.doc.getLine(n);while(n>0&&/^\s*$/.test(D));t=D.length,/\s+$/.test(D)||(D="")}var a=S.stringReverse(D),r=this.$shortWordEndIndex(a);return this.moveCursorTo(n,t-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 t,D=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===n&&(0!==e&&(this.session.$bidiHandler.isBidiRow(D.row,this.lead.row)?(t=this.session.$bidiHandler.getPosLeft(D.column),D.column=Math.round(t/this.session.$bidiHandler.charWidths[0])):t=D.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?D.column=this.$desiredColumn:this.$desiredColumn=D.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 a=this.session.screenToDocumentPosition(D.row+e,D.column,t);0!==e&&0===n&&a.row===this.lead.row&&(a.column,this.lead.column),this.moveCursorTo(a.row,a.column+n,0===n)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,n,t){var D=this.session.getFoldAt(e,n,1);D&&(e=D.start.row,n=D.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,t||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,n,t){var D=this.session.screenToDocumentPosition(e,n);this.moveCursorTo(D.row,D.column,t)},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 t=this.getCursor();return r.fromPoints(n,t)}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 t=r.fromPoints(e[n].start,e[n].end);e[n].isBackwards&&(t.cursor=t.start),this.addRange(t,!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,D.implement(o.prototype,a),n.Selection=o}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,n,t){"use strict";var D=e("./lib/report_error").reportError,S=2e3,a=function(){function e(e){for(var n in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var t=this.states[n],D=[],S=0,a=this.matchMappings[n]={defaultToken:"text"},r="g",o=[],i=0;i<t.length;i++){var g=t[i];if(g.defaultToken&&(a.defaultToken=g.defaultToken),g.caseInsensitive&&-1===r.indexOf("i")&&(r+="i"),g.unicode&&-1===r.indexOf("u")&&(r+="u"),null!=g.regex){g.regex instanceof RegExp&&(g.regex=g.regex.toString().slice(1,-1));var s=g.regex,l=RegExp("(?:("+s+")|(.))").exec("a").length-2;Array.isArray(g.token)?1==g.token.length||1==l?g.token=g.token[0]:l-1!=g.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:g,groupCount:l-1}),g.token=g.token[0]):(g.tokenArray=g.token,g.token=null,g.onMatch=this.$arrayTokens):"function"!=typeof g.token||g.onMatch||(l>1?g.onMatch=this.$applyToken:g.onMatch=g.token),l>1&&(/\\\d/.test(g.regex)?s=g.regex.replace(/\\([0-9]+)/g,function(e,n){return"\\"+(parseInt(n,10)+S+1)}):(l=1,s=this.removeCapturingGroups(g.regex)),g.splitRegex||"string"==typeof g.token||o.push(g)),a[S]=i,S+=l,D.push(s),g.onMatch||(g.onMatch=null)}}D.length||(a[0]=0,D.push("$")),o.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,r)},this),this.regExps[n]=RegExp("("+D.join(")|(")+")|($)",r)}}return e.prototype.$setMaxTokenCount=function(e){S=0|e},e.prototype.$applyToken=function(e){var n=this.splitRegex.exec(e).slice(1),t=this.token.apply(this,n);if("string"==typeof t)return[{type:t,value:e}];for(var D=[],S=0,a=t.length;S<a;S++)n[S]&&(D[D.length]={type:t[S],value:n[S]});return D},e.prototype.$arrayTokens=function(e){if(!e)return[];var n=this.splitRegex.exec(e);if(!n)return"text";for(var t=[],D=this.tokenArray,S=0,a=D.length;S<a;S++)n[S+1]&&(t[t.length]={type:D[S],value:n[S+1]});return t},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 t=0,D=!1,S={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,n,a,r,o,i){return D?D="]"!=o:o?D=!0:r?(t==S.stack&&(S.end=i+1,S.stack=-1),t--):a&&(t++,1!=a.length&&(S.stack=t,S.start=i)),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 t=n.slice(0);"#tmp"===(n=t[0])&&(t.shift(),n=t.shift())}else var t=[];var D=n||"start",a=this.states[D];a||(D="start",a=this.states[D]);var r=this.matchMappings[D],o=this.regExps[D];o.lastIndex=0;for(var i,g=[],s=0,l=0,d={type:null,value:""};i=o.exec(e);){var c=r.defaultToken,u=null,f=i[0],h=o.lastIndex;if(h-f.length>s){var p=e.substring(s,h-f.length);d.type==c?d.value+=p:(d.type&&g.push(d),d={type:c,value:p})}for(var m=0;m<i.length-2;m++)if(void 0!==i[m+1]){u=a[r[m]],c=u.onMatch?u.onMatch(f,D,t,e):u.token,u.next&&(D="string"==typeof u.next?u.next:u.next(D,t),(a=this.states[D])||(this.reportError("state doesn't exist",D),D="start",a=this.states[D]),r=this.matchMappings[D],s=h,(o=this.regExps[D]).lastIndex=h),u.consumeLineEnd&&(s=h);break}if(f){if("string"==typeof c)u&&!1===u.merge||d.type!==c?(d.type&&g.push(d),d={type:c,value:f}):d.value+=f;else if(c){d.type&&g.push(d),d={type:null,value:""};for(var m=0;m<c.length;m++)g.push(c[m])}}if(s==e.length)break;if(s=h,l++>S){for(l>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:n,line:e});s<e.length;)d.type&&g.push(d),d={value:e.substring(s,s+=500),type:"overflow"};D="start",t=[];break}}return d.type&&g.push(d),t.length>1&&t[0]!==D&&t.unshift("#tmp",D),{tokens:g,state:t.length?t:D}},e}();a.prototype.reportError=D,n.Tokenizer=a}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,n,t){"use strict";var D,S=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,n){if(!n){for(var t in e)this.$rules[t]=e[t];return}for(var t in e){for(var D=e[t],S=0;S<D.length;S++){var a=D[S];(a.next||a.onMatch)&&("string"==typeof a.next&&0!==a.next.indexOf(n)&&(a.next=n+a.next),a.nextState&&0!==a.nextState.indexOf(n)&&(a.nextState=n+a.nextState))}this.$rules[n+t]=D}},this.getRules=function(){return this.$rules},this.embedRules=function(e,n,t,D,a){var r="function"==typeof e?new e().getRules():e;if(D)for(var o=0;o<D.length;o++)D[o]=n+D[o];else for(var i in D=[],r)D.push(n+i);if(this.addRules(r,n),t)for(var g=Array.prototype[a?"push":"unshift"],o=0;o<D.length;o++)g.apply(this.$rules[D[o]],S(t));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 t=0,D=this.$rules;function S(a){var r=D[a];r.processed=!0;for(var o=0;o<r.length;o++){var i=r[o],g=null;Array.isArray(i)&&(g=i,i={}),!i.regex&&i.start&&(i.regex=i.start,i.next||(i.next=[]),i.next.push({defaultToken:i.token},{token:i.token+".end",regex:i.end||i.start,next:"pop"}),i.token=i.token+".start",i.push=!0);var s=i.next||i.push;if(s&&Array.isArray(s)){var l=i.stateName;!l&&("string"!=typeof(l=i.token)&&(l=l[0]||""),D[l]&&(l+=t++)),D[l]=s,i.next=l,S(l)}else"pop"==s&&(i.next=n);if(i.push&&(i.nextState=i.next||i.push,i.next=e,delete i.push),i.rules)for(var d in i.rules)D[d]?D[d].push&&D[d].push.apply(D[d],i.rules[d]):D[d]=i.rules[d];var c="string"==typeof i?i:i.include;if(c&&("$self"===c&&(c="start"),g=Array.isArray(c)?c.map(function(e){return D[e]}):D[c]),g){var u=[o,1].concat(g);i.noEscape&&(u=u.filter(function(e){return!e.next})),r.splice.apply(r,u),o--}i.keywordMap&&(i.token=this.createKeywordMapper(i.keywordMap,i.defaultToken||"text",i.caseInsensitive),delete i.defaultToken)}}Object.keys(D).forEach(S,this)},this.createKeywordMapper=function(e,n,t,D){var S=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(n){for(var a=e[n].split(D||"|"),r=a.length;r--;){var o=a[r];this.$keywordList.push(o),t&&(o=o.toLowerCase()),S[o]=n}},this),e=null,t?function(e){return S[e.toLowerCase()]||n}:function(e){return S[e]||n}},this.getKeywords=function(){return this.$keywords}}).call((D=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),n.TextHighlightRules=D}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,n,t){"use strict";var D;(function(){this.add=function(e,n,t){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][n]=t},this.addBehaviours=function(e){for(var n in e)for(var t in e[n])this.add(n,t,e[n][t])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,n){if("function"==typeof e)var t=new e().getBehaviours(n);else var t=e.getBehaviours(n);this.addBehaviours(t)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var n={},t=0;t<e.length;t++)this.$behaviours[e[t]]&&(n[e[t]]=this.$behaviours[e[t]]);return n}}).call((D=function(){this.$behaviours={}}).prototype),n.Behaviour=D}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=e("./range").Range;n.TokenIterator=function(){function e(e,n,t){this.$session=e,this.$row=n,this.$rowTokens=e.getTokens(n);var D=e.getTokenAt(n,t);this.$tokenIndex=D?D.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,t=e[n].start;if(void 0!==t)return t;for(t=0;n>0;)n-=1,t+=e[n].value.length;return t},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 D(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,t){"use strict";var D,S,a=e("../../lib/oop"),r=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,i=e("../../lib/lang"),g=["text","paren.rparen","rparen","paren","punctuation.operator"],s=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],l={},d={'"':'"',"'":"'"},c=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 D=l[n];D=l[n]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},u=function(e,n,t,D){var S=e.end.row-e.start.row;return{text:t+n+D,selection:[0,e.start.column+1,S,e.end.column+ +!S]}};(S=function(e){e=e||{},this.add("braces","insertion",function(n,t,a,r,o){var g=a.getCursorPosition(),s=r.doc.getLine(g.row);if("{"==o){c(a);var l=a.getSelectionRange(),d=r.doc.getTextRange(l),f=r.getTokenAt(g.row,g.column);if(""!==d&&"{"!==d&&a.getWrapBehavioursEnabled())return u(l,d,"{","}");if(f&&/(?:string)\.quasi|\.xml/.test(f.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(f.type)})||/(string)\.quasi/.test(f.type)&&"$"!==f.value[g.column-f.start-1])return;return S.recordAutoInsert(a,r,"}"),{text:"{}",selection:[1,1]}}if(S.isSaneInsertion(a,r))if(/[\]\}\)]/.test(s[g.column])||a.inMultiSelectMode||e.braces)return S.recordAutoInsert(a,r,"}"),{text:"{}",selection:[1,1]};else return S.recordMaybeInsert(a,r,"{"),{text:"{",selection:[1,1]}}else if("}"==o){c(a);var h=s.substring(g.column,g.column+1);if("}"==h&&null!==r.$findOpeningBracket("}",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,o))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==o||"\r\n"==o){c(a);var p="";S.isMaybeInsertedClosing(g,s)&&(p=i.stringRepeat("}",D.maybeInsertedBrackets),S.clearMaybeInsertedClosing());var h=s.substring(g.column,g.column+1);if("}"===h){var m=r.findMatchingBracket({row:g.row,column:g.column+1},"}");if(!m)return null;var y=this.$getIndent(r.getLine(m.row))}else if(!p)return void S.clearMaybeInsertedClosing();else var y=this.$getIndent(s);var b=y+r.getTabString();return{text:"\n"+b+"\n"+y+p,selection:[1,b.length,1,b.length]}}else S.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,n,t,S,a){var r=S.doc.getTextRange(a);if(!a.isMultiLine()&&"{"==r){if(c(t),"}"==S.doc.getLine(a.start.row).substring(a.end.column,a.end.column+1))return a.end.column++,a;D.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,n,t,D,a){if("("==a){c(t);var r=t.getSelectionRange(),o=D.doc.getTextRange(r);if(""!==o&&t.getWrapBehavioursEnabled())return u(r,o,"(",")");if(S.isSaneInsertion(t,D))return S.recordAutoInsert(t,D,")"),{text:"()",selection:[1,1]}}else if(")"==a){c(t);var i=t.getCursorPosition(),g=D.doc.getLine(i.row);if(")"==g.substring(i.column,i.column+1)&&null!==D.$findOpeningBracket(")",{column:i.column+1,row:i.row})&&S.isAutoInsertedClosing(i,g,a))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,n,t,D,S){var a=D.doc.getTextRange(S);if(!S.isMultiLine()&&"("==a&&(c(t),")"==D.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,t,D,a){if("["==a){c(t);var r=t.getSelectionRange(),o=D.doc.getTextRange(r);if(""!==o&&t.getWrapBehavioursEnabled())return u(r,o,"[","]");if(S.isSaneInsertion(t,D))return S.recordAutoInsert(t,D,"]"),{text:"[]",selection:[1,1]}}else if("]"==a){c(t);var i=t.getCursorPosition(),g=D.doc.getLine(i.row);if("]"==g.substring(i.column,i.column+1)&&null!==D.$findOpeningBracket("]",{column:i.column+1,row:i.row})&&S.isAutoInsertedClosing(i,g,a))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,n,t,D,S){var a=D.doc.getTextRange(S);if(!S.isMultiLine()&&"["==a&&(c(t),"]"==D.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,t,D,S){var a=D.$mode.$quotes||d;if(1==S.length&&a[S]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(S))return;c(t);var r=S,o=t.getSelectionRange(),i=D.doc.getTextRange(o);if(""!==i&&(1!=i.length||!a[i])&&t.getWrapBehavioursEnabled())return u(o,i,r,r);if(!i){var g,s=t.getCursorPosition(),l=D.doc.getLine(s.row),f=l.substring(s.column-1,s.column),h=l.substring(s.column,s.column+1),p=D.getTokenAt(s.row,s.column),m=D.getTokenAt(s.row,s.column+1);if("\\"==f&&p&&/escape/.test(p.type))return null;var y=p&&/string|escape/.test(p.type),b=!m||/string|escape/.test(m.type);if(h==r)(g=y!==b)&&/string\.end/.test(m.type)&&(g=!1);else{if(y&&!b||y&&b)return null;var v=D.$mode.tokenRe;v.lastIndex=0;var $=v.test(f);v.lastIndex=0;var w=v.test(h),_=D.$mode.$pairQuotesAfter;if(!(_&&_[r]&&_[r].test(f))&&$||w||h&&!/[\s;,.})\]\\]/.test(h))return null;var A=l[s.column-2];if(f==r&&(A==r||v.test(A)))return null;g=!0}return{text:g?r+r:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,n,t,D,S){var a=D.$mode.$quotes||d,r=D.doc.getTextRange(S);if(!S.isMultiLine()&&a.hasOwnProperty(r)&&(c(t),D.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,t,D,S){if("doc-start"===e&&("\n"===S||"\r\n"===S)&&t.selection.isEmpty()){var a=t.getCursorPosition();if(0!==a.column){for(var r=D.doc.getLine(a.row),o=D.doc.getLine(a.row+1),i=D.getTokens(a.row),g=0,s=0;s<i.length;s++){g+=i[s].value.length;var l=i[s];if(g>=a.column){if(g===a.column){if(!/\.doc/.test(l.type))return;if(/\*\//.test(l.value)){var d=i[s+1];if(!d||!/\.doc/.test(d.type))return}}var c=a.column-(g-l.value.length),u=l.value.indexOf("*/"),f=l.value.indexOf("/**",u>-1?u+2:0);if(-1!==f&&c>f&&c<f+3||-1!==u&&-1!==f&&c>=u&&c<=f||!/\.doc/.test(l.type))return;break}}var h=this.$getIndent(r);if(/\s*\*/.test(o))if(/^\s*\*/.test(r))return{text:S+h+"* ",selection:[1,2+h.length,1,2+h.length]};else return{text:S+h+" * ",selection:[1,3+h.length,1,3+h.length]};if(/\/\*\*/.test(r.substring(0,a.column)))return{text:S+h+" * "+S+" "+h+"*/",selection:[1,4+h.length,1,4+h.length]}}}})}).isSaneInsertion=function(e,n){var t=e.getCursorPosition(),D=new o(n,t.row,t.column);if(!this.$matchTokenType(D.getCurrentToken()||"text",g)){if(/[)}\]]/.test(e.session.getLine(t.row)[t.column]))return!0;var S=new o(n,t.row,t.column+1);if(!this.$matchTokenType(S.getCurrentToken()||"text",g))return!1}return D.stepForward(),D.getCurrentTokenRow()!==t.row||this.$matchTokenType(D.getCurrentToken()||"text",s)},S.$matchTokenType=function(e,n){return n.indexOf(e.type||e)>-1},S.recordAutoInsert=function(e,n,t){var S=e.getCursorPosition(),a=n.doc.getLine(S.row);this.isAutoInsertedClosing(S,a,D.autoInsertedLineEnd[0])||(D.autoInsertedBrackets=0),D.autoInsertedRow=S.row,D.autoInsertedLineEnd=t+a.substr(S.column),D.autoInsertedBrackets++},S.recordMaybeInsert=function(e,n,t){var S=e.getCursorPosition(),a=n.doc.getLine(S.row);this.isMaybeInsertedClosing(S,a)||(D.maybeInsertedBrackets=0),D.maybeInsertedRow=S.row,D.maybeInsertedLineStart=a.substr(0,S.column)+t,D.maybeInsertedLineEnd=a.substr(S.column),D.maybeInsertedBrackets++},S.isAutoInsertedClosing=function(e,n,t){return D.autoInsertedBrackets>0&&e.row===D.autoInsertedRow&&t===D.autoInsertedLineEnd[0]&&n.substr(e.column)===D.autoInsertedLineEnd},S.isMaybeInsertedClosing=function(e,n){return D.maybeInsertedBrackets>0&&e.row===D.maybeInsertedRow&&n.substr(e.column)===D.maybeInsertedLineEnd&&n.substr(0,e.column)==D.maybeInsertedLineStart},S.popAutoInsertedClosing=function(){D.autoInsertedLineEnd=D.autoInsertedLineEnd.substr(1),D.autoInsertedBrackets--},S.clearMaybeInsertedClosing=function(){D&&(D.maybeInsertedBrackets=0,D.maybeInsertedRow=-1)},a.inherits(S,r),n.CstyleBehaviour=S}),ace.define("ace/unicode",["require","exports","module"],function(e,n,t){"use strict";for(var D=[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,a=[],r=0;r<D.length;r+=2)a.push(S+=D[r]),D[r+1]&&a.push(45,S+=D[r+1]);n.wordChars=String.fromCharCode.apply(null,a)}),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,t){"use strict";var D,S=e("../config"),a=e("../tokenizer").Tokenizer,r=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,i=e("../unicode"),g=e("../lib/lang"),s=e("../token_iterator").TokenIterator,l=e("../range").Range;(function(){this.$defaultBehaviour=new o,this.tokenRe=RegExp("^["+i.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+i.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new a(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,n,t,D){var S=n.doc,a=!0,r=!0,o=1/0,i=n.getTabSize(),s=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var l=this.lineCommentStart.map(g.escapeRegExp).join("|"),d=this.lineCommentStart[0];else var l=g.escapeRegExp(this.lineCommentStart),d=this.lineCommentStart;l=RegExp("^(\\s*)(?:"+l+") ?"),s=n.getUseSoftTabs();var c=function(e,n){var t=e.match(l);if(t){var D=t[1].length,a=t[0].length;!p(e,D,a)&&" "==t[0][a-1]&&a--,S.removeInLine(n,D,a)}},u=d+" ",f=function(e,n){(!a||/\S/.test(e))&&(p(e,o,o)?S.insertInLine({row:n,column:o},u):S.insertInLine({row:n,column:o},d))},h=function(e,n){return l.test(e)},p=function(e,n,t){for(var D=0;n--&&" "==e.charAt(n);)D++;if(D%i!=0)return!1;for(var D=0;" "==e.charAt(t++);)D++;return i>2?D%i!=i-1:D%i==0}}else{if(!this.blockComment)return!1;var d=this.blockComment.start,m=this.blockComment.end,l=RegExp("^(\\s*)(?:"+g.escapeRegExp(d)+")"),y=RegExp("(?:"+g.escapeRegExp(m)+")\\s*$"),f=function(e,n){!h(e,n)&&(!a||/\S/.test(e))&&(S.insertInLine({row:n,column:e.length},m),S.insertInLine({row:n,column:o},d))},c=function(e,n){var t;(t=e.match(y))&&S.removeInLine(n,e.length-t[0].length,e.length),(t=e.match(l))&&S.removeInLine(n,t[1].length,t[0].length)},h=function(e,t){if(l.test(e))return!0;for(var D=n.getTokens(t),S=0;S<D.length;S++)if("comment"===D[S].type)return!0}}function b(e){for(var n=t;n<=D;n++)e(S.getLine(n),n)}var v=1/0;b(function(e,n){var t=e.search(/\S/);-1!==t?(t<o&&(o=t),r&&!h(e,n)&&(r=!1)):v>e.length&&(v=e.length)}),o==1/0&&(o=v,a=!1,r=!1),s&&o%i!=0&&(o=Math.floor(o/i)*i),b(r?c:f)},this.toggleBlockComment=function(e,n,t,D){var S=this.blockComment;if(S){!S.start&&S[0]&&(S=S[0]);var a=new s(n,D.row,D.column),r=a.getCurrentToken();n.selection;var o=n.selection.toOrientedRange();if(r&&/comment/.test(r.type)){for(;r&&/comment/.test(r.type);){var i,g,d,c,u=r.value.indexOf(S.start);if(-1!=u){var f=a.getCurrentTokenRow(),h=a.getCurrentTokenColumn()+u;d=new l(f,h,f,h+S.start.length);break}r=a.stepBackward()}for(var a=new s(n,D.row,D.column),r=a.getCurrentToken();r&&/comment/.test(r.type);){var u=r.value.indexOf(S.end);if(-1!=u){var f=a.getCurrentTokenRow(),h=a.getCurrentTokenColumn()+u;c=new l(f,h,f,h+S.end.length);break}r=a.stepForward()}c&&n.remove(c),d&&(n.remove(d),i=d.start.row,g=-S.start.length)}else g=S.start.length,i=t.start.row,n.insert(t.end,S.end),n.insert(t.start,S.start);o.start.row==i&&(o.start.column+=g),o.end.row==i&&(o.end.column+=g),n.selection.fromOrientedRange(o)}},this.getNextLineIndent=function(e,n,t){return this.$getIndent(n)},this.checkOutdent=function(e,n,t){return!1},this.autoOutdent=function(e,n,t){},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 t=e[n],D=t.prototype.$id,a=S.$modes[D];a||(S.$modes[D]=a=new t),S.$modes[n]||(S.$modes[n]=a),this.$embeds.push(n),this.$modes[n]=a}for(var r=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],o=function(e){!function(n){var t=r[e],D=n[t];n[r[e]]=function(){return this.$delegator(t,arguments,D)}}(i)},i=this,n=0;n<r.length;n++)o(n)},this.$delegator=function(e,n,t){var D=n[0]||"start";if("string"!=typeof D){if(Array.isArray(D[2])){var S=D[2][D[2].length-1],a=this.$modes[S];if(a)return a[e].apply(a,[D[1]].concat([].slice.call(n,1)))}D=D[0]||"start"}for(var r=0;r<this.$embeds.length;r++)if(this.$modes[this.$embeds[r]]){var o=D.split(this.$embeds[r]);if(!o[0]&&o[1]){n[0]=o[1];var a=this.$modes[this.$embeds[r]];return a[e].apply(a,n)}}var i=t.apply(this,n);return t?i:void 0},this.transformAction=function(e,n,t,D,S){if(this.$behaviour){var a=this.$behaviour.getBehaviours();for(var r in a)if(a[r][n]){var o=a[r][n].apply(this,arguments);if(o)return o}}},this.getKeywords=function(e){if(!this.completionKeywords){var n=this.$tokenizer.rules,t=[];for(var D in n)for(var S=n[D],a=0,r=S.length;a<r;a++)if("string"==typeof S[a].token)/keyword|support|storage/.test(S[a].token)&&t.push(S[a].regex);else if("object"==typeof S[a].token){for(var o=0,i=S[a].token.length;o<i;o++)if(/keyword|support|storage/.test(S[a].token[o])){var D=S[a].regex.match(/\(.+?\)/g)[o];t.push(D.substr(1,D.length-2))}}this.completionKeywords=t}return e?t.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,n,t,D){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((D=function(){this.HighlightRules=r}).prototype),n.Mode=D}),ace.define("ace/apply_delta",["require","exports","module"],function(e,n,t){"use strict";n.applyDelta=function(e,n,t){var D=n.start.row,S=n.start.column,a=e[D]||"";switch(n.action){case"insert":if(1===n.lines.length)e[D]=a.substring(0,S)+n.lines[0]+a.substring(S);else{var r=[D,1].concat(n.lines);e.splice.apply(e,r),e[D]=a.substring(0,S)+e[D],e[D+n.lines.length-1]+=a.substring(S)}break;case"remove":var o=n.end.column,i=n.end.row;D===i?e[D]=a.substring(0,S)+a.substring(o):e.splice(D,i-D+1,a.substring(0,S)+e[i].substring(o))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,a=function(){function e(e,n,t){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof n?this.setPosition(n.row,n.column):this.setPosition(n,t)}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,t){if(D=t?{row:e,column:n}:this.$clipPositionToDocument(e,n),this.row!=D.row||this.column!=D.column){var D,S={row:this.row,column:this.column};this.row=D.row,this.column=D.column,this._signal("change",{old:S,value:D})}},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 t={};return e>=this.document.getLength()?(t.row=Math.max(0,this.document.getLength()-1),t.column=this.document.getLine(t.row).length):e<0?(t.row=0,t.column=0):(t.row=e,t.column=Math.min(this.document.getLine(t.row).length,Math.max(0,n))),n<0&&(t.column=0),t},e}();function r(e,n,t){var D=t?e.column<=n.column:e.column<n.column;return e.row<n.row||e.row==n.row&&D}function o(e,n,t){var D="insert"==e.action,S=(D?1:-1)*(e.end.row-e.start.row),a=(D?1:-1)*(e.end.column-e.start.column),o=e.start,i=D?o:e.end;return r(n,o,t)?{row:n.row,column:n.column}:r(i,n,!t)?{row:n.row+S,column:n.column+(n.row==i.row?a:0)}:{row:o.row,column:o.column}}a.prototype.$insertRight=!1,D.implement(a.prototype,S),n.Anchor=a}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./apply_delta").applyDelta,a=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=e("./anchor").Anchor,i=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 t=n.length-1;e.end.row-e.start.row==t&&(n[t]=n[t].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 t=this.clippedPos(e.row,e.column),D=this.pos(e.row,e.column+n.length);return this.applyDelta({start:t,end:D,action:"insert",lines:[n]},!0),this.clonePos(D)},e.prototype.clippedPos=function(e,n){var t=this.getLength();void 0===e?e=t:e<0?e=0:e>=t&&(e=t-1,n=void 0);var D=this.getLine(e);return void 0==n&&(n=D.length),{row:e,column:n=Math.min(Math.max(n,0),D.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 t=0;e<this.getLength()?(n=n.concat([""]),t=0):(n=[""].concat(n),e--,t=this.$lines[e].length),this.insertMergedLines({row:e,column:t},n)},e.prototype.insertMergedLines=function(e,n){var t=this.clippedPos(e.row,e.column),D={row:t.row+n.length-1,column:(1==n.length?t.column:0)+n[n.length-1].length};return this.applyDelta({start:t,end:D,action:"insert",lines:n}),this.clonePos(D)},e.prototype.remove=function(e){var n=this.clippedPos(e.start.row,e.start.column),t=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:n,end:t,action:"remove",lines:this.getLinesForRange({start:n,end:t})}),this.clonePos(n)},e.prototype.removeInLine=function(e,n,t){var D=this.clippedPos(e,n),S=this.clippedPos(e,t);return this.applyDelta({start:D,end:S,action:"remove",lines:this.getLinesForRange({start:D,end:S})},!0),this.clonePos(D)},e.prototype.removeFullLines=function(e,n){e=Math.min(Math.max(0,e),this.getLength()-1);var t=(n=Math.min(Math.max(0,n),this.getLength()-1))==this.getLength()-1&&e>0,D=n<this.getLength()-1,S=t?e-1:e,a=t?this.getLine(S).length:0,o=D?n+1:n,i=D?0:this.getLine(o).length,g=new r(S,a,o,i),s=this.$lines.slice(e,n+1);return this.applyDelta({start:g.start,end:g.end,action:"remove",lines:this.getLinesForRange(g)}),s},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 t;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),t=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 t="insert"==e.action;(t?!(e.lines.length<=1)||e.lines[0]:r.comparePoints(e.start,e.end))&&(t&&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 t=e.lines,D=t.length-n+1,S=e.start.row,a=e.start.column,r=0,o=0;r<D;r=o){o+=n-1;var i=t.slice(r,o);i.push(""),this.applyDelta({start:this.pos(S+r,a),end:this.pos(S+o,a=0),action:e.action,lines:i},!0)}e.lines=t.slice(r),e.start.row=S+r,e.start.column=a,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 t=this.$lines||this.getAllLines(),D=this.getNewLineCharacter().length,S=n||0,a=t.length;S<a;S++)if((e-=t[S].length+D)<0)return{row:S,column:e+t[S].length+D};return{row:a-1,column:e+t[a-1].length+D}},e.prototype.positionToIndex=function(e,n){for(var t=this.$lines||this.getAllLines(),D=this.getNewLineCharacter().length,S=0,a=Math.min(e.row,t.length),r=n||0;r<a;++r)S+=t[r].length+D;return S+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();i.prototype.$autoNewLine="",i.prototype.$newLineMode="auto",D.implement(i.prototype,a),n.Document=i}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,a=function(){function e(e,n){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var t=this;this.$worker=function(){if(t.running){for(var e=new Date,n=t.currentLine,D=-1,S=t.doc,a=n;t.lines[n];)n++;var r=S.getLength(),o=0;for(t.running=!1;n<r;){t.$tokenizeRow(n),D=n;do n++;while(t.lines[n]);if(++o%5==0&&new Date-e>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=n,-1==D&&(D=n),a<=D&&t.fireUpdateEvent(a,D)}}}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 t={first:e,last:n};this._signal("update",{data:t})},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,t=e.end.row-n;if(0===t)this.lines[n]=null;else if("remove"==e.action)this.lines.splice(n,t+1,null),this.states.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.lines.splice.apply(this.lines,D),this.states.splice.apply(this.states,D)}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),t=this.states[e-1],D=this.tokenizer.getLineTokens(n,t,e);return this.states[e]+""!=D.state+""?(this.states[e]=D.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=D.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();D.implement(a.prototype,S),n.BackgroundTokenizer=a}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,n,t){"use strict";var D=e("./lib/lang"),S=e("./range").Range,a=function(){function e(e,n,t){void 0===t&&(t="text"),this.setRegexp(e),this.clazz=n,this.type=t}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,n,t,a){if(this.regExp)for(var r=a.firstRow,o=a.lastRow,i={},g=r;g<=o;g++){var s=this.cache[g];null==s&&((s=D.getMatchOffsets(t.getLine(g),this.regExp)).length>this.MAX_RANGES&&(s=s.slice(0,this.MAX_RANGES)),s=s.map(function(e){return new S(g,e.offset,g,e.offset+e.length)}),this.cache[g]=s.length?s:"");for(var l=s.length;l--;){var d=s[l].toScreenRange(t),c=d.toString();i[c]||(i[c]=!0,n.drawSingleLineMarker(e,d,this.clazz,a))}}},e}();a.prototype.MAX_RANGES=500,n.SearchHighlight=a}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=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,t){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===n||!this.lastDeltas){this.lastDeltas=[];var D=this.$undoStack.length;D>this.$undoDepth-1&&this.$undoStack.splice(0,D-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 t=this.$undoStack,D=t.length;D--;){var S=t[D][0];if(S.id<=e)break;S.id<n&&(S.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,n){for(var t=this.selections,D=t.length;D--;){var S=t[D];if(S.rev<e)return n&&(S=t[D+1]),S}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,n){null==n&&(n=this.$rev+1);for(var t=this.$undoStack,D=null,S=0,a=t.length;a--;){var r=t[a][0];if(r.id<n&&!D&&(D=a+1),r.id<=e){S=a+1;break}}return t.slice(S,D)},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 t=this.$undoStack;if(S(t,t.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var D=t.pop(),a=null;return D&&(a=e.undoChanges(D,n),this.$redoStack.push(D),this.$syncRev()),this.$fromUndo=!1,a}},e.prototype.redo=function(e,n){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var t=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);m(this.$redoStack,t),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var D=this.$redoStack.pop(),S=null;return D&&(S=e.redoChanges(D,n),this.$undoStack.push(D),this.$syncRev()),this.$fromUndo=!1,S},e.prototype.$syncRev=function(){var e=this.$undoStack,n=e[e.length-1],t=n&&n[0].id||0;this.$redoStackBaseRev=t,this.$rev=t},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?g(e):g(this.$undoStack)+"\n---\n"+g(this.$redoStack)},e}();function S(e,n){for(var t=n;t--;){var D=e[t];if(D&&!D[0].ignore){for(;t<n-1;){var S=d(e[t],e[t+1]);e[t]=S[0],e[t+1]=S[1],t++}return!0}}}D.prototype.hasUndo=D.prototype.canUndo,D.prototype.hasRedo=D.prototype.canRedo,D.prototype.isClean=D.prototype.isAtBookmark,D.prototype.markClean=D.prototype.bookmark;var a=e("./range").Range,r=a.comparePoints;function o(e){return{row:e.row,column:e.column}}function i(e){return{start:o(e.start),end:o(e.end),action:e.action,lines:e.lines.slice()}}function g(e){if(Array.isArray(e=e||this))return e.map(g).join("\n");var n="";return e.action?n=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(n=Array.isArray(e.value)?e.value.map(s).join("\n"):s(e.value)),e.start&&(n+=s(e)),(e.id||e.rev)&&(n+=" ("+(e.id||e.rev)+")"),n}function s(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function l(e,n){var t="insert"==e.action,D="insert"==n.action;if(t&&D)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.start,e.start)))return null;u(e,n,1)}else if(t&&!D)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.end,e.start)))return null;u(e,n,-1)}else if(!t&&D)if(r(n.start,e.start)>=0)u(n,e,1);else{if(!(0>=r(n.start,e.start)))return null;u(e,n,1)}else if(!t&&!D)if(r(n.start,e.start)>=0)u(n,e,1);else{if(!(0>=r(n.end,e.start)))return null;u(e,n,-1)}return[n,e]}function d(e,n){for(var t=e.length;t--;)for(var D=0;D<n.length;D++)if(!l(e[t],n[D])){for(;t<e.length;){for(;D--;)l(n[D],e[t]);D=n.length,t++}return[e,n]}return e.selectionBefore=n.selectionBefore=e.selectionAfter=n.selectionAfter=null,[n,e]}function c(e,n){var t,D,S="insert"==e.action,o="insert"==n.action;if(S&&o)0>r(e.start,n.start)?u(n,e,1):u(e,n,1);else if(S&&!o)r(e.start,n.end)>=0?u(e,n,-1):(0>=r(e.start,n.start)||u(e,a.fromPoints(n.start,e.start),-1),u(n,e,1));else if(!S&&o)r(n.start,e.end)>=0?u(n,e,-1):(0>=r(n.start,e.start)||u(n,a.fromPoints(e.start,n.start),-1),u(e,n,1));else if(!S&&!o)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.end,e.start)))return 0>r(e.start,n.start)&&(t=e,e=h(e,n.start)),r(e.end,n.end)>0&&(D=h(e,n.end)),f(n.end,e.start,e.end,-1),D&&!t&&(e.lines=D.lines,e.start=D.start,e.end=D.end,D=e),[n,t,D].filter(Boolean);u(e,n,-1)}return[n,e]}function u(e,n,t){f(e.start,n.start,n.end,t),f(e.end,n.start,n.end,t)}function f(e,n,t,D){e.row==(1==D?n:t).row&&(e.column+=D*(t.column-n.column)),e.row+=D*(t.row-n.row)}function h(e,n){var t=e.lines,D=e.end;e.end=o(n);var S=e.end.row-e.start.row,a=t.splice(S,t.length),r=S?n.column:n.column-e.start.column;return t.push(a[0].substring(0,r)),a[0]=a[0].substr(r),{start:o(n),end:D,lines:a,action:e.action}}function p(e,n){n=i(n);for(var t=e.length;t--;){for(var D=e[t],S=0;S<D.length;S++){var a=c(D[S],n);n=a[0],2!=a.length&&(a[2]?(D.splice(S+1,1,a[1],a[2]),S++):!a[1]&&(D.splice(S,1),S--))}D.length||e.splice(t,1)}return e}function m(e,n){for(var t=0;t<n.length;t++)for(var D=n[t],S=0;S<D.length;S++)p(e,D[S])}a.comparePoints,n.UndoManager=D}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=e("../range").Range;n.FoldLine=function(){function e(e,n){this.foldData=e,Array.isArray(n)?this.folds=n:n=this.folds=[n];var t=n[n.length-1];this.range=new D(n[0].start.row,n[0].start.column,t.end.row,t.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,t){var D,S,a,r=0,o=this.folds,i=!0;null==n&&(n=this.end.row,t=this.end.column);for(var g=0;g<o.length;g++){if(-1==(S=(D=o[g]).range.compareStart(n,t)))return void e(null,n,t,r,i);if((a=!(a=e(null,D.start.row,D.start.column,r,i))&&e(D.placeholder,D.start.row,D.start.column,r))||0===S)return;i=!D.sameRow,r=D.end.column}e(null,n,t,r,i)},e.prototype.getNextFoldTo=function(e,n){for(var t,D,S=0;S<this.folds.length;S++){if(-1==(D=(t=this.folds[S]).range.compareEnd(e,n)))return{fold:t,kind:"after"};if(0===D)return{fold:t,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,n,t){var D,S,a=this.getNextFoldTo(e,n);if(a){if(D=a.fold,"inside"==a.kind&&D.start.column!=n&&D.start.row!=e)window.console&&window.console.log(e,n,D);else if(D.start.row==e){var r=(S=this.folds).indexOf(D);for(0===r&&(this.start.column+=t);r<S.length;r++){if(D=S[r],D.start.column+=t,!D.sameRow)return;D.end.column+=t}this.end.column+=t}}},e.prototype.split=function(n,t){var D=this.getNextFoldTo(n,t);if(!D||"inside"==D.kind)return null;var S=D.fold,a=this.folds,r=this.foldData,o=a.indexOf(S),i=a[o-1];this.end.row=i.end.row,this.end.column=i.end.column;var g=new e(r,a=a.splice(o,a.length-o));return r.splice(r.indexOf(this)+1,0,g),g},e.prototype.merge=function(e){for(var n=e.folds,t=0;t<n.length;t++)this.addFold(n[t]);var D=this.foldData;D.splice(D.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,t=0;t<this.folds.length;t++){var D=this.folds[t];if((e-=D.start.column-n)<0)return{row:D.start.row,column:D.start.column+e};if((e-=D.placeholder.length)<0)return D.start;n=D.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,t){"use strict";var D=e("./range").Range.comparePoints,S=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,n,t){for(var S=this.ranges,a=t||0;a<S.length;a++){var r=S[a],o=D(e,r.end);if(!(o>0)){var i=D(e,r.start);if(0===o)return n&&0!==i?-a-2:a;if(i>0||0===i&&!n)return a;break}}return-a-1},e.prototype.add=function(e){var n=!e.isEmpty(),t=this.pointIndex(e.start,n);t<0&&(t=-t-1);var D=this.pointIndex(e.end,n,t);return D<0?D=-D-1:D++,this.ranges.splice(t,D-t,e)},e.prototype.addList=function(e){for(var n=[],t=e.length;t--;)n.push.apply(n,this.add(e[t]));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=[],t=this.ranges,S=(t=t.sort(function(e,n){return D(e.start,n.start)}))[0],a=1;a<t.length;a++){e=S,S=t[a];var r=D(e.end,S.start);!(r<0)&&(0!=r||e.isEmpty()||S.isEmpty())&&(0>D(e.end,S.end)&&(e.end.row=S.end.row,e.end.column=S.end.column),t.splice(a,1),n.push(S),S=e,a--)}return this.ranges=t,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 t=this.ranges;if(t[0].start.row>n||t[t.length-1].start.row<e)return[];var D=this.pointIndex({row:e,column:0});D<0&&(D=-D-1);var S=this.pointIndex({row:n,column:0},D);S<0&&(S=-S-1);for(var a=[],r=D;r<S;r++)a.push(t[r]);return a},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,t=e.end,D=n.row,S=t.row,a=this.ranges,r=0,o=a.length;r<o;r++){var i=a[r];if(i.end.row>=D)break}if("insert"==e.action)for(var g=S-D,s=-n.column+t.column;r<o;r++){var i=a[r];if(i.start.row>D)break;if(i.start.row==D&&i.start.column>=n.column&&(i.start.column==n.column&&this.$bias<=0||(i.start.column+=s,i.start.row+=g)),i.end.row==D&&i.end.column>=n.column){if(i.end.column==n.column&&this.$bias<0)continue;i.end.column==n.column&&s>0&&r<o-1&&i.end.column>i.start.column&&i.end.column==a[r+1].start.column&&(i.end.column-=s),i.end.column+=s,i.end.row+=g}}else for(var g=D-S,s=n.column-t.column;r<o;r++){var i=a[r];if(i.start.row>S)break;i.end.row<S&&(D<i.end.row||D==i.end.row&&n.column<i.end.column)?(i.end.row=D,i.end.column=n.column):i.end.row==S?i.end.column<=t.column?(g||i.end.column>n.column)&&(i.end.column=n.column,i.end.row=n.row):(i.end.column+=s,i.end.row+=g):i.end.row>S&&(i.end.row+=g),i.start.row<S&&(D<i.start.row||D==i.start.row&&n.column<i.start.column)?(i.start.row=D,i.start.column=n.column):i.start.row==S?i.start.column<=t.column?(g||i.start.column>n.column)&&(i.start.column=n.column,i.start.row=n.row):(i.start.column+=s,i.start.row+=g):i.start.row>S&&(i.start.row+=g)}if(0!=g&&r<o)for(;r<o;r++){var i=a[r];i.start.row+=g,i.end.row+=g}},e}();S.prototype.comparePoints=D,n.RangeList=S}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,n,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}();function S(e,n){e.row-=n.row,0==e.row&&(e.column-=n.column)}function a(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,t){var D=e.call(this)||this;return D.foldLine=null,D.placeholder=t,D.range=n,D.start=n.start,D.end=n.end,D.sameRow=n.start.row==n.end.row,D.subFolds=D.ranges=[],D}return D(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)){a(e,this.start);for(var n=e.start.row,t=e.start.column,D=0,S=-1;D<this.subFolds.length&&1==(S=this.subFolds[D].range.compare(n,t));D++);var r=this.subFolds[D],o=0;if(0==S)if(r.range.containsRange(e))return r.addSubFold(e);else o=1;for(var n=e.range.end.row,t=e.range.end.column,i=D,S=-1;i<this.subFolds.length&&1==(S=this.subFolds[i].range.compare(n,t));i++);0==S&&i++;for(var g=this.subFolds.splice(D,i-D,e),s=0==S?g.length-1:g.length,l=o;l<s;l++)e.addSubFold(g[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,t){"use strict";var D=e("../range").Range,S=e("./fold_line").FoldLine,a=e("./fold").Fold,r=e("../token_iterator").TokenIterator,o=e("../mouse/mouse_event").MouseEvent;n.Folding=function(){this.getFoldAt=function(e,n,t){var D=this.getFoldLine(e);if(!D)return null;for(var S=D.folds,a=0;a<S.length;a++){var r=S[a].range;if(r.contains(e,n)){if(1==t&&r.isEnd(e,n)&&!r.isEmpty()||-1==t&&r.isStart(e,n)&&!r.isEmpty())continue;return S[a]}}},this.getFoldsInRange=function(e){var n=e.start,t=e.end,D=this.$foldData,S=[];n.column+=1,t.column-=1;for(var a=0;a<D.length;a++){var r=D[a].range.compareRange(e);if(2!=r){if(-2==r)break;for(var o=D[a].folds,i=0;i<o.length;i++){var g=o[i];if(-2==(r=g.range.compareRange(e)))break;if(2!=r){if(42==r)break;S.push(g)}}}}return n.column-=1,t.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,t=0;t<n.length;t++)for(var D=0;D<n[t].folds.length;D++)e.push(n[t].folds[D]);return e},this.getFoldStringAt=function(e,n,t,D){if(!(D=D||this.getFoldLine(e)))return null;for(var S,a,r={end:{column:0}},o=0;o<D.folds.length;o++){var i=(a=D.folds[o]).range.compareEnd(e,n);if(-1==i){S=this.getLine(a.start.row).substring(r.end.column,a.start.column);break}if(0===i)return null;r=a}return(S||(S=this.getLine(a.start.row).substring(r.end.column)),-1==t)?S.substring(0,n-r.end.column):1==t?S.substring(n-r.end.column):S},this.getFoldLine=function(e,n){var t=this.$foldData,D=0;for(n&&(D=t.indexOf(n)),-1==D&&(D=0);D<t.length;D++){var S=t[D];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 t=this.$foldData,D=0;for(n&&(D=t.indexOf(n)),-1==D&&(D=0);D<t.length;D++){var S=t[D];if(S.end.row>=e)return S}return null},this.getFoldedRowCount=function(e,n){for(var t=this.$foldData,D=n-e+1,S=0;S<t.length;S++){var a=t[S],r=a.end.row,o=a.start.row;if(r>=n){o<n&&(o>=e?D-=n-o:D=0);break}r>=e&&(o>=e?D-=r-o:D-=r-e+1)}return D},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 t,D=this.$foldData,r=!1;e instanceof a?t=e:(t=new a(n,e)).collapseChildren=n.collapseChildren,this.$clipRangeToDocument(t.range);var o=t.start.row,i=t.start.column,g=t.end.row,s=t.end.column,l=this.getFoldAt(o,i,1),d=this.getFoldAt(g,s,-1);if(l&&d==l)return l.addSubFold(t);l&&!l.range.isStart(o,i)&&this.removeFold(l),d&&!d.range.isEnd(g,s)&&this.removeFold(d);var c=this.getFoldsInRange(t.range);c.length>0&&(this.removeFolds(c),t.collapseChildren||c.forEach(function(e){t.addSubFold(e)}));for(var u=0;u<D.length;u++){var f=D[u];if(g==f.start.row){f.addFold(t),r=!0;break}if(o==f.end.row){if(f.addFold(t),r=!0,!t.sameRow){var h=D[u+1];h&&h.start.row==g&&f.merge(h)}break}if(g<=f.start.row)break}return r||(f=this.$addFoldLine(new S(this.$foldData,t))),this.$useWrapMode?this.$updateWrapData(f.start.row,f.start.row):this.$updateRowLengthCache(f.start.row,f.start.row),this.$modified=!0,this._signal("changeFold",{data:t,action:"add"}),t},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var n=e.foldLine,t=n.start.row,D=n.end.row,S=this.$foldData,a=n.folds;if(1==a.length)S.splice(S.indexOf(n),1);else if(n.range.isEnd(e.end.row,e.end.column))a.pop(),n.end.row=a[a.length-1].end.row,n.end.column=a[a.length-1].end.column;else if(n.range.isStart(e.start.row,e.start.column))a.shift(),n.start.row=a[0].start.row,n.start.column=a[0].start.column;else if(e.sameRow)a.splice(a.indexOf(e),1);else{var r=n.split(e.start.row,e.start.column);(a=r.folds).shift(),r.start.row=a[0].start.row,r.start.column=a[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(t,D):this.$updateRowLengthCache(t,D)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var n=[],t=0;t<e.length;t++)n.push(e[t]);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)t=new D(0,0,this.getLength(),0),null==n&&(n=!0);else if("number"==typeof e)t=new D(e,0,e,this.getLine(e).length);else if("row"in e)t=D.fromPoints(e,e);else{if(Array.isArray(e))return S=[],e.forEach(function(e){S=S.concat(this.unfold(e))},this),S;t=e}for(var t,S=this.getFoldsInRangeList(t),a=S;1==S.length&&0>D.comparePoints(S[0].start,t.start)&&D.comparePoints(S[0].end,t.end)>0;)this.expandFolds(S),S=this.getFoldsInRangeList(t);if(!1!=n?this.removeFolds(S):this.expandFolds(S),a.length)return a},this.isRowFolded=function(e,n){return!!this.getFoldLine(e,n)},this.getRowFoldEnd=function(e,n){var t=this.getFoldLine(e,n);return t?t.end.row:e},this.getRowFoldStart=function(e,n){var t=this.getFoldLine(e,n);return t?t.start.row:e},this.getFoldDisplayLine=function(e,n,t,D,S){null==D&&(D=e.start.row),null==S&&(S=0),null==n&&(n=e.end.row),null==t&&(t=this.getLine(n).length);var a=this.doc,r="";return e.walk(function(e,n,t,o){if(!(n<D)){if(n==D){if(t<S)return;o=Math.max(S,o)}null!=e?r+=e:r+=a.getLine(n).substring(o,t)}},n,t),r},this.getDisplayLine=function(e,n,t,D){var S,a=this.getFoldLine(e);return a?this.getFoldDisplayLine(a,e,n,t,D):(S=this.doc.getLine(e)).substring(D||0,n||S.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(n){var t=n.folds.map(function(e){return e.clone()});return new S(e,t)})},this.toggleFold=function(e){var n,t,D=this.selection.getRange();if(D.isEmpty()){var S=D.start;if(n=this.getFoldAt(S.row,S.column))return void this.expandFold(n);(t=this.findMatchingBracket(S))?1==D.comparePoint(t)?D.end=t:(D.start=t,D.start.column++,D.end.column--):(t=this.findMatchingBracket({row:S.row,column:S.column+1}))?(1==D.comparePoint(t)?D.end=t:D.start=t,D.start.column++):D=this.getCommentFoldRange(S.row,S.column)||D}else{var a=this.getFoldsInRange(D);if(e&&a.length)return void this.expandFolds(a);1==a.length&&(n=a[0])}if(n||(n=this.getFoldAt(D.start.row,D.start.column)),n&&n.range.toString()==D.toString())return void this.expandFold(n);var r="...";if(!D.isMultiLine()){if((r=this.getTextRange(D)).length<4)return;r=r.trim().substring(0,2)+".."}this.addFold(r,D)},this.getCommentFoldRange=function(e,n,t){var S=new r(this,e,n),a=S.getCurrentToken(),o=a&&a.type;if(a&&/^comment|string/.test(o)){"comment"==(o=o.match(/comment|string/)[0])&&(o+="|doc-start|\\.doc");var i=new RegExp(o),g=new D;if(1!=t){do a=S.stepBackward();while(a&&i.test(a.type));a=S.stepForward()}g.start.row=S.getCurrentTokenRow(),g.start.column=S.getCurrentTokenColumn()+a.value.length,S=new r(this,e,n);var s=this.getState(S.$row);if(-1!=t){var l=-1;do if(a=S.stepForward(),-1==l){var d=this.getState(S.$row);s.toString()!==d.toString()&&(l=S.$row)}else if(S.$row>l)break;while(a&&i.test(a.type));a=S.stepBackward()}else a=S.getCurrentToken();return g.end.row=S.getCurrentTokenRow(),g.end.column=S.getCurrentTokenColumn(),g}},this.foldAll=function(e,n,t,D){void 0==t&&(t=1e5);var S=this.foldWidgets;if(S){n=n||this.getLength(),e=e||0;for(var a=e;a<n;a++)if((null==S[a]&&(S[a]=this.getFoldWidget(a)),"start"==S[a])&&(!D||D(a))){var r=this.getFoldWidgetRange(a);r&&r.isMultiLine()&&r.end.row<=n&&r.start.row>=e&&(a=r.end.row,r.collapseChildren=t,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 t=e.getTokens(n),D=0;D<t.length;D++){var S=t[D];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 t=this.foldWidgets;if(!t||n&&t[e])return{};for(var D,S=e-1;S>=0;){var a=t[S];if(null==a&&(a=t[S]=this.getFoldWidget(S)),"start"==a){var r=this.getFoldWidgetRange(S);if(D||(D=r),r&&r.end.row>=e)break}S--}return{range:-1!==S&&r,firstRange:D}},this.onFoldWidgetClick=function(e,n){n instanceof o&&(n=n.domEvent);var t={children:n.shiftKey,all:n.ctrlKey||n.metaKey,siblings:n.altKey};if(!this.$toggleFoldWidget(e,t)){var D=n.target||n.srcElement;D&&/ace_fold-widget/.test(D.className)&&(D.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,n){if(this.getFoldWidget){var t=this.getFoldWidget(e),D=this.getLine(e),S="end"===t?-1:1,a=this.getFoldAt(e,-1===S?0:D.length,S);if(a)return n.children||n.all?this.removeFold(a):this.expandFold(a),a;var r=this.getFoldWidgetRange(e,!0);if(r&&!r.isMultiLine()&&(a=this.getFoldAt(r.start.row,r.start.column,1))&&r.isEqual(a.range))return this.removeFold(a),a;if(n.siblings){var o=this.getParentFoldRangeData(e);if(o.range)var i=o.range.start.row+1,g=o.range.end.row;this.foldAll(i,g,1e4*!!n.all)}else n.children?(g=r?r.end.row:this.getLength(),this.foldAll(e+1,g,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 t=this.$toggleFoldWidget(n,{});if(!t){var D=this.getParentFoldRangeData(n,!0);if(t=D.range||D.firstRange){n=t.start.row;var S=this.getFoldAt(n,this.getLine(n).length,1);S?this.removeFold(S):this.addFold("...",t)}}},this.updateFoldWidgets=function(e){var n=e.start.row,t=e.end.row-n;if(0===t)this.foldWidgets[n]=null;else if("remove"==e.action)this.foldWidgets.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,D)}},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,t){"use strict";var D=e("../token_iterator").TokenIterator,S=e("../range").Range;n.BracketMatch=function(){this.findMatchingBracket=function(e,n){if(0==e.column)return null;var t=n||this.getLine(e.row).charAt(e.column-1);if(""==t)return null;var D=t.match(/([\(\[\{])|([\)\]\}])/);return D?D[1]?this.$findClosingBracket(D[1],e):this.$findOpeningBracket(D[2],e):null},this.getBracketRange=function(e){var n,t=this.getLine(e.row),D=!0,a=t.charAt(e.column-1),r=a&&a.match(/([\(\[\{])|([\)\]\}])/);if(r||(a=t.charAt(e.column),e={row:e.row,column:e.column+1},r=a&&a.match(/([\(\[\{])|([\)\]\}])/),D=!1),!r)return null;if(r[1]){var o=this.$findClosingBracket(r[1],e);if(!o)return null;n=S.fromPoints(e,o),!D&&(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),!D&&(n.start.column++,n.end.column--),n.cursor=n.start}return n},this.getMatchingBracketRanges=function(e,n){var t=this.getLine(e.row),D=/([\(\[\{])|([\)\]\}])/,a=!n&&t.charAt(e.column-1),r=a&&a.match(D);if(r||(a=(void 0===n||n)&&t.charAt(e.column),e={row:e.row,column:e.column+1},r=a&&a.match(D)),!r)return null;var o=new S(e.row,e.column-1,e.row,e.column),i=r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e);return i?[o,new S(i.row,i.column,i.row,i.column+1)]:[o]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,n,t){var S=this.$brackets[e],a=1,r=new D(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){t||(t=RegExp("(\\.?"+o.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var i=n.column-r.getCurrentTokenColumn()-2,g=o.value;;){for(;i>=0;){var s=g.charAt(i);if(s==S){if(0==(a-=1))return{row:r.getCurrentTokenRow(),column:i+r.getCurrentTokenColumn()}}else s==e&&(a+=1);i-=1}do o=r.stepBackward();while(o&&!t.test(o.type));if(null==o)break;i=(g=o.value).length-1}return null}},this.$findClosingBracket=function(e,n,t){var S=this.$brackets[e],a=1,r=new D(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){t||(t=RegExp("(\\.?"+o.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var i=n.column-r.getCurrentTokenColumn();;){for(var g=o.value,s=g.length;i<s;){var l=g.charAt(i);if(l==S){if(0==(a-=1))return{row:r.getCurrentTokenRow(),column:i+r.getCurrentTokenColumn()}}else l==e&&(a+=1);i+=1}do o=r.stepForward();while(o&&!t.test(o.type));if(null==o)break;i=0}return null}},this.getMatchingTags=function(e){var n=new D(this,e.row,e.column),t=this.$findTagName(n);if(t){var S=n.stepBackward();return"<"===S.value?this.$findClosingTag(n,t):this.$findOpeningTag(n,t)}},this.$findTagName=function(e){var n=e.getCurrentToken(),t=!1,D=!1;if(n&&-1===n.type.indexOf("tag-name"))do(n=D?e.stepBackward():e.stepForward())&&("/>"===n.value?D=!0:-1!==n.type.indexOf("tag-name")&&(t=!0));while(n&&!t);return n},this.$findClosingTag=function(e,n){var t,D=n.value,a=n.value,r=0,o=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);n=e.stepForward();var i=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length),g=!1;do{if(-1!==(t=n).type.indexOf("tag-close")&&!g){var s=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);g=!0}if(n=e.stepForward()){if(">"===n.value&&!g){var s=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);g=!0}if(-1!==n.type.indexOf("tag-name")){if(a===(D=n.value)){if("<"===t.value)r++;else if("</"===t.value&&--r<0){e.stepBackward();var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);n=e.stepForward();var d=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 c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(a===D&&"/>"===n.value&&--r<0)var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),d=l,c=d,s=new S(i.end.row,i.end.column,i.end.row,i.end.column+1)}}while(n&&r>=0);if(o&&s&&l&&c&&i&&d)return{openTag:new S(o.start.row,o.start.column,s.end.row,s.end.column),closeTag:new S(l.start.row,l.start.column,c.end.row,c.end.column),openTagName:i,closeTagName:d}},this.$findOpeningTag=function(e,n){var t=e.getCurrentToken(),D=n.value,a=0,r=e.getCurrentTokenRow(),o=e.getCurrentTokenColumn(),i=o+2,g=new S(r,o,r,i);e.stepForward();var s=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=t,r=e.getCurrentTokenRow(),i=(o=e.getCurrentTokenColumn())+n.value.length,t=e.stepBackward(),n){if(-1!==n.type.indexOf("tag-name")){if(D===n.value)if("<"===t.value){if(++a>0){var d=new S(r,o,r,i),c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do n=e.stepForward();while(n&&">"!==n.value);var u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===t.value&&a--}else if("/>"===n.value){for(var f=0,h=t;h;){if(-1!==h.type.indexOf("tag-name")&&h.value===D){a--;break}if("<"===h.value)break;h=e.stepBackward(),f++}for(var p=0;p<f;p++)e.stepForward()}}while(t&&a<=0);if(c&&u&&g&&l&&d&&s)return{openTag:new S(c.start.row,c.start.column,u.end.row,u.end.column),closeTag:new S(g.start.row,g.start.column,l.end.row,l.end.column),openTagName:d,closeTagName:s}}}}}),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/lang"),a=e("./bidihandler").BidiHandler,r=e("./config"),o=e("./lib/event_emitter").EventEmitter,i=e("./selection").Selection,g=e("./mode/text").Mode,s=e("./range").Range,l=e("./document").Document,d=e("./background_tokenizer").BackgroundTokenizer,c=e("./search_highlight").SearchHighlight,u=e("./undomanager").UndoManager,f=function(){function e(n,t){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 d(new g().getTokenizer(),this);var D=this;this.bgTokenizer.on("update",function(e){D._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 i(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new a(this),r.resetOptions(this),this.setMode(t),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,t=this.$getRowCacheIndex(this.$docRowCache,e)+1;n>t&&(this.$docRowCache.splice(t,n),this.$screenRowCache.splice(t,n))},e.prototype.$getRowCacheIndex=function(e,n){for(var t=0,D=e.length-1;t<=D;){var S=t+D>>1,a=e[S];if(n>a)t=S+1;else{if(!(n<a))return S;D=S-1}}return t-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 t=new u;t.$undoStack=n.history.undo,t.$redoStack=n.history.redo,t.mark=n.history.mark,t.$rev=n.history.rev;var D=new e(n.value);return n.folds.forEach(function(e){D.addFold("...",s.fromPoints(e.start,e.end))}),D.setAnnotations(n.annotations),D.setBreakpoints(n.breakpoints),D.setMode(n.mode),D.setScrollLeft(n.scrollLeft),D.setScrollTop(n.scrollTop),D.setUndoManager(t),D.selection.fromJSON(n.selection),D},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 t,D=this.bgTokenizer.getTokens(e),S=0;if(null==n){var a=D.length-1;S=this.getLine(e).length}else for(var a=0;a<D.length&&!((S+=D[a].value.length)>=n);a++);return(t=D[a])?(t.index=a,t.start=S-t.value.length,t):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,t,D){var S=this.$markerId++,a={range:e,type:t||"line",renderer:"function"==typeof t?t:null,clazz:n,inFront:!!D,id:S};return D?(this.$frontMarkers[S]=a,this._signal("changeFrontMarker")):(this.$backMarkers[S]=a,this._signal("changeBackMarker")),S},e.prototype.addDynamicMarker=function(e,n){if(e.update){var t=this.$markerId++;return e.id=t,e.inFront=!!n,n?(this.$frontMarkers[t]=e,this._signal("changeFrontMarker")):(this.$backMarkers[t]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var n=this.$frontMarkers[e]||this.$backMarkers[e];if(n){var t=n.inFront?this.$frontMarkers:this.$backMarkers;delete t[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 c(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(n)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,n,t,D){"number"!=typeof n&&(t=n,n=e),t||(t="ace_step");var S=new s(e,0,n,1/0);return S.id=this.addMarker(S,t,"fullLine",D),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 t=this.getLine(e),D=!1;if(n>0&&(D=!!t.charAt(n-1).match(this.tokenRe)),D||(D=!!t.charAt(n).match(this.tokenRe)),D)var S=this.tokenRe;else if(/^\s+$/.test(t.slice(n-1,n+1)))var S=/\s/;else var S=this.nonTokenRe;var a=n;if(a>0){do a--;while(a>=0&&t.charAt(a).match(S));a++}for(var r=n;r<t.length&&t.charAt(r).match(S);)r++;return new s(e,a,e,r)},e.prototype.getAWordRange=function(e,n){for(var t=this.getWordRange(e,n),D=this.getLine(t.end.row);D.charAt(t.end.column).match(/[ \t]/);)t.end.column+=1;return t},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 t=e,D=t.path}else D=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new g),this.$modes[D]&&!t){this.$onChangeMode(this.$modes[D]),n&&n();return}this.$modeId=D,r.loadModule(["mode",D],(function(e){if(this.$modeId!==D)return n&&n();this.$modes[D]&&!t?this.$onChangeMode(this.$modes[D]):e&&e.Mode&&(e=new e.Mode(t),t||(this.$modes[D]=e,e.$id=D),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 t=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var D=e.getTokenizer();if(void 0!==D.on){var S=this.onReloadTokenizer.bind(this);D.on("update",S)}this.bgTokenizer.setTokenizer(D),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:t,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(),t=this.$rowLengthCache,D=0,S=0,a=this.$foldData[S],r=a?a.start.row:1/0,o=n.length,i=0;i<o;i++){if(i>r){if((i=a.end.row+1)>=o)break;r=(a=this.$foldData[S++])?a.start.row:1/0}null==t[i]&&(t[i]=this.$getStringScreenWidth(n[i])[0]),t[i]>D&&(D=t[i])}this.screenWidth=D}},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 t=e.length-1;-1!=t;t--){var D=e[t];"insert"==D.action||"remove"==D.action?this.doc.revertDelta(D):D.folds&&this.addFolds(D.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 t=0;t<e.length;t++){var D=e[t];("insert"==D.action||"remove"==D.action)&&this.doc.$safeApplyDelta(D)}!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 t(e){return n?"insert"!==e.action:"insert"===e.action}for(var D,S,a=0;a<e.length;a++){var r=e[a];if(r.start){if(!D){D=t(r)?s.fromPoints(r.start,r.end):s.fromPoints(r.start,r.start);continue}t(r)?(S=r.start,-1==D.compare(S.row,S.column)&&D.setStart(S),S=r.end,1==D.compare(S.row,S.column)&&D.setEnd(S)):(S=r.start,-1==D.compare(S.row,S.column)&&(D=s.fromPoints(r.start,r.start)))}}return D},e.prototype.replace=function(e,n){return this.doc.replace(e,n)},e.prototype.moveText=function(e,n,t){var D=this.getTextRange(e),S=this.getFoldsInRange(e),a=s.fromPoints(n,n);if(!t){this.remove(e);var r=e.start.row-e.end.row,o=r?-e.end.column:e.start.column-e.end.column;o&&(a.start.row==e.end.row&&a.start.column>e.end.column&&(a.start.column+=o),a.end.row==e.end.row&&a.end.column>e.end.column&&(a.end.column+=o)),r&&a.start.row>=e.end.row&&(a.start.row+=r,a.end.row+=r)}if(a.end=this.insert(a.start,D),S.length){var i=e.start,g=a.start,r=g.row-i.row,o=g.column-i.column;this.addFolds(S.map(function(e){return(e=e.clone()).start.row==i.row&&(e.start.column+=o),e.end.row==i.row&&(e.end.column+=o),e.start.row+=r,e.end.row+=r,e}))}return a},e.prototype.indentRows=function(e,n,t){t=t.replace(/\t/g,this.getTabString());for(var D=e;D<=n;D++)this.doc.insertInLine({row:D,column:0},t)},e.prototype.outdentRows=function(e){for(var n=e.collapseRows(),t=new s(0,0,0,0),D=this.getTabSize(),S=n.start.row;S<=n.end.row;++S){var a=this.getLine(S);t.start.row=S,t.end.row=S;for(var r=0;r<D&&" "==a.charAt(r);++r);r<D&&" "==a.charAt(r)?(t.start.column=r,t.end.column=r+1):(t.start.column=0,t.end.column=r),this.remove(t)}},e.prototype.$moveLines=function(e,n,t){if(e=this.getRowFoldStart(e),n=this.getRowFoldEnd(n),t<0){var D=this.getRowFoldStart(e+t);if(D<0)return 0;var S=D-e}else if(t>0){var D=this.getRowFoldEnd(n+t);if(D>this.doc.getLength()-1)return 0;var S=D-n}else{e=this.$clipRowToDocument(e);var S=(n=this.$clipRowToDocument(n))-e+1}var a=new s(e,0,n,Number.MAX_VALUE),r=this.getFoldsInRange(a).map(function(e){return e=e.clone(),e.start.row+=S,e.end.row+=S,e}),o=0==t?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 t=this.doc.getLength();e>=t?(e=t-1,n=this.doc.getLine(t-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 t=this.$wrapLimitRange;t.max<0&&(t={min:n,max:n});var D=this.$constrainWrapLimit(e,t.min,t.max);return D!=this.$wrapLimit&&D>1&&(this.$wrapLimit=D,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,n,t){return n&&(e=Math.max(n,e)),t&&(e=Math.min(t,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,t=e.action,D=e.start,S=e.end,a=D.row,r=S.row,o=r-a,i=null;if(this.$updating=!0,0!=o)if("remove"===t){this[n?"$wrapData":"$rowLengthCache"].splice(a,o);var g=this.$foldData;i=this.getFoldsInRange(e),this.removeFolds(i);var s=this.getFoldLine(S.row),l=0;if(s){s.addRemoveChars(S.row,S.column,D.column-S.column),s.shiftRow(-o);var d=this.getFoldLine(a);d&&d!==s&&(d.merge(s),s=d),l=g.indexOf(s)+1}for(;l<g.length;l++){var s=g[l];s.start.row>=S.row&&s.shiftRow(-o)}r=a}else{var c=Array(o);c.unshift(a,0);var u=n?this.$wrapData:this.$rowLengthCache;u.splice.apply(u,c);var g=this.$foldData,s=this.getFoldLine(a),l=0;if(s){var f=s.range.compareInside(D.row,D.column);0==f?(s=s.split(D.row,D.column))&&(s.shiftRow(o),s.addRemoveChars(r,0,S.column-D.column)):-1==f&&(s.addRemoveChars(a,0,S.column-D.column),s.shiftRow(o)),l=g.indexOf(s)+1}for(;l<g.length;l++){var s=g[l];s.start.row>=a&&s.shiftRow(o)}}else{o=Math.abs(e.start.column-e.end.column),"remove"===t&&(i=this.getFoldsInRange(e),this.removeFolds(i),o=-o);var s=this.getFoldLine(a);s&&s.addRemoveChars(a,D.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(a,r):this.$updateRowLengthCache(a,r),i},e.prototype.$updateRowLengthCache=function(e,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[n]=null},e.prototype.$updateWrapData=function(e,n){var t,D,S=this.doc.getAllLines(),a=this.getTabSize(),r=this.$wrapData,o=this.$wrapLimit,i=e;for(n=Math.min(n,S.length-1);i<=n;)(D=this.getFoldLine(i,D))?(t=[],D.walk((function(e,n,D,a){var r;if(null!=e){(r=this.$getDisplayTokens(e,t.length))[0]=m;for(var o=1;o<r.length;o++)r[o]=y}else r=this.$getDisplayTokens(S[n].substring(a,D),t.length);t=t.concat(r)}).bind(this),D.end.row,S[D.end.row].length+1),r[D.start.row]=this.$computeWrapSplits(t,o,a),i=D.end.row+1):(t=this.$getDisplayTokens(S[i]),r[i]=this.$computeWrapSplits(t,o,a),i++)},e.prototype.$computeWrapSplits=function(e,n,t){if(0==e.length)return[];var D=[],S=e.length,a=0,r=0,o=this.$wrapAsCode,i=this.$indentedSoftWrap,g=n<=Math.max(2*t,8)||!1===i?0:Math.floor(n/2);function s(){var n=0;if(0===g)return n;if(i)for(var D=0;D<e.length;D++){var S=e[D];if(S==v)n+=1;else if(S==$)n+=t;else if(S==w)continue;else break}return o&&!1!==i&&(n+=t),Math.min(n,g)}function l(n){for(var t=n-a,S=a;S<n;S++){var o=e[S];(12===o||2===o)&&(t-=1)}D.length||(D.indent=d=s()),r+=t,D.push(r),a=n}for(var d=0;S-a>n-d;){var c=a+n-d;if(e[c-1]>=v&&e[c]>=v){l(c);continue}if(e[c]==m||e[c]==y){for(;c!=a-1&&e[c]!=m;c--);if(c>a){l(c);continue}for(c=a+n;c<e.length&&e[c]==y;c++);if(c==e.length)break;l(c);continue}for(var u=Math.max(c-(n-(n>>2)),a-1);c>u&&e[c]<m;)c--;if(o){for(;c>u&&e[c]<m;)c--;for(;c>u&&e[c]==b;)c--}else for(;c>u&&e[c]<v;)c--;if(c>u){l(++c);continue}e[c=a+n]==p&&c--,l(c-d)}return D},e.prototype.$getDisplayTokens=function(e,n){var t,D=[];n=n||0;for(var S=0;S<e.length;S++){var a=e.charCodeAt(S);if(9==a){t=this.getScreenTabSize(D.length+n),D.push($);for(var r=1;r<t;r++)D.push(w)}else 32==a?D.push(v):a>39&&a<48||a>57&&a<64?D.push(b):a>=4352&&_(a)?D.push(h,p):D.push(h)}return D},e.prototype.$getStringScreenWidth=function(e,n,t){var D,S;if(0==n)return[0,0];for(null==n&&(n=1/0),t=t||0,S=0;S<e.length&&(9==(D=e.charCodeAt(S))?t+=this.getScreenTabSize(t):D>=4352&&_(D)?t+=2:t+=1,!(t>n));S++);return[t,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),t=this.$wrapData[n.row];return t.length&&t[0]<n.column?t.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 t=this.documentToScreenRow(e,n);return this.getScreenLastRowColumn(t)},e.prototype.getDocumentLastRowColumnPosition=function(e,n){var t=this.documentToScreenRow(e,n);return this.screenToDocumentPosition(t,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,t){if(e<0)return{row:0,column:0};var D,S,a=0,r=0,o=0,i=0,g=this.$screenRowCache,s=this.$getRowCacheIndex(g,e),l=g.length;if(l&&s>=0)var o=g[s],a=this.$docRowCache[s],d=e>g[l-1];else var d=!l;for(var c=this.getLength()-1,u=this.getNextFoldLine(a),f=u?u.start.row:1/0;o<=e&&!(o+(i=this.getRowLength(a))>e)&&!(a>=c);)o+=i,++a>f&&(a=u.end.row+1,f=(u=this.getNextFoldLine(a,u))?u.start.row:1/0),d&&(this.$docRowCache.push(a),this.$screenRowCache.push(o));if(u&&u.start.row<=a)D=this.getFoldDisplayLine(u),a=u.start.row;else{if(o+i<=e||a>c)return{row:c,column:this.getLine(c).length};D=this.getLine(a),u=null}var h=0,p=Math.floor(e-o);if(this.$useWrapMode){var m=this.$wrapData[a];m&&(S=m[p],p>0&&m.length&&(h=m.indent,r=m[p-1]||m[m.length-1],D=D.substring(r)))}return(void 0!==t&&this.$bidiHandler.isBidiRow(o+p,a,p)&&(n=this.$bidiHandler.offsetToCol(t)),r+=this.$getStringScreenWidth(D,n-h)[1],this.$useWrapMode&&r>=S&&(r=S-1),u)?u.idxToPosition(r):{row:a,column:r}},e.prototype.documentToScreenPosition=function(e,n){if(void 0===n)var t=this.$clipPositionToDocument(e.row,e.column);else t=this.$clipPositionToDocument(e,n);e=t.row,n=t.column;var D=0,S=null,a=null;(a=this.getFoldAt(e,n,1))&&(e=a.start.row,n=a.start.column);var r,o=0,i=this.$docRowCache,g=this.$getRowCacheIndex(i,e),s=i.length;if(s&&g>=0)var o=i[g],D=this.$screenRowCache[g],l=e>i[s-1];else var l=!s;for(var d=this.getNextFoldLine(o),c=d?d.start.row:1/0;o<e;){if(o>=c){if((r=d.end.row+1)>e)break;c=(d=this.getNextFoldLine(r,d))?d.start.row:1/0}else r=o+1;D+=this.getRowLength(o),o=r,l&&(this.$docRowCache.push(o),this.$screenRowCache.push(D))}var u="";d&&o>=c?(u=this.getFoldDisplayLine(d,e,n),S=d.start.row):(u=this.getLine(e).substring(0,n),S=e);var f=0;if(this.$useWrapMode){var h=this.$wrapData[S];if(h){for(var p=0;u.length>=h[p];)D++,p++;u=u.substring(h[p-1]||0,u.length),f=p>0?h.indent:0}}return this.lineWidgets&&this.lineWidgets[o]&&this.lineWidgets[o].rowsAbove&&(D+=this.lineWidgets[o].rowsAbove),{row:D,column:f+this.$getStringScreenWidth(u)[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 t=this.$wrapData.length,D=0,S=0,n=this.$foldData[S++],a=n?n.start.row:1/0;D<t;){var r=this.$wrapData[D];e+=r?r.length+1:1,++D>a&&(D=n.end.row+1,a=(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,t,D){var S,a;if(0===t)return[0,0];for(t||(t=1/0),D=D||0,a=0;a<n.length&&(" "===(S=n.charAt(a))?D+=this.getScreenTabSize(D):D+=e.getCharacterWidth(S),!(D>t));a++);return[D,a]})},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}();f.$uid=0,f.prototype.$modes=r.$modes,f.prototype.getValue=f.prototype.toString,f.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},f.prototype.$overwrite=!1,f.prototype.$mode=null,f.prototype.$modeId=null,f.prototype.$scrollTop=0,f.prototype.$scrollLeft=0,f.prototype.$wrapLimit=80,f.prototype.$useWrapMode=!1,f.prototype.$wrapLimitRange={min:null,max:null},f.prototype.lineWidgets=null,f.prototype.isFullWidth=_,D.implement(f.prototype,o);var h=1,p=2,m=3,y=4,b=9,v=10,$=11,w=12;function _(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(f.prototype),e("./edit_session/bracket_match").BracketMatch.call(f.prototype),r.defineOptions(f.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=f}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,n,t){"use strict";var D=e("./lib/lang"),S=e("./lib/oop"),a=e("./range").Range;function r(e,n){var t=D.supportsLookbehind();function S(e,D){if(void 0===D&&(D=!0),(t&&n.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||n.regExp)return t&&n.$supportsUnicodeFlag?D?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var a=Array.from(e),r=a[0],o=a[a.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 D.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var n=this.$options,t=this.$matchIterator(e,n);if(!t)return!1;var D=null;return t.forEach(function(e,t,S,r){return D=new a(e,t,S,r),!(t==r&&n.start&&n.start.start&&!1!=n.skipCurrent&&D.isEqual(n.start))||(D=null,!1)}),D},e.prototype.findAll=function(e){var n=this.$options;if(!n.needle)return[];this.$assembleRegExp(n);var t=n.range,S=t?e.getLines(t.start.row,t.end.row):e.doc.getAllLines(),r=[],o=n.re;if(n.$isMultiLine){var i,g=o.length,s=S.length-g;e:for(var l=o.offset||0;l<=s;l++){for(var d=0;d<g;d++)if(-1==S[l+d].search(o[d]))continue e;var c=S[l],u=S[l+g-1],f=c.length-c.match(o[0])[0].length,h=u.match(o[g-1])[0].length;i&&i.end.row===l&&i.end.column>f||(r.push(i=new a(l,f,l+g-1,h)),g>2&&(l=l+g-2))}}else for(var p=0;p<S.length;p++)for(var m=D.getMatchOffsets(S[p],o),d=0;d<m.length;d++){var y=m[d];r.push(new a(p,y.offset,p,y.offset+y.length))}if(t){for(var b=t.start.column,v=t.end.column,p=0,d=r.length-1;p<d&&r[p].start.column<b&&0==r[p].start.row;)p++;for(var $=t.end.row-t.start.row;p<d&&r[d].end.column>v&&r[d].end.row==$;)d--;for(r=r.slice(p,d+1),p=0,d=r.length;p<d;p++)r[p].start.row+=t.start.row,r[p].end.row+=t.start.row}return r},e.prototype.replace=function(e,n){var t=this.$options,D=this.$assembleRegExp(t);if(t.$isMultiLine)return n;if(D){var S=D.exec(e);if(!S||S[0].length!=e.length)return null;if(t.regExp||(n=n.replace(/\$/g,"$$$$")),n=e.replace(D,n),t.preserveCase){n=n.split("");for(var a=Math.min(e.length,e.length);a--;){var r=e[a];r&&r.toLowerCase()!=r?n[a]=n[a].toUpperCase():n[a]=n[a].toLowerCase()}n=n.join("")}return n}},e.prototype.$assembleRegExp=function(e,n){if(e.needle instanceof RegExp)return e.re=e.needle;var t=e.needle;if(!e.needle)return e.re=!1;e.regExp||(t=D.escapeRegExp(t));var S=e.caseSensitive?"gm":"gmi";try{RegExp(t,"u"),e.$supportsUnicodeFlag=!0,S+="u"}catch(n){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(t=r(t,e)),e.$isMultiLine=!n&&/[\n\r]/.test(t),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(t,S);try{var a=new RegExp(t,S)}catch(e){a=!1}return e.re=a},e.prototype.$assembleMultilineRegExp=function(e,n){for(var t=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),D=[],S=0;S<t.length;S++)try{D.push(new RegExp(t[S],n))}catch(e){return!1}return D},e.prototype.$matchIterator=function(e,n){var t=this.$assembleRegExp(n);if(!t)return!1;var S=!0==n.backwards,a=!1!=n.skipCurrent,r=t.unicode,o=n.range,i=n.start;i||(i=o?o[S?"end":"start"]:e.selection.getRange()),i.start&&(i=i[a!=S?"end":"start"]);var g=o?o.start.row:0,s=o?o.end.row:e.getLength()-1;if(S)var l=function(e){var t=i.row;if(!c(t,i.column,e)){for(t--;t>=g;t--)if(c(t,Number.MAX_VALUE,e))return;if(!1!=n.wrap){for(t=s,g=i.row;t>=g;t--)if(c(t,Number.MAX_VALUE,e))return}}};else var l=function(e){var t=i.row;if(!c(t,i.column,e)){for(t+=1;t<=s;t++)if(c(t,0,e))return;if(!1!=n.wrap){for(t=g,s=i.row;t<=s;t++)if(c(t,0,e))return}}};if(n.$isMultiLine)var d=t.length,c=function(n,D,a){var r=S?n-d+1:n;if(!(r<0||r+d>e.getLength())){var o=e.getLine(r),i=o.search(t[0]);if((S||!(i<D))&&-1!==i){for(var g=1;g<d;g++)if(-1==(o=e.getLine(r+g)).search(t[g]))return;var s=o.match(t[d-1])[0].length;if((!S||!(s>D))&&a(r,i,r+d-1,s))return!0}}};else if(S)var c=function(n,S,a){var o,i=e.getLine(n),g=[],s=0;for(t.lastIndex=0;o=t.exec(i);){var l=o[0].length;if(s=o.index,!l){if(s>=i.length)break;t.lastIndex=s+=D.skipEmptyMatch(i,s,r)}if(o.index+l>S)break;g.push(o.index,l)}for(var d=g.length-1;d>=0;d-=2){var c=g[d-1],l=g[d];if(a(n,c,n,c+l))return!0}};else var c=function(n,S,a){var o,i,g=e.getLine(n);for(t.lastIndex=S;i=t.exec(g);){var s=i[0].length;if(a(n,o=i.index,n,o+s))return!0;if(!s&&(t.lastIndex=o+=D.skipEmptyMatch(g,o,r),o>=g.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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("../lib/keys"),a=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,t){this.platform=n||(a.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=t},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 t=e&&("string"==typeof e?e:e.name);e=this.commands[t],n||delete this.commands[t];var D=this.commandKeyBinding;for(var S in D){var a=D[S];if(a==e)delete D[S];else if(Array.isArray(a)){var r=a.indexOf(e);-1!=r&&(a.splice(r,1),1==a.length&&(D[S]=a[0]))}}},e.prototype.bindKey=function(e,n,t){if("object"==typeof e&&e&&(void 0==t&&(t=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 D="";if(-1!=e.indexOf(" ")){var S=e.split(/\s+/);e=S.pop(),S.forEach(function(e){var n=this.parseKeys(e),t=r[n.hashId]+n.key;D+=(D?" ":"")+t,this._addCommandToBinding(D,"chainKeys")},this),D+=" "}var a=this.parseKeys(e),o=r[a.hashId]+a.key;this._addCommandToBinding(D+o,n,t)},this)}},e.prototype._addCommandToBinding=function(e,n,t){var D,S=this.commandKeyBinding;if(n)if(!S[e]||this.$singleCommand)S[e]=n;else{Array.isArray(S[e])?-1!=(D=S[e].indexOf(n))&&S[e].splice(D,1):S[e]=[S[e]],"number"!=typeof t&&(t=i(n));var a=S[e];for(D=0;D<a.length&&!(i(a[D])>t);D++);a.splice(D,0,n)}else delete S[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(n){var t=e[n];if(t){if("string"==typeof t)return this.bindKey(t,n);"function"==typeof t&&(t={exec:t}),"object"==typeof t&&(t.name||(t.name=n),this.addCommand(t))}},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}),t=n.pop(),D=S[t];if(S.FUNCTION_KEYS[D])t=S.FUNCTION_KEYS[D].toLowerCase();else if(!n.length)return{key:t,hashId:-1};else if(1==n.length&&"shift"==n[0])return{key:t.toUpperCase(),hashId:-1};for(var a=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;a|=o}return{key:t,hashId:a}},e.prototype.findKeyCommand=function(e,n){var t=r[e]+n;return this.commandKeyBinding[t]},e.prototype.handleKeyboard=function(e,n,t,D){if(!(D<0)){var S=r[n]+t,a=this.commandKeyBinding[S];return(e.$keyChain&&(e.$keyChain+=" "+S,a=this.commandKeyBinding[e.$keyChain]||a),a&&("chainKeys"==a||"chainKeys"==a[a.length-1]))?(e.$keyChain=e.$keyChain||S,{command:"null"}):(e.$keyChain&&(n&&4!=n||1!=t.length?(-1==n||D>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-S.length-1)),{command:a})}},e.prototype.getStatusText=function(e,n){return n.$keyChain||""},e}();function i(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var g=function(e){function n(n,t){var D=e.call(this,n,t)||this;return D.$singleCommand=!0,D}return D(n,e),n}(o);g.call=function(e,n,t){o.prototype.$init.call(e,n,t,!0)},o.call=function(e,n,t){o.prototype.$init.call(e,n,t,!1)},n.HashHandler=g,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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("../lib/oop"),a=e("../keyboard/hash_handler").MultiHashHandler,r=e("../lib/event_emitter").EventEmitter,o=function(e){function n(n,t){var D=e.call(this,t,n)||this;return D.byName=D.commands,D.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)}),D}return D(n,e),n.prototype.exec=function(e,n,t){if(Array.isArray(e)){for(var D=e.length;D--;)if(this.exec(e[D],n,t))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:t};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}(a);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,t){"use strict";var D=e("../lib/lang"),S=e("../config"),a=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(D.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(),t=n?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),S=n?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),r=e.session.doc.getLine(t.row).length,o=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,i=e.session.doc.getLine(t.row),g=t.row+1;g<=S.row+1;g++){var s=D.stringTrimLeft(D.stringTrimRight(e.session.doc.getLine(g)));0!==s.length&&(s=" "+s),i+=s}S.row+1<e.session.doc.getLength()-1&&(i+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new a(t.row,0,S.row+2,0),i),o>0?(e.selection.moveCursorTo(t.row,t.column),e.selection.selectTo(t.row,t.column+o)):(r=e.session.doc.getLine(t.row).length>r?r+1:r,e.selection.moveCursorTo(t.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,t=e.session.doc.getLine(n).length,D=e.selection.rangeList.ranges,S=[];D.length<1&&(D=[e.selection.getRange()]);for(var r=0;r<D.length;r++)r==D.length-1&&(D[r].end.row!==n||D[r].end.column!==t)&&S.push(new a(D[r].end.row,D[r].end.column,n,t)),0===r?(0!==D[r].start.row||0!==D[r].start.column)&&S.push(new a(0,0,D[r].start.row,D[r].start.column)):S.push(new a(D[r-1].end.row,D[r-1].end.column,D[r].start.row,D[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,t){"use strict";var D=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 t=this.session.lineWidgets;t&&t.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 t=n.lineWidgets;if(t&&e.action){for(var D=e.data,S=D.start.row,a=D.end.row,r="add"==e.action,o=S+1;o<a;o++)t[o]&&(t[o].hidden=r);t[a]&&(r?t[S]?t[a].hidden=r:t[S]=t[a]:(t[S]==t[a]&&(t[S]=void 0),t[a].hidden=r))}},e.prototype.updateOnChange=function(e){var n=this.session.lineWidgets;if(n){var t=e.start.row,D=e.end.row-t;if(0===D);else if("remove"==e.action){var S=n.splice(t+1,D);!n[t]&&S[S.length-1]&&(n[t]=S.pop()),S.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var a=Array(D);n[t]&&null!=n[t].column&&e.start.column>n[t].column&&t++,a.unshift(t,0),n.splice.apply(n,a),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var n=!0;e.forEach(function(e,t){if(e)for(n=!1,e.row=t;e.$oldWidget;)e.$oldWidget.row=t,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=D.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=D.createElement("div"),e.el.textContent=e.text),e.el&&(D.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&D.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 t=this.session.getFoldAt(e.row,0);if(e.$fold=t,t){var S=this.session.lineWidgets;e.row!=t.end.row||S[t.start.row]?e.hidden=!0:S[t.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,t=n&&n[e],D=[];t;)D.push(t),t=t.$oldWidget;return D},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,n){var t=this.session._changedWidgets,D=n.layerConfig;if(t&&t.length){for(var S=1/0,a=0;a<t.length;a++){var r=t[a];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/D.characterWidth));var o=r.h/D.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 t=n.layerConfig,D=this.session.lineWidgets;if(D){for(var S=Math.min(this.firstRow,t.firstRow),a=Math.max(this.lastRow,t.lastRow,D.length);S>0&&!D[S];)S--;this.firstRow=t.firstRow,this.lastRow=t.lastRow,n.$cursorLayer.config=t;for(var r=S;r<=a;r++){var o=D[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 i=n.$cursorLayer.getPixelPosition({row:r,column:0},!0).top;o.coverLine||(i+=t.lineHeight*this.session.getRowLineCount(o.row)),o.el.style.top=i-t.offset+"px";var g=o.coverGutter?0:n.gutterWidth;o.fixedWidth||(g-=n.scrollLeft),o.el.style.left=g+"px",o.fullWidth&&o.screenWidth&&(o.el.style.minWidth=t.width+2*t.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,t){"use strict";var D=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===D.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=D.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),t=this.$findNearestAnnotation(e);if(null!==n||null!==t){if(null===n&&null!==t){this.activeRowIndex=t,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==n&&null===t){this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(t-e)<Math.abs(n-e)){this.activeRowIndex=t,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 a(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===D.tab)return void e.preventDefault();if(e.keyCode===D.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===D.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===D.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===D.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===D.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===D.enter||e.keyCode===D.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 t=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),S=this.annotationTooltip.getElement().style;S.left=t.right+"px",S.top=t.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)),t="none"!==this.$getFoldWidget(e).style.display;return n&&t},e.prototype.$isAnnotationVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),t="none"!==this.$getAnnotation(e).style.display;return n&&t},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 t=this.$findNearestFoldWidget(this.activeRowIndex);if(null==t)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=t,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 a=function(){function e(e,n){this.gutterKeyboardHandler=n,this.domEvent=e}return e.prototype.getKey=function(){return D.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=a}),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,t){"use strict";var D=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/lang"),o=e("./lib/useragent"),i=e("./keyboard/textinput").TextInput,g=e("./mouse/mouse_handler").MouseHandler,s=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,d=e("./edit_session").EditSession,c=e("./search").Search,u=e("./range").Range,f=e("./lib/event_emitter").EventEmitter,h=e("./commands/command_manager").CommandManager,p=e("./commands/default_commands").commands,m=e("./config"),y=e("./token_iterator").TokenIterator,b=e("./line_widgets").LineWidgets,v=e("./keyboard/gutter_handler").GutterKeyboardHandler,$=e("./config").nls,w=e("./clipboard"),_=e("./lib/keys"),A=function(){function e(n,t,D){this.session,this.$toDestroy=[];var S=n.getContainerElement();this.container=S,this.renderer=n,this.id="editor"+ ++e.$uid,this.commands=new h(o.isMac?"mac":"win",p),"object"==typeof document&&(this.textInput=new i(n.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new g(this),new s(this)),this.keyBinding=new l(this),this.$search=new c().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(t||D&&D.session||new d("")),m.resetOptions(this),D&&this.setOptions(D),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,t=n&&n.scrollIntoView;if(t){switch(t){case"center-animate":t="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var D=this.selection.getRange(),S=this.renderer.layerConfig;(D.start.row>=S.lastRow||D.end.row<=S.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==t&&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,t=this.$mergeableCommands,D=n.command&&e.command.name==n.command.name;if("insertstring"==e.command.name){var S=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),D=D&&this.mergeNextCommand&&(!/\s/.test(S)||/\s/.test(n.args)),this.mergeNextCommand=!0}else D=D&&-1!==t.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(D=!1),D?this.session.mergeUndoDeltas=!0:-1!==t.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 t=this;m.loadModule(["keybinding",e],function(D){t.$keybindingId==e&&t.keyBinding.setKeyboardHandler(D&&D.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 t=this.session.getSelection();t.off("changeCursor",this.$onCursorChange),t.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")||a.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 t=e.getCursorPosition(),D=e.getKeyboardHandler(),S=D&&D.$getDirectionForHighlight&&D.$getDirectionForHighlight(e),a=n.getMatchingBracketRanges(t,S);if(!a){var r=new y(n,t.row,t.column).getCurrentToken();if(r&&/\b(?:tag-open|tag-name)/.test(r.type)){var o=n.getMatchingTags(t);o&&(a=[o.openTagName.isEmpty()?o.openTag:o.openTagName,o.closeTagName.isEmpty()?o.closeTag:o.closeTagName])}}if(!a&&n.$mode.getMatching&&(a=n.$mode.getMatching(e.session)),!a){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var i="ace_bracket";Array.isArray(a)?1==a.length&&(i="ace_error_bracket"):a=[a],2==a.length&&(0==u.comparePoints(a[0].end,a[1].start)?a=[u.fromPoints(a[0].start,a[1].end)]:0==u.comparePoints(a[0].start,a[1].end)&&(a=[u.fromPoints(a[1].start,a[0].end)])),n.$bracketHighlight={ranges:a,markerIds:a.map(function(e){return n.addMarker(e,i,"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,t=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,t,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 t=new u(e.row,e.column,e.row,1/0);t.id=n.addMarker(t,"ace_active-line","screenLine"),n.$highlightLineMarker=t}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 t=this.selection.getRange(),D=this.getSelectionStyle();n.$selectionMarker=n.addMarker(t,"ace_selection",D)}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 t=n.start.column,D=n.end.column,S=e.getLine(n.start.row),a=S.substring(t,D);if(!(a.length>5e3)&&/[\w\d]/.test(a)){var r=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:a}),o=S.substring(t-1,D+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(),t=!1;if(!e&&this.$copyWithEmptySelection){t=!0;for(var D=this.selection.getAllRanges(),S=0;S<D.length;S++){var a=D[S];S&&D[S-1].start.row==a.start.row||(e+=this.session.getLine(a.start.row)+n)}}var r={text:e};return this._signal("copy",r),w.lineMode=!!t&&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 t={text:e,event:n};this.commands.exec("paste",this,t)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var n=e.text,t=n===w.lineMode,D=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)t?D.insert({row:this.selection.lead.row,column:0},n):this.insert(n);else if(t)this.selection.rangeList.ranges.forEach(function(e){D.insert({row:e.start.row,column:0},n)});else{var S=n.split(/\r\n|\r|\n/),a=this.selection.rangeList.ranges,r=2==S.length&&(!S[0]||!S[1]);if(S.length!=a.length||r)return this.commands.exec("insertstring",this,n);for(var o=a.length;o--;){var i=a[o];i.isEmpty()||D.remove(i),D.insert(i.start,S[o])}}},e.prototype.execCommand=function(e,n){return this.commands.exec(e,this,n)},e.prototype.insert=function(e,n){var t=this.session,D=t.getMode(),S=this.getCursorPosition();if(this.getBehavioursEnabled()&&!n){var a=D.transformAction(t.getState(S.row),"insertion",this,t,e);a&&(e===a.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=a.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var r=u.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=t.getLine(S.row);if(S.column>o.search(/\S|$/)){var i=o.substr(S.column).search(/\S|$/);t.doc.removeInLine(S.row,S.column,S.column+i)}}this.clearSelection();var g=S.column,s=t.getState(S.row),o=t.getLine(S.row),l=D.checkOutdent(s,o,e);if(t.insert(S,e),a&&a.selection&&(2==a.selection.length?this.selection.setSelectionRange(new u(S.row,g+a.selection[0],S.row,g+a.selection[1])):this.selection.setSelectionRange(new u(S.row+a.selection[0],a.selection[1],S.row+a.selection[2],a.selection[3]))),this.$enableAutoIndent){if(t.getDocument().isNewLine(e)){var d=D.getNextLineIndent(s,o.slice(0,S.column),t.getTabString());t.insert({row:S.row+1,column:0},d)}l&&D.autoOutdent(s,t,S.row)}},e.prototype.autoIndent=function(){for(var e=this.session,n=e.getMode(),t=this.selection.isEmpty()?[new u(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),D="",S="",a="",r=e.getTabString(),o=0;o<t.length;o++)for(var i=t[o].start.row,g=t[o].end.row,s=i;s<=g;s++){s>0&&(D=e.getState(s-1),S=e.getLine(s-1),a=n.getNextLineIndent(D,S,r));var l=e.getLine(s),d=n.$getIndent(l);if(a!==d){if(d.length>0){var c=new u(s,0,s,d.length);e.remove(c)}a.length>0&&e.insert({row:s,column:0},a)}n.autoOutdent(D,e,s)}},e.prototype.onTextInput=function(e,n){if(!n)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var t=this.applyComposition.bind(this,e,n);this.selection.rangeCount?this.forEachSelection(t):t(),this.endOperation()},e.prototype.applyComposition=function(e,n){if(n.extendLeft||n.extendRight){var t=this.selection.getRange();t.start.column-=n.extendLeft,t.end.column+=n.extendRight,t.start.column<0&&(t.start.row--,t.start.column+=this.session.getLine(t.start.row).length+1),this.selection.setRange(t),e||t.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),n.restoreStart||n.restoreEnd){var t=this.selection.getRange();t.start.column-=n.restoreStart,t.end.column-=n.restoreEnd,this.selection.setRange(t)}},e.prototype.onCommandKey=function(e,n,t){return this.keyBinding.onCommandKey(e,n,t)},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 t=this.session,D=t.getState(n.start.row),S=t.getMode().transformAction(D,"deletion",this,t,n);if(0===n.end.column){var a=t.getTextRange(n);if("\n"==a[a.length-1]){var r=t.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 b(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,t=this.getCursorPosition(),D=t.column;if(0!==D){var S=this.session.getLine(t.row);D<S.length?(e=S.charAt(D)+S.charAt(D-1),n=new u(t.row,D-1,t.row,D+1)):(e=S.charAt(D-1)+S.charAt(D-2),n=new u(t.row,D-2,t.row,D)),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(),t=this.session.getTextRange(n);this.session.replace(n,t.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),t=this.session.getTextRange(n);this.session.replace(n,t.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,n=this.getSelectionRange();if(n.start.row<n.end.row){var t=this.$getSelectedRows();e.indentRows(t.first,t.last," ");return}if(n.start.column<n.end.column){var D=e.getTextRange(n);if(!/^\s+$/.test(D)){var t=this.$getSelectedRows();e.indentRows(t.first,t.last," ");return}}var S=e.getLine(n.start.row),a=n.start,o=e.getTabSize(),i=e.documentToScreenColumn(a.row,a.column);if(this.session.getUseSoftTabs())var g=o-i%o,s=r.stringRepeat(" ",g);else{for(var g=i%o;" "==S[n.start.column-1]&&g;)n.start.column--,g--;this.selection.setSelectionRange(n),s=" "}return this.insert(s)},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,t=[],D=e.first;D<=e.last;D++)t.push(n.getLine(D));t.sort(function(e,n){return e.toLowerCase()<n.toLowerCase()?-1:+(e.toLowerCase()>n.toLowerCase())});for(var S=new u(0,0,0,0),D=e.first;D<=e.last;D++){var a=n.getLine(D);S.start.row=D,S.end.row=D,S.end.column=a.length,n.replace(S,t[D-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),t=this.getSelectionRange();this.session.getMode().toggleBlockComment(n,this.session,t,e)},e.prototype.getNumberAt=function(e,n){var t=/[\-]?[0-9]+(?:\.[0-9]+)?/g;t.lastIndex=0;for(var D=this.session.getLine(e);t.lastIndex<n;){var S=t.exec(D);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,t=this.selection.getCursor().column,D=new u(n,t-1,n,t),S=this.session.getTextRange(D);if(!isNaN(parseFloat(S))&&isFinite(S)){var a=this.getNumberAt(n,t);if(a){var r=a.value.indexOf(".")>=0?a.start+a.value.indexOf(".")+1:a.end,o=a.start+a.value.length-r,i=parseFloat(a.value);i*=Math.pow(10,o),r!==a.end&&t<r?e*=Math.pow(10,a.end-t-1):e*=Math.pow(10,a.end-t),i+=e;var g=(i/=Math.pow(10,o)).toFixed(o),s=new u(n,a.start,n,a.end);this.session.replace(s,g),this.moveCursorTo(n,Math.max(a.start+1,t+g.length-a.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,n=this.selection.getCursor().row,t=this.selection.getCursor().column;this.selection.selectWord();var D=this.getSelectedText(),S=this.selection.getWordRange().start.column,a=D.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=t-S-1;o<0&&(o=0);var i=0,g=0,s=this;D.match(/[A-Za-z0-9_]+/)&&a.forEach(function(e,t){g=i+e.length,o>=i&&o<=g&&(D=e,s.selection.clearSelection(),s.moveCursorTo(n,i+S),s.selection.selectTo(n,g+S)),i=g});for(var l=this.$toggleWordPairs,d=0;d<l.length;d++)for(var c=l[d],u=0;u<=1;u++){var f=+!u,h=D.match(RegExp("^\\s?_?("+r.escapeRegExp(c[u])+")\\s?$","i"));h&&D.match(RegExp("([_]|^|\\s)("+r.escapeRegExp(h[1])+")($|\\s)","g"))&&(e=D.replace(RegExp(r.escapeRegExp(c[u]),"i"),function(e){var n=c[f];return e.toUpperCase()==e?n=n.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(n=n.substr(0,0)+c[f].charAt(0).toUpperCase()+n.substr(1)),n}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,n){var t=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),S=n;S<0&&(S=0);var a,r,o,i=0,g=0;try{for(var s=D(t),l=s.next();!l.done;l=s.next()){var d=l.value;if(g=i+d.length,S>=i&&S<=g&&d.match(/((?:https?|ftp):\/\/[\S]+)/)){o=d.replace(/[\s:.,'";}\]]+$/,"");break}i=g}}catch(e){a={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.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,t=e.getRange(),D=e.isBackwards();if(t.isEmpty()){var S=t.start.row;n.duplicateLines(S,S)}else{var a=D?t.start:t.end,r=n.insert(a,n.getTextRange(t));t.start=a,t.end=r,e.setSelectionRange(t,D)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,n,t){return this.session.moveText(e,n,t)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,n){var t,D,S=this.selection;if(!S.inMultiSelectMode||this.inVirtualSelectionMode){var a=S.toOrientedRange();t=this.$getSelectedRows(a),D=this.session.$moveLines(t.first,t.last,n?0:e),n&&-1==e&&(D=0),a.moveBy(D,0),S.fromOrientedRange(a)}else{var r=S.rangeList.ranges;S.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var o=0,i=0,g=r.length,s=0;s<g;s++){var l=s;r[s].moveBy(o,0);for(var d=(t=this.$getSelectedRows(r[s])).first,c=t.last;++s<g;){i&&r[s].moveBy(i,0);var u=this.$getSelectedRows(r[s]);if(n&&u.first!=c||!n&&u.first>c+1)break;c=u.last}for(s--,o=this.session.$moveLines(d,c,n?0:e),n&&-1==e&&(l=s+1);l<=s;)r[l].moveBy(o,0),l++;n||(o=0),i+=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 t=this.renderer,D=this.renderer.layerConfig,S=e*Math.floor(D.height/D.lineHeight);!0===n?this.selection.$moveSelection(function(){this.moveCursorBy(S,0)}):!1===n&&(this.selection.moveCursorBy(S,0),this.selection.clearSelection());var a=t.scrollTop;t.scrollBy(0,S*D.lineHeight),null!=n&&t.scrollCursorIntoView(null,.5),t.animateScrolling(a)},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,t,D){this.renderer.scrollToLine(e,n,t,D)},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 t,D,S,a,r=this.getCursorPosition(),o=new y(this.session,r.row,r.column),i=o.getCurrentToken(),g=0;i&&-1!==i.type.indexOf("tag-name")&&(i=o.stepBackward());var s=i||o.stepForward();if(s){var l=!1,d={},c=r.column-s.start,f={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g)){for(;c<s.value.length&&!l;c++)if(f[s.value[c]])switch(isNaN(d[D=f[s.value[c]]+"."+s.type.replace("rparen","lparen")])&&(d[D]=0),s.value[c]){case"(":case"[":case"{":d[D]++;break;case")":case"]":case"}":d[D]--,-1===d[D]&&(t="bracket",l=!0)}}else -1!==s.type.indexOf("tag-name")&&(isNaN(d[s.value])&&(d[s.value]=0),"<"===i.value&&g>1?d[s.value]++:"</"===i.value&&d[s.value]--,-1===d[s.value]&&(t="tag",l=!0));l||(i=s,g++,s=o.stepForward(),c=0)}while(s&&!l);if(t){if("bracket"===t)!(S=this.session.getBracketRange(r))&&(a=(S=new u(o.getCurrentTokenRow(),o.getCurrentTokenColumn()+c-1,o.getCurrentTokenRow(),o.getCurrentTokenColumn()+c-1)).start,(n||a.row===r.row&&2>Math.abs(a.column-r.column))&&(S=this.session.getBracketRange(a)));else if("tag"===t){if(!s||-1===s.type.indexOf("tag-name"))return;if(0===(S=new u(o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2,o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2)).compare(r.row,r.column)){var h=this.session.getMatchingTags(r);h&&(h.openTag.contains(r.row,r.column)?a=(S=h.closeTag).start:(S=h.openTag,a=h.closeTag.start.row===r.row&&h.closeTag.start.column===r.column?S.end:S.start))}a=a||S.start}a=S&&S.cursor||a,a&&(e?S&&n?this.selection.setRange(S):S&&S.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(a.row,a.column):this.selection.moveTo(a.row,a.column))}}},e.prototype.gotoLine=function(e,n,t){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,t)},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 t=this.$search.find(this.session),D=0;return t&&(this.$tryReplace(t,e)&&(D=1),this.selection.setSelectionRange(t),this.renderer.scrollSelectionIntoView(t.start,t.end)),D},e.prototype.replaceAll=function(e,n){n&&this.$search.set(n);var t=this.$search.findAll(this.session),D=0;if(!t.length)return D;var S=this.getSelectionRange();this.selection.moveTo(0,0);for(var a=t.length-1;a>=0;--a)this.$tryReplace(t[a],e)&&D++;return this.selection.setSelectionRange(S),D},e.prototype.$tryReplace=function(e,n){var t=this.session.getTextRange(e);return null!==(n=this.$search.replace(t,n))?(e.end=this.session.replace(e,n),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,n,t){n||(n={}),"string"==typeof e||e instanceof RegExp?n.needle=e:"object"==typeof e&&S.mixin(n,e);var D=this.selection.getRange();null==n.needle&&((e=this.session.getTextRange(D)||this.$search.$options.needle)||(D=this.session.getWordRange(D.start.row,D.start.column),e=this.session.getTextRange(D)),this.$search.set({needle:e})),this.$search.set(n),n.start||this.$search.set({start:D});var a=this.$search.find(this.session);return n.preventScroll?a:a?(this.revealRange(a,t),a):void(n.backwards?D.start=D.end:D.end=D.start,this.selection.setRange(D))},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 t=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==n&&this.renderer.animateScrolling(t)},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,t=this,D=!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 a=this.on("changeSelection",function(){D=!0}),r=this.renderer.on("beforeRender",function(){D&&(n=t.renderer.container.getBoundingClientRect())}),o=this.renderer.on("afterRender",function(){if(D&&n&&(t.isFocused()||t.searchBox&&t.searchBox.isFocused())){var e=t.renderer,a=e.$cursorLayer.$pixelPos,r=e.layerConfig,o=a.top-r.offset;null!=(D=a.top>=0&&o+n.top<0||(!(a.top<r.height)||!(a.top+n.top+r.lineHeight>window.innerHeight))&&null)&&(S.style.top=o+"px",S.style.left=a.left+"px",S.style.height=r.lineHeight+"px",S.scrollIntoView(D)),D=n=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",a),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,a.setCssClass(n.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,n,t){var D=this;m.loadModule("ace/ext/prompt",function(S){S.prompt(D,e,n,t)})},e}();A.$uid=0,A.prototype.curOp=null,A.prototype.prevOp={},A.prototype.$mergeableCommands=["backspace","del","insertstring"],A.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(A.prototype,f),m.defineOptions(A.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?M.attach(this):M.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?M.attach(this):M.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),a.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),a.addCssClass(this.container,"ace_hasPlaceholder");var n=a.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,t={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},D=function(e){if(e.target==this.renderer.scroller&&e.keyCode===_.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",$("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",$("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",D.bind(this)),this.commands.addCommand(t),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",$("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",$("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 v(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",D.bind(this)),this.commands.removeCommand(t),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 M={getText:function(e,n){return(Math.abs(e.selection.lead.row-n)||n+1+(n<9?"\xb7":""))+""},getWidth:function(e,n,t){return Math.max(n.toString().length,(t.lastRow+1).toString().length,2)*t.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=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=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){D.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,t){var D=Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight);return t.documentToScreenRow(e,0)*n.lineHeight-D*this.canvasHeight},e.prototype.computeLineHeight=function(e,n,t){return n.lineHeight*t.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=D.createFragment(this.element),t=0;t<e.length;t++)n.appendChild(e[t].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=D.createFragment(this.element),t=0;t<e.length;t++)n.appendChild(e[t].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,t,S){var a=this.cellCache.pop();if(!a){var r=D.createElement("div");S&&S(r),this.element.appendChild(r),a={element:r,text:"",row:e}}return a.row=e,a},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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/oop"),a=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,o=e("./lines").Lines,i=e("../config").nls,g=function(){function e(e){this.element=D.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 t=e[n],D=t.row,S=this.$annotations[D];S||(S=this.$annotations[D]={text:[],type:[],displayText:[]});var r=t.text,o=t.text,i=t.type;r=r?a.escapeHTML(r):t.html||"",o=o||t.html||"",-1===S.text.indexOf(r)&&(S.text.push(r),S.type.push(i),S.displayText.push(o));var g=t.className;g?S.className=g:"error"===i?S.className=" ace_error":"security"!==i||/\bace_error\b/.test(S.className)?"warning"!==i||/\bace_(error|security)\b/.test(S.className)?"info"!==i||S.className?"hint"!==i||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,t=e.end.row-n;if(0===t);else if("remove"==e.action)this.$annotations.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.$annotations.splice.apply(this.$annotations,D)}}},e.prototype.update=function(e){this.config=e;var n=this.session,t=e.firstRow,D=Math.min(e.lastRow+e.gutterOffset,n.getLength()-1);this.oldLastRow=D,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var S=n.getNextFoldLine(t),a=S?S.start.row:1/0,r=null,o=-1,i=t;;){if(i>a&&(i=S.end.row+1,a=(S=n.getNextFoldLine(i,S))?S.start.row:1/0),i>D){for(;this.$lines.getLength()>o+1;)this.$lines.pop();break}(r=this.$lines.get(++o))?r.row=i:(r=this.$lines.createCell(i,e,this.session,s),this.$lines.push(r)),this.$renderCell(r,e,S,i),i++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var n=this.session,t=n.gutterRenderer||this.$renderer,D=n.$firstLineNumber,S=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||n.$useWrapMode)&&(S=n.getLength()+D-1);var a=t?t.getWidth(n,S,e):S.toString().length*e.characterWidth,r=this.$padding||this.$computePadding();(a+=r.left+r.right)===this.gutterWidth||isNaN(a)||(this.gutterWidth=a,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",a))},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 t=0;t<n.length;t++){var D=n[t];if(D.row>=this.$cursorRow){if(D.row>this.$cursorRow){var S=this.session.getFoldLine(this.$cursorRow);if(t>0&&S&&S.start.row==n[t-1].row)D=n[t-1];else break}D.element.className="ace_gutter-active-line "+D.element.className,this.$cursorCell=D;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 t=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),D=this.oldLastRow;if(this.oldLastRow=t,!n||D<e.firstRow||t<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(D>t)for(var S=this.session.getFoldedRowCount(t+1,D);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,n.firstRow-1)),t>D&&this.$lines.push(this.$renderLines(e,D+1,t)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,n,t){for(var D=[],S=n,a=this.session.getNextFoldLine(S),r=a?a.start.row:1/0;S>r&&(S=a.end.row+1,r=(a=this.session.getNextFoldLine(S,a))?a.start.row:1/0),!(S>t);){var o=this.$lines.createCell(S,e,this.session,s);this.$renderCell(o,e,a,S),D.push(o),S++}return D},e.prototype.$renderCell=function(e,n,t,S){var a,r=e.element,o=this.session,g=r.childNodes[0],s=r.childNodes[1],l=r.childNodes[2],d=l.firstChild,c=o.$firstLineNumber,u=o.$breakpoints,f=o.$decorations,h=o.gutterRenderer||this.$renderer,p=this.$showFoldWidgets&&o.foldWidgets,m=t?t.start.row:Number.MAX_VALUE,y=n.lineHeight+"px",b=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",v=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",$=(h?h.getText(o,S):S+c).toString();if(this.$highlightGutterLine&&(S==this.$cursorRow||t&&S<this.$cursorRow&&S>=m&&this.$cursorRow<=t.end.row)&&(b+="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)),u[S]&&(b+=u[S]),f[S]&&(b+=f[S]),this.$annotations[S]&&S!==m&&(b+=this.$annotations[S].className),p){var w=p[S];null==w&&(w=p[S]=o.getFoldWidget(S))}if(w){var _="ace_fold-widget ace_"+w,A="start"==w&&S==m&&S<t.end.row;if(A){_+=" ace_closed";for(var M="",x=!1,L=S+1;L<=t.end.row;L++)if(this.$annotations[L]){if(" ace_error"===this.$annotations[L].className){x=!0,M=" ace_error_fold";break}" ace_security"===this.$annotations[L].className?(x=!0,M=" ace_security_fold"):" ace_warning"===this.$annotations[L].className&&" ace_security_fold"!==M&&(x=!0,M=" ace_warning_fold")}b+=M}else _+=" ace_open";s.className!=_&&(s.className=_),D.setStyle(s.style,"height",y),D.setStyle(s.style,"display","inline-block"),s.setAttribute("role","button"),s.setAttribute("tabindex","-1");var C=o.getFoldWidgetRange(S);C?s.setAttribute("aria-label",i("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[C.start.row+1,C.end.row+1])):t?s.setAttribute("aria-label",i("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[t.start.row+1,t.end.row+1])):s.setAttribute("aria-label",i("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[S+1])),A?(s.setAttribute("aria-expanded","false"),s.setAttribute("title",i("gutter.code-folding.closed.title","Unfold code"))):(s.setAttribute("aria-expanded","true"),s.setAttribute("title",i("gutter.code-folding.open.title","Fold code")))}else s&&(D.setStyle(s.style,"display","none"),s.setAttribute("tabindex","0"),s.removeAttribute("role"),s.removeAttribute("aria-label"));if(x&&this.$showFoldedAnnotations){switch(l.className="ace_gutter_annotation",d.className=v,d.className+=M,D.setStyle(d.style,"height",y),D.setStyle(l.style,"display","block"),D.setStyle(l.style,"height",y),M){case" ace_error_fold":a=i("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security_fold":a=i("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning_fold":a=i("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$])}l.setAttribute("aria-label",a),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else if(this.$annotations[S]){switch(l.className="ace_gutter_annotation",d.className=v,this.$useSvgGutterIcons?d.className+=this.$annotations[S].className:r.classList.add(this.$annotations[S].className.replace(" ","")),D.setStyle(d.style,"height",y),D.setStyle(l.style,"display","block"),D.setStyle(l.style,"height",y),this.$annotations[S].className){case" ace_error":a=i("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security":a=i("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning":a=i("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$]);break;case" ace_info":a=i("gutter.annotation.aria-label.info","Info, read annotations row $0",[$]);break;case" ace_hint":a=i("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[$])}l.setAttribute("aria-label",a),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else D.setStyle(l.style,"display","none"),l.removeAttribute("aria-label"),l.removeAttribute("role"),l.setAttribute("tabindex","0");return $!==g.data&&(g.data=$),r.className!=b&&(r.className=b),D.setStyle(e.element.style,"height",this.$lines.computeLineHeight(S,n,o)+"px"),D.setStyle(e.element.style,"top",this.$lines.computeLineTop(S,n,o)+"px"),e.text=$,"none"===l.style.display&&"none"===s.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?D.addCssClass(this.element,"ace_folding-enabled"):D.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=D.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(),t=this.element.getBoundingClientRect();return e.x<n.left+t.left?"markers":this.$showFoldWidgets&&e.x>t.right-n.right?"foldWidgets":void 0},e}();function s(e){var n=document.createTextNode("");e.appendChild(n);var t=D.createElement("span");e.appendChild(t);var S=D.createElement("span");e.appendChild(S);var a=D.createElement("span");return S.appendChild(a),e}g.prototype.$fixedWidth=!1,g.prototype.$highlightGutterLine=!0,g.prototype.$renderer="",g.prototype.$showLineNumbers=!0,g.prototype.$showFoldWidgets=!0,S.implement(g.prototype,r),n.Gutter=g}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,n,t){"use strict";var D=e("../range").Range,S=e("../lib/dom"),a=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 t=-1!=this.i&&this.element.childNodes[this.i];t?this.i++:(t=document.createElement("div"),this.element.appendChild(t),this.i=-1),t.style.cssText=n,t.className=e},e.prototype.update=function(e){if(e){for(var n in this.config=e,this.i=0,this.markers){var t,D=this.markers[n];if(!D.range){D.update(t,this,this.session,e);continue}var S=D.range.clipRows(e.firstRow,e.lastRow);if(!S.isEmpty())if(S=S.toScreenRange(this.session),D.renderer){var a=this.$getTop(S.start.row,e),r=this.$padding+S.start.column*e.characterWidth;D.renderer(t,S,r,a,e)}else"fullLine"==D.type?this.drawFullLineMarker(t,S,D.clazz,e):"screenLine"==D.type?this.drawScreenLineMarker(t,S,D.clazz,e):S.isMultiLine()?"text"==D.type?this.drawTextMarker(t,S,D.clazz,e):this.drawMultiLineMarker(t,S,D.clazz,e):this.drawSingleLineMarker(t,S,D.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,t,S,a){for(var o=this.session,i=n.start.row,g=n.end.row,s=i,l=0,d=0,c=o.getScreenLastRowColumn(s),u=new D(s,n.start.column,s,d);s<=g;s++)u.start.row=u.end.row=s,u.start.column=s==i?n.start.column:o.getRowWrapIndent(s),u.end.column=c,l=d,d=c,c=s+1<g?o.getScreenLastRowColumn(s+1):s==g?0:n.end.column,this.drawSingleLineMarker(e,u,t+(s==i?" ace_start":"")+" ace_br"+r(s==i||s==i+1&&n.start.column,l<d,d>c,s==g),S,+(s!=g),a)},e.prototype.drawMultiLineMarker=function(e,n,t,D,S){var a=this.$padding,r=D.lineHeight,o=this.$getTop(n.start.row,D),i=a+n.start.column*D.characterWidth;if(S=S||"",this.session.$bidiHandler.isBidiRow(n.start.row)){var g=n.clone();g.end.row=g.start.row,g.end.column=this.session.getLine(g.start.row).length,this.drawBidiSingleLineMarker(e,g,t+" ace_br1 ace_start",D,null,S)}else this.elt(t+" ace_br1 ace_start","height:"+r+"px;right:"+a+"px;top:"+o+"px;left:"+i+"px;"+(S||""));if(this.session.$bidiHandler.isBidiRow(n.end.row)){var g=n.clone();g.start.row=g.end.row,g.start.column=0,this.drawBidiSingleLineMarker(e,g,t+" ace_br12",D,null,S)}else{o=this.$getTop(n.end.row,D);var s=n.end.column*D.characterWidth;this.elt(t+" ace_br12","height:"+r+"px;width:"+s+"px;top:"+o+"px;left:"+a+"px;"+(S||""))}if(!((r=(n.end.row-n.start.row-1)*D.lineHeight)<=0)){o=this.$getTop(n.start.row+1,D);var l=!!n.start.column|8*!n.end.column;this.elt(t+(l?" ace_br"+l:""),"height:"+r+"px;right:"+a+"px;top:"+o+"px;left:"+a+"px;"+(S||""))}},e.prototype.drawSingleLineMarker=function(e,n,t,D,S,a){if(this.session.$bidiHandler.isBidiRow(n.start.row))return this.drawBidiSingleLineMarker(e,n,t,D,S,a);var r=D.lineHeight,o=(n.end.column+(S||0)-n.start.column)*D.characterWidth,i=this.$getTop(n.start.row,D),g=this.$padding+n.start.column*D.characterWidth;this.elt(t,"height:"+r+"px;width:"+o+"px;top:"+i+"px;left:"+g+"px;"+(a||""))},e.prototype.drawBidiSingleLineMarker=function(e,n,t,D,S,a){var r=D.lineHeight,o=this.$getTop(n.start.row,D),i=this.$padding;this.session.$bidiHandler.getSelections(n.start.column,n.end.column).forEach(function(e){this.elt(t,"height:"+r+"px;width:"+(e.width+(S||0))+"px;top:"+o+"px;left:"+(i+e.left)+"px;"+(a||""))},this)},e.prototype.drawFullLineMarker=function(e,n,t,D,S){var a=this.$getTop(n.start.row,D),r=D.lineHeight;n.start.row!=n.end.row&&(r+=this.$getTop(n.end.row,D)-a),this.elt(t,"height:"+r+"px;top:"+a+"px;left:0;right:0;"+(S||""))},e.prototype.drawScreenLineMarker=function(e,n,t,D,S){var a=this.$getTop(n.start.row,D),r=D.lineHeight;this.elt(t,"height:"+r+"px;top:"+a+"px;left:0;right:0;"+(S||""))},e}();function r(e,n,t,D){return!!e|2*!!n|4*!!t|8*!!D}a.prototype.$padding=0,n.Marker=a}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,n,t){var D=new Set(["text","rparen","lparen"]);n.isTextToken=function(e){return D.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,t){"use strict";var D=e("../lib/oop"),S=e("../lib/dom"),a=e("../lib/lang"),r=e("./lines").Lines,o=e("../lib/event_emitter").EventEmitter,i=e("../config").nls,g=e("./text_util").isTextToken,s=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],t=1;t<e+1;t++)if(this.showTabs){var D=this.dom.createElement("span");D.className="ace_invisible ace_invisible_tab",D.textContent=a.stringRepeat(this.TAB_CHAR,t),n.push(D)}else n.push(this.dom.createTextNode(a.stringRepeat(" ",t),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?a.stringRepeat(this.SPACE_CHAR,this.tabSize):a.stringRepeat(" ",this.tabSize),i=this.showTabs?" ace_invisible ace_invisible_tab":"",g=this.showTabs?a.stringRepeat(this.TAB_CHAR,this.tabSize):o,D=this.dom.createElement("span");D.className=S+r,D.textContent=o,this.$tabStrings[" "]=D;var D=this.dom.createElement("span");D.className=S+i,D.textContent=g,this.$tabStrings[" "]=D}},e.prototype.updateLines=function(e,n,t){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var D=Math.max(n,e.firstRow),S=Math.min(t,e.lastRow),a=this.element.childNodes,r=0,o=e.firstRow;o<D;o++){var i=this.session.getFoldLine(o);if(i)if(i.containsRow(D)){D=i.start.row;break}else o=i.end.row;r++}for(var g=!1,o=D,i=this.session.getNextFoldLine(o),s=i?i.start.row:1/0;o>s&&(o=i.end.row+1,s=(i=this.session.getNextFoldLine(o,i))?i.start.row:1/0),!(o>S);){var l=a[r++];if(l){this.dom.removeChildren(l),this.$renderLine(l,o,o==s&&i),g&&(l.style.top=this.$lines.computeLineTop(o,e,this.session)+"px");var d=e.lineHeight*this.session.getRowLength(o)+"px";l.style.height!=d&&(g=!0,l.style.height=d)}o++}if(g)for(;r<this.$lines.cells.length;){var c=this.$lines.cells[r++];c.element.style.top=this.$lines.computeLineTop(c.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 t=e.lastRow,D=n?n.lastRow:-1;if(!n||D<e.firstRow||t<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,t){for(var D=[],a=n,r=this.session.getNextFoldLine(a),o=r?r.start.row:1/0;a>o&&(a=r.end.row+1,o=(r=this.session.getNextFoldLine(a,r))?r.start.row:1/0),!(a>t);){var i=this.$lines.createCell(a,e,this.session),g=i.element;this.dom.removeChildren(g),S.setStyle(g.style,"height",this.$lines.computeLineHeight(a,e,this.session)+"px"),S.setStyle(g.style,"top",this.$lines.computeLineTop(a,e,this.session)+"px"),this.$renderLine(g,a,a==o&&r),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",D.push(i),a++}return D},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var n=e.firstRow,t=e.lastRow,D=this.$lines;D.getLength();)D.pop();D.push(this.$renderLinesFragment(e,n,t))},e.prototype.$renderToken=function(e,n,t,D){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,s=this.dom.createFragment(this.element),l=0;S=o.exec(D);){var d=S[1],c=S[2],u=S[3],f=S[4],h=S[5];if(r.showSpaces||!c){var p=l!=S.index?D.slice(l,S.index):"";if(l=S.index+S[0].length,p&&s.appendChild(this.dom.createTextNode(p,this.element)),d){var m=r.session.getScreenTabSize(n+S.index);s.appendChild(r.$tabStrings[m].cloneNode(!0)),n+=m-1}else if(c)if(r.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=a.stringRepeat(r.SPACE_CHAR,c.length),s.appendChild(y)}else s.appendChild(this.dom.createTextNode(c,this.element));else if(u){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=a.stringRepeat(r.SPACE_CHAR,u.length),s.appendChild(y)}else if(f){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:f,s.appendChild(y)}else if(h){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className="ace_cjk",y.textContent=h,s.appendChild(y)}}}if(s.appendChild(this.dom.createTextNode(l?D.slice(l):D,this.element)),g(t.type))e.appendChild(s);else{var b="ace_"+t.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==t.type&&(y.style.width=t.value.length*this.config.characterWidth+"px",y.setAttribute("title",i("inline-fold.closed.title","Unfold code"))),y.className=b,y.appendChild(s),e.appendChild(y)}return n+D.length},e.prototype.renderIndentGuide=function(e,n,t){var D=n.search(this.$indentGuideRe);if(D<=0||D>=t)return n;if(" "==n[0]){for(var S=(D-=D%this.tabSize)/this.tabSize,a=0;a<S;a++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(D)}if(" "==n[0]){for(var a=0;a<D;a++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(D)}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(),t=/^\s*/.exec(this.session.doc.getLine(n.row))[0].length,D=Math.floor(t/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:D,start:n.row};var S=this.session.$bracketHighlight;if(S){for(var a=this.session.$bracketHighlight.ranges,r=0;r<a.length;r++)if(n.row!==a[r].start.row){this.$highlightIndentGuideMarker.end=a[r].start.row,n.row>a[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],i=/^\s*/.exec(o)[0].length;if(""!==o&&(this.$highlightIndentGuideMarker.end=r,i<=t))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,n=0;n<e.length;n++){var t=e[n].element.childNodes;if(t.length>0){for(var D=0;D<t.length;D++)if(t[D].classList&&t[D].classList.contains("ace_indent-guide-active")){t[D].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,n){if(""!==this.session.doc.getLine(e.row)){var t=e.element.childNodes;if(t){var D=t[n-1];D&&D.classList&&D.classList.contains("ace_indent-guide")&&D.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 t=0;t<e.length;t++){var D=e[t];if(this.$highlightIndentGuideMarker.end&&D.row>=this.$highlightIndentGuideMarker.start+1){if(D.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(D,n)}}else for(var t=e.length-1;t>=0;t--){var D=e[t];if(this.$highlightIndentGuideMarker.end&&D.row<this.$highlightIndentGuideMarker.start){if(D.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(D,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,t){var D=0,S=0,r=t[0],o=0,i=this.$createLineElement();e.appendChild(i);for(var g=0;g<n.length;g++){var s=n[g],l=s.value;if(0==g&&this.displayIndentGuides){if(D=l.length,!(l=this.renderIndentGuide(i,l,r)))continue;D-=l.length}if(D+l.length<r)o=this.$renderToken(i,o,s,l),D+=l.length;else{for(;D+l.length>=r;)o=this.$renderToken(i,o,s,l.substring(0,r-D)),l=l.substring(r-D),D=r,i=this.$createLineElement(),e.appendChild(i),i.appendChild(this.dom.createTextNode(a.stringRepeat("\xa0",t.indent),this.element)),o=0,r=t[++S]||Number.MAX_VALUE;0!=l.length&&(D+=l.length,o=this.$renderToken(i,o,s,l))}}t[t.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(i,o,null,"",!0)},e.prototype.$renderSimpleLine=function(e,n){for(var t=0,D=0;D<n.length;D++){var S=n[D],a=S.value;if(0!=D||!this.displayIndentGuides||(a=this.renderIndentGuide(e,a))){if(t+a.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,t,S,a);t=this.$renderToken(e,t,S,a)}}},e.prototype.$renderOverflowMessage=function(e,n,t,D,S){t&&this.$renderToken(e,n,t,D.slice(0,this.MAX_LINE_LENGTH-n));var a=this.dom.createElement("span");a.className="ace_inline_button ace_keyword ace_toggle_wrap",a.textContent=S?"<hide>":"<click to see more...>",e.appendChild(a)},e.prototype.$renderLine=function(e,n,t){if(t||!1==t||(t=this.session.getFoldLine(n)),t)var D=this.$getFoldLineTokens(n,t);else var D=this.session.getTokens(n);var S=e;if(D.length){var a=this.session.getRowSplitData(n);if(a&&a.length){this.$renderWrappedLine(e,D,a);var S=e.lastChild}else{var S=e;this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S)),this.$renderSimpleLine(S,D)}}else this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S));if(this.showEOL&&S){t&&(n=t.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 t=this.session,D=[];function S(e,n,t){for(var S=0,a=0;a+e[S].value.length<n;)if(a+=e[S].value.length,++S==e.length)return;if(a!=n){var r=e[S].value.substring(n-a);r.length>t-n&&(r=r.substring(0,t-n)),D.push({type:e[S].type,value:r}),a=n+r.length,S+=1}for(;a<t&&S<e.length;){var r=e[S].value;r.length+a>t?D.push({type:e[S].type,value:r.substring(0,t-a)}):D.push(e[S]),a+=r.length,S+=1}}var a=t.getTokens(e);return n.walk(function(e,n,r,o,i){null!=e?D.push({type:"fold",value:e}):(i&&(a=t.getTokens(n)),a.length&&S(a,o,r))},n.end.row,this.session.getLine(n.end.row).length),D},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();s.prototype.EOF_CHAR="\xb6",s.prototype.EOL_CHAR_LF="\xac",s.prototype.EOL_CHAR_CRLF="\xa4",s.prototype.EOL_CHAR=s.prototype.EOL_CHAR_LF,s.prototype.TAB_CHAR="—",s.prototype.SPACE_CHAR="\xb7",s.prototype.$padding=0,s.prototype.MAX_LINE_LENGTH=1e4,s.prototype.showInvisibles=!1,s.prototype.showSpaces=!1,s.prototype.showTabs=!1,s.prototype.showEOL=!1,s.prototype.displayIndentGuides=!0,s.prototype.$highlightIndentGuides=!0,s.prototype.$tabStrings=[],s.prototype.destroy={},s.prototype.onChangeTabSize=s.prototype.$computeTabString,D.implement(s.prototype,o),n.Text=s}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=e("../lib/dom"),S=function(){function e(e){this.element=D.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(),D.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var n=this.cursors,t=n.length;t--;)D.setStyle(n[t].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&&D.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,D.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,D.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=D.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,D.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,D.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,D.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&&D.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),D.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 t=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(t.row,e.row)?this.session.$bidiHandler.getPosLeft(t.column):t.column*this.config.characterWidth),top:(t.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,t=0,S=0;(void 0===n||0===n.length)&&(n=[{cursor:null}]);for(var t=0,a=n.length;t<a;t++){var r=this.getPixelPosition(n[t].cursor,!0);if(!(r.top>e.height+e.offset)&&!(r.top<0)||!(t>1)){var o=this.cursors[S++]||this.addCursor(),i=o.style;this.drawCursor?this.drawCursor(o,r,e,n[t],this.session):this.isCursorInView(r,e)?(D.setStyle(i,"display","block"),D.translate(o,r.left,r.top),D.setStyle(i,"width",Math.round(e.characterWidth)+"px"),D.setStyle(i,"height",e.lineHeight+"px")):D.setStyle(i,"display","none")}}for(;this.cursors.length>S;)this.removeCursor();var g=this.session.getOverwrite();this.$setOverwrite(g),this.$pixelPos=r,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?D.addCssClass(this.element,"ace_overwrite-cursors"):D.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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,i=32768,g=function(){function e(e,n){this.element=a.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+n,this.inner=a.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(g.prototype,o);var s=function(e){function n(n,t){var D=e.call(this,n,"-v")||this;return D.scrollTop=0,D.scrollHeight=0,t.$scrollbarWidth=D.width=a.scrollbarWidth(n.ownerDocument),D.inner.style.width=D.element.style.width=(D.width||15)+5+"px",D.$minWidth=0,D}return D(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>i?(this.coeff=i/e,e=i):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}(g);s.prototype.setInnerHeight=s.prototype.setScrollHeight;var l=function(e){function n(n,t){var D=e.call(this,n,"-h")||this;return D.scrollLeft=0,D.height=t.$scrollbarWidth,D.inner.style.height=D.element.style.height=(D.height||15)+5+"px",D}return D(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}(g);n.ScrollBar=s,n.ScrollBarV=s,n.ScrollBarH=l,n.VScrollBar=s,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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter;a.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 i=function(){function e(e,n){this.element=a.createElement("div"),this.element.className="ace_sb"+n,this.inner=a.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(i.prototype,o);var g=function(e){function n(n,t){var D=e.call(this,n,"-v")||this;return D.scrollTop=0,D.scrollHeight=0,D.parent=n,D.width=D.VScrollWidth,D.renderer=t,D.inner.style.width=D.element.style.width=(D.width||15)+"px",D.$minWidth=0,D}return D(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var t=this,D=n.clientY,S=function(e){D=e.clientY},a=function(){clearInterval(s)},o=n.clientY,i=this.thumbTop,g=function(){if(void 0!==D){var e=t.scrollTopFromThumbTop(i+D-o);e!==t.scrollTop&&t._emit("scroll",{data:e})}};r.capture(this.inner,S,a);var s=setInterval(g,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}(i);g.prototype.setInnerHeight=g.prototype.setScrollHeight;var s=function(e){function n(n,t){var D=e.call(this,n,"-h")||this;return D.scrollLeft=0,D.scrollWidth=0,D.height=D.HScrollHeight,D.inner.style.height=D.element.style.height=(D.height||12)+"px",D.renderer=t,D}return D(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var t=this,D=n.clientX,S=function(e){D=e.clientX},a=function(){clearInterval(s)},o=n.clientX,i=this.thumbLeft,g=function(){if(void 0!==D){var e=t.scrollLeftFromThumbLeft(i+D-o);e!==t.scrollLeft&&t._emit("scroll",{data:e})}};r.capture(this.inner,S,a);var s=setInterval(g,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}(i);s.prototype.setInnerWidth=s.prototype.setScrollWidth,n.ScrollBar=g,n.ScrollBarV=g,n.ScrollBarH=s,n.VScrollBar=g,n.HScrollBar=s}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,n,t){"use strict";var D=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 t=this;this._flush=function(e){t.pending=!1;var n=t.changes;if(n&&(D.blockIdle(100),t.changes=0,t.onRender(n)),t.changes){if(t.$recursionLimit--<0)return;t.schedule()}else t.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(D.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,t){var D=e("../lib/oop"),S=e("../lib/dom"),a=e("../lib/lang"),r=e("../lib/event"),o=e("../lib/useragent"),i=e("../lib/event_emitter").EventEmitter,g=512,s="function"==typeof ResizeObserver,l=200,d=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=a.stringRepeat("X",g),this.$characterSize={width:0,height:0},s?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/g};return 0===n.width||0===n.height?null:n},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=a.stringRepeat(e,g),this.$main.getBoundingClientRect().width/g},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 t(e,n,t){var D=e[1]*n[0]-e[0]*n[1];return[(-n[1]*t[0]+n[0]*t[1])/D,(e[1]*t[0]-e[0]*t[1])/D]}function D(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 a(e,n){return[e*n[0],e*n[1]]}function r(e){var n=e.getBoundingClientRect();return[n.left,n.top]}e&&(e=a(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var o=r(this.els[0]),i=r(this.els[1]),g=r(this.els[2]),s=r(this.els[3]),d=t(D(s,i),D(s,g),D(S(i,g),S(s,o))),c=a(1+d[0],D(i,o)),u=a(1+d[1],D(g,o));if(n){var f=n,h=d[0]*f[0]/l+d[1]*f[1]/l+1,p=S(a(f[0],c),a(f[1],u));return S(a(1/h/l,p),o)}var m=D(e,o),y=t(D(c,a(d[0],m)),D(u,a(d[1],m)),m);return a(l,y)},e}();d.prototype.$characterSize={width:0,height:0},D.implement(d.prototype,i),n.FontMetrics=d}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,n,t){t.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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/oop"),a=e("../lib/event_emitter").EventEmitter,r=function(){function e(e,n){this.canvas=D.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 t=this.canvas.getContext("2d");function D(e,n){return e.priority<n.priority?-1:+(e.priority>n.priority)}var S=this.renderer.session.$annotations;if(t.clearRect(0,0,this.canvas.width,this.canvas.height),S){var a={info:1,warning:2,error:3};S.forEach(function(e){e.priority=a[e.type]||null}),S=S.sort(D);for(var r=this.renderer.session.$foldData,o=0;o<S.length;o++){var i=S[o].row,g=this.compensateFoldRows(i,r),s=Math.round((i-g)*this.lineHeight*this.heightRatio),l=Math.round((i-g)*this.lineHeight*this.heightRatio),d=Math.round(((i-g)*this.lineHeight+this.lineHeight)*this.heightRatio);if(d-l<this.minDecorationHeight){var c=(l+d)/2|0;c<this.halfMinDecorationHeight?c=this.halfMinDecorationHeight:c+this.halfMinDecorationHeight>this.canvasHeight&&(c=this.canvasHeight-this.halfMinDecorationHeight),l=Math.round(c-this.halfMinDecorationHeight),d=Math.round(c+this.halfMinDecorationHeight)}t.fillStyle=n[S[o].type]||null,t.fillRect(0,s,this.canvasWidth,d-l)}}var u=this.renderer.session.selection.getCursor();if(u){var g=this.compensateFoldRows(u.row,r),s=Math.round((u.row-g)*this.lineHeight*this.heightRatio);t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,s,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,n){var t=0;if(n&&n.length>0)for(var D=0;D<n.length;D++)e>n[D].start.row&&e<n[D].end.row?t+=e-n[D].start.row:e>=n[D].end.row&&(t+=n[D].end.row-n[D].start.row);return t},e}();S.implement(r.prototype,a),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/dom"),a=e("./lib/lang"),r=e("./config"),o=e("./layer/gutter").Gutter,i=e("./layer/marker").Marker,g=e("./layer/text").Text,s=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,d=e("./scrollbar").VScrollBar,c=e("./scrollbar_custom").HScrollBar,u=e("./scrollbar_custom").VScrollBar,f=e("./renderloop").RenderLoop,h=e("./layer/font_metrics").FontMetrics,p=e("./lib/event_emitter").EventEmitter,m=e("./css/editor-css"),y=e("./layer/decorators").Decorator,b=e("./lib/useragent"),v=e("./layer/text_util").isTextToken;S.importCssString(m,"ace_editor.css",!1);var $=function(){function e(e,n){var t=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 i(this.content);var D=this.$textLayer=new g(this.content);this.canvas=D.element,this.$markerFront=new i(this.content),this.$cursorLayer=new s(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new d(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new h(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){t.updateCharacterSize(),t.onResize(!0,t.gutterWidth,t.$size.width,t.$size.height),t._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=!b.isIOS,this.$loop=new f(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,t){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(!t)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,t,D){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var S=this.container;D||(D=S.clientHeight||S.scrollHeight),!D&&this.$maxLines&&this.lineHeight>1&&(!S.style.height||"0px"==S.style.height)&&(S.style.height="1px",D=S.clientHeight||S.scrollHeight),t||(t=S.clientWidth||S.scrollWidth);var a=this.$updateCachedSize(e,n,t,D);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!t&&!D)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(a|this.$changes,!0):this.$loop.schedule(a|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,t,D){D-=this.$extraHeight||0;var a=0,r=this.$size,o={width:r.width,height:r.height,scrollerHeight:r.scrollerHeight,scrollerWidth:r.scrollerWidth};if(D&&(e||r.height!=D)&&(r.height=D,a|=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",a|=this.CHANGE_SCROLL),t&&(e||r.width!=t)){a|=this.CHANGE_SIZE,r.width=t,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,t-n-this.scrollBarV.getWidth()-this.margin.h),S.setStyle(this.$gutter.style,"left",this.margin.left+"px");var i=this.scrollBarV.getWidth()+"px";S.setStyle(this.scrollBarH.element.style,"right",i),S.setStyle(this.scroller.style,"right",i),S.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(r.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(a|=this.CHANGE_FULL)}return r.$dirty=!t||!D,a&&this._signal("resize",o),a},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 t=this.$cursorLayer.$pixelPos;if(t){n&&n.markerRange&&(t=this.$cursorLayer.getPixelPosition(n.markerRange.start,!0));var D=this.layerConfig,a=t.top,r=t.left;a-=D.offset;var o=n&&n.useTextareaForIME||b.isMobile?this.lineHeight:1;if(a<0||a>D.height-o)return void S.translate(this.textarea,0,0);var i=1,g=this.$size.height-o;if(n)if(n.useTextareaForIME){var s=this.textarea.value;i=this.characterWidth*this.session.$getStringScreenWidth(s)[0]}else a+=this.lineHeight+2;else a+=this.lineHeight;r-=this.scrollLeft,r>this.$size.scrollerWidth-i&&(r=this.$size.scrollerWidth-i),r+=this.gutterWidth+this.margin.left,S.setStyle(e,"height",o+"px"),S.setStyle(e,"width",i+"px"),S.translate(this.textarea,Math.min(r,this.$size.scrollerWidth-i),Math.min(a,g))}}},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,t,D){var S=this.scrollMargin;S.top=0|e,S.bottom=0|n,S.right=0|D,S.left=0|t,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,t,D){var S=this.margin;S.top=0|e,S.bottom=0|n,S.right=0|D,S.left=0|t,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 t=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(),t.firstRow!=this.layerConfig.firstRow&&t.firstRowScreen==this.layerConfig.firstRowScreen){var D=this.scrollTop+(t.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;D>0&&(this.scrollTop=D,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}t=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),S.translate(this.content,-this.scrollLeft,-t.offset);var a=t.width+2*this.$padding+"px",r=t.minHeight+"px";S.setStyle(this.content.style,"width",a),S.setStyle(this.content.style,"height",r)}if(e&this.CHANGE_H_SCROLL&&(S.translate(this.content,-this.scrollLeft,-t.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(t),this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t),this.$markerBack.update(t),this.$markerFront.update(t),this.$cursorLayer.update(t),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(t):this.$textLayer.scrollLines(t),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(t):this.$gutterLayer.scrollLines(t)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t),this.$markerBack.update(t),this.$markerFront.update(t),this.$cursorLayer.update(t),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(t),this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(t),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(t),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(t),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,n=this.$maxLines*this.lineHeight,t=Math.min(n,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(t+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&t>this.$maxPixelHeight&&(t=this.$maxPixelHeight);var D=!(t<=2*this.lineHeight)&&e>n;if(t!=this.desiredHeight||this.$size.height!=this.desiredHeight||D!=this.$vScroll){D!=this.$vScroll&&(this.$vScroll=D,this.scrollBarV.setVisible(D));var S=this.container.clientWidth;this.container.style.height=t+"px",this.$updateCachedSize(!0,this.$gutterWidth,S,t),this.desiredHeight=t,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,n,t=this.session,D=this.$size,S=D.height<=2*this.lineHeight,a=this.session.getScreenLength()*this.lineHeight,r=this.$getLongestLine(),o=!S&&(this.$hScrollBarAlwaysVisible||D.scrollerWidth-r-2*this.$padding<0),i=this.$horizScroll!==o;i&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var g=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var s=D.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(D.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;a+=l;var d=this.scrollMargin;this.session.setScrollTop(Math.max(-d.top,Math.min(this.scrollTop,a-D.scrollerHeight+d.bottom))),this.session.setScrollLeft(Math.max(-d.left,Math.min(this.scrollLeft,r+2*this.$padding-D.scrollerWidth+d.right)));var c=!S&&(this.$vScrollBarAlwaysVisible||D.scrollerHeight-a+l<0||this.scrollTop>d.top),u=g!==c;u&&(this.$vScroll=c,this.scrollBarV.setVisible(c));var f=this.scrollTop%this.lineHeight,h=Math.ceil(s/this.lineHeight)-1,p=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),m=p+h,y=this.lineHeight;p=t.screenToDocumentRow(p,0);var b=t.getFoldLine(p);b&&(p=b.start.row),e=t.documentToScreenRow(p,0),n=t.getRowLength(p)*y,m=Math.min(t.screenToDocumentRow(m,0),t.getLength()-1),s=D.scrollerHeight+t.getRowLength(m)*y+n,f=this.scrollTop-e*y;var v=0;return(this.layerConfig.width!=r||i)&&(v=this.CHANGE_H_SCROLL),(i||u)&&(v|=this.$updateCachedSize(!0,this.gutterWidth,D.width,D.height),this._signal("scrollbarVisibilityChanged"),u&&(r=this.$getLongestLine())),this.layerConfig={width:r,padding:this.$padding,firstRow:p,firstRowScreen:e,lastRow:m,lineHeight:y,characterWidth:this.characterWidth,minHeight:s,maxHeight:a,offset:f,gutterOffset:y?Math.max(0,Math.ceil((f+D.height-D.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(r-this.$padding),v},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,n=this.$changedLines.lastRow;this.$changedLines=null;var t=this.layerConfig;if(!(e>t.lastRow+1)&&!(n<t.firstRow)){if(n===1/0){this.$showGutter&&this.$gutterLayer.update(t),this.$textLayer.update(t);return}return this.$textLayer.updateLines(t,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,t){this.scrollCursorIntoView(e,t),this.scrollCursorIntoView(n,t)},e.prototype.scrollCursorIntoView=function(e,n,t){if(0!==this.$size.scrollerHeight){var D=this.$cursorLayer.getPixelPosition(e),S=D.left,a=D.top,r=t&&t.top||0,o=t&&t.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var i=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;i+r>a?(n&&i+r>a+this.lineHeight&&(a-=n*this.$size.scrollerHeight),0===a&&(a=-this.scrollMargin.top),this.session.setScrollTop(a)):i+this.$size.scrollerHeight-o<a+this.lineHeight&&(n&&i+this.$size.scrollerHeight-o<a-this.lineHeight&&(a+=n*this.$size.scrollerHeight),this.session.setScrollTop(a+this.lineHeight+o-this.$size.scrollerHeight));var g=this.scrollLeft,s=2*this.layerConfig.characterWidth;S-s<g?((S-=s)<this.$padding+s&&(S=-this.scrollMargin.left),this.session.setScrollLeft(S)):(S+=s,g+this.$size.scrollerWidth<S+this.characterWidth?this.session.setScrollLeft(Math.round(S+this.characterWidth-this.$size.scrollerWidth)):g<=this.$padding&&S-g<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 t=this.$cursorLayer.getPixelPosition(e),D=this.$size.scrollerHeight-this.lineHeight,S=t.top-D*(n||0);return this.session.setScrollTop(S),S},e.prototype.$calcSteps=function(e,n){var t=0,D=this.STEPS,S=[],a=function(e,n,t){return t*(Math.pow(e-1,3)+1)+n};for(t=0;t<D;++t)S.push(a(t/this.STEPS,e,n-e));return S},e.prototype.scrollToLine=function(e,n,t,D){var S=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;n&&(S-=this.$size.scrollerHeight/2);var a=this.scrollTop;this.session.setScrollTop(S),!1!==t&&this.animateScrolling(a,D)},e.prototype.animateScrolling=function(e,n){var t=this.scrollTop;if(this.$animatedScroll){var D=this;if(e!=t){if(this.$scrollAnimation){var S=this.$scrollAnimation.steps;if(S.length&&(e=S[0])==t)return}var a=D.$calcSteps(e,t);this.$scrollAnimation={from:e,to:t,steps:a},clearInterval(this.$timer),D.session.setScrollTop(a.shift()),D.session.$scrollTop=t,this.$timer=setInterval(function(){return D.$stopAnimation?void r():D.session?void(a.length?(D.session.setScrollTop(a.shift()),D.session.$scrollTop=t):null!=t?(D.session.$scrollTop=-1,D.session.setScrollTop(t),t=null):r()):clearInterval(D.$timer)},10)}}function r(){D.$timer=clearInterval(D.$timer),D.$scrollAnimation=null,D.$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 t={top:0,left:0},D=this.$fontMetrics.transformCoordinates([e,n]);e=D[1]-this.gutterWidth-this.margin.left,n=D[0]}else t=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-t.left-this.$padding,a=S/this.characterWidth,r=Math.floor((n+this.scrollTop-t.top)/this.lineHeight),o=this.$blockCursor?Math.floor(a):Math.round(a);return{row:r,column:o,side:a-o>0?1:-1,offsetX:S}},e.prototype.screenToTextCoordinates=function(e,n){if(this.$hasCssTransforms){var t={top:0,left:0},D=this.$fontMetrics.transformCoordinates([e,n]);e=D[1]-this.gutterWidth-this.margin.left,n=D[0]}else t=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-t.left-this.$padding,a=S/this.characterWidth,r=this.$blockCursor?Math.floor(a):Math.round(a),o=Math.floor((n+this.scrollTop-t.top)/this.lineHeight);return this.session.screenToDocumentPosition(o,Math.max(r,0),S)},e.prototype.textToScreenCoordinates=function(e,n){var t=this.scroller.getBoundingClientRect(),D=this.session.documentToScreenPosition(e,n),S=this.$padding+(this.session.$bidiHandler.isBidiRow(D.row,e)?this.session.$bidiHandler.getPosLeft(D.column):Math.round(D.column*this.characterWidth)),a=D.row*this.lineHeight;return{pageX:t.left+S-this.scrollLeft,pageY:t.top+a-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 t=this.session.selection.cursor,D=n||{row:t.row,column:t.column};this.removeGhostText();var a=this.$calculateWrappedTextChunks(e,D);this.addToken(a[0].text,"ghost_text",D.row,D.column),this.$ghostText={text:e,position:{row:D.row,column:D.column}};var r=S.createElement("div");if(a.length>1){var o,i=this.hideTokensAfterPosition(D.row,D.column);a.slice(1).forEach(function(e){var n=S.createElement("div"),t=S.createElement("span");t.className="ace_ghost_text",e.wrapped&&(n.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),t.appendChild(S.createTextNode(e.text)),n.appendChild(t),r.appendChild(n),o=n}),i.forEach(function(e){var n=S.createElement("span");v(e.type)||(n.className="ace_"+e.type.replace(/\./g," ace_")),n.appendChild(S.createTextNode(e.value)),o.appendChild(n)}),this.$ghostTextWidget={el:r,row:D.row,column:D.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var g=this.$cursorLayer.getPixelPosition(D,!0),s=this.container.getBoundingClientRect().height,l=a.length*this.lineHeight;if(l<s-g.top)return;l<s?this.scrollBy(0,(a.length-1)*this.lineHeight):this.scrollToRow(D.row)}},e.prototype.$calculateWrappedTextChunks=function(e,n){var t=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;t=t<=0?60:t;for(var D=e.split(/\r?\n/),S=[],a=0;a<D.length;a++){var r=this.session.$getDisplayTokens(D[a],n.column),o=this.session.$computeWrapSplits(r,t,this.session.$tabSize);if(o.length>0){var i=0;o.push(D[a].length);for(var g=0;g<o.length;g++){var s=D[a].slice(i,o[g]);S.push({text:s,wrapped:!0}),i=o[g]}}else S.push({text:D[a],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,t,D){var S=this.session;S.bgTokenizer.lines[t]=null;var a={type:n,value:e},r=S.getTokens(t);if(null!=D&&r.length)for(var o=0,i=0;i<r.length;i++){var g=r[i];if(D<=(o+=g.value.length)){var s=g.value.length-(o-D),l=g.value.slice(0,s),d=g.value.slice(s);r.splice(i,1,{type:g.type,value:l},a,{type:g.type,value:d});break}}else r.push(a);this.updateLines(t,t)},e.prototype.hideTokensAfterPosition=function(e,n){for(var t=this.session.getTokens(e),D=0,S=!1,a=[],r=0;r<t.length;r++){var o=t[r];if(D+=o.value.length,"ghost_text"!==o.type){if(S){a.push({type:o.type,value:o.value}),o.type="hidden_token";continue}D===n&&(S=!0)}}return this.updateLines(e,e),a},e.prototype.removeExtraToken=function(e,n){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,n){var t=this;if(this.$themeId=e,t._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)a(e);else{var D=e||this.$options.theme.initialValue;r.loadModule(["theme",D],a)}function a(D){if(t.$themeId!=e)return n&&n();if(!D||!D.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");D.$id&&(t.$themeId=D.$id),S.importCssString(D.cssText,D.cssClass,t.container),t.theme&&S.removeCssClass(t.container,t.theme.cssClass);var a="padding"in D?D.padding:"padding"in(t.theme||{})?4:t.$padding;t.$padding&&a!=t.$padding&&t.setPadding(a),t.$theme=D.cssClass,t.theme=D,S.addCssClass(t.container,D.cssClass),S.setCssClass(t.container,"ace_dark",D.isDark),t.$size&&(t.$size.width=0,t.$updateSizeAsync()),t._dispatchEvent("themeLoaded",{theme:D}),n&&n(),b.isSafari&&t.scroller&&(t.scroller.style.background="red",t.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 u(this.container,this),this.scrollBarH=new c(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 d(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=a.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(n){var t=n[0].contentRect.width,D=n[0].contentRect.height;Math.abs(e.$size.width-t)>1||Math.abs(e.$size.height-D)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();$.prototype.CHANGE_CURSOR=1,$.prototype.CHANGE_MARKER=2,$.prototype.CHANGE_GUTTER=4,$.prototype.CHANGE_SCROLL=8,$.prototype.CHANGE_LINES=16,$.prototype.CHANGE_TEXT=32,$.prototype.CHANGE_SIZE=64,$.prototype.CHANGE_MARKER_BACK=128,$.prototype.CHANGE_MARKER_FRONT=256,$.prototype.CHANGE_FULL=512,$.prototype.CHANGE_H_SCROLL=1024,$.prototype.$changes=0,$.prototype.$padding=null,$.prototype.$frozen=!1,$.prototype.STEPS=8,D.implement($.prototype,p),r.defineOptions($.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:!b.isMobile&&!b.isIE}}),n.VirtualRenderer=$}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,n,t){"use strict";var D=e("../lib/oop"),S=e("../lib/net"),a=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 t=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return t.append(n),t.getBlob("application/javascript")}}function i(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 g=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(){D.implement(this,a),this.$createWorkerFromOldConfig=function(n,t,D,S,a){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),r.get("packaged")||!e.toUrl)S=S||r.moduleUrl(t,"worker");else{var o=this.$normalizePath;S=S||o(e.toUrl("ace/worker/worker.js",null,"_"));var g={};n.forEach(function(n){g[n]=o(e.toUrl(n,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=i(S),a&&this.send("importScripts",a),this.$worker.postMessage({init:!0,tlns:g,module:t,classname:D}),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 t=this.callbacks[n.id];t&&(t(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,t){if(t){var D=this.callbackId++;this.callbacks[D]=t,n.push(D)}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(g.prototype),n.UIWorkerClient=function(e,n,t){var D=null,S=!1,o=Object.create(a),i=[],s=new g({messageBuffer:i,terminate:function(){},postMessage:function(e){i.push(e),D&&(S?setTimeout(l):l())}});s.setEmitSync=function(e){S=e};var l=function(){var e=i.shift();e.command?D[e.command].apply(D,e.args):e.event&&o._signal(e.event,e.data)};return o.postMessage=function(e){s.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(D=new e[t](o);i.length;)l()}),s},n.WorkerClient=g,n.createWorker=i}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,n,t){"use strict";var D=e("./range").Range,S=e("./lib/event_emitter").EventEmitter,a=e("./lib/oop"),r=function(){function e(e,n,t,D,S,a){var r=this;this.length=n,this.session=e,this.doc=e.getDocument(),this.mainClass=S,this.othersClass=a,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=D,this.$onCursorChange=function(){setTimeout(function(){r.onCursorChange()})},this.$pos=t;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,t=this.session;this.selectionBefore=t.selection.toJSON(),t.selection.inMultiSelectMode&&t.selection.toSingleRange(),this.pos=n.createAnchor(this.$pos.row,this.$pos.column);var S=this.pos;S.$insertRight=!0,S.detach(),S.markerId=t.addMarker(new D(S.row,S.column,S.row,S.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(t){var D=n.createAnchor(t.row,t.column);D.$insertRight=!0,D.detach(),e.others.push(D)}),t.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,n=this;this.othersActive=!0,this.others.forEach(function(t){t.markerId=e.addMarker(new D(t.row,t.column,t.row,t.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 t="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,a=n.start.column-this.pos.column;if(this.updateAnchors(e),S&&(this.length+=t),S&&!this.session.$fromUndo){if("insert"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],i={row:o.row,column:o.column+a};this.doc.insertMergedLines(i,e.lines)}else if("remove"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],i={row:o.row,column:o.column+a};this.doc.remove(new D(i.row,i.column,i.row,i.column-t))}}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,t=function(t,S){n.removeMarker(t.markerId),t.markerId=n.addMarker(new D(t.row,t.column,t.row,t.column+e.length),S,null,!1)};t(this.pos,this.mainClass);for(var S=this.others.length;S--;)t(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,t=0;t<n;t++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();a.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,t){var D=e("../lib/event"),S=e("../lib/useragent");function a(e,n){return e.row==n.row&&e.column==n.column}n.onMouseDown=function(e){var n=e.domEvent,t=n.altKey,r=n.shiftKey,o=n.ctrlKey,i=e.getAccelKey(),g=e.getButton();if(o&&S.isMac&&(g=n.button),e.editor.inMultiSelectMode&&2==g)return void e.editor.textInput.onContextMenu(e.domEvent);if(!o&&!t&&!i){0===g&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===g){var s=e.editor,l=s.selection,d=s.inMultiSelectMode,c=e.getDocumentPosition(),u=l.getCursor(),f=e.inSelection()||l.isEmpty()&&a(c,u),h=e.x,p=e.y,m=function(e){h=e.clientX,p=e.clientY},y=s.session,b=s.renderer.pixelToScreenCoordinates(h,p),v=b;if(s.$mouseHandler.$enableJumpToDef)o&&t||i&&t?_=r?"block":"add":t&&s.$blockSelectEnabled&&(_="block");else if(i&&!t){if(_="add",!d&&r)return}else t&&s.$blockSelectEnabled&&(_="block");if(_&&S.isMac&&n.ctrlKey&&s.$mouseHandler.cancelContextMenu(),"add"==_){if(!d&&f)return;if(!d){var $=l.toOrientedRange();s.addSelectionMarker($)}var w=l.rangeList.rangeAtPoint(c);s.inVirtualSelectionMode=!0,r&&(w=null,$=l.ranges[0]||$,s.removeSelectionMarker($)),s.once("mouseup",function(){var e=l.toOrientedRange();w&&e.isEmpty()&&a(w.cursor,e.cursor)?l.substractPoint(e.cursor):(r?l.substractPoint($.cursor):$&&(s.removeSelectionMarker($),l.addRange($)),l.addRange(e)),s.inVirtualSelectionMode=!1})}else if("block"==_){e.stop(),s.inVirtualSelectionMode=!0;var _,A,M=[],x=function(){var e=s.renderer.pixelToScreenCoordinates(h,p),n=y.screenToDocumentPosition(e.row,e.column,e.offsetX);a(v,e)&&a(n,l.lead)||(v=e,s.selection.moveToPosition(n),s.renderer.scrollCursorIntoView(),s.removeSelectionMarkers(M),M=l.rectangularRangeBlock(v,b),s.$mouseHandler.$clickSelection&&1==M.length&&M[0].isEmpty()&&(M[0]=s.$mouseHandler.$clickSelection.clone()),M.forEach(s.addSelectionMarker,s),s.updateSelectionMarkers())};d&&!i?l.toSingleRange():!d&&i&&(A=l.toOrientedRange(),s.addSelectionMarker(A)),r?b=y.documentToScreenPosition(l.lead):l.moveToPosition(c),v={row:-1,column:-1};var L=function(e){x(),clearInterval(k),s.removeSelectionMarkers(M),M.length||(M=[l.toOrientedRange()]),A&&(s.removeSelectionMarker(A),l.toSingleRange(A));for(var n=0;n<M.length;n++)l.addRange(M[n]);s.inVirtualSelectionMode=!1,s.$mouseHandler.$clickSelection=null},C=x;D.capture(s.container,m,L);var k=setInterval(function(){C()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,n,t){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,t){var D=e("./range_list").RangeList,S=e("./range").Range,a=e("./selection").Selection,r=e("./mouse/multi_select_handler").onMouseDown,o=e("./lib/event"),i=e("./lib/lang"),g=e("./commands/multi_select_commands");n.commands=g.defaultCommands.concat(g.multiSelectCommands);var s=new(e("./search")).Search;function l(e,n,t){return s.$options.wrap=!0,s.$options.needle=n,s.$options.backwards=-1==t,s.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 t=this.toOrientedRange();if(this.rangeList.add(t),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),n||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(t),this.$onAddRange(t)}e.cursor||(e.cursor=e.end);var D=this.rangeList.add(e);return this.$onAddRange(e),D.length&&this.$onRemoveRange(D),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 t=e.length;t--;){var D=this.ranges.indexOf(e[t]);this.ranges.splice(D,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 D,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=[],t=0;t<e.length;t++){var D=e[t],a=D.start.row,r=D.end.row;if(a===r)n.push(D.clone());else{for(n.push(new S(a,D.start.column,a,this.session.getLine(a).length));++a<r;)n.push(this.getLineRange(a,!0));n.push(new S(r,0,r,D.end.column))}0!=t||this.isBackwards()||(n=n.reverse())}this.toSingleRange();for(var t=n.length;t--;)this.addRange(n[t])},this.joinSelections=function(){var e=this.rangeList.ranges,n=e[e.length-1],t=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(t,n.cursor==n.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,n=e[e.length-1],t=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(t,n.cursor==n.start)}else{var D=this.session.documentToScreenPosition(this.cursor),a=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(D,a).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,n,t){var D,a=[],r=e.column<n.column;if(r)var o=e.column,i=n.column,g=e.offsetX,s=n.offsetX;else var o=n.column,i=e.column,g=n.offsetX,s=e.offsetX;var l=e.row<n.row;if(l)var d=e.row,u=n.row;else var d=n.row,u=e.row;o<0&&(o=0),d<0&&(d=0),d==u&&(t=!0);for(var f=d;f<=u;f++){var h=S.fromPoints(this.session.screenToDocumentPosition(f,o,g),this.session.screenToDocumentPosition(f,i,s));if(h.isEmpty()){if(D&&c(h.end,D))break;D=h.end}h.cursor=r?h.start:h.end,a.push(h)}if(l&&a.reverse(),!t){for(var p=a.length-1;a[p].isEmpty()&&p>0;)p--;if(p>0)for(var m=0;a[m].isEmpty();)m++;for(var y=p;y>=m;y--)a[y].isEmpty()&&a.splice(y,1)}return a}}).call(a.prototype);var d=e("./editor").Editor;function c(e,n){return e.row==n.row&&e.column==n.column}function u(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(g.defaultCommands),f(e))}function f(e){if(e.textInput){var n=e.textInput.getElement(),t=!1;o.addListener(n,"keydown",function(n){var S=18==n.keyCode&&!(n.ctrlKey||n.shiftKey||n.metaKey);e.$blockSelectEnabled&&S?t||(e.renderer.setMouseCursor("crosshair"),t=!0):t&&D()},e),o.addListener(n,"keyup",D,e),o.addListener(n,"blur",D,e)}function D(n){t&&(e.renderer.setMouseCursor(""),t=!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,t=e.length;t--;){var D=e[t];if(D.marker){this.session.removeMarker(D.marker);var S=n.indexOf(D);-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(g.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(g.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var n=e.command,t=e.editor;if(t.multiSelect){if(n.multiSelectAction)"forEach"==n.multiSelectAction?D=t.forEachSelection(n,e.args):"forEachLine"==n.multiSelectAction?D=t.forEachSelection(n,e.args,!0):"single"==n.multiSelectAction?(t.exitMultiSelectMode(),D=n.exec(t,e.args||{})):D=n.multiSelectAction(t,e.args||{});else{var D=n.exec(t,e.args||{});t.multiSelect.addRange(t.multiSelect.toOrientedRange()),t.multiSelect.mergeOverlappingRanges()}return D}},this.forEachSelection=function(e,n,t){if(!this.inVirtualSelectionMode){var D,S=t&&t.keepOrder,r=!0==t||t&&t.$byLines,o=this.session,i=this.selection,g=i.rangeList,s=(S?i:g).ranges;if(!s.length)return e.exec?e.exec(this,n||{}):e(this,n||{});var l=i._eventRegistry;i._eventRegistry={};var d=new a(o);this.inVirtualSelectionMode=!0;for(var c=s.length;c--;){if(r)for(;c>0&&s[c].start.row==s[c-1].end.row;)c--;d.fromOrientedRange(s[c]),d.index=c,this.selection=o.selection=d;var u=e.exec?e.exec(this,n||{}):e(this,n||{});D||void 0===u||(D=u),d.toOrientedRange(s[c])}d.detach(),this.selection=o.selection=i,this.inVirtualSelectionMode=!1,i._eventRegistry=l,i.mergeOverlappingRanges(),i.ranges[0]&&i.fromOrientedRange(i.ranges[0]);var f=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),f&&f.from==f.to&&this.renderer.animateScrolling(f.from),D}},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,t=[],D=0;D<n.length;D++)t.push(this.session.getTextRange(n[D]));var S=this.session.getDocument().getNewLineCharacter();(e=t.join(S)).length==(t.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 t=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||n!=this.multiSelect.anchor){var D=n==this.multiSelect.anchor?t.cursor==t.start?t.end:t.start:t.cursor;D.row!=n.row||this.session.$clipPositionToDocument(D.row,D.column).column!=n.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,n,t){if((n=n||{}).needle=e||n.needle,void 0==n.needle){var D=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();n.needle=this.session.getTextRange(D)}this.$search.set(n);var S=this.$search.findAll(this.session);if(!S.length)return 0;var a=this.multiSelect;t||a.toSingleRange(S[0]);for(var r=S.length;r--;)a.addRange(S[r],!0);return D&&a.rangeList.rangeAtPoint(D.start)&&a.addRange(D,!0),S.length},this.selectMoreLines=function(e,n){var t=this.selection.toOrientedRange(),D=t.cursor==t.end,a=this.session.documentToScreenPosition(t.cursor);this.selection.$desiredColumn&&(a.column=this.selection.$desiredColumn);var r=this.session.screenToDocumentPosition(a.row+e,a.column);if(t.isEmpty())var o=r;else var i=this.session.documentToScreenPosition(D?t.end:t.start),o=this.session.screenToDocumentPosition(i.row+e,i.column);if(D){var g=S.fromPoints(r,o);g.cursor=g.start}else{var g=S.fromPoints(o,r);g.cursor=g.end}if(g.desiredColumn=a.column,this.selection.inMultiSelectMode){if(n)var s=t.cursor}else this.selection.addRange(t);this.selection.addRange(g),s&&this.selection.substractPoint(s)},this.transposeSelections=function(e){for(var n=this.session,t=n.multiSelect,D=t.ranges,S=D.length;S--;){var a=D[S];if(a.isEmpty()){var r=n.getWordRange(a.start.row,a.start.column);a.start.row=r.start.row,a.start.column=r.start.column,a.end.row=r.end.row,a.end.column=r.end.column}}t.mergeOverlappingRanges();for(var o=[],S=D.length;S--;){var a=D[S];o.unshift(n.getTextRange(a))}e<0?o.unshift(o.pop()):o.push(o.shift());for(var S=D.length;S--;){var a=D[S],i=a.clone();n.replace(a,o[S]),a.start.row=i.start.row,a.start.column=i.start.column}t.fromOrientedRange(t.ranges[0])},this.selectMore=function(e,n,t){var D=this.session,S=D.multiSelect.toOrientedRange();if(!S.isEmpty()||((S=D.getWordRange(S.start.row,S.start.column)).cursor=-1==e?S.start:S.end,this.multiSelect.addRange(S),!t)){var a=D.getTextRange(S),r=l(D,a,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,t=n.ranges,D=-1,a=t.filter(function(e){if(e.cursor.row==D)return!0;D=e.cursor.row});if(t.length&&a.length!=t.length-1){a.forEach(function(e){n.substractPoint(e.cursor)});var r=0,o=1/0,g=t.map(function(n){var t=n.cursor,D=e.getLine(t.row).substr(t.column).search(/\S/g);return -1==D&&(D=0),t.column>r&&(r=t.column),D<o&&(o=D),D});t.forEach(function(n,t){var D=n.cursor,a=r-D.column,s=g[t]-o;a>s?e.insert(D,i.stringRepeat(" ",a-s)):e.remove(new S(D.row,D.column,D.row,D.column-a+s)),n.start.column=n.end.column=r,n.start.row=n.end.row=D.row,n.cursor=n.end}),n.fromOrientedRange(t[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var s=this.selection.getRange(),l=s.start.row,d=s.end.row,c=l==d;if(c){var u,f=this.session.getLength();do u=this.session.getLine(d);while(/[=:]/.test(u)&&++d<f);do u=this.session.getLine(l);while(/[=:]/.test(u)&&--l>0);l<0&&(l=0),d>=f&&(d=f-1)}var h=this.session.removeFullLines(l,d);h=this.$reAlignText(h,c),this.session.insert({row:l,column:0},h.join("\n")+"\n"),c||(s.start.column=0,s.end.column=h[h.length-1].length),this.selection.setRange(s)}},this.$reAlignText=function(e,n){var t,D,S,a=!0,r=!0;return e.map(function(e){var n=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return n?(null==t?(t=n[1].length,D=n[2].length,S=n[3].length):(t+D+S!=n[1].length+n[2].length+n[3].length&&(r=!1),t!=n[1].length&&(a=!1),t>n[1].length&&(t=n[1].length),D<n[2].length&&(D=n[2].length),S>n[3].length&&(S=n[3].length)),n):[e]}).map(n?g:a?r?s:g:l);function o(e){return i.stringRepeat(" ",e)}function g(e){return e[2]?o(t)+e[2]+o(D-e[2].length+S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function s(e){return e[2]?o(t+D-e[2].length)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?o(t)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(d.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 t=e.oldSession;t&&(t.multiSelect.off("addRange",this.$onAddRange),t.multiSelect.off("removeRange",this.$onRemoveRange),t.multiSelect.off("multiSelect",this.$onMultiSelect),t.multiSelect.off("singleSelect",this.$onSingleSelect),t.multiSelect.lead.off("change",this.$checkMultiselectChange),t.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=u,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){u(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,t){"use strict";var D=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,n,t){var D=e.getLine(t);return this.foldingStartMarker.test(D)?"start":"markbeginend"==n&&this.foldingStopMarker&&this.foldingStopMarker.test(D)?"end":""},this.getFoldWidgetRange=function(e,n,t){return null},this.indentationBlock=function(e,n,t){var S=/\S/,a=e.getLine(n),r=a.search(S);if(-1!=r){for(var o=t||a.length,i=e.getLength(),g=n,s=n;++n<i;){var l=e.getLine(n).search(S);if(-1!=l){if(l<=r){var d=e.getTokenAt(n,0);if(!d||"string"!==d.type)break}s=n}}if(s>g){var c=e.getLine(s).length;return new D(g,o,s,c)}}},this.openingBracketBlock=function(e,n,t,S,a){var r={row:t,column:S+1},o=e.$findClosingBracket(n,r,a);if(o){var i=e.foldWidgets[o.row];return null==i&&(i=e.getFoldWidget(o.row)),"start"==i&&o.row>r.row&&(o.row--,o.column=e.getLine(o.row).length),D.fromPoints(r,o)}},this.closingBracketBlock=function(e,n,t,S,a){var r={row:t,column:S},o=e.$findOpeningBracket(n,r);if(o)return o.column++,r.column--,D.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,t){"use strict";var D=e("../line_widgets").LineWidgets,S=e("../lib/dom"),a=e("../range").Range,r=e("../config").nls;function o(e,n,t){for(var D=0,S=e.length-1;D<=S;){var a=D+S>>1,r=t(n,e[a]);if(r>0)D=a+1;else{if(!(r<0))return a;S=a-1}}return-(D+1)}function i(e,n,t){var D=e.getAnnotations().sort(a.comparePoints);if(D.length){var S=o(D,{row:n,column:-1},a.comparePoints);S<0&&(S=-S-1),S>=D.length?S=t>0?0:D.length-1:0===S&&t<0&&(S=D.length-1);var r=D[S];if(r&&t){if(r.row===n){do r=D[S+=t];while(r&&r.row===n);if(!r)return D.slice()}var i=[];n=r.row;do i[t<0?"unshift":"push"](r),r=D[S+=t];while(r&&r.row==n);return i.length&&i}}}n.showErrorMarker=function(e,n){var t,a=e.session;a.widgetManager||(a.widgetManager=new D(a),a.widgetManager.attach(e));var o=e.getCursorPosition(),g=o.row,s=a.widgetManager.getWidgetsAtRow(g).filter(function(e){return"errorMarker"==e.type})[0];s?s.destroy():g-=n;var l=i(a,g,n);if(l){var d=l[0];o.column=(d.pos&&"number"!=typeof d.column?d.pos.sc:d.column)||0,o.row=d.row,t=e.renderer.$gutterLayer.$annotations[o.row]}else{if(s)return;t={displayText:[r("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(o.row),e.selection.moveToPosition(o);var c={row:o.row,fixedWidth:!0,coverGutter:!0,el:S.createElement("div"),type:"errorMarker"},u=c.el.appendChild(S.createElement("div")),f=c.el.appendChild(S.createElement("div"));f.className="error_widget_arrow "+t.className;var h=e.renderer.$cursorLayer.getPixelPosition(o).left;f.style.left=h+e.renderer.gutterWidth-5+"px",c.el.className="error_widget_wrapper",u.className="error_widget "+t.className,t.displayText.forEach(function(e,n){u.appendChild(S.createTextNode(e)),n<t.displayText.length-1&&u.appendChild(S.createElement("br"))}),u.appendChild(S.createElement("div"));var p=function(e,n,t){if(0===n&&("esc"===t||"return"===t))return c.destroy(),{command:"null"}};c.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(p),a.widgetManager.removeLineWidget(c),e.off("changeSelection",c.destroy),e.off("changeSession",c.destroy),e.off("mouseup",c.destroy),e.off("change",c.destroy))},e.keyBinding.addKeyboardHandler(p),e.on("changeSelection",c.destroy),e.on("changeSession",c.destroy),e.on("mouseup",c.destroy),e.on("change",c.destroy),e.session.widgetManager.addLineWidget(c),c.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:c.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,t){"use strict";e("./loader_build")(n);var D=e("./lib/dom"),S=e("./range").Range,a=e("./editor").Editor,r=e("./edit_session").EditSession,o=e("./undomanager").UndoManager,i=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,t){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 a)return e.env.editor;var r="";if(e&&/input|textarea/i.test(e.tagName)){var o=e;r=o.value,e=D.createElement("pre"),o.parentNode.replaceChild(e,o)}else e&&(r=e.textContent,e.innerHTML="");var g=n.createEditSession(r),s=new a(new i(e),g,t),l={document:g,editor:s,onResize:s.resize.bind(s,null)};return o&&(l.textarea=o),s.on("destroy",function(){l.editor.container.env=null}),s.container.env=s.env=l,s},n.createEditSession=function(e,n){var t=new r(e,n);return t.setUndoManager(new o),t},n.Range=S,n.Editor=a,n.EditSession=r,n.UndoManager=o,n.VirtualRenderer=i,n.version=n.config.version}),function(){ace.require(["ace/ace"],function(n){n&&(n.config.init(!0),n.define=ace.define);var t=function(){return this}();for(var D in!t&&"u">typeof window&&(t=window),!t&&"u">typeof self&&(t=self),t.ace||(t.ace=n),n)n.hasOwnProperty(D)&&(t.ace[D]=n[D]);t.ace.default=t.ace,e&&(e.exports=t.ace)})}()},20047(e,n,t){e=t.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,t){"use strict";var D=e("./lib/dom"),S=e("./lib/oop"),a=e("./lib/event_emitter").EventEmitter,r=e("./lib/lang"),o=e("./range").Range,i=e("./range_list").RangeList,g=e("./keyboard/hash_handler").HashHandler,s=e("./tokenizer").Tokenizer,l=e("./clipboard"),d={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,n,t){var D=e.session.getTextRange();return t?D.replace(/\n\r?([ \t]*\S)/g,"\n"+t+"$1"):D},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:c.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:c.bind(null,{year:"2-digit"}),CURRENT_MONTH:c.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:c.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:c.bind(null,{month:"short"}),CURRENT_DATE:c.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:c.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:c.bind(null,{weekday:"short"}),CURRENT_HOUR:c.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:c.bind(null,{minute:"2-digit"}),CURRENT_SECOND:c.bind(null,{second:"2-digit"})};function c(e){var n=new Date().toLocaleString("en-us",e);return 1==n.length?"0"+n:n}d.SELECTED_TEXT=d.SELECTION;var u=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=d}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 t(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var D={regex:"/("+t("/")+"+)/",onMatch:function(e,n,t){var D=t[0];return D.fmtString=!0,D.guard=e.slice(1,-1),D.flag="",""},next:"formatString"};return e.$tokenizer=new s({start:[{regex:/\\./,onMatch:function(e,n,t){var D=e[1];return"}"==D&&t.length?e=D:-1!="`$\\".indexOf(D)&&(e=D),[e]}},{regex:/}/,onMatch:function(e,n,t){return[t.length?t.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:n},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,t,D){var S=n(e.substr(1));return D.unshift(S[0]),S},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+t("\\|")+"*\\|",onMatch:function(e,n,t){var D=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return t[0].choices=D,[D[0]]},next:"start"},D,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,n,t){return t.length&&t[0].expectElse?(t[0].expectElse=!1,t[0].ifEnd={elseEnd:t[0]},[t[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,n,t){var D=e[1];return"}"==D&&t.length||-1!="`$\\".indexOf(D)?e=D:"n"==D?e="\n":"t"==D?e=" ":-1!="ulULE".indexOf(D)&&(e={changeCase:D,local:D>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,n,t){var D=t.shift();return D&&(D.flag=e.slice(1,-1)),this.next=D&&D.tabstopId?"start":"",[D||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,n,t){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,n,t){var D={text:e.slice(2)};return t.unshift(D),[D]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,n,t){var D=t.shift();return this.next=D&&D.tabstopId?"start":"",[D||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,n,t){return t[0].formatFunction=e.slice(2,-1),[t.shift()]},next:"formatString"},D,{regex:/:[\?\-+]?/,onMatch:function(e,n,t){"+"==e[1]&&(t[0].ifEnd=t[0]),"?"==e[1]&&(t[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,t){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 D=this.variables[n];return"function"==typeof D&&(D=this.variables[n](e,n,t)),null==D?"":D},e.prototype.tmStrFormat=function(e,n,t){if(!n.fmt)return e;var D=n.flag||"",S=n.guard;S=new RegExp(S,D.replace(/[^gim]/g,""));var a="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(a,t),D="E",S=0;S<n.length;S++){var o=n[S];if("object"==typeof o)if(n[S]="",o.changeCase&&o.local){var i=n[S+1];i&&"string"==typeof i&&("u"==o.changeCase?n[S]=i[0].toUpperCase():n[S]=i[0].toLowerCase(),n[S+1]=i.substr(1))}else o.changeCase&&(D=o.changeCase);else"U"==D?n[S]=o.toUpperCase():"L"==D&&(n[S]=o.toLowerCase())}return r.variables.__=e,n.join("")})},e.prototype.tmFormatFunction=function(e,n,t){return"upcase"==n.formatFunction?e.toUpperCase():"downcase"==n.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,n){for(var t=[],D="",S=!0,a=0;a<e.length;a++){var r=e[a];if("string"==typeof r){t.push(r),"\n"==r?(S=!0,D=""):S&&(D=/^\t*/.exec(r)[0],S=/\S/.test(r));continue}if(r){if(S=!1,r.fmtString){var o=e.indexOf(r,a+1);-1==o&&(o=e.length),r.fmt=e.slice(a+1,o),a=o}if(r.text){var i=this.getVariableValue(n,r.text,D)+"";r.fmtString&&(i=this.tmStrFormat(i,r,n)),r.formatFunction&&(i=this.tmFormatFunction(i,r,n)),i&&!r.ifEnd?(t.push(i),g(r)):!i&&r.ifEnd&&g(r.ifEnd)}else r.elseEnd?g(r.elseEnd):null!=r.tabstopId?t.push(r):null!=r.changeCase&&t.push(r)}}function g(n){var t=e.indexOf(n,a+1);-1!=t&&(a=t)}return t},e.prototype.getDisplayTextForSnippet=function(e,n){return f.call(this,e,n).text},e.prototype.insertSnippetForSelection=function(e,n,t){void 0===t&&(t={});var D=f.call(this,e,n,t),S=e.getSelectionRange(),a=e.session.replace(S,D.text),r=new h(e),o=e.inVirtualSelectionMode&&e.selection.index;r.addTabstops(D.tabstops,S.start,a,o)},e.prototype.insertSnippet=function(e,n,t){void 0===t&&(t={});var D=this;if(e.inVirtualSelectionMode)return D.insertSnippetForSelection(e,n,t);e.forEachSelection(function(){D.insertSnippetForSelection(e,n,t)},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 t=e.getCursorPosition(),D=e.session.getState(t.row);"object"==typeof D&&(D=D[0]),D.substring&&("js-"==D.substring(0,3)?n="javascript":"css-"==D.substring(0,4)?n="css":"php-"==D.substring(0,4)&&(n="php"))}return n},e.prototype.getActiveScopes=function(e){var n=this.$getScope(e),t=[n],D=this.snippetMap;return D[n]&&D[n].includeScopes&&t.push.apply(t,D[n].includeScopes),t.push("_"),t},e.prototype.expandWithTab=function(e,n){var t=this,D=e.forEachSelection(function(){return t.expandSnippetForSelection(e,n)},null,{keepOrder:!0});return D&&e.tabstopManager&&e.tabstopManager.tabNext(),D},e.prototype.expandSnippetForSelection=function(e,n){var t,D=e.getCursorPosition(),S=e.session.getLine(D.row),a=S.substring(0,D.column),r=S.substr(D.column),o=this.snippetMap;return this.getActiveScopes(e).some(function(e){var n=o[e];return n&&(t=this.findMatchingSnippet(n,a,r)),!!t},this),!!t&&(!!n&&!!n.dryRun||(e.session.doc.removeInLine(D.row,D.column-t.replaceBefore.length,D.column+t.replaceAfter.length),this.variables.M__=t.matchBefore,this.variables.T__=t.matchAfter,this.insertSnippetForSelection(e,t.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,n,t){for(var D=e.length;D--;){var S=e[D];if((!S.startRe||S.startRe.test(n))&&(!S.endRe||S.endRe.test(t))&&(S.startRe||S.endRe))return S.matchBefore=S.startRe?S.startRe.exec(n):[""],S.matchAfter=S.endRe?S.endRe.exec(t):[""],S.replaceBefore=S.triggerRe?S.triggerRe.exec(n)[0]:"",S.replaceAfter=S.endTriggerRe?S.endTriggerRe.exec(t)[0]:"",S}},e.prototype.register=function(e,n){var t=this.snippetMap,D=this.snippetNameMap,S=this;function a(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function o(e,n,t){return e=a(e),n=a(n),t?(e=n+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=n)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function i(e){e.scope||(e.scope=n||"_"),t[n=e.scope]||(t[n]=[],D[n]={});var a=D[n];if(e.name){var i=a[e.name];i&&S.unregister(i),a[e.name]=e}t[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(i):Object.keys(e).forEach(function(n){i(e[n])}),this._signal("registerSnippets",{scope:n})},e.prototype.unregister=function(e,n){var t=this.snippetMap,D=this.snippetNameMap;function S(e){var S=D[e.scope||n];if(S&&S[e.name]){delete S[e.name];var a=t[e.scope||n],r=a&&a.indexOf(e);r>=0&&a.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,t=[],D={},S=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;n=S.exec(e);){if(n[1])try{D=JSON.parse(n[1]),t.push(D)}catch(e){}if(n[4])D.content=n[4].replace(/^\t/gm,""),t.push(D),D={};else{var a=n[2],r=n[3];if("regex"==a){var o=/\/((?:[^\/\\]|\\.)*)|$/g;D.guard=o.exec(r)[1],D.trigger=o.exec(r)[1],D.endTrigger=o.exec(r)[1],D.endGuard=o.exec(r)[1]}else"snippet"==a?(D.tabTrigger=r.match(/^\S*/)[0],D.name||(D.name=r)):a&&(D[a]=r)}}return t},e.prototype.getSnippetByName=function(e,n){var t,D=this.snippetNameMap;return this.getActiveScopes(n).some(function(n){var S=D[n];return S&&(t=S[e]),!!t},this),t},e}();S.implement(u.prototype,a);var f=function(e,n,t){void 0===t&&(t={});var D=e.getCursorPosition(),S=e.session.getLine(D.row),a=e.session.getTabString(),r=S.match(/^\s*/)[0];D.column<r.length&&(r=r.slice(0,D.column)),n=n.replace(/\r/g,"");var o=this.tokenizeTmSnippet(n);o=(o=this.resolveVariables(o,e)).map(function(e){return"\n"!=e||t.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,a):e:e+r});var i=[];o.forEach(function(e,n){if("object"==typeof e){var t=e.tabstopId,D=i[t];if(D||((D=i[t]=[]).index=t,D.value="",D.parents={}),-1===D.indexOf(e)){e.choices&&!D.choices&&(D.choices=e.choices),D.push(e);var S=o.indexOf(e,n+1);if(-1!==S){var a=o.slice(n+1,S),r=a.some(function(e){return"object"==typeof e});r&&!D.value?D.value=a:a.length&&(!D.value||"string"!=typeof D.value)&&(D.value=a.join(""))}}}}),i.forEach(function(e){e.length=0});var g={};function s(e){for(var n=[],t=0;t<e.length;t++){var D=e[t];if("object"==typeof D){if(g[D.tabstopId])continue;D=n[e.lastIndexOf(D,t-1)]||{tabstopId:D.tabstopId}}n[t]=D}return n}for(var l=0;l<o.length;l++){var d=o[l];if("object"==typeof d){var c=d.tabstopId,u=i[c],f=o.indexOf(d,l+1);if(g[c]){g[c]===d&&(delete g[c],Object.keys(g).forEach(function(e){u.parents[e]=!0}));continue}g[c]=d;var h=u.value;"string"!=typeof h?h=s(h):d.fmt&&(h=this.tmStrFormat(h,d,e)),o.splice.apply(o,[l+1,Math.max(0,f-l)].concat(h,d)),-1===u.indexOf(d)&&u.push(d)}}var p=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,p+=n.length-1):m+=e.length,y+=e}else e&&(e.start?e.end={row:p,column:m}:e.start={row:p,column:m})}),{text:y,tabstops:i,tokens:o}},h=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],t=this.selectedTabstop||{},D=t.parents||{},S=this.tabstops.slice(),a=0;a<S.length;a++){var r=S[a],o=r==t||D[r.index];if(r.rangeList.$bias=+!o,"remove"==e.action&&r!==t){var i=r.parents&&r.parents[t.index],g=r.rangeList.pointIndex(e.start,i);g=g<0?-g-1:g+1;var s=r.rangeList.pointIndex(e.end,i);s=s<0?-s-1:s-1;for(var l=r.rangeList.ranges.slice(g,s),d=0;d<l.length;d++)this.removeRange(l[d])}r.rangeList.$onChange(e)}var c=this.session;this.$inChange||!n||1!=c.getLength()||c.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var t=this.session,D=t.getTextRange(e.firstNonLinked),S=0;S<e.length;S++){var a=e[S];if(a.linked){var r=a.original,o=n.snippetManager.tmStrFormat(D,r,this.editor);t.replace(a,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,t=this.editor.selection.isEmpty(),D=0;D<this.ranges.length;D++)if(!this.ranges[D].linked){var S=this.ranges[D].contains(e.row,e.column),a=t||this.ranges[D].contains(n.row,n.column);if(S&&a)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var n=this.tabstops.length,t=this.index+(e||1);(t=Math.min(Math.max(t,1),n))==n&&(t=0),this.selectTabstop(t),this.updateTabstopMarkers(),0===t&&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 t=n.firstNonLinked||n;if(n.choices&&(t.cursor=t.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(t);else{var D=this.editor.multiSelect;D.toSingleRange(t);for(var S=0;S<n.length;S++)n.hasLinkedRanges&&n[S].linked||D.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,t){var D=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var S=o.fromPoints(t,t);m(S.start,n),m(S.end,n),e[0]=[S],e[0].index=0}var a=[this.index+1,0],r=this.ranges,g=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,t){var S=this.$openTabstops[t]||e;S.snippetId=g;for(var s=0;s<e.length;s++){var l=e[s],d=o.fromPoints(l.start,l.end||l.start);p(d.start,n),p(d.end,n),d.original=l,d.tabstop=S,r.push(d),S!=e?S.unshift(d):S[s]=d,l.fmtString||S.firstNonLinked&&D?(d.linked=!0,S.hasLinkedRanges=!0):S.firstNonLinked||(S.firstNonLinked=d)}S.firstNonLinked||(S.hasLinkedRanges=!1),S===e&&(a.push(S),this.$openTabstops[t]=S),this.addTabstopMarkers(S),S.rangeList=S.rangeList||new i,S.rangeList.$bias=0,S.rangeList.addList(S)},this),a.length>2&&(this.tabstops.length&&a.push(a.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,a))},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}();h.prototype.keyboardHandler=new g,h.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 p=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};D.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 u,(function(){this.insertSnippet=function(e,t){return n.snippetManager.insertSnippet(this,e,t)},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,t){"use strict";var D=e("../virtual_renderer").VirtualRenderer,S=e("../editor").Editor,a=e("../range").Range,r=e("../lib/event"),o=e("../lib/lang"),i=e("../lib/dom"),g=e("../config").nls,s=e("./../lib/useragent"),l=function(e){return"suggest-aria-id:".concat(e)},d=s.isSafari?"menu":"listbox",c=s.isSafari?"menuitem":"option",u=s.isSafari?"aria-current":"aria-selected",f=function(e){var n=new D(e);n.$maxLines=4;var t=new S(n);return t.setHighlightActiveLine(!1),t.setShowPrintMargin(!1),t.renderer.setShowGutter(!1),t.renderer.setHighlightGutterLine(!1),t.$mouseHandler.$focusTimeout=0,t.$highlightTagPending=!0,t},h=function(){return function(e){var n,t=i.createElement("div"),D=f(t);e&&e.appendChild(t),t.style.display="none",D.renderer.content.style.cursor="default",D.renderer.setStyle("ace_autocomplete"),D.renderer.$textLayer.element.setAttribute("role",d),D.renderer.$textLayer.element.setAttribute("aria-roledescription",g("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),D.renderer.$textLayer.element.setAttribute("aria-label",g("autocomplete.popup.aria-label","Autocomplete suggestions")),D.renderer.textarea.setAttribute("aria-hidden","true"),D.setOption("displayIndentGuides",!1),D.setOption("dragDelay",150);var S=function(){};D.focus=S,D.$isFocused=!0,D.renderer.$cursorLayer.restartTimer=S,D.renderer.$cursorLayer.element.style.opacity="0",D.renderer.$maxLines=8,D.renderer.$keepTextAreaAtCursor=!1,D.setHighlightActiveLine(!1),D.session.highlight(""),D.session.$searchHighlight.clazz="ace_highlight-marker",D.on("mousedown",function(e){var n=e.getDocumentPosition();D.selection.moveToPosition(n),h.start.row=h.end.row=n.row,e.stop()});var s=new a(-1,0,-1,1/0),h=new a(-1,0,-1,1/0);h.id=D.session.addMarker(h,"ace_active-line","fullLine"),D.setSelectOnHover=function(e){e?s.id&&(D.session.removeMarker(s.id),s.id=null):s.id=D.session.addMarker(s,"ace_line-hover","fullLine")},D.setSelectOnHover(!1),D.on("mousemove",function(e){if(!n){n=e;return}if(n.x!=e.x||n.y!=e.y){n=e,n.scrollTop=D.renderer.scrollTop,D.isMouseOver=!0;var t=n.getDocumentPosition().row;s.start.row!=t&&(s.id||D.setRow(t),m(t))}}),D.renderer.on("beforeRender",function(){if(n&&-1!=s.start.row){n.$pos=null;var e=n.getDocumentPosition().row;s.id||D.setRow(e),m(e,!0)}}),D.renderer.on("afterRender",function(){var e=D.getRow(),n=D.renderer.$textLayer,t=n.element.childNodes[e-n.config.firstRow],S=document.activeElement;if(t!==D.selectedNode&&D.selectedNode&&(i.removeCssClass(D.selectedNode,"ace_selected"),S.removeAttribute("aria-activedescendant"),D.selectedNode.removeAttribute(u),D.selectedNode.removeAttribute("id")),D.selectedNode=t,t){i.addCssClass(t,"ace_selected");var a=l(e);t.id=a,n.element.setAttribute("aria-activedescendant",a),S.setAttribute("aria-activedescendant",a),t.setAttribute("role",c),t.setAttribute("aria-roledescription",g("autocomplete.popup.item.aria-roledescription","item")),t.setAttribute("aria-label",D.getData(e).caption||D.getData(e).value),t.setAttribute("aria-setsize",D.data.length),t.setAttribute("aria-posinset",e+1),t.setAttribute("aria-describedby","doc-tooltip"),t.setAttribute(u,"true")}});var p=function(){m(-1)},m=function(e,n){e!==s.start.row&&(s.start.row=s.end.row=e,n||D.session._emit("changeBackMarker"),D._emit("changeHoverMarker"))};D.getHoveredRow=function(){return s.start.row},r.addListener(D.container,"mouseout",function(){D.isMouseOver=!1,p()}),D.on("hide",p),D.on("changeSelection",p),D.session.doc.getLength=function(){return D.data.length},D.session.doc.getLine=function(e){var n=D.data[e];return"string"==typeof n?n:n&&n.value||""};var y=D.session.bgTokenizer;return y.$tokenizeRow=function(e){var n=D.data[e],t=[];if(!n)return t;"string"==typeof n&&(n={value:n});var S=n.caption||n.value||n.name;function a(e,D){e&&t.push({type:(n.className||"")+(D||""),value:e})}for(var r=S.toLowerCase(),o=(D.filterText||"").toLowerCase(),i=0,g=0,s=0;s<=o.length;s++)if(s!=g&&(n.matchMask&1<<s||s==o.length)){var l=o.slice(g,s);g=s;var d=r.indexOf(l,i);if(-1==d)continue;a(S.slice(i,d),""),i=d+l.length,a(S.slice(d,i),"completion-highlight")}return a(S.slice(i,S.length),""),t.push({type:"completion-spacer",value:" "}),n.meta&&t.push({type:"completion-meta",value:n.meta}),n.message&&t.push({type:"completion-message",value:n.message}),t},y.$updateOnChange=S,y.start=S,D.session.$computeWidth=function(){return this.screenWidth=0},D.isOpen=!1,D.isTopdown=!1,D.autoSelect=!0,D.filterText="",D.isMouseOver=!1,D.data=[],D.setData=function(e,n){D.filterText=n||"",D.setValue(o.stringRepeat("\n",e.length),-1),D.data=e||[],D.setRow(0)},D.getData=function(e){return D.data[e]},D.getRow=function(){return h.start.row},D.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),h.start.row!=e&&(D.selection.clearSelection(),h.start.row=h.end.row=e||0,D.session._emit("changeBackMarker"),D.moveCursorTo(e||0,0),D.isOpen&&D._signal("select"))},D.on("changeSelection",function(){D.isOpen&&D.setRow(D.selection.lead.row),D.renderer.scrollCursorIntoView()}),D.hide=function(){this.container.style.display="none",D.anchorPos=null,D.anchor=null,D.isOpen&&(D.isOpen=!1,this._signal("hide"))},D.tryShow=function(e,t,S,a){if(!a&&D.isOpen&&D.anchorPos&&D.anchor&&D.anchorPos.top===e.top&&D.anchorPos.left===e.left&&D.anchor===S)return!0;var r=this.container,o=window.innerHeight,i=window.innerWidth,g=this.renderer,s=g.$maxLines*t*1.4,l={top:0,bottom:0},d=o-e.top-3*this.$borderSize-t,c=e.top-3*this.$borderSize;S||(S=c<=d||d>=s?"bottom":"top"),"top"===S?(l.bottom=e.top-this.$borderSize,l.top=l.bottom-s):"bottom"===S&&(l.top=e.top+t+this.$borderSize,l.bottom=l.top+s);var u=l.top>=0&&l.bottom<=o;if(!a&&!u)return!1;u?g.$maxPixelHeight=null:"top"===S?g.$maxPixelHeight=c:g.$maxPixelHeight=d,"top"===S?(r.style.top="",r.style.bottom=o-l.bottom+"px",D.isTopdown=!1):(r.style.top=l.top+"px",r.style.bottom="",D.isTopdown=!0),r.style.display="";var f=e.left;return f+r.offsetWidth>i&&(f=i-r.offsetWidth),r.style.left=f+"px",r.style.right="",D.isOpen||(D.isOpen=!0,this._signal("show"),n=null),D.anchorPos=e,D.anchor=S,!0},D.show=function(e,n,t){this.tryShow(e,n,t?"bottom":void 0,!0)},D.goTo=function(e){var n=this.getRow(),t=this.session.getLength()-1;switch(e){case"up":n=n<=0?t:n-1;break;case"down":n=n>=t?-1:n+1;break;case"start":n=0;break;case"end":n=t}this.setRow(n)},D.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},D.$imageSize=0,D.$borderSize=1,D}}();i.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=h,n.$singleLineEditor=f,n.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,n,t){"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,t=n.element.childNodes[e-n.config.firstRow];if(t){for(var D="doc-tooltip ",S=0;S<this._lines.length;S++)D+="ace-inline-screenreader-line-".concat(S," ");t.setAttribute("aria-describedby",D)}}).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 t=document.createElement("code");t.setAttribute("id","ace-inline-screenreader-line-".concat(n));var D=document.createTextNode(this._lines[n]);t.appendChild(D),e.appendChild(t)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,n,t){"use strict";var D=e("../snippets").snippetManager,S=e("./inline_screenreader").AceInlineScreenReader;n.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,n,t){if(t=t||"",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 a=n.snippet?D.getDisplayTextForSnippet(e,n.snippet):n.value;return!n.hideInlinePreview&&!!a&&!!a.startsWith(t)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(a),""===(a=a.slice(t.length))?e.removeGhostText():e.setGhostText(a),!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,t){"use strict";n.parForEach=function(e,n,t){var D=0,S=e.length;0===S&&t();for(var a=0;a<S;a++)n(e[a],function(e,n){++D===S&&t(e,n)})};var D=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(e,n,t){t=t||D;for(var S=[],a=n-1;a>=0;a--)if(t.test(e[a]))S.push(e[a]);else break;return S.reverse().join("")},n.retrieveFollowingIdentifier=function(e,n,t){t=t||D;for(var S=[],a=n;a<e.length;a++)if(t.test(e[a]))S.push(e[a]);else break;return S},n.getCompletionPrefix=function(e){var n,t=e.getCursorPosition(),D=e.session.getLine(t.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!n&&e&&(n=this.retrievePrecedingIdentifier(D,t.column,e))}).bind(this))}).bind(this)),n||this.retrievePrecedingIdentifier(D,t.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,t){"use strict";var D=e("./keyboard/hash_handler").HashHandler,S=e("./autocomplete/popup").AcePopup,a=e("./autocomplete/inline").AceInline,r=e("./autocomplete/popup").getAriaId,o=e("./autocomplete/util"),i=e("./lib/lang"),g=e("./lib/dom"),s=e("./snippets").snippetManager,l=e("./config"),d=e("./lib/event"),c=e("./lib/scroll").preventParentScroll,u=function(e,n){n.completer&&n.completer.destroy()},f=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new D,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=i.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=i.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=i.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=i.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=i.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 p(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)),d.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 a,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,t=this.base.column,D=this.editor.getCursorPosition().column,S=this.editor.session.getLine(n).slice(t,D);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 t=this.popup.getData(n);t&&(!e||t.hideInlinePreview)&&this.$seen(t)}},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,t=n.layerConfig.lineHeight,D=n.$cursorLayer.getPixelPosition(this.base,!0);D.left-=this.popup.getTextLeftOffset();var S=e.container.getBoundingClientRect();D.top+=S.top-n.layerConfig.offset,D.left+=S.left-e.renderer.scrollLeft,D.left+=n.gutterWidth;var a={top:D.top,left:D.left};n.$ghostText&&n.$ghostTextWidget&&this.base.row===n.$ghostText.position.row&&(a.top+=n.$ghostTextWidget.el.offsetHeight);var r=e.container.getBoundingClientRect().bottom-t,o=r<a.top?{top:r,left:a.left}:a;this.popup.tryShow(o,t,"bottom")||this.popup.tryShow(D,t,"top")||this.popup.show(D,t)},e.prototype.openPopup=function(e,n,t){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var D,S=this.popup.getRow(),a=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&&(D=this.popup.data.indexOf(a)),D&&-1!==D||(D=0),this.popup.setRow(this.autoSelect?D:-1),D===S&&a!==this.completions.filtered[D]&&this.$onPopupChange();var o=this.inlineRenderer&&this.inlineEnabled;if(D===S&&o){var i=this.popup.getData(this.popup.getRow());this.$updateGhostText(i)}!t&&(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,t=this.editor.textInput.getElement(),D=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),S=this.popup&&this.popup.container;n==t||n.parentNode==S||D||n==this.tooltipNode||e.relatedTarget==t||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 t=this.completions,D=this.getCompletionProvider().insertMatch(this.editor,e,t.filterText,n);return this.completions==t&&this.detach(),D},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 h(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,n){return this.getCompletionProvider().gatherCompletions(e,n)},e.prototype.updateCompletions=function(n,t){if(n&&this.base&&this.completions){var D=this.editor.getCursorPosition(),S=this.editor.session.getTextRange({start:this.base,end:D});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(t&&t.matches){var D=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(D.row,D.column),this.base.$insertRight=!0,this.completions=new p(t.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",n)}var a=this.editor.getSession(),D=this.editor.getCursorPosition(),S=o.getCompletionPrefix(this.editor);this.base=a.doc.createAnchor(D.row,D.column-S.length),this.base.$insertRight=!0;var r={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:S,pos:D}).provideCompletions(this.editor,r,(function(t,D,S){var a=D.filtered,r=o.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),S){if(!a.length){var i=!this.autoShown&&this.emptyMessage;if("function"==typeof i&&(i=this.emptyMessage(r)),i){var g=[{caption:i,value:""}];this.completions=new p(g),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==a.length&&a[0].value==r&&!a[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==a.length)return this.insertMatch(a[0])}this.completions=!S&&this.showLoadingState?new p(e.completionsForLoading.concat(a),D.filterText):D,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,t=n&&(n[e.getHoveredRow()]||n[e.getRow()]),D=null;if(!t||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var S=this.editor.completers.length,a=0;a<S;a++){var r=this.editor.completers[a];if(r.getDocTooltip&&t.completerId===r.id){D=r.getDocTooltip(t);break}}if(D||"string"==typeof t||(D=t),"string"==typeof D&&(D={docText:D}),!D||!(D.docHTML||D.docText))return this.hideDocTooltip();this.showDocTooltip(D)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=g.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",c));var n=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(n.isDark?"ace_dark ":"")+(n.cssClass||"");var t=this.tooltipNode;e.docHTML?t.innerHTML=e.docHTML:e.docText&&(t.textContent=e.docText),t.parentNode||this.popup.container.appendChild(this.tooltipNode);var D=this.popup,S=D.container.getBoundingClientRect();t.style.top=D.container.style.top,t.style.bottom=D.container.style.bottom,t.style.display="block",window.innerWidth-S.right<320?S.left<320?(D.isTopdown?t.style.top=S.bottom+"px":t.style.top=D.container.offsetTop-t.offsetHeight+"px",t.style.left=S.left+"px",t.style.right="",t.style.bottom=""):(t.style.right=window.innerWidth-S.left+"px",t.style.left=""):(t.style.left=S.right+1+"px",t.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",u),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();f.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()}},f.for=function(e){return e.completer instanceof f||(e.completer&&(e.completer.destroy(),e.completer=null),l.get("sharedPopups")?(f.$sharedInstance||(f.$sharedInstance=new f),e.completer=f.$sharedInstance):(e.completer=new f,e.once("destroy",u))),e.completer},f.startCommand={name:"startAutocomplete",exec:function(e,n){var t=f.for(e);t.autoInsert=!1,t.autoSelect=!0,t.autoShown=!1,t.showPopup(e,n),t.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var h=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,n,t){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[n],t)},e.prototype.insertMatch=function(e,n,t){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 D=this.completions.filterText.length,S=0;if(n.range&&n.range.start.row===n.range.end.row&&(D-=this.initialPosition.prefix.length,D+=this.initialPosition.pos.column-n.range.start.column,S+=n.range.end.column-this.initialPosition.pos.column),D||S){a=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var a,r,o=0;r=a[o];o++)r.start.column-=D,r.end.column+=S,e.session.remove(r)}n.snippet?s.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 t=n.value||n;e.execCommand("insertstring",t)},e.prototype.gatherCompletions=function(e,n){var t=e.getSession(),D=e.getCursorPosition(),S=o.getCompletionPrefix(e),a=[];this.completers=e.completers;var r=e.completers.length;return e.completers.forEach(function(i,g){i.getCompletions(e,t,D,S,function(t,D){i.hideInlinePreview&&(D=D.map(function(e){return Object.assign(e,{hideInlinePreview:i.hideInlinePreview})})),!t&&D&&(a=a.concat(D)),n(null,{prefix:o.getCompletionPrefix(e),matches:a,finished:0==--r})})}),!0},e.prototype.provideCompletions=function(e,n,t){var D=(function(e){var D=e.prefix,S=e.matches;this.completions=new p(S),n.exactMatch&&(this.completions.exactMatch=!0),n.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(D),(e.finished||this.completions.filtered.length)&&t(null,this.completions,e.finished)}).bind(this),S=!0,a=null;if(this.gatherCompletions(e,(function(e,n){if(this.active&&(e&&(t(e,[],!0),this.detach()),0===n.prefix.indexOf(n.prefix))){if(S){a=n;return}D(n)}}).bind(this)),S=!1,a){var r=a;a=null,D(r)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),p=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 t=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!==t&&(t=n,!0)}),this.filtered=n},e.prototype.filterCompletions=function(e,n){var t=[],D=n.toUpperCase(),S=n.toLowerCase();n:for(var a,r=0;a=e[r];r++){var o,i,g=!this.ignoreCaption&&a.caption||a.value||a.snippet;if(g){var s=-1,l=0,d=0;if(this.exactMatch){if(n!==g.substr(0,n.length))continue}else{var c=g.toLowerCase().indexOf(S);if(c>-1)d=c;else for(var u=0;u<n.length;u++){var f=g.indexOf(S[u],s+1),h=g.indexOf(D[u],s+1);if((o=f>=0&&(h<0||f<h)?f:h)<0)continue n;(i=o-s-1)>0&&(-1===s&&(d+=10),d+=i,l|=1<<u),s=o}}a.matchMask=l,a.exactMatch=+!d,a.$score=(a.score||0)-d,t.push(a)}}return t},e}();n.Autocomplete=f,n.CompletionProvider=h,n.FilteredList=p}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,n,t){var D=e("../range").Range,S=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function a(e,n){return e.getTextRange(D.fromPoints({row:0,column:0},n)).split(S).length-1}function r(e,n){var t=a(e,n),D=e.getValue().split(S),r=Object.create(null),o=D[t];return D.forEach(function(e,n){if(e&&e!==o){var S=Math.abs(t-n),a=D.length-S;r[e]?r[e]=Math.max(a,r[e]):r[e]=a}}),r}n.getCompletions=function(e,n,t,D,S){var a=r(n,t);S(null,Object.keys(a).map(function(e){return{caption:e,value:e,score:a[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,t){"use strict";var D,S=e("../snippets").snippetManager,a=e("../autocomplete").Autocomplete,r=e("../config"),o=e("../lib/lang"),i=e("../autocomplete/util"),g=e("../autocomplete/text_completer"),s={getCompletions:function(e,n,t,D,S){if(n.$mode.completer)return n.$mode.completer.getCompletions(e,n,t,D,S);var a=e.session.getState(t.row),r=n.$mode.getCompletions(a,n,t,D);S(null,r=r.map(function(e){return e.completerId=s.id,e}))},id:"keywordCompleter"},l=function(e){var n={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,t,D,S){return n[t]=S||""}).replace(/\$(\d+?)/g,function(e,t){return n[t]})},d={getCompletions:function(e,n,t,D,a){var r=[],o=n.getTokenAt(t.row,t.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 i=S.snippetMap,g=[];r.forEach(function(e){for(var n=i[e]||[],t=n.length;t--;){var D=n[t],S=D.name||D.tabTrigger;S&&g.push({caption:S,snippet:D.content,meta:D.tabTrigger&&!D.name?D.tabTrigger+"⇥ ":"snippet",completerId:d.id})}},this),a(null,g)},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"},c=[d,g,s];n.setCompleters=function(e){c.length=0,e&&c.push.apply(c,e)},n.addCompleter=function(e){c.push(e)},n.textCompleter=g,n.keyWordCompleter=s,n.snippetCompleter=d;var u={name:"expandSnippet",exec:function(e){return S.expandWithTab(e)},bindKey:"Tab"},f=function(e,n){h(n.session.$mode)},h=function(e){"string"==typeof e&&(e=r.$modes[e]),e&&(S.files||(S.files={}),p(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(h))},p=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){h("ace/mode/"+e)})))}))},m=function(e){var n=e.editor,t=n.completer&&n.completer.activated;if("backspace"===e.command.name)t&&!i.getCompletionPrefix(n)&&n.completer.detach();else if("insertstring"===e.command.name&&!t){D=e;var S=e.editor.$liveAutocompletionDelay;S?y.delay(S):b(e)}},y=o.delayedCall(function(){b(D)},0),b=function(e){var n=e.editor,t=i.getCompletionPrefix(n),D=e.args,S=i.triggerAutocomplete(n,D);if(t&&t.length>=n.$liveAutocompletionThreshold||S){var r=a.for(n);r.autoShown=!0,r.showPopup(n)}},v=e("../editor").Editor;e("../config").defineOptions(v.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),this.commands.addCommand(a.startCommand)):this.commands.removeCommand(a.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),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(u),this.on("changeMode",f),f(null,this)):(this.commands.removeCommand(u),this.off("changeMode",f))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(n){e&&(e.exports=n)})}()},20009(e,n,t){e=t.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,t){"use strict";var D,S=e("./lib/oop");e("./lib/lang");var a=e("./lib/event_emitter").EventEmitter,r=e("./editor").Editor,o=e("./virtual_renderer").VirtualRenderer,i=e("./edit_session").EditSession;(function(){S.implement(this,a),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 i(e.getDocument(),e.getMode()),t=e.getUndoManager();return n.setUndoManager(t),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 t=null==n?this.$cEditor:this.$editors[n];return this.$editors.some(function(n){return n.session===e})&&(e=this.$cloneSession(e)),t.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,t=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var D=n/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=D+"px",e.container.style.top="0px",e.container.style.left=S*D+"px",e.container.style.height=t+"px",e.resize();else for(var a=t/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=n+"px",e.container.style.top=S*a+"px",e.container.style.left="0px",e.container.style.height=a+"px",e.resize()}}).call((D=function(e,n,t){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(t||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),n.Split=D}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,n,t){"use strict";t.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(n){e&&(e.exports=n)})}()},62432(e,n,t){ace.config.setModuleUrl("ace/ext/beautify",t(1853)),ace.config.setModuleUrl("ace/ext/code_lens",t(42836)),ace.config.setModuleUrl("ace/ext/command_bar",t(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",t(40275)),ace.config.setModuleUrl("ace/ext/emmet",t(25962)),ace.config.setModuleUrl("ace/ext/error_marker",t(377)),ace.config.setModuleUrl("ace/ext/hardwrap",t(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",t(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",t(97188)),ace.config.setModuleUrl("ace/ext/language_tools",t(10194)),ace.config.setModuleUrl("ace/ext/linking",t(43794)),ace.config.setModuleUrl("ace/ext/modelist",t(71739)),ace.config.setModuleUrl("ace/ext/options",t(43804)),ace.config.setModuleUrl("ace/ext/prompt",t(20706)),ace.config.setModuleUrl("ace/ext/rtl",t(27480)),ace.config.setModuleUrl("ace/ext/searchbox",t(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",t(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",t(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",t(51834)),ace.config.setModuleUrl("ace/ext/split",t(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",t(99729)),ace.config.setModuleUrl("ace/ext/statusbar",t(86397)),ace.config.setModuleUrl("ace/ext/textarea",t(36454)),ace.config.setModuleUrl("ace/ext/themelist",t(85107)),ace.config.setModuleUrl("ace/ext/whitespace",t(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",t(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",t(1832)),ace.config.setModuleUrl("ace/keyboard/vim",t(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",t(98557)),ace.config.setModuleUrl("ace/mode/abap",t(48208)),ace.config.setModuleUrl("ace/mode/abc",t(22128)),ace.config.setModuleUrl("ace/mode/actionscript",t(3871)),ace.config.setModuleUrl("ace/mode/ada",t(87272)),ace.config.setModuleUrl("ace/mode/alda",t(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",t(70029)),ace.config.setModuleUrl("ace/mode/apex",t(24266)),ace.config.setModuleUrl("ace/mode/applescript",t(78831)),ace.config.setModuleUrl("ace/mode/aql",t(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",t(36417)),ace.config.setModuleUrl("ace/mode/asl",t(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",t(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",t(9319)),ace.config.setModuleUrl("ace/mode/astro",t(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",t(5215)),ace.config.setModuleUrl("ace/mode/batchfile",t(182)),ace.config.setModuleUrl("ace/mode/bibtex",t(54316)),ace.config.setModuleUrl("ace/mode/c9search",t(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",t(69563)),ace.config.setModuleUrl("ace/mode/cirru",t(25995)),ace.config.setModuleUrl("ace/mode/clojure",t(81384)),ace.config.setModuleUrl("ace/mode/cobol",t(12307)),ace.config.setModuleUrl("ace/mode/coffee",t(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",t(82540)),ace.config.setModuleUrl("ace/mode/crystal",t(70162)),ace.config.setModuleUrl("ace/mode/csharp",t(86173)),ace.config.setModuleUrl("ace/mode/csound_document",t(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",t(54722)),ace.config.setModuleUrl("ace/mode/csound_score",t(48055)),ace.config.setModuleUrl("ace/mode/csp",t(61634)),ace.config.setModuleUrl("ace/mode/css",t(59119)),ace.config.setModuleUrl("ace/mode/curly",t(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",t(34379)),ace.config.setModuleUrl("ace/mode/d",t(48656)),ace.config.setModuleUrl("ace/mode/dart",t(1647)),ace.config.setModuleUrl("ace/mode/diff",t(30365)),ace.config.setModuleUrl("ace/mode/django",t(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",t(62136)),ace.config.setModuleUrl("ace/mode/dot",t(40631)),ace.config.setModuleUrl("ace/mode/drools",t(36363)),ace.config.setModuleUrl("ace/mode/edifact",t(19906)),ace.config.setModuleUrl("ace/mode/eiffel",t(61933)),ace.config.setModuleUrl("ace/mode/ejs",t(78924)),ace.config.setModuleUrl("ace/mode/elixir",t(91429)),ace.config.setModuleUrl("ace/mode/elm",t(98664)),ace.config.setModuleUrl("ace/mode/erlang",t(18885)),ace.config.setModuleUrl("ace/mode/flix",t(98513)),ace.config.setModuleUrl("ace/mode/forth",t(50379)),ace.config.setModuleUrl("ace/mode/fortran",t(87166)),ace.config.setModuleUrl("ace/mode/fsharp",t(55288)),ace.config.setModuleUrl("ace/mode/fsl",t(96369)),ace.config.setModuleUrl("ace/mode/ftl",t(5474)),ace.config.setModuleUrl("ace/mode/gcode",t(39264)),ace.config.setModuleUrl("ace/mode/gherkin",t(67942)),ace.config.setModuleUrl("ace/mode/gitignore",t(37898)),ace.config.setModuleUrl("ace/mode/glsl",t(2474)),ace.config.setModuleUrl("ace/mode/gobstones",t(70154)),ace.config.setModuleUrl("ace/mode/golang",t(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",t(75542)),ace.config.setModuleUrl("ace/mode/groovy",t(50436)),ace.config.setModuleUrl("ace/mode/haml",t(63920)),ace.config.setModuleUrl("ace/mode/handlebars",t(51526)),ace.config.setModuleUrl("ace/mode/haskell",t(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",t(67784)),ace.config.setModuleUrl("ace/mode/haxe",t(81690)),ace.config.setModuleUrl("ace/mode/hjson",t(44406)),ace.config.setModuleUrl("ace/mode/html",t(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",t(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",t(76542)),ace.config.setModuleUrl("ace/mode/ini",t(88110)),ace.config.setModuleUrl("ace/mode/io",t(91930)),ace.config.setModuleUrl("ace/mode/ion",t(24958)),ace.config.setModuleUrl("ace/mode/jack",t(42901)),ace.config.setModuleUrl("ace/mode/jade",t(55300)),ace.config.setModuleUrl("ace/mode/java",t(29750)),ace.config.setModuleUrl("ace/mode/javascript",t(80437)),ace.config.setModuleUrl("ace/mode/jexl",t(62115)),ace.config.setModuleUrl("ace/mode/json",t(46544)),ace.config.setModuleUrl("ace/mode/json5",t(17965)),ace.config.setModuleUrl("ace/mode/jsoniq",t(78118)),ace.config.setModuleUrl("ace/mode/jsp",t(41705)),ace.config.setModuleUrl("ace/mode/jssm",t(22901)),ace.config.setModuleUrl("ace/mode/jsx",t(73937)),ace.config.setModuleUrl("ace/mode/julia",t(941)),ace.config.setModuleUrl("ace/mode/kotlin",t(86571)),ace.config.setModuleUrl("ace/mode/latex",t(30808)),ace.config.setModuleUrl("ace/mode/latte",t(2986)),ace.config.setModuleUrl("ace/mode/less",t(72799)),ace.config.setModuleUrl("ace/mode/liquid",t(95630)),ace.config.setModuleUrl("ace/mode/lisp",t(85950)),ace.config.setModuleUrl("ace/mode/livescript",t(74703)),ace.config.setModuleUrl("ace/mode/logiql",t(72094)),ace.config.setModuleUrl("ace/mode/logtalk",t(39512)),ace.config.setModuleUrl("ace/mode/lsl",t(94275)),ace.config.setModuleUrl("ace/mode/lua",t(46890)),ace.config.setModuleUrl("ace/mode/luapage",t(81029)),ace.config.setModuleUrl("ace/mode/lucene",t(7616)),ace.config.setModuleUrl("ace/mode/makefile",t(77882)),ace.config.setModuleUrl("ace/mode/markdown",t(21459)),ace.config.setModuleUrl("ace/mode/mask",t(54050)),ace.config.setModuleUrl("ace/mode/matlab",t(35907)),ace.config.setModuleUrl("ace/mode/maze",t(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",t(72268)),ace.config.setModuleUrl("ace/mode/mel",t(66018)),ace.config.setModuleUrl("ace/mode/mips",t(20617)),ace.config.setModuleUrl("ace/mode/mixal",t(98667)),ace.config.setModuleUrl("ace/mode/mushcode",t(61026)),ace.config.setModuleUrl("ace/mode/mysql",t(21630)),ace.config.setModuleUrl("ace/mode/nasal",t(23523)),ace.config.setModuleUrl("ace/mode/nginx",t(16788)),ace.config.setModuleUrl("ace/mode/nim",t(31900)),ace.config.setModuleUrl("ace/mode/nix",t(6135)),ace.config.setModuleUrl("ace/mode/nsis",t(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",t(51481)),ace.config.setModuleUrl("ace/mode/objectivec",t(75466)),ace.config.setModuleUrl("ace/mode/ocaml",t(49088)),ace.config.setModuleUrl("ace/mode/odin",t(5610)),ace.config.setModuleUrl("ace/mode/partiql",t(76557)),ace.config.setModuleUrl("ace/mode/pascal",t(80694)),ace.config.setModuleUrl("ace/mode/perl",t(7135)),ace.config.setModuleUrl("ace/mode/pgsql",t(55707)),ace.config.setModuleUrl("ace/mode/php",t(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",t(49935)),ace.config.setModuleUrl("ace/mode/pig",t(7124)),ace.config.setModuleUrl("ace/mode/plain_text",t(92868)),ace.config.setModuleUrl("ace/mode/plsql",t(24808)),ace.config.setModuleUrl("ace/mode/powershell",t(77823)),ace.config.setModuleUrl("ace/mode/praat",t(46124)),ace.config.setModuleUrl("ace/mode/prisma",t(18114)),ace.config.setModuleUrl("ace/mode/prolog",t(35061)),ace.config.setModuleUrl("ace/mode/properties",t(56059)),ace.config.setModuleUrl("ace/mode/protobuf",t(86305)),ace.config.setModuleUrl("ace/mode/prql",t(58317)),ace.config.setModuleUrl("ace/mode/puppet",t(85804)),ace.config.setModuleUrl("ace/mode/python",t(51652)),ace.config.setModuleUrl("ace/mode/qml",t(11038)),ace.config.setModuleUrl("ace/mode/r",t(438)),ace.config.setModuleUrl("ace/mode/raku",t(4847)),ace.config.setModuleUrl("ace/mode/razor",t(67300)),ace.config.setModuleUrl("ace/mode/rdoc",t(6430)),ace.config.setModuleUrl("ace/mode/red",t(85347)),ace.config.setModuleUrl("ace/mode/redshift",t(36975)),ace.config.setModuleUrl("ace/mode/rhtml",t(7047)),ace.config.setModuleUrl("ace/mode/robot",t(66276)),ace.config.setModuleUrl("ace/mode/rst",t(8781)),ace.config.setModuleUrl("ace/mode/ruby",t(334)),ace.config.setModuleUrl("ace/mode/rust",t(43292)),ace.config.setModuleUrl("ace/mode/sac",t(26329)),ace.config.setModuleUrl("ace/mode/sass",t(52748)),ace.config.setModuleUrl("ace/mode/scad",t(46193)),ace.config.setModuleUrl("ace/mode/scala",t(19366)),ace.config.setModuleUrl("ace/mode/scheme",t(81413)),ace.config.setModuleUrl("ace/mode/scrypt",t(70877)),ace.config.setModuleUrl("ace/mode/scss",t(55146)),ace.config.setModuleUrl("ace/mode/sh",t(77105)),ace.config.setModuleUrl("ace/mode/sjs",t(16042)),ace.config.setModuleUrl("ace/mode/slim",t(58715)),ace.config.setModuleUrl("ace/mode/smarty",t(48146)),ace.config.setModuleUrl("ace/mode/smithy",t(75144)),ace.config.setModuleUrl("ace/mode/snippets",t(33124)),ace.config.setModuleUrl("ace/mode/soy_template",t(23446)),ace.config.setModuleUrl("ace/mode/space",t(29582)),ace.config.setModuleUrl("ace/mode/sparql",t(4911)),ace.config.setModuleUrl("ace/mode/sql",t(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",t(19771)),ace.config.setModuleUrl("ace/mode/stylus",t(60940)),ace.config.setModuleUrl("ace/mode/svg",t(68506)),ace.config.setModuleUrl("ace/mode/swift",t(39215)),ace.config.setModuleUrl("ace/mode/tcl",t(54987)),ace.config.setModuleUrl("ace/mode/terraform",t(31372)),ace.config.setModuleUrl("ace/mode/tex",t(63609)),ace.config.setModuleUrl("ace/mode/text",t(12585)),ace.config.setModuleUrl("ace/mode/textile",t(29541)),ace.config.setModuleUrl("ace/mode/toml",t(69774)),ace.config.setModuleUrl("ace/mode/tsx",t(53135)),ace.config.setModuleUrl("ace/mode/turtle",t(12476)),ace.config.setModuleUrl("ace/mode/twig",t(71255)),ace.config.setModuleUrl("ace/mode/typescript",t(5397)),ace.config.setModuleUrl("ace/mode/vala",t(98124)),ace.config.setModuleUrl("ace/mode/vbscript",t(70801)),ace.config.setModuleUrl("ace/mode/velocity",t(33189)),ace.config.setModuleUrl("ace/mode/verilog",t(36982)),ace.config.setModuleUrl("ace/mode/vhdl",t(98256)),ace.config.setModuleUrl("ace/mode/visualforce",t(7335)),ace.config.setModuleUrl("ace/mode/vue",t(2256)),ace.config.setModuleUrl("ace/mode/wollok",t(29446)),ace.config.setModuleUrl("ace/mode/xml",t(93489)),ace.config.setModuleUrl("ace/mode/xquery",t(27174)),ace.config.setModuleUrl("ace/mode/yaml",t(32113)),ace.config.setModuleUrl("ace/mode/zeek",t(38035)),ace.config.setModuleUrl("ace/mode/zig",t(86882)),ace.config.setModuleUrl("ace/theme/ambiance",t(7890)),ace.config.setModuleUrl("ace/theme/chaos",t(40156)),ace.config.setModuleUrl("ace/theme/chrome",t(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",t(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",t(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",t(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",t(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",t(93008)),ace.config.setModuleUrl("ace/theme/clouds",t(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",t(54131)),ace.config.setModuleUrl("ace/theme/cobalt",t(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",t(63553)),ace.config.setModuleUrl("ace/theme/dawn",t(58732)),ace.config.setModuleUrl("ace/theme/dracula",t(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",t(71791)),ace.config.setModuleUrl("ace/theme/eclipse",t(28409)),ace.config.setModuleUrl("ace/theme/github",t(28573)),ace.config.setModuleUrl("ace/theme/github_dark",t(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",t(50836)),ace.config.setModuleUrl("ace/theme/gob",t(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",t(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",t(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",t(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",t(46925)),ace.config.setModuleUrl("ace/theme/iplastic",t(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",t(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",t(67773)),ace.config.setModuleUrl("ace/theme/kuroir",t(78990)),ace.config.setModuleUrl("ace/theme/merbivore",t(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",t(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",t(61343)),ace.config.setModuleUrl("ace/theme/monokai",t(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",t(63554)),ace.config.setModuleUrl("ace/theme/one_dark",t(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",t(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",t(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",t(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",t(14995)),ace.config.setModuleUrl("ace/theme/terminal",t(91493)),ace.config.setModuleUrl("ace/theme/textmate",t(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",t(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",t(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",t(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",t(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",t(59069)),ace.config.setModuleUrl("ace/theme/twilight",t(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",t(26689)),ace.config.setModuleUrl("ace/theme/xcode",t(26433)),ace.config.setModuleUrl("ace/mode/base_worker",t(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",t(74901)),ace.config.setModuleUrl("ace/mode/css_worker",t(88494)),ace.config.setModuleUrl("ace/mode/html_worker",t(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",t(7182)),ace.config.setModuleUrl("ace/mode/json_worker",t(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",t(55639)),ace.config.setModuleUrl("ace/mode/php_worker",t(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",t(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",t(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",t(67782)),ace.config.setModuleUrl("ace/snippets/abap",t(57909)),ace.config.setModuleUrl("ace/snippets/abc",t(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",t(63178)),ace.config.setModuleUrl("ace/snippets/ada",t(70563)),ace.config.setModuleUrl("ace/snippets/alda",t(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",t(53290)),ace.config.setModuleUrl("ace/snippets/apex",t(64691)),ace.config.setModuleUrl("ace/snippets/applescript",t(86568)),ace.config.setModuleUrl("ace/snippets/aql",t(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",t(64428)),ace.config.setModuleUrl("ace/snippets/asl",t(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",t(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",t(54726)),ace.config.setModuleUrl("ace/snippets/astro",t(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",t(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",t(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",t(34929)),ace.config.setModuleUrl("ace/snippets/c9search",t(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",t(51824)),ace.config.setModuleUrl("ace/snippets/cirru",t(90368)),ace.config.setModuleUrl("ace/snippets/clojure",t(70819)),ace.config.setModuleUrl("ace/snippets/cobol",t(10232)),ace.config.setModuleUrl("ace/snippets/coffee",t(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",t(71241)),ace.config.setModuleUrl("ace/snippets/crystal",t(94925)),ace.config.setModuleUrl("ace/snippets/csharp",t(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",t(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",t(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",t(46326)),ace.config.setModuleUrl("ace/snippets/csp",t(3029)),ace.config.setModuleUrl("ace/snippets/css",t(21452)),ace.config.setModuleUrl("ace/snippets/curly",t(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",t(46790)),ace.config.setModuleUrl("ace/snippets/d",t(32803)),ace.config.setModuleUrl("ace/snippets/dart",t(48138)),ace.config.setModuleUrl("ace/snippets/diff",t(54060)),ace.config.setModuleUrl("ace/snippets/django",t(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",t(58661)),ace.config.setModuleUrl("ace/snippets/dot",t(38180)),ace.config.setModuleUrl("ace/snippets/drools",t(53542)),ace.config.setModuleUrl("ace/snippets/edifact",t(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",t(71020)),ace.config.setModuleUrl("ace/snippets/ejs",t(78027)),ace.config.setModuleUrl("ace/snippets/elixir",t(81672)),ace.config.setModuleUrl("ace/snippets/elm",t(20259)),ace.config.setModuleUrl("ace/snippets/erlang",t(80564)),ace.config.setModuleUrl("ace/snippets/flix",t(38984)),ace.config.setModuleUrl("ace/snippets/forth",t(50528)),ace.config.setModuleUrl("ace/snippets/fortran",t(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",t(60317)),ace.config.setModuleUrl("ace/snippets/fsl",t(60470)),ace.config.setModuleUrl("ace/snippets/ftl",t(64093)),ace.config.setModuleUrl("ace/snippets/gcode",t(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",t(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",t(51069)),ace.config.setModuleUrl("ace/snippets/glsl",t(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",t(19433)),ace.config.setModuleUrl("ace/snippets/golang",t(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",t(90933)),ace.config.setModuleUrl("ace/snippets/groovy",t(28101)),ace.config.setModuleUrl("ace/snippets/haml",t(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",t(63083)),ace.config.setModuleUrl("ace/snippets/haskell",t(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",t(11831)),ace.config.setModuleUrl("ace/snippets/haxe",t(71443)),ace.config.setModuleUrl("ace/snippets/hjson",t(70389)),ace.config.setModuleUrl("ace/snippets/html",t(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",t(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",t(42201)),ace.config.setModuleUrl("ace/snippets/ini",t(36453)),ace.config.setModuleUrl("ace/snippets/io",t(93307)),ace.config.setModuleUrl("ace/snippets/ion",t(4345)),ace.config.setModuleUrl("ace/snippets/jack",t(37832)),ace.config.setModuleUrl("ace/snippets/jade",t(17469)),ace.config.setModuleUrl("ace/snippets/java",t(44967)),ace.config.setModuleUrl("ace/snippets/javascript",t(64472)),ace.config.setModuleUrl("ace/snippets/jexl",t(63542)),ace.config.setModuleUrl("ace/snippets/json",t(50165)),ace.config.setModuleUrl("ace/snippets/json5",t(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",t(60927)),ace.config.setModuleUrl("ace/snippets/jsp",t(36142)),ace.config.setModuleUrl("ace/snippets/jssm",t(44592)),ace.config.setModuleUrl("ace/snippets/jsx",t(33158)),ace.config.setModuleUrl("ace/snippets/julia",t(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",t(94158)),ace.config.setModuleUrl("ace/snippets/latex",t(1075)),ace.config.setModuleUrl("ace/snippets/latte",t(46769)),ace.config.setModuleUrl("ace/snippets/less",t(52466)),ace.config.setModuleUrl("ace/snippets/liquid",t(27191)),ace.config.setModuleUrl("ace/snippets/lisp",t(63635)),ace.config.setModuleUrl("ace/snippets/livescript",t(41122)),ace.config.setModuleUrl("ace/snippets/logiql",t(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",t(27299)),ace.config.setModuleUrl("ace/snippets/lsl",t(38552)),ace.config.setModuleUrl("ace/snippets/lua",t(67401)),ace.config.setModuleUrl("ace/snippets/luapage",t(57030)),ace.config.setModuleUrl("ace/snippets/lucene",t(95437)),ace.config.setModuleUrl("ace/snippets/makefile",t(63275)),ace.config.setModuleUrl("ace/snippets/markdown",t(81586)),ace.config.setModuleUrl("ace/snippets/mask",t(49087)),ace.config.setModuleUrl("ace/snippets/matlab",t(65946)),ace.config.setModuleUrl("ace/snippets/maze",t(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",t(29999)),ace.config.setModuleUrl("ace/snippets/mel",t(17417)),ace.config.setModuleUrl("ace/snippets/mips",t(74332)),ace.config.setModuleUrl("ace/snippets/mixal",t(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",t(31539)),ace.config.setModuleUrl("ace/snippets/mysql",t(59577)),ace.config.setModuleUrl("ace/snippets/nasal",t(49224)),ace.config.setModuleUrl("ace/snippets/nginx",t(82227)),ace.config.setModuleUrl("ace/snippets/nim",t(93243)),ace.config.setModuleUrl("ace/snippets/nix",t(72152)),ace.config.setModuleUrl("ace/snippets/nsis",t(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",t(81136)),ace.config.setModuleUrl("ace/snippets/objectivec",t(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",t(96183)),ace.config.setModuleUrl("ace/snippets/odin",t(91983)),ace.config.setModuleUrl("ace/snippets/partiql",t(78106)),ace.config.setModuleUrl("ace/snippets/pascal",t(79323)),ace.config.setModuleUrl("ace/snippets/perl",t(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",t(98692)),ace.config.setModuleUrl("ace/snippets/php",t(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",t(43416)),ace.config.setModuleUrl("ace/snippets/pig",t(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",t(91365)),ace.config.setModuleUrl("ace/snippets/plsql",t(18423)),ace.config.setModuleUrl("ace/snippets/powershell",t(41273)),ace.config.setModuleUrl("ace/snippets/praat",t(8711)),ace.config.setModuleUrl("ace/snippets/prisma",t(87915)),ace.config.setModuleUrl("ace/snippets/prolog",t(58432)),ace.config.setModuleUrl("ace/snippets/properties",t(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",t(93932)),ace.config.setModuleUrl("ace/snippets/prql",t(79240)),ace.config.setModuleUrl("ace/snippets/puppet",t(35129)),ace.config.setModuleUrl("ace/snippets/python",t(54309)),ace.config.setModuleUrl("ace/snippets/qml",t(31005)),ace.config.setModuleUrl("ace/snippets/r",t(55961)),ace.config.setModuleUrl("ace/snippets/raku",t(42950)),ace.config.setModuleUrl("ace/snippets/razor",t(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",t(62535)),ace.config.setModuleUrl("ace/snippets/red",t(13500)),ace.config.setModuleUrl("ace/snippets/redshift",t(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",t(84064)),ace.config.setModuleUrl("ace/snippets/robot",t(61111)),ace.config.setModuleUrl("ace/snippets/rst",t(43530)),ace.config.setModuleUrl("ace/snippets/ruby",t(12767)),ace.config.setModuleUrl("ace/snippets/rust",t(36729)),ace.config.setModuleUrl("ace/snippets/sac",t(37506)),ace.config.setModuleUrl("ace/snippets/sass",t(82737)),ace.config.setModuleUrl("ace/snippets/scad",t(35400)),ace.config.setModuleUrl("ace/snippets/scala",t(92945)),ace.config.setModuleUrl("ace/snippets/scheme",t(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",t(64128)),ace.config.setModuleUrl("ace/snippets/scss",t(48387)),ace.config.setModuleUrl("ace/snippets/sh",t(13176)),ace.config.setModuleUrl("ace/snippets/sjs",t(68801)),ace.config.setModuleUrl("ace/snippets/slim",t(93390)),ace.config.setModuleUrl("ace/snippets/smarty",t(67831)),ace.config.setModuleUrl("ace/snippets/smithy",t(34577)),ace.config.setModuleUrl("ace/snippets/snippets",t(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",t(93779)),ace.config.setModuleUrl("ace/snippets/space",t(50673)),ace.config.setModuleUrl("ace/snippets/sparql",t(38842)),ace.config.setModuleUrl("ace/snippets/sql",t(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",t(56420)),ace.config.setModuleUrl("ace/snippets/stylus",t(3309)),ace.config.setModuleUrl("ace/snippets/svg",t(82161)),ace.config.setModuleUrl("ace/snippets/swift",t(41200)),ace.config.setModuleUrl("ace/snippets/tcl",t(32384)),ace.config.setModuleUrl("ace/snippets/terraform",t(75607)),ace.config.setModuleUrl("ace/snippets/tex",t(6874)),ace.config.setModuleUrl("ace/snippets/text",t(54012)),ace.config.setModuleUrl("ace/snippets/textile",t(93878)),ace.config.setModuleUrl("ace/snippets/toml",t(49599)),ace.config.setModuleUrl("ace/snippets/tsx",t(22028)),ace.config.setModuleUrl("ace/snippets/turtle",t(86333)),ace.config.setModuleUrl("ace/snippets/twig",t(11078)),ace.config.setModuleUrl("ace/snippets/typescript",t(40344)),ace.config.setModuleUrl("ace/snippets/vala",t(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",t(5368)),ace.config.setModuleUrl("ace/snippets/velocity",t(4896)),ace.config.setModuleUrl("ace/snippets/verilog",t(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",t(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",t(82036)),ace.config.setModuleUrl("ace/snippets/vue",t(36751)),ace.config.setModuleUrl("ace/snippets/wollok",t(12463)),ace.config.setModuleUrl("ace/snippets/xml",t(65690)),ace.config.setModuleUrl("ace/snippets/xquery",t(84835)),ace.config.setModuleUrl("ace/snippets/yaml",t(46716)),ace.config.setModuleUrl("ace/snippets/zeek",t(51174)),ace.config.setModuleUrl("ace/snippets/zig",t(64865))},63282(e,n,t){"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 D=t(4042),S=t(86144),a=t(36653),r=t(72079),o=["/properties"],i="http://json-schema.org/draft-07/schema";class g extends D.default{_addVocabularies(){super._addVocabularies(),S.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(r,o):r;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}n.Ajv=g,e.exports=n=g,e.exports.Ajv=g,Object.defineProperty(n,"__esModule",{value:!0}),n.default=g;var s=t(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var l=t(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 d=t(13558);Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return d.default}});var c=t(34551);Object.defineProperty(n,"MissingRefError",{enumerable:!0,get:function(){return c.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 t{}n._CodeOrName=t,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class D extends t{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=D;class S extends t{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 D&&(e[n.str]=(e[n.str]||0)+1),e),{})}}function a(e,...n){let t=[e[0]],D=0;for(;D<n.length;)i(t,n[D]),t.push(e[++D]);return new S(t)}n._Code=S,n.nil=new S(""),n._=a;let r=new S("+");function o(e,...n){let t=[d(e[0])],D=0;for(;D<n.length;)t.push(r),i(t,n[D]),t.push(r,d(e[++D]));return g(t),new S(t)}function i(e,n){n instanceof S?e.push(...n._items):n instanceof D?e.push(n):e.push(l(n))}function g(e){let n=1;for(;n<e.length-1;){if(e[n]===r){let t=s(e[n-1],e[n+1]);if(void 0!==t){e.splice(n-1,3,t);continue}e[n++]="+"}n++}}function s(e,n){return'""'===n?e:'""'===e?n:"string"==typeof e?n instanceof D||'"'!==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 D?void 0:`"${e}${n.slice(1)}`}function l(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:d(Array.isArray(e)?e.join(","):e)}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c(e){return"string"==typeof e&&n.IDENTIFIER.test(e)?new S(`.${e}`):a`[${e}]`}function u(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=i,n.strConcat=function(e,n){return n.emptyStr()?e:e.emptyStr()?n:o`${e}${n}`},n.stringify=function(e){return new S(d(e))},n.safeStringify=d,n.getProperty=c,n.getEsmExportName=u,n.regexpCode=function(e){return new S(e.toString())}},99029(e,n,t){"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 D=t(41520),S=t(57845);var a=t(41520);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(n,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(n,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(n,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return a.Name}});var r=t(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 D._Code(">"),GTE:new D._Code(">="),LT:new D._Code("<"),LTE:new D._Code("<="),EQ:new D._Code("==="),NEQ:new D._Code("!=="),NOT:new D._Code("!"),OR:new D._Code("||"),AND:new D._Code("&&"),ADD:new D._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,n){return this}}class i extends o{constructor(e,n,t){super(),this.varKind=e,this.name=n,this.rhs=t}render({es5:e,_n:n}){let t=e?S.varKinds.var:this.varKind,D=void 0===this.rhs?"":` = ${this.rhs}`;return`${t} ${this.name}${D};`+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 D._CodeOrName?this.rhs.names:{}}}class g extends o{constructor(e,n,t){super(),this.lhs=e,this.rhs=n,this.sideEffects=t}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof D.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=T(this.rhs,e,n),this}get names(){return E(this.lhs instanceof D.Name?{}:{...this.lhs.names},this.rhs)}}class s extends g{constructor(e,n,t,D){super(e,t,D),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 d extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let n=this.label?` ${this.label}`:"";return`break${n};`+e}}class c extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class u 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 D._CodeOrName?this.code.names:{}}}class f extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,t)=>n+t.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let t=e[n].optimizeNodes();Array.isArray(t)?e.splice(n,1,...t):t?e[n]=t:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:t}=this,D=t.length;for(;D--;){let S=t[D];S.optimizeNames(e,n)||(O(e,S.names),t.splice(D,1))}return t.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>k(e,n.names),{})}}class h extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class p extends f{}class m extends h{}m.kind="else";class y extends h{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 t;if(this.else=null==(t=this.else)?void 0:t.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 E(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class b extends h{}b.kind="for";class v extends b{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 $ extends b{constructor(e,n,t,D){super(),this.varKind=e,this.name=n,this.from=t,this.to=D}render(e){let n=e.es5?S.varKinds.var:this.varKind,{name:t,from:D,to:a}=this;return`for(${n} ${t}=${D}; ${t}<${a}; ${t}++)`+super.render(e)}get names(){let e=E(super.names,this.from);return E(e,this.to)}}class w extends b{constructor(e,n,t,D){super(),this.loop=e,this.varKind=n,this.name=t,this.iterable=D}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 _ extends h{constructor(e,n,t){super(),this.name=e,this.args=n,this.async=t}render(e){let n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class A extends f{render(e){return"return "+super.render(e)}}A.kind="return";class M extends h{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 t,D;return super.optimizeNames(e,n),null==(t=this.catch)||t.optimizeNames(e,n),null==(D=this.finally)||D.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 h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class L extends h{render(e){return"finally"+super.render(e)}}L.kind="finally";class C{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 p]}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 t=this._extScope.value(e,n);return(this._values[t.prefix]||(this._values[t.prefix]=new Set)).add(t),t}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,t,D){let S=this._scope.toName(n);return void 0!==t&&D&&(this._constants[S.str]=t),this._leafNode(new i(e,S,t)),S}const(e,n,t){return this._def(S.varKinds.const,e,n,t)}let(e,n,t){return this._def(S.varKinds.let,e,n,t)}var(e,n,t){return this._def(S.varKinds.var,e,n,t)}assign(e,n,t){return this._leafNode(new g(e,n,t))}add(e,t){return this._leafNode(new s(e,n.operators.ADD,t))}code(e){return"function"==typeof e?e():e!==D.nil&&this._leafNode(new u(e)),this}object(...e){let n=["{"];for(let[t,S]of e)n.length>1&&n.push(","),n.push(t),(t!==S||this.opts.es5)&&(n.push(":"),(0,D.addCodeArg)(n,S));return n.push("}"),new D._Code(n)}if(e,n,t){if(this._blockNode(new y(e)),n&&t)this.code(n).else().code(t).endIf();else if(n)this.code(n).endIf();else if(t)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 v(e),n)}forRange(e,n,t,D,a=this.opts.es5?S.varKinds.var:S.varKinds.let){let r=this._scope.toName(e);return this._for(new $(a,r,n,t),()=>D(r))}forOf(e,n,t,a=S.varKinds.const){let r=this._scope.toName(e);if(this.opts.es5){let e=n instanceof D.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,D._)`${e}.length`,n=>{this.var(r,(0,D._)`${e}[${n}]`),t(r)})}return this._for(new w("of",a,r,n),()=>t(r))}forIn(e,n,t,a=this.opts.es5?S.varKinds.var:S.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,D._)`Object.keys(${n})`,t);let r=this._scope.toName(e);return this._for(new w("in",a,r,n),()=>t(r))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){let n=new A;if(this._blockNode(n),this.code(e),1!==n.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(e,n,t){if(!n&&!t)throw Error('CodeGen: "try" without "catch" and "finally"');let D=new M;if(this._blockNode(D),this.code(e),n){let e=this.name("e");this._currNode=D.catch=new x(e),n(e)}return t&&(this._currNode=D.finally=new L,this.code(t)),this._endBlockNode(x,L)}throw(e){return this._leafNode(new c(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 t=this._nodes.length-n;if(t<0||void 0!==e&&t!==e)throw Error(`CodeGen: wrong number of nodes: ${t} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=D.nil,t,S){return this._blockNode(new _(e,n,t)),S&&this.code(S).endFunc(),this}endFunc(){return this._endBlockNode(_)}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 t=this._currNode;if(t instanceof e||n&&t 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 t in n)e[t]=(e[t]||0)+(n[t]||0);return e}function E(e,n){return n instanceof D._CodeOrName?k(e,n.names):e}function T(e,n,t){if(e instanceof D.Name)return S(e);if(!a(e))return e;return new D._Code(e._items.reduce((e,n)=>(n instanceof D.Name&&(n=S(n)),n instanceof D._Code?e.push(...n._items):e.push(n),e),[]));function S(e){let D=t[e.str];return void 0===D||1!==n[e.str]?e:(delete n[e.str],D)}function a(e){return e instanceof D._Code&&e._items.some(e=>e instanceof D.Name&&1===n[e.str]&&void 0!==t[e.str])}}function O(e,n){for(let t in n)e[t]=(e[t]||0)-(n[t]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,D._)`!${P(e)}`}n.CodeGen=C,n.not=R;let I=j(n.operators.AND);n.and=function(...e){return e.reduce(I)};let N=j(n.operators.OR);function j(e){return(n,t)=>n===D.nil?t:t===D.nil?n:(0,D._)`${P(n)} ${e} ${P(t)}`}function P(e){return e instanceof D.Name?e:(0,D._)`(${e})`}n.or=function(...e){return e.reduce(N)}},57845(e,n,t){"use strict";var D;Object.defineProperty(n,"__esModule",{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;let S=t(41520);class a 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"}(D||(n.UsedValueState=D={})),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,t;if((null==(t=null==(n=this._parent)?void 0:n._prefixes)?void 0:t.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:t}){this.value=e,this.scopePath=(0,S._)`.${new S.Name(n)}[${t}]`}}n.ValueScopeName=o;let i=(0,S._)`\n`;class g extends r{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:S.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,n){var t;if(void 0===n.ref)throw Error("CodeGen: ref must be passed in value");let D=this.toName(e),{prefix:S}=D,a=null!=(t=n.key)?t:n.ref,r=this._values[S];if(r){let e=r.get(a);if(e)return e}else r=this._values[S]=new Map;r.set(a,D);let o=this._scope[S]||(this._scope[S]=[]),i=o.length;return o[i]=n.ref,D.setValue(n,{property:S,itemIndex:i}),D}getValue(e,n){let t=this._values[e];if(t)return t.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,t){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},n,t)}_reduceValues(e,t,r={},o){let i=S.nil;for(let g in e){let s=e[g];if(!s)continue;let l=r[g]=r[g]||new Map;s.forEach(e=>{if(l.has(e))return;l.set(e,D.Started);let r=t(e);if(r){let t=this.opts.es5?n.varKinds.var:n.varKinds.const;i=(0,S._)`${i}${t} ${e} = ${r};${this.opts._n}`}else if(r=null==o?void 0:o(e))i=(0,S._)`${i}${r}${this.opts._n}`;else throw new a(e);l.set(e,D.Completed)})}return i}}n.ValueScope=g},48708(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;let D=t(99029),S=t(94227),a=t(42023);function r(e,t=n.keywordError,S,a){let{it:o}=e,{gen:s,compositeRule:d,allErrors:c}=o,u=l(e,t,S);(null!=a?a:d||c)?i(s,u):g(o,(0,D._)`[${u}]`)}function o(e,t=n.keywordError,D){let{it:S}=e,{gen:r,compositeRule:s,allErrors:d}=S;i(r,l(e,t,D)),s||d||g(S,a.default.vErrors)}function i(e,n){let t=e.const("err",n);e.if((0,D._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,D._)`[${t}]`),(0,D._)`${a.default.vErrors}.push(${t})`),e.code((0,D._)`${a.default.errors}++`)}function g(e,n){let{gen:t,validateName:S,schemaEnv:a}=e;a.$async?t.throw((0,D._)`new ${e.ValidationError}(${n})`):(t.assign((0,D._)`${S}.errors`,n),t.return(!1))}n.keywordError={message:({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`},n.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,D.str)`"${e}" keyword must be ${n} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`},n.reportError=r,n.reportExtraError=o,n.resetErrorsCount=function(e,n){e.assign(a.default.errors,n),e.if((0,D._)`${a.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,D._)`${a.default.vErrors}.length`,n),()=>e.assign(a.default.vErrors,null)))},n.extendErrors=function({gen:e,keyword:n,schemaValue:t,data:S,errsCount:r,it:o}){if(void 0===r)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",r,a.default.errors,r=>{e.const(i,(0,D._)`${a.default.vErrors}[${r}]`),e.if((0,D._)`${i}.instancePath === undefined`,()=>e.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(a.default.instancePath,o.errorPath))),e.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${o.errSchemaPath}/${n}`),o.opts.verbose&&(e.assign((0,D._)`${i}.schema`,t),e.assign((0,D._)`${i}.data`,S))})};let s={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function l(e,n,t){let{createErrors:S}=e.it;return!1===S?(0,D._)`{}`:d(e,n,t)}function d(e,n,t={}){let{gen:D,it:S}=e,a=[c(S,t),u(e,t)];return f(e,n,a),D.object(...a)}function c({errorPath:e},{instancePath:n}){let t=n?(0,D.str)`${e}${(0,S.getErrorPath)(n,S.Type.Str)}`:e;return[a.default.instancePath,(0,D.strConcat)(a.default.instancePath,t)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:t,parentSchema:a}){let r=a?n:(0,D.str)`${n}/${e}`;return t&&(r=(0,D.str)`${r}${(0,S.getErrorPath)(t,S.Type.Str)}`),[s.schemaPath,r]}function f(e,{params:n,message:t},S){let{keyword:r,data:o,schemaValue:i,it:g}=e,{opts:l,propertyName:d,topSchemaRef:c,schemaPath:u}=g;S.push([s.keyword,r],[s.params,"function"==typeof n?n(e):n||(0,D._)`{}`]),l.messages&&S.push([s.message,"function"==typeof t?t(e):t]),l.verbose&&S.push([s.schema,i],[s.parentSchema,(0,D._)`${c}${u}`],[a.default.data,o]),d&&S.push([s.propertyName,d])}},73835(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;let D=t(99029),S=t(13558),a=t(42023),r=t(66939),o=t(94227),i=t(62586);class g{constructor(e){var n;let t;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(t=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==t?void 0:t[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==t?void 0:t.$async,this.refs={}}}function s(e){let n,t,o=d.call(this,e);if(o)return o;let g=(0,r.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:s,lines:l}=this.opts.code,{ownProperties:c}=this.opts,u=new D.CodeGen(this.scope,{es5:s,lines:l,ownProperties:c});e.$async&&(n=u.scopeValue("Error",{ref:S.default,code:(0,D._)`require("ajv/dist/runtime/validation_error").default`}));let f=u.scopeName("validate");e.validateName=f;let h={gen:u,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[D.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,D.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:g,baseId:e.baseId||g,schemaPath:D.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,D._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,i.validateFunctionCode)(h),u.optimize(this.opts.code.optimize);let n=u.toString();t=`${u.scopeRefs(a.default.scope)}return ${n}`,this.opts.code.process&&(t=this.opts.code.process(t,e));let S=Function(`${a.default.self}`,`${a.default.scope}`,t)(this,this.scope.get());if(this.scope.value(f,{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:f,validateCode:n,scopeValues:u._values}),this.opts.unevaluated){let{props:e,items:n}=h;S.evaluated={props:e instanceof D.Name?void 0:e,items:n instanceof D.Name?void 0:n,dynamicProps:e instanceof D.Name,dynamicItems:n instanceof D.Name},S.source&&(S.source.evaluated=(0,D.stringify)(S.evaluated))}return e.validate=S,e}catch(n){throw delete e.validate,delete e.validateName,t&&this.logger.error("Error compiling schema, function code:",t),n}finally{this._compilations.delete(e)}}function l(e){return(0,r.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:s.call(this,e)}function d(e){for(let n of this._compilations)if(c(n,e))return n}function c(e,n){return e.schema===n.schema&&e.root===n.root&&e.baseId===n.baseId}function u(e,n){let t;for(;"string"==typeof(t=this.refs[n]);)n=t;return t||this.schemas[n]||f.call(this,e,n)}function f(e,n){let t=this.opts.uriResolver.parse(n),D=(0,r._getFullPath)(this.opts.uriResolver,t),S=(0,r.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&D===S)return p.call(this,t,e);let a=(0,r.normalizeId)(D),o=this.refs[a]||this.schemas[a];if("string"==typeof o){let n=f.call(this,e,o);if("object"!=typeof(null==n?void 0:n.schema))return;return p.call(this,t,n)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||s.call(this,o),a===(0,r.normalizeId)(n)){let{schema:n}=o,{schemaId:t}=this.opts,D=n[t];return D&&(S=(0,r.resolveUrl)(this.opts.uriResolver,S,D)),new g({schema:n,schemaId:t,root:e,baseId:S})}return p.call(this,t,o)}}n.SchemaEnv=g,n.compileSchema=s,n.resolveRef=function(e,n,t){var D;t=(0,r.resolveUrl)(this.opts.uriResolver,n,t);let S=e.refs[t];if(S)return S;let a=u.call(this,e,t);if(void 0===a){let S=null==(D=e.localRefs)?void 0:D[t],{schemaId:r}=this.opts;S&&(a=new g({schema:S,schemaId:r,root:e,baseId:n}))}if(void 0!==a)return e.refs[t]=l.call(this,a)},n.getCompilingSchema=d,n.resolveSchema=f;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function p(e,{baseId:n,schema:t,root:D}){var S;let a;if((null==(S=e.fragment)?void 0:S[0])!=="/")return;for(let D of e.fragment.slice(1).split("/")){if("boolean"==typeof t)return;let e=t[(0,o.unescapeFragment)(D)];if(void 0===e)return;let S="object"==typeof(t=e)&&t[this.opts.schemaId];!h.has(D)&&S&&(n=(0,r.resolveUrl)(this.opts.uriResolver,n,S))}if("boolean"!=typeof t&&t.$ref&&!(0,o.schemaHasRulesButRef)(t,this.RULES)){let e=(0,r.resolveUrl)(this.opts.uriResolver,n,t.$ref);a=f.call(this,D,e)}let{schemaId:i}=this.opts;if((a=a||new g({schema:t,schemaId:i,root:D,baseId:n})).schema!==a.root.schema)return a}},42023(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(99029);n.default={data:new D.Name("data"),valCxt:new D.Name("valCxt"),instancePath:new D.Name("instancePath"),parentData:new D.Name("parentData"),parentDataProperty:new D.Name("parentDataProperty"),rootData:new D.Name("rootData"),dynamicAnchors:new D.Name("dynamicAnchors"),vErrors:new D.Name("vErrors"),errors:new D.Name("errors"),this:new D.Name("this"),self:new D.Name("self"),scope:new D.Name("scope"),json:new D.Name("json"),jsonPos:new D.Name("jsonPos"),jsonLen:new D.Name("jsonLen"),jsonPart:new D.Name("jsonPart")}},34551(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(66939);class S extends Error{constructor(e,n,t,S){super(S||`can't resolve reference ${t} from id ${n}`),this.missingRef=(0,D.resolveUrl)(e,n,t),this.missingSchema=(0,D.normalizeId)((0,D.getFullPath)(e,this.missingRef))}}n.default=S},66939(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;let D=t(94227),S=t(32017),a=t(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?!i(e):!!n&&g(e)<=n)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e){for(let n in e){if(o.has(n))return!0;let t=e[n];if(Array.isArray(t)&&t.some(i)||"object"==typeof t&&i(t))return!0}return!1}function g(e){let n=0;for(let t in e)if("$ref"===t||(n++,!r.has(t)&&("object"==typeof e[t]&&(0,D.eachItem)(e[t],e=>n+=g(e)),n===1/0)))return 1/0;return n}function s(e,n="",t){!1!==t&&(n=c(n));let D=e.parse(n);return l(e,D)}function l(e,n){return e.serialize(n).split("#")[0]+"#"}n.getFullPath=s,n._getFullPath=l;let d=/#\/?$/;function c(e){return e?e.replace(d,""):""}n.normalizeId=c,n.resolveUrl=function(e,n,t){return t=c(t),e.resolve(n,t)};let u=/^[a-z_][-a-z0-9._]*$/i;n.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};let{schemaId:t,uriResolver:D}=this.opts,r=c(e[t]||n),o={"":r},i=s(D,r,!1),g={},l=new Set;return a(e,{allKeys:!0},(e,n,D,S)=>{if(void 0===S)return;let a=i+n,r=o[S];function s(n){let t=this.opts.uriResolver.resolve;if(n=c(r?t(r,n):n),l.has(n))throw f(n);l.add(n);let D=this.refs[n];return"string"==typeof D&&(D=this.refs[D]),"object"==typeof D?d(e,D.schema,n):n!==c(a)&&("#"===n[0]?(d(e,g[n],n),g[n]=e):this.refs[n]=a),n}function h(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[t]&&(r=s.call(this,e[t])),h.call(this,e.$anchor),h.call(this,e.$dynamicAnchor),o[n]=r}),g;function d(e,n,t){if(void 0!==n&&!S(e,n))throw f(t)}function f(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 t=new Set(["string","number","integer","boolean","null","object","array"]);n.isJSONType=function(e){return"string"==typeof e&&t.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,t){"use strict";var D;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=t(99029),a=t(41520);function r(e,n=e.schema){let{opts:t,self:D}=e;if(!t.strictSchema||"boolean"==typeof n)return;let S=D.RULES.keywords;for(let t in n)S[t]||u(e,`unknown keyword: "${t}"`)}function o(e,n){if("boolean"==typeof e)return!e;for(let t in e)if(n[t])return!0;return!1}function i(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function g(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:e,mergeToName:n,mergeValues:t,resultToName:D}){return(a,r,o,i)=>{let g=void 0===o?r:o instanceof S.Name?(r instanceof S.Name?e(a,r,o):n(a,r,o),o):r instanceof S.Name?(n(a,o,r),r):t(r,o);return i!==S.Name||g instanceof S.Name?g:D(a,g)}}function l(e,n){if(!0===n)return e.var("props",!0);let t=e.var("props",(0,S._)`{}`);return void 0!==n&&d(e,t,n),t}function d(e,n,t){Object.keys(t).forEach(t=>e.assign((0,S._)`${n}${(0,S.getProperty)(t)}`,!0))}n.toHash=function(e){let n={};for(let t of e)n[t]=!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 t in e)if("$ref"!==t&&n.all[t])return!0;return!1},n.schemaRefOrVal=function({topSchemaRef:e,schemaPath:n},t,D,a){if(!a){if("number"==typeof t||"boolean"==typeof t)return t;if("string"==typeof t)return(0,S._)`${t}`}return(0,S._)`${e}${n}${(0,S.getProperty)(D)}`},n.unescapeFragment=function(e){return g(decodeURIComponent(e))},n.escapeFragment=function(e){return encodeURIComponent(i(e))},n.escapeJsonPointer=i,n.unescapeJsonPointer=g,n.eachItem=function(e,n){if(Array.isArray(e))for(let t of e)n(t);else n(e)},n.mergeEvaluated={props:s({mergeNames:(e,n,t)=>e.if((0,S._)`${t} !== true && ${n} !== undefined`,()=>{e.if((0,S._)`${n} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,S._)`${t} || {}`).code((0,S._)`Object.assign(${t}, ${n})`))}),mergeToName:(e,n,t)=>e.if((0,S._)`${t} !== true`,()=>{!0===n?e.assign(t,!0):(e.assign(t,(0,S._)`${t} || {}`),d(e,t,n))}),mergeValues:(e,n)=>!0===e||{...e,...n},resultToName:l}),items:s({mergeNames:(e,n,t)=>e.if((0,S._)`${t} !== true && ${n} !== undefined`,()=>e.assign(t,(0,S._)`${n} === true ? true : ${t} > ${n} ? ${t} : ${n}`)),mergeToName:(e,n,t)=>e.if((0,S._)`${t} !== true`,()=>e.assign(t,!0===n||(0,S._)`${t} > ${n} ? ${t} : ${n}`)),mergeValues:(e,n)=>!0===e||Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})},n.evaluatedPropsToName=l,n.setEvaluated=d;let c={};function u(e,n,t=e.opts.strictSchema){if(t){if(n=`strict mode: ${n}`,!0===t)throw Error(n);e.self.logger.warn(n)}}n.useFunc=function(e,n){return e.scopeValue("func",{ref:n,code:c[n.code]||(c[n.code]=new a._Code(n.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(D||(n.Type=D={})),n.getErrorPath=function(e,n,t){if(e instanceof S.Name){let a=n===D.Num;return t?a?(0,S._)`"[" + ${e} + "]"`:(0,S._)`"['" + ${e} + "']"`:a?(0,S._)`"/" + ${e}`:(0,S._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,S.getProperty)(e).toString():"/"+i(e)},n.checkStrictMode=u},7887(e,n){"use strict";function t(e,n){return n.rules.some(n=>D(e,n))}function D(e,n){var t;return void 0!==e[n.keyword]||(null==(t=n.definition.implements)?void 0:t.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},D){let S=n.RULES.types[D];return S&&!0!==S&&t(e,S)},n.shouldUseGroup=t,n.shouldUseRule=D},28727(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;let D=t(48708),S=t(99029),a=t(42023),r={message:"boolean schema is false"};function o(e,n){let{gen:t,data:S}=e,a={gen:t,keyword:"false schema",data:S,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,D.reportError)(a,r,void 0,n)}n.topBoolOrEmptySchema=function(e){let{gen:n,schema:t,validateName:D}=e;!1===t?o(e,!1):"object"==typeof t&&!0===t.$async?n.return(a.default.data):(n.assign((0,S._)`${D}.errors`,null),n.return(!0))},n.boolOrEmptySchema=function(e,n){let{gen:t,schema:D}=e;!1===D?(t.var(n,!1),o(e)):t.var(n,!0)}},10208(e,n,t){"use strict";var D;Object.defineProperty(n,"__esModule",{value:!0}),n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;let S=t(10396),a=t(7887),r=t(48708),o=t(99029),i=t(94227);function g(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"}(D||(n.DataType=D={})),n.getSchemaTypes=function(e){let n=g(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=g,n.coerceAndCheckDataType=function(e,n){let{gen:t,data:S,opts:r}=e,o=l(n,r.coerceTypes),i=n.length>0&&!(0===o.length&&1===n.length&&(0,a.schemaHasRulesForType)(e,n[0]));if(i){let a=f(n,S,r.strictNumbers,D.Wrong);t.if(a,()=>{o.length?d(e,n,o):p(e)})}return i};let s=new Set(["string","number","integer","boolean","null"]);function l(e,n){return n?e.filter(e=>s.has(e)||"array"===n&&"array"===e):[]}function d(e,n,t){let{gen:D,data:S,opts:a}=e,r=D.let("dataType",(0,o._)`typeof ${S}`),i=D.let("coerced",(0,o._)`undefined`);for(let e of("array"===a.coerceTypes&&D.if((0,o._)`${r} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>D.assign(S,(0,o._)`${S}[0]`).assign(r,(0,o._)`typeof ${S}`).if(f(n,S,a.strictNumbers),()=>D.assign(i,S))),D.if((0,o._)`${i} !== undefined`),t))(s.has(e)||"array"===e&&"array"===a.coerceTypes)&&g(e);function g(e){switch(e){case"string":D.elseIf((0,o._)`${r} == "number" || ${r} == "boolean"`).assign(i,(0,o._)`"" + ${S}`).elseIf((0,o._)`${S} === null`).assign(i,(0,o._)`""`);return;case"number":D.elseIf((0,o._)`${r} == "boolean" || ${S} === null
|
|
5
|
+
failing expression: ${e}`)}return null}function n8(e,n,t,D){let{myValue:S,patient:a}=D,{sex:r,age:o}=a??{};"field"===e.type&&void 0===S&&e.value&&(S=t[e.value.id]);let i=new n1;i.putObject("prevEnc",{value:D.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(n=>n.concept.uuid==e)}});let g=D?.visit??{},s=g?.visitType||{uuid:""},l=s.uuid??"",d={isEmpty:n_.A};return{...new nQ(e,a,n,t),...rt(),...D,...t,patient:a,myValue:S,sex:r,age:o,HD:i,visit:g,visitType:s,visitTypeUuid:l,_:d}}function n9(e){let n=nZ(e);if(n0.has(n))return n0.get(n);let t=(0,o.compile)(e);return n0.set(n,t),t}function n7(e,n,t){for(let D of(0,o.extractVariableNames)(e)){let e=t.find(e=>e.id===D);e&&nJ(n,e)}}function n6(e,n,t,D){return"embedded-view"==D||("automatic"==e?"maximized"==t&&n.endsWith("desktop"):"single-line"==e)}function n5(e,n){let t=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,D=n.find(e=>e.id==t);D&&(D.fieldDependents||(D.fieldDependents=new Set)).add(e.id)}function te(e,n,t){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:D,referenceQuestionId:S}=e.required,a=n.find(e=>e.id==S);return!!a&&((a.fieldDependents||(a.fieldDependents=new Set)).add(e.id),D?.includes(t[S]))}function tn(e,n,t,D,S,a){let{value:r}=e;return a(r.disabled?.disableWhenExpression,e,n,t,{mode:D,patient:S})}function tt(e,n,t,D,S,a,r){let{value:o,type:i}=e,g=a(o.hide?.hideWhenExpression,e,n,t,{mode:D,patient:S});e.value.isHidden=g,"field"==i&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=g}),"page"==i&&o.sections.forEach(e=>{e.isParentHidden=g,tD(g,e,n,r)}),"section"==i&&tD(g,o,n,r)}function tD(e,n,t,D){let S=n.questions.map(e=>e.id);t.filter(e=>S.includes(e.id)).forEach(n=>{n.isParentHidden=e,"group"==n.questionOptions.rendering&&n.questions.forEach(n=>{n.isParentHidden=e}),D?.(n)})}function tS(e,n){if(!e?.includes(":"))return n?.find(n=>n.uuid===e);{let[t,D]=e.split(":");return n?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===t.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===D.toUpperCase()))}}function ta(e,n=!1){let t=document.getElementById(e);t?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),n&&t?.focus()}let tr=(e,n)=>{let t=e.questionOptions.rendering;if("object"!=typeof n)return{value:n,display:n};let D="Observation"===n.resourceType?ti(n,t):n;if(!D)return{value:null,display:null};if("string"==typeof D.value||"number"==typeof D.value){if("date"===t||"datetime"===t){let e=nb(`${D.value}`);return{value:e,display:nr()(e).format("YYYY-MM-DD HH:mm")}}return{value:D.value,display:D.value}}return["toggle","checkbox"].includes(t)?{value:D.value?.uuid,display:D.value?.name?.name}:{value:D.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===D.value?.uuid)?.label}};function to(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function ti(e,n){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:tg(e,n)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function tg(e,n){switch(n){case"toggle":return e.valueBoolean?{uuid:i.t$}:{uuid:i.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 ts(e,n){return e.pages.find(e=>n.meta.pageId===e.id).sections.find(e=>e.questions.find(e=>e.id===n.id))}var tl=t(10578);function td(e,n){let{methods:{getValues:t}}=n,D=t();i.FU.includes(e.questionOptions.rendering)&&tc(e,D,n),tu(e,D,n)}function tc(e,n,t){let{sessionMode:D,formFields:S,patient:a,visit:r}=t;e.questionOptions.answers.forEach(t=>{let o=t.disable?.disableWhenExpression;o&&o.includes("myValue")&&(t.disable.isDisabled=n3(t.disable?.disableWhenExpression,{value:e,type:"field"},S,n,{mode:D,patient:a,visit:r}))})}function tu(e,n,t){let{sessionMode:D,formFields:S,patient:a,formFieldValidators:r,formJson:o,methods:{setValue:i},updateFormField:g,setForm:s,visit:l}=t,d=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let s=S.find(n=>n.id==e);if(s.questionOptions.calculate?.calculateExpression&&n4(s.questionOptions.calculate.calculateExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l}).then(e=>{i(s.id,e);let{errors:r,warnings:o}=tf(s,e,t.formFieldValidators,{formFields:S,values:n,expressionContext:{patient:a,mode:D}});s.meta.submission||(s.meta.submission={}),s.meta.submission.errors=r,s.meta.submission.warnings=o,r.length||t.formFieldAdapters[s.type].transformFieldValue(s,e,t),g(s)}).catch(e=>{(0,tl.N)(e,"Error evaluating calculate expression")}),s.hide){let e=ts(o,s),t=e?.questions.some(e=>!e.isHidden);if(tt({value:s,type:"field"},S,n,D,a,n3,g),e){e.questions=e?.questions.map(e=>e.id===s.id?s:e);let n=s.isHidden,D=[...e.questions,s].some(e=>!e.isHidden);t||n?t&&!D&&(e.isHidden=!0,d=!0):(e.isHidden=!1,d=!0)}}if("object"==typeof s.disabled&&s.disabled.disableWhenExpression&&(s.isDisabled=tn({value:s,type:"field"},S,n,D,a,n3)),"object"==typeof s.required&&s.required?.type==="conditionalRequired"&&(s.isRequired=te(s,S,n)),s.validators?.some(e=>"conditionalAnswered"===e.type)){let e=s.validators?.find(e=>"conditionalAnswered"===e.type),t=r.conditionalAnswered.validate(s,s.meta.submission?.newValue,{...e,expressionContext:{patient:a,mode:D},values:n,formFields:S});s.meta.submission={...s.meta.submission,errors:t}}s?.questionOptions.answers?.filter(e=>!nl(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=n3(e.hide?.hideWhenExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})}),s?.questionOptions.answers?.filter(e=>!nl(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=n3(e.disable?.disableWhenExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})}),!s.isHidden&&s.meta.readonlyExpression&&(s.readonly=n3(s.meta.readonlyExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})),nf(s,"repeating")&&!nl(s.questionOptions.repeatOptions?.limitExpression)&&(s.questionOptions.repeatOptions.limit=n3(s.questionOptions.repeatOptions?.limitExpression,{value:s,type:"field"},S,n,{mode:D,patient:a,visit:l})),g(s)}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let t=0;t<o.pages.length;t++){let r=o.pages[t].sections.find(n=>n.label==e);if(r){tt({value:r,type:"section"},S,n,D,a,n3,g),d=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{tt({value:o.pages.find(n=>n.label==e),type:"page"},S,n,D,a,n3,g),d=!0}),d&&s(o)}function tf(e,n,t,D){let S=[],a=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(r=>{let o=t[r.type]?.validate?.(e,n,{...r,...D});o&&o.forEach(e=>{"error"===e.resultType?S.push(e):"warning"===e.resultType&&a.push(e)})})}catch(e){console.error(e)}return{errors:S,warnings:a}}var th=t(6232);let tp=s().createContext(void 0),tm=({methods:e,children:n,...t})=>s().createElement(tp.Provider,{value:{...t,methods:e}},n),ty=()=>{let e=s().useContext(tp);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e};var tb=t(7521),tv={};tv.styleTagTransform=_(),tv.setAttributes=b(),tv.insert=m().bind(null,"head"),tv.domAPI=h(),tv.insertStyleElement=$(),u()(tb.A,tv);let t$=tb.A&&tb.A.locals?tb.A.locals:void 0,tw=()=>{let{t:e}=(0,nD.useTranslation)();return s().createElement("div",null,s().createElement("span",{className:t$.empty},"(",e("blank","Blank"),")"))},t_=({value:e})=>Array.isArray(e)?s().createElement(tA,{valueArray:e}):s().createElement("div",{className:t$.value},e),tA=({valueArray:e})=>s().createElement("ul",null,e.map(e=>s().createElement("li",{className:t$.item},e)));var tM=t(50793),tx={};tx.styleTagTransform=_(),tx.setAttributes=b(),tx.insert=m().bind(null,"head"),tx.domAPI=h(),tx.insertStyleElement=$(),u()(tM.A,tx);let tL=tM.A&&tM.A.locals?tM.A.locals:void 0,tC=({previousValue:e,displayText:n,field:t,hideHeader:D,onAfterChange:S})=>{let{t:a}=(0,nD.useTranslation)(),{methods:{setValue:r}}=ty(),o=n=>{n.preventDefault(),r(t.id,e),S(e)};return s().createElement("div",{className:tL.formField},s().createElement("div",{className:tL.row},!D&&s().createElement("div",null,a("previousValue","Previous value:")),s().createElement("div",{className:tL.value},s().createElement(t_,{value:n}))),s().createElement("div",{className:tL.reuseButton,role:"button",tabIndex:0,onClick:o},a("reuseValue","Reuse value")))};var tk=t(50847),tE={};tE.styleTagTransform=_(),tE.setAttributes=b(),tE.insert=m().bind(null,"head"),tE.domAPI=h(),tE.insertStyleElement=$(),u()(tk.A,tE);let tT=tk.A&&tk.A.locals?tk.A.locals:void 0,tO=({field:e,fieldValue:n,setFieldValue:t,onAfterChange:D})=>{let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)(!1),{sessionMode:o,updateFormField:i}=ty();(0,g.useEffect)(()=>{nl(n)&&"edit"===o&&(r(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,g.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!nl(n))&&(r(!1),e.meta.submission.unspecified=!1,i(e))},[e.meta?.submission,n]);let l=(0,g.useCallback)(n=>{let S=e.questionOptions.rendering;if(n.target.checked){r(!0);let n="checkbox"===S?[]:"";nh(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],i(e),t(n),D(n)}else r(!1),e.meta.submission.unspecified=!1,i(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,th.H)(e.readonly)&&!ny(o)&&s().createElement("div",{className:tT.unspecified},s().createElement(L.Sc0,{id:`${e.id}-unspecified`,labelText:S("unspecified","Unspecified"),value:S("unspecified","Unspecified"),onChange:l,checked:a,disabled:e.isDisabled}))};function tR(e,n,t,D){return!("embedded-view"===e&&t&&(n||D))}var tI=t(54880),tN={};tN.styleTagTransform=_(),tN.setAttributes=b(),tN.insert=m().bind(null,"head"),tN.domAPI=h(),tN.insertStyleElement=$(),u()(tI.A,tN);let tj=tI.A&&tI.A.locals?tI.A.locals:void 0,tP=({fieldId:e,valueAdapter:n,repeatOptions:t})=>{let[D,S]=(0,g.useState)(null),[a,r]=(0,g.useState)([]),[i,l]=(0,g.useState)([]),[d,c]=(0,g.useState)(null),u=ty(),f=!1;try{let e=(0,o.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});f=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:h,getValues:p,getFieldState:m},patient:y,sessionMode:b,formFields:v,formFieldValidators:$,addInvalidField:w,removeInvalidField:_,updateFormField:A}=u,M=ey({control:h,name:e,exact:!0}),x=()=>{},L=(0,g.useMemo)(()=>v.find(n=>n.id===e),[e,v]);(0,g.useEffect)(()=>{if(nf(L,"repeating")&&t?.targetRendering?a8(t.targetRendering).then(e=>{e&&S({value:e})}):a9(L).then(e=>{e&&S({value:e})}),"enter"===b&&(L.historicalExpression||u.previousDomainObjectValue))try{u.processor.getHistoricalValue(L,u).then(e=>{c(e)})}catch(e){console.error(e)}},[]),(0,g.useEffect)(()=>{let{isDirty:e,isTouched:t}=m(L.id),{submission:D,unspecified:S}=L.meta,{calculate:a,defaultValue:r}=L.questionOptions;!nl(M)&&!D?.newValue&&!e&&!S&&(a?.calculateExpression||r)&&n.transformFieldValue(L,M,u),(e||t)&&C(M)},[M]),(0,g.useEffect)(()=>{L.meta.submission?.errors&&r(L.meta.submission.errors),L.meta.submission?.warnings&&l(L.meta.submission.warnings),L.meta.submission?.unspecified&&(r([]),_(L.id))},[L.meta.submission]);let C=e=>{let{errors:t,warnings:D}=tf(L,e,$,{formFields:v,values:p(),expressionContext:{patient:y,mode:b}});if(L.meta.submission&&(L.meta.submission.errors=void 0,L.meta.submission.warnings=void 0),a.length&&!t.length?(_(L.id),r([])):t.length&&(r(t),w(L)),t.length||n.transformFieldValue(L,e,u),l(D),td(L,u),L.meta.groupId){let e=v.find(e=>e.id===L.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===L.id?L:e),A(e))}};if(!D)return null;let k=D.value;return!t?.targetRendering&&tB(L.questionOptions.rendering)?s().createElement(k,{key:L.id,field:L,value:null,errors:a,warnings:i,setFieldValue:null}):tR(b,!!L.questionOptions.isTransient,nl(M),f)?s().createElement(nS.tH,{FallbackComponent:tF,onReset:x},s().createElement(ev,{control:h,name:L.id,render:({field:{value:e,onChange:n,onBlur:t}})=>s().createElement("div",null,s().createElement(k,{key:`${L.id}-input-component`,field:L,value:e,errors:a,warnings:i,setFieldValue:e=>{n(e),C(e),t()}}),tU(L)&&s().createElement("div",{className:tj.unspecifiedContainer},L.unspecified&&s().createElement(tO,{key:`${L.id}-unspecified`,field:L,setFieldValue:n,onAfterChange:C,fieldValue:e})),d?.value&&s().createElement("div",null,s().createElement(tC,{key:`${L.id}-previous-value-review`,previousValue:d.value,displayText:d.display,onAfterChange:C,field:L})))})):null};function tF({error:e}){let{t:n}=(0,nD.useTranslation)();return s().createElement(L.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 tU(e){let{rendering:n}=e.questionOptions;return(0,th.H)(e.unspecified)&&"toggle"!=n&&"group"!=n&&"repeating"!=n&&"markdown"!=n&&"extension-widget"!=n&&"workspace-launcher"!=n}function tB(e){return"group"===e||"repeating"===e}let tz=({field:e,...n})=>{let{t}=(0,nD.useTranslation)(),{formFieldAdapters:D,formFields:S}=ty(),a=(0,g.useMemo)(()=>e.questions.map(e=>S.find(n=>n.id===e.id)).filter(e=>!e.isHidden).map((t,S)=>{let a=`${t.id}_${S}`;return t.id===e.id?s().createElement(tF,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===t.type&&tB(t.questionOptions.rendering)?s().createElement("div",{key:a,className:x.nestedGroupContainer},s().createElement(tz,{field:t,...n})):D[t.type]?s().createElement("div",{className:d()(x.flexColumn),key:a},s().createElement("div",{className:x.groupContainer},s().createElement(tP,{fieldId:t.id,valueAdapter:D[t.type]}))):void 0}),[e,S]);return s().createElement("div",{className:x.groupContainer},a.length>1?s().createElement(L.gE_,{legendText:t(e.label),className:x.boldLegend},a):a)},tV=tz;var tH=t(89817),tW={};tW.styleTagTransform=_(),tW.setAttributes=b(),tW.insert=m().bind(null,"head"),tW.domAPI=h(),tW.insertStyleElement=$(),u()(tH.A,tW);let tq=tH.A&&tH.A.locals?tH.A.locals:void 0,tG=({value:e,tooltipText:n})=>s().createElement("div",{className:tq.label},s().createElement(L.lrh,{autoAlign:!0,tabIndex:0,definition:n??""},s().createElement("span",{className:"cds--label"},`${e}:`)));var tK=t(51364),tY={};tY.styleTagTransform=_(),tY.setAttributes=b(),tY.insert=m().bind(null,"head"),tY.domAPI=h(),tY.insertStyleElement=$(),u()(tK.A,tY);let tQ=tK.A&&tK.A.locals?tK.A.locals:void 0,tZ=({label:e,conceptName:n,value:t,isInline:D})=>s().createElement(s().Fragment,null,D?s().createElement("div",{className:tQ.inlineFlexRow},s().createElement("div",{className:tQ.inlineFlexColumn},s().createElement(tG,{value:e,tooltipText:n})),s().createElement("div",{className:tQ.inlineFlexColumn},nl(t)?s().createElement(tw,null):s().createElement(t_,{value:t}))):s().createElement("div",{className:tQ.readonly},s().createElement("div",{className:tQ.formField},s().createElement(tG,{value:e,tooltipText:n}),s().createElement("div",{className:tQ.value},nl(t)?s().createElement(tw,null):s().createElement(t_,{value:t})))));var tJ=t(71671),tX={};tX.styleTagTransform=_(),tX.setAttributes=b(),tX.insert=m().bind(null,"head"),tX.domAPI=h(),tX.insertStyleElement=$(),u()(tJ.A,tX);let t1=tJ.A&&tJ.A.locals?tJ.A.locals:void 0;var t0=t(31362),t2=t(30357),t3={};t3.styleTagTransform=_(),t3.setAttributes=b(),t3.insert=m().bind(null,"head"),t3.domAPI=h(),t3.insertStyleElement=$(),u()(t2.A,t3);let t4=t2.A&&t2.A.locals?t2.A.locals:void 0,t8=({field:e,children:n})=>{let{t}=(0,nD.useTranslation)();return e.questionInfo?s().createElement(L.m_M,{autoAlign:!0,label:t(e.questionInfo)},s().createElement("div",null,n)):s().createElement(s().Fragment,null,n)},t9=({field:e,customLabel:n})=>{let{t}=(0,nD.useTranslation)(),D=!!e.questionInfo,S=n||t(e.label);return s().createElement(t8,{field:e},s().createElement("div",{className:t4.questionLabel,"data-testid":`${e.id}-label`},s().createElement("span",null,S),e.isRequired&&s().createElement("span",{title:t("required","Required"),className:t4.required},"*"),D&&s().createElement(t0.$$,{size:16,"aria-hidden":"true",className:t4.tooltipIcon,"data-testid":`${e.id}-information-icon`})))},t7=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),c=(0,g.useCallback)(e=>{S(e.name)},[S]),u=(0,g.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),f=(0,g.useMemo)(()=>u.findIndex(e=>e.concept==n),[n,u]),h=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o||(0,th.H)(e.readonly)?s().createElement("div",{className:t1.formField},s().createElement(tZ,{label:a(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:h})):!e.isHidden&&s().createElement(L.gE_,{legendText:s().createElement("div",{className:t1.boldedLegend},s().createElement(t9,{field:e})),className:d()({[t1.errorLegend]:t.length>0,[t1.boldedLegend]:0===t.length})},s().createElement(L.Tps,{onChange:c,selectedIndex:f,className:t1.selectedOption,size:"md"},u.map((n,t)=>s().createElement(L.dOG,{name:n.concept||n.value,text:a(n.label),key:t,disabled:e.isDisabled}))))};var t6=t(63769),t5={};t5.styleTagTransform=_(),t5.setAttributes=b(),t5.insert=m().bind(null,"head"),t5.domAPI=h(),t5.insertStyleElement=$(),u()(t6.A,t5);let De=t6.A&&t6.A.locals?t6.A.locals:void 0,Dn=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),[r,i]=(0,g.useState)(""),{layoutType:l,sessionMode:c,workspaceLayout:u}=ty(),f=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(c)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,l,u,c),[c,e.readonly,e.inlineRendering,l,u]),h=(0,g.useCallback)(e=>{p(e,r),S(e)},[S,r]),p=(0,g.useCallback)((e,n)=>{if(!nl(n)){let[t,D]=n.split(":").map(Number);e.setHours(t??0,D??0)}},[]),m=(0,g.useCallback)(t=>{let D=t.target.value;i(D);let a="timer"===e.datePickerFormat?new Date:new Date(n);p(a,D),S(a)},[S,p,n]);(0,g.useEffect)(()=>{n&&n instanceof Date&&i([10>n.getHours()?`0${n.getHours()}`:`${n.getHours()}`,10>n.getMinutes()?`0${n.getMinutes()}`:`${n.getMinutes()}`].join(":"))},[n]);let y=(0,g.useMemo)(()=>"timer"===e.datePickerFormat?s().createElement(t9,{field:e}):s().createElement(t9,{field:e,customLabel:a("time","Time")}),[e.datePickerFormat,e.label,a]);return"view"==c||"embedded-view"==c||(0,th.H)(e.readonly)?s().createElement(tZ,{label:a(e.label),value:n instanceof Date?nv(e,n):n,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&s().createElement("div",{className:De.datetime},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&s().createElement("div",{className:De.datePickerSpacing},s().createElement(L.Wdr,null,s().createElement(o.OpenmrsDatePicker,{id:e.id,onChange:h,labelText:s().createElement("span",{className:De.datePickerLabel},s().createElement(t9,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,th.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:t.length>0,invalidText:t[0]?.message,value:n})),D.length>0?s().createElement("div",{className:De.datePickerWarn},D[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?s().createElement("div",null,s().createElement(L.Wdr,null,s().createElement(L.AG,{className:d()(De.boldedLabel,De.timeInput),id:e.id,labelText:y,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!n,invalid:t.length>0,invalidText:t[0]?.message,readOnly:(0,th.H)(e.readonly),warning:D.length>0,warningText:D[0]?.message,value:r||(n instanceof Date?n.toLocaleDateString(window.navigator.language):n),onChange:m}))):null)},Dt=({field:e,setFieldValue:n})=>{let t=ty();return(0,g.useEffect)(()=>{e.meta?.initialValue?.omrsObject||nl(e.meta.fixedValue)||(n(e.meta.fixedValue),t.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,t))},[]),s().createElement(s().Fragment,null)};var DD=t(29012),DS=t(19697),Da={};Da.styleTagTransform=_(),Da.setAttributes=b(),Da.insert=m().bind(null,"head"),Da.domAPI=h(),Da.insertStyleElement=$(),u()(DS.A,Da);let Dr=DS.A&&DS.A.locals?DS.A.locals:void 0,Do={a:({node:e,...n})=>s().createElement("a",{...n,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},Di=({markdown:e})=>s().createElement("div",{className:Dr.markdownWrapper},s().createElement(DD.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:Do})),Dg=({field:e})=>{let{t:n}=(0,nD.useTranslation)(),t=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&&s().createElement(Di,{markdown:t(e.value)})};var Ds=t(59793),Dl={};Dl.styleTagTransform=_(),Dl.setAttributes=b(),Dl.insert=m().bind(null,"head"),Dl.domAPI=h(),Dl.insertStyleElement=$(),u()(Ds.A,Dl);let Dd=Ds.A&&Ds.A.locals?Ds.A.locals:void 0,Dc=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),[d,c]=(0,g.useState)(0),[u,f]=(0,g.useState)([]),h=(0,g.useRef)(!0),p=e.questionOptions.answers.filter(e=>!e.isHidden).map((n,t)=>({id:`${e.id}-${n.concept}`,concept:n.concept,label:a(n.label),key:t,disabled:n.disable?.isDisabled,readonly:(0,th.H)(e.readonly)})),m=(0,g.useMemo)(()=>n?.length&&d<1?(c(d+1),p.filter(e=>n?.includes(e.concept))):[],[n]),y=({selectedItems:e})=>{S(e.map(e=>e.concept))},b=(0,g.useMemo)(()=>(0,th.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,g.useEffect)(()=>{h.current&&1===d&&(f(m.map(e=>e.concept)),h.current=!1)},[m,h]);let v=e=>{let n,t=e.concept;f(n=u.some(e=>e===t)?u.filter(e=>e!==t):u.some(e=>e===t)?u.filter(e=>e!==t):[...u,t]),S(n)},$=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o?s().createElement("div",{className:Dd.formField},s().createElement(tZ,{label:a(e.label),value:n?l[e.type]?.getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:$})):!e.isHidden&&s().createElement(s().Fragment,null,s().createElement("div",{className:Dd.boldedLabel},s().createElement(L.Wdr,null,b?s().createElement(L.Qp5,{disabled:e.isDisabled,id:e.id,initialSelectedItems:m,invalid:t.length>0,invalidText:t[0]?.message,items:p,itemToString:e=>e?a(e.label):" ",key:e.id,onChange:y,placeholder:a("search","Search")+"...",readOnly:(0,th.H)(e.readonly),titleText:s().createElement(t9,{field:e}),warn:D.length>0,warnText:D[0]?.message}):s().createElement(L.$QX,{legendText:s().createElement(t9,{field:e}),readOnly:(0,th.H)(e.readonly)},p?.map((n,t)=>s().createElement(L.Sc0,{className:Dd.checkbox,checked:u.some(e=>e===n.concept),disabled:n.disabled,id:`${e.id}-${n.concept}`,key:`${e.id}-${n.concept}-${t}`,labelText:a(n.label),name:n.concept,onChange:()=>v(n),readOnly:(0,th.H)(e.readonly)}))))),b&&s().createElement("div",{className:Dd.selectionDisplay},n?.length?s().createElement("div",{className:Dd.tagContainer},l[e.type]?.getDisplayValue(e,n)?.map((e,n)=>s().createElement(L.vwO,{key:n,type:"cool-gray"},a(e)))):s().createElement(tw,null)))};var Du=t(41287),Df={};Df.styleTagTransform=_(),Df.setAttributes=b(),Df.insert=m().bind(null,"head"),Df.domAPI=h(),Df.insertStyleElement=$(),u()(Du.A,Df);let Dh=Du.A&&Du.A.locals?Du.A.locals:void 0,Dp=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i}=ty(),l=(0,g.useMemo)(()=>isNaN(n)?"":n??"",[n]),c=(0,g.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),u=(0,g.useCallback)((e,{value:n})=>{let t=c(n);S(isNaN(t)?void 0:t)},[S,c]),f=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]),h=c(e.questionOptions.max),p=c(e.questionOptions.min);return"view"==o||"embedded-view"==o?s().createElement("div",{className:Dh.formField},s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:f})):!e.isHidden&&s().createElement(L.Wdr,null,s().createElement(L.Q7x,{id:e.id,invalid:t.length>0,invalidText:t[0]?.message,label:s().createElement(t9,{field:e}),max:h,min:p,name:e.id,value:l,onChange:u,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),className:d()(Dh.controlWidthConstrained,Dh.boldedLabel),warn:D.length>0,warnText:D[0]?.message,step:e.questionOptions.step??.01}))};var Dm=t(12),Dy={};Dy.styleTagTransform=_(),Dy.setAttributes=b(),Dy.insert=m().bind(null,"head"),Dy.domAPI=h(),Dy.insertStyleElement=$(),u()(Dm.A,Dy);let Db=Dm.A&&Dm.A.locals?Dm.A.locals:void 0,Dv=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i,formFieldAdapters:l}=ty(),d=e=>{S(e)},c=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o||(0,th.H)(e.readonly)?s().createElement(tZ,{label:a(e.label),value:n?l[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:c}):!e.isHidden&&s().createElement(L.gE_,{legendText:s().createElement(t9,{field:e}),className:Db.boldedLegend,disabled:e.isDisabled,invalid:t?.length>0},s().createElement(L.zWQ,{name:e.id,valueSelected:n,onChange:d,readOnly:(0,th.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((t,D)=>s().createElement(L.aaP,{id:`${e.id}-${t.label}`,labelText:a(t.label)??"",value:t.concept,key:D,onClick:e=>{n&&e.target.checked?(e.target.checked=!1,e.preventDefault(),d(null)):d(t.concept)}}))),(t?.length>0||D?.length>0)&&s().createElement("div",null,s().createElement("div",{className:Db.errorMessage},t.length>0?t[0].message:D.length>0?D[0].message:null)))};var D$=t(55256),Dw={};Dw.styleTagTransform=_(),Dw.setAttributes=b(),Dw.insert=m().bind(null,"head"),Dw.domAPI=h(),Dw.insertStyleElement=$(),u()(D$.A,Dw);let D_=D$.A&&D$.A.locals?D$.A.locals:void 0,DA=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:l,formFieldAdapters:d}=ty(),c=(0,g.useCallback)(({selectedItem:e})=>{S(e===i.ZA?null:e)},[S]),u=(0,g.useCallback)(n=>{let t=e.questionOptions.answers.find(e=>e.value?e.value==n:e.concept==n);return t?a(t.label):""},[e.questionOptions.answers,a]),f=(0,g.useMemo)(()=>{let n=e.questionOptions.answers;return n.some(e=>e.value===i.ZA)||n.unshift({value:i.ZA,label:a("chooseAnOption","Choose an option")}),n.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),h=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,l,o),[o,e.readonly,e.inlineRendering,r,l]);return"view"==o||"embedded-view"==o?s().createElement(tZ,{label:a(e.label),value:n?d[e.type].getDisplayValue(e,n):n,conceptName:e.meta?.concept?.display,isInline:h}):!e.isHidden&&s().createElement("div",{className:D_.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.msM,{"aria-label":a(e.label),disabled:e.isDisabled,id:e.id,invalid:t.length>0,invalidText:t[0]?.message,items:f,itemToString:u,label:"",onChange:c,readOnly:(0,th.H)(e.readonly),selectedItem:nl(n)?i.ZA:n,titleText:s().createElement(t9,{field:e}),warn:D.length>0,warnText:D[0]?.message})))};var DM=t(1495),Dx={};Dx.styleTagTransform=_(),Dx.setAttributes=b(),Dx.insert=m().bind(null,"head"),Dx.domAPI=h(),Dx.insertStyleElement=$(),u()(DM.A,Dx);let DL=DM.A&&DM.A.locals?DM.A.locals:void 0,DC=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),[r,o]=(0,g.useState)(n),{layoutType:i,sessionMode:l,workspaceLayout:d}=ty(),c=e=>{e.preventDefault(),r!==n&&o(n)},u=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(l)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,i,d,l),[l,e.readonly,e.inlineRendering,i,d]);return"view"==l||"embedded-view"==l?s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&s().createElement("div",{className:DL.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.fs1,{id:e.id,labelText:s().createElement(t9,{field:e}),name:e.id,onChange:S,onBlur:c,value:n||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),invalid:t.length>0,invalidText:t[0]?.message,warn:D.length>0,warnText:D[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))};var Dk=t(30303),DE={};DE.styleTagTransform=_(),DE.setAttributes=b(),DE.insert=m().bind(null,"head"),DE.domAPI=h(),DE.insertStyleElement=$(),u()(Dk.A,DE);let DT=Dk.A&&Dk.A.locals?Dk.A.locals:void 0,DO=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),{layoutType:r,sessionMode:o,workspaceLayout:i}=ty(),[l,d]=(0,g.useState)(null),c=e=>{e.preventDefault(),l!==n&&d(n)},u=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(o)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,r,i,o),[o,e.readonly,e.inlineRendering,r,i]);return"view"==o||"embedded-view"==o?s().createElement(tZ,{label:a(e.label),value:n,conceptName:e.meta?.concept?.display,isInline:u}):!e.isHidden&&s().createElement("div",{className:DT.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.ksK,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:t.length>0,invalidText:t[0]?.message,labelText:s().createElement(t9,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:c,onChange:e=>{S(e.target.value)},readOnly:(0,th.H)(e.readonly),value:n??"",warn:D.length>0,warnText:D.length>0?D[0].message:void 0})))};var DR=t(47557),DI={};DI.styleTagTransform=_(),DI.setAttributes=b(),DI.insert=m().bind(null,"head"),DI.domAPI=h(),DI.insertStyleElement=$(),u()(DR.A,DI);let DN=DR.A&&DR.A.locals?DR.A.locals:void 0,Dj=({field:e,value:n,errors:t,warnings:D,setFieldValue:S})=>{let{t:a}=(0,nD.useTranslation)(),r=ty(),o=e=>{S(e)};(0,g.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=r.sessionMode||r.formFieldAdapters[e.type].transformFieldValue(e,n??!1,r)},[]);let i=(0,g.useMemo)(()=>!!(["view","embedded-view"].includes(r.sessionMode)||(0,th.H)(e.readonly))&&n6(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?s().createElement(tZ,{label:a(e.label),value:nl(n)?n:r.formFieldAdapters[e.type].getDisplayValue(e,n),conceptName:e.meta?.concept?.display,isInline:i}):!e.isHidden&&s().createElement("div",{className:DN.boldedLabel},s().createElement(L.lMk,{labelText:a(e.label),className:DN.boldedLabel,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:o,toggled:!!n,disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly)}))};var DP=t(44861);let DF=[{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"]}}}],DU=e=>DF.find(n=>n.name===e),DB=e=>{let n=e.questionOptions.config?.referencedField,{methods:{control:t}}=ty();return ey({control:t,name:n,exact:!0,disabled:!n})};var Dz=t(51711),DV={};DV.styleTagTransform=_(),DV.setAttributes=b(),DV.insert=m().bind(null,"head"),DV.domAPI=h(),DV.insertStyleElement=$(),u()(Dz.A,DV);let DH=Dz.A&&Dz.A.locals?Dz.A.locals:void 0,DW=({field:e,errors:n,warnings:t,setFieldValue:D})=>{let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)([]),[o,i]=(0,g.useState)(!1),[l,d]=(0,g.useState)(!1),[c,u]=(0,g.useState)(""),f=(0,g.useRef)(!1),[h,p]=(0,g.useState)(null),[m,y]=(0,g.useState)({}),b=DB(e),v=(0,th.H)(e.questionOptions.isSearchable),{layoutType:$,sessionMode:w,workspaceLayout:_,methods:{control:A,getFieldState:M}}=ty(),x=ey({control:A,name:e.id,exact:!0}),{isDirty:C}=M(e.id),k=(0,g.useMemo)(()=>!!(ny(w)||(0,th.H)(e.readonly))&&n6(e.inlineRendering,$,_,w),[w,e.readonly,e.inlineRendering,$,_]),E=(0,g.useMemo)(()=>a.find(e=>e.uuid==x)||null,[a,x]),T=(0,DP.A)((e,n)=>{d(!0),n.fetchData(e,m).then(e=>{if(e.length){let t=a.find(e=>e.uuid==x),D=e.map(n.toUuidAndDisplay);t&&!D.some(e=>e.uuid==t.uuid)&&D.unshift(t),r(D)}d(!1)}).catch(e=>{console.error(e),d(!1)})},300),O=(0,g.useCallback)(e=>a.some(n=>n.display?.toLowerCase().includes(e.toLowerCase())),[a]);return((0,g.useEffect)(()=>{let n=e.questionOptions?.datasource?.name;y(n?e.questionOptions.datasource?.config:DU(e.questionOptions.rendering)?.datasource?.config),rn(n||e.questionOptions.rendering).then(e=>p(e))},[e.questionOptions?.datasource]),(0,g.useEffect)(()=>{let n=!1;return h&&!(0,th.H)(e.questionOptions.isSearchable)&&(r([]),i(!0),h.fetchData(null,{...m,referencedValue:b}).then(e=>{n||(r(e.map(h.toUuidAndDisplay)),i(!1))}).catch(e=>{n||(console.error(e),i(!1),r([]))})),()=>{n=!0}},[h,m,b]),(0,g.useEffect)(()=>{h&&v&&!nl(c)&&!O(c)&&T(c,h)},[h,c,m]),(0,g.useEffect)(()=>{let e=!1;return x&&!C&&h&&v&&!a.length&&(i(!0),h.fetchSingleItem(x).then(n=>{e||(r([h.toUuidAndDisplay(n)]),i(!1))}).catch(n=>{e||(console.error(n),i(!1))})),()=>{e=!0}},[x,C,h,v,a]),o)?s().createElement(L.dF7,null):ny(w)||(0,th.H)(e.readonly)?s().createElement(tZ,{label:S(e.label),value:x?a.find(e=>e.uuid==x)?.display:x,conceptName:e.meta?.concept?.display,isInline:k}):!e.isHidden&&s().createElement("div",{className:DH.boldedLabel},s().createElement(L.Wdr,null,s().createElement(L.a32,{id:e.id,titleText:s().createElement(t9,{field:e}),items:a,itemToString:e=>e?.display,selectedItem:E,placeholder:v?S("search","Search")+"...":null,onChange:({selectedItem:e})=>{f.current=!0,D(e?.uuid)},disabled:e.isDisabled,readOnly:(0,th.H)(e.readonly),invalid:n.length>0,invalidText:n.length&&n[0].message,onInputChange:n=>{if(f.current){f.current=!1;return}e.questionOptions.isSearchable&&u(n)},onBlur:e=>{e.target.value||D(null)}}),l&&s().createElement(L.OuH,{className:DH.loader,description:S("searching","Searching")+"..."})))};var Dq=t(89953),DG={};DG.styleTagTransform=_(),DG.setAttributes=b(),DG.insert=m().bind(null,"head"),DG.domAPI=h(),DG.insertStyleElement=$(),u()(Dq.A,DG);let DK=Dq.A&&Dq.A.locals?Dq.A.locals:void 0,DY=({field:e})=>{let{t:n}=(0,nD.useTranslation)(),{sessionMode:t,patient:D,visit:S}=ty(),a=async()=>{let t=e.questionOptions?.workspaceName;if(!t)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 a=e.questionOptions?.workspaceProps??{},r={patient:D,patientUuid:D?.id,visitContext:S};try{await (0,o.launchWorkspace2)(t,a,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||ny(t)?null:s().createElement("div",null,s().createElement("div",{className:DK.label},s().createElement(t9,{field:e})),s().createElement("div",{className:DK.workspaceButton},s().createElement(L.$nd,{disabled:(0,th.H)(e.readonly??!1)||!D,onClick:a},e.questionOptions.buttonLabel?n(e.questionOptions.buttonLabel):n("launchWorkspace","Launch Workspace")),!D&&s().createElement(L.jeF,{className:DK.noPatientNotification,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 DQ=t(20903);function DZ(e,n,t){let D=[],S=(0,DQ.A)(e);return S.questionOptions.repeatOptions={...S.questionOptions.repeatOptions??{}},S.meta={repeat:{...S.meta??{},isClone:!0},initialValue:{omrsObject:n}},S.id=`${S.id}_${t}`,S.questions?.forEach(e=>{D.push(e.id),e.id=`${e.id}_${t}`,e.meta.groupId=S.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,nh(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=DJ(e.hide.hideWhenExpression,t,D)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=DJ(e.failsWhenExpression,t,D))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=DJ(e.questionOptions.calculate?.calculateExpression,t,D))}),S}function DJ(e,n,t){let D=[...new Set(t)];if(!D.length)return e;let S=D.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 DX(e,n){let t=Number(e);return!(nl(e)||isNaN(t))&&n>=t}let D1=[],D0={async getInitialValue(e,n,t){let D=Se(nu((n??t.domainObjectValue).obs),D1,e);return nf(e,"file")&&D?.length?Sn(e,D):D2(e,D,!0)},async getPreviousValue(e,n,t){let D=n??t.previousDomainObjectValue;if(D){let n=D2(e,Se(nu(D.obs),D1,e),!0);if(!nl(n))return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:(e,n)=>{let t=e.questionOptions.rendering;return nl(n)?n:n instanceof Date?nv(e,n):"checkbox"===t?n.map(n=>e.questionOptions.answers?.find(e=>e.concept==n)?.label):"toggle"===t?n?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:i.FU.includes(t)?e.questionOptions.answers?.find(e=>e.concept==n)?.label:n},transformFieldValue:(e,n,t)=>(nh(e),!e.meta.initialValue?.omrsObject&&nl(n))?null:nf(e,"checkbox")?D6(e,Array.isArray(n)?n:[n]):nf(e,"file")?D5(e,n):!nl(n)&&D7(e,n)?np(e,D8(e,n),void 0):e.meta.initialValue?.omrsObject&&nl(n)?np(e,void 0,D4(e.meta.initialValue.omrsObject)):nl(n)?null:np(e,D3(e,n),void 0),tearDown:function(){D1=[]}};function D2(e,n=[],t=!1){let D=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),n.length){if("checkbox"==D)return D1.push(...n.map(e=>e.uuid)),e.meta.initialValue.omrsObject=t?n:null,n.map(e=>e.value.uuid);let S=n[0];if(t&&(e.meta.initialValue.omrsObject={...S}),D1.push(S.uuid),"string"==typeof S.value||"number"==typeof S.value){if(D.startsWith("date")){let n=nb(S.value);return t&&(e.meta.initialValue.omrsObject.value=nr()(n).format("YYYY-MM-DD HH:mm")),n}return S.value}return"toggle"==D?S.value.uuid===i.t$:"fixed-value"==D?e.fixedValue:S.value?.uuid}return""}function D3(e,n){return nl(n)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?D9(e,n):n},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function D4(e){return{uuid:e.uuid,voided:!0}}function D8(e,n){let t=e.meta.initialValue?.omrsObject,D=e.questionOptions.rendering.startsWith("date")?D9(e,n):n;return{uuid:t.uuid,value:D,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function D9(e,n){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return nr()(n).format("YYYY-MM-DD");case"timer":return nr()(n).format("HH:mm");case"both":return nr()(n).format("YYYY-MM-DD HH:mm")}return n}function D7(e,n){let t=e.meta.initialValue?.omrsObject;return!nl(t)&&(i.FU.includes(e.questionOptions.rendering)?t.value.uuid!==n:nf(e,"date")?0!==nr()(n).diff(nr()(t.value),"D"):nf(e,"datetime")||"both"===e.datePickerFormat?0!==nr()(n).diff(nr()(t.value),"minute"):nf(e,"toggle")?t.value.uuid===i.t$!==n:t.value!==n)}function D6(e,n=[]){let t=e.meta.initialValue?.omrsObject;if(t?.length&&nl(n))return np(e,null,t.map(e=>D4(e)));if(t?.length&&!nl(n)){let D=t.filter(e=>!n.includes(e.value.uuid));return np(e,n.filter(e=>!t.some(n=>n.value.uuid===e)).map(n=>D3(e,n)),D.map(e=>D4(e)))}return np(e,n.map(n=>D3(e,n)),void 0)}function D5(e,n=[]){let t=n.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),D=e.meta.submission.newValue=n.filter(e=>!e.uuid).map(n=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...n}));return np(e,D,t)}function Se(e,n,t){let D=e.filter(e=>!!nf(t,"file")&&e.formFieldPath==`rfe-forms-${t.id}`||e.formFieldPath==`rfe-forms-${t.id}`&&e.concept.uuid==t.questionOptions.concept);if(!D?.length){let D=e.filter(e=>e.concept.uuid==t.questionOptions.concept);return n?.length?D.filter(e=>!n.includes(e.uuid)):D}return D}async function Sn(e,n){let t=new AbortController,D=await Promise.all(n.map(e=>(0,o.getAttachmentByUuid)(e.uuid,t).then(e=>e.data).catch(n=>(console.error(`Failed to fetch attachment ${e.uuid}:`,n),null))));return e.meta.initialValue={omrsObject:n},D.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 St={validate:(e,n)=>!nl(n)&&i.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"}]:nl(n)||"date"!=e.questionOptions.rendering||nr()(n).isValid()?!nl(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}'`}]},SD=[],SS="testorder",Sa="6f0c9a92-6f24-11e3-af88-005056821db0",Sr={transformFieldValue:function(e,n,t){if("edit"==t.sessionMode&&e.meta.initialValue?.omrsObject)return Si(n,e,t.currentProvider.uuid);let D=So(n,e,t.currentProvider.uuid);return np(e,D,null),D},getInitialValue:function(e,n,t){let D=e.questionOptions.answers?.map(e=>e.concept)||[],S=n?.orders.filter(e=>!SD.includes(e.uuid)&&!e.voided).find(e=>D.includes(e.concept.uuid));return S?(e.meta={...e.meta||{},initialValue:{omrsObject:S,refinedValue:S.concept.uuid}},SD.push(S.uuid),S.concept.uuid):null},getPreviousValue:function(e,n,t){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){SD=[]}};function So(e,n,t){return e?{action:"NEW",concept:e,type:n?.questionOptions?.orderType||SS,careSetting:n?.questionOptions?.orderSettingUuid||Sa,orderer:t}:null}function Si(e,n,t){let D=n.meta.initialValue?.omrsObject;if(e===D?.concept?.uuid)return nh(n),null;let S={uuid:D?.uuid,voided:!0};return np(n,So(e,n,t),S),n.meta.submission.newValue||null}let Sg=[],Ss={transformFieldValue:function(e,n,t){if(e.meta.initialValue?.omrsObject&&nl(n))return np(e,void 0,Su(e.meta.initialValue.omrsObject));if(!nl(n)){let D=e.meta.initialValue?.omrsObject;if(Sc(D,n))return np(e,Sd(n,e,D,t.patient.id),void 0)}let D=Sl(n,e,t.patient.id);return np(e,D,null),D},getInitialValue:function(e,n,t){let D=(n??t.domainObjectValue).diagnoses.find(n=>n.formFieldPath===`rfe-forms-${e.id}`);return D?(e.meta={...e.meta||{},initialValue:{omrsObject:D,refinedValue:D.diagnosis?.coded.uuid}},Sg.includes(D.diagnosis?.coded?.uuid)||Sg.push(D.diagnosis?.coded?.uuid),D.diagnosis?.coded.uuid):null},getPreviousValue:function(e,n,t){return null},getDisplayValue:(e,n)=>e.questionOptions.answers?.find(e=>e.concept==n)?.label||n,tearDown:function(){Sg=[]}},Sl=(e,n,t)=>e?{patient:t,condition:null,diagnosis:{coded:e},certainty:(0,th.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms"}:null;function Sd(e,n,t,D){return{patient:D,condition:null,diagnosis:{coded:e},certainty:(0,th.H)(n.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:n.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${n.id}`,formFieldNamespace:"rfe-forms",uuid:t.uuid}}function Sc(e,n){return!nl(e)&&e.value!==n}function Su(e){return{uuid:e.uuid,voided:!0}}function Sf(e,n,t,D,S){let{patient:a,formJson:r,domainObjectValue:o,formFields:i,visit:g,deletedFields:s}=e,l=[...i,...s],d=[];S_(d,l);let c=Sx(l),u=ST(l),f={};return o?(Object.assign(f,o),-1===f.encounterProviders.findIndex(e=>e.provider.uuid==D)&&(f.encounterProviders=[...f.encounterProviders,{provider:D,encounterRole:t}]),f.encounterDatetime=n,f.location=S,f.form={uuid:r.uuid},g&&(f.visit=g.uuid),f.obs=d,f.orders=c,f.diagnoses=u):f={patient:a.id,encounterDatetime:n,location:S,encounterType:r.encounterType,encounterProviders:[{provider:D,encounterRole:t}],obs:d,form:{uuid:r.uuid},visit:g?.uuid,orders:c,diagnoses:u},f}function Sh(e,n){return e.filter(e=>"patientIdentifier"===e.type&&nm(e)).map(e=>e.meta.submission.newValue)}function Sp(e,n){return n.map(n=>(0,nj.savePatientIdentifier)(n,e.id))}function Sm(e){return e.filter(e=>"personAttribute"===e.type&&nm(e)).map(e=>e.meta.submission.newValue)}function Sy(e,n){return n.map(n=>(0,nj.savePersonAttribute)(n,e.id))}function Sb(e,n,t){let D=e.filter(e=>"programState"===e.type&&nm(e)),S=new Map;return D.forEach(e=>{let D=e.questionOptions.programUuid,a=e.meta.submission.newValue,r=t.find(e=>e.program.uuid===D);r?S.has(D)?S.get(D).states.push(a):S.set(D,{uuid:r.uuid,states:[a]}):S.has(D)?S.get(D).states.push(a):S.set(D,{patient:n.id,program:D,states:[a],dateEnrolled:nr()().format()})}),Array.from(S.values())}function Sv(e){let n=new AbortController;return Promise.all(e.map(e=>(0,nj.saveProgramEnrollment)(e,n)))}function S$(e,n,t){let D=e?.filter(e=>e?.questionOptions.rendering==="file"&&nm(e));return D?.length?Promise.all(D.flatMap(e=>{let t="string"==typeof n?.patient?n?.patient:n?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,nj.createAttachment)(t,n.uuid,e))})):[]}function Sw(e){let{formFields:n,location:t,currentProvider:D,customDependencies:S,domainObjectValue:a}=e,{defaultEncounterRole:r}=S;return{encounterRole:n.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||r?.uuid,encounterProvider:n.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||D.uuid,encounterDate:n.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,encounterLocation:n.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||a?.location?.uuid||t.uuid}}function S_(e,n){n.filter(e=>SC(e)).forEach(n=>SA(e,n))}function SA(e,n){(n.isHidden||n.isParentHidden)&&n.meta.initialValue.omrsObject?SL(e,(Array.isArray(n.meta.initialValue.omrsObject)?n.meta.initialValue.omrsObject:[n.meta.initialValue.omrsObject]).map(e=>D4(e))):"obsGroup"===n.type?SM(e,n):(nf(n,"file")||SL(e,n.meta.submission.newValue),SL(e,n.meta.submission.voidedValue))}function SM(e,n){if(n.meta.submission?.voidedValue)return void SL(e,n.meta.submission.voidedValue);let t=D3(n,null);n.meta.initialValue?.omrsObject&&(t.uuid=n.meta.initialValue.omrsObject.uuid),n.questions.forEach(e=>{if("obsGroup"===e.type){let n=[];SM(n,e),SL(t.groupMembers,n)}else nm(e)&&(SL(t.groupMembers,e.meta.submission.newValue),SL(t.groupMembers,e.meta.submission.voidedValue))}),(t.groupMembers?.length||t.voided)&&SL(e,t)}function Sx(e){return e.filter(e=>"testOrder"===e.type&&nm(e)).flatMap(e=>[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function SL(e,n){n&&(Array.isArray(n)?e.push(...n):e.push(n))}function SC(e){let{questionOptions:{isTransient:n},type:t}=e;return!n&&!!["obs","obsGroup"].includes(t)&&!e.meta.groupId&&(!!((e.isHidden||e.isParentHidden)&&e.meta.initialValue?.omrsObject)||!e.isHidden&&!e.isParentHidden&&("obsGroup"===t||nm(e)))}function Sk(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==i.t$;let n=St.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 SE(e,n,t,D){let S=1,{formFieldAdapters:a}=D,r=n.obs.filter(n=>n.concept.uuid===e.questionOptions.concept&&n.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!D1.includes(n.uuid)),o=n.orders.filter(n=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(n.concept?.uuid)&&!SD.includes(n.uuid));if("testOrder"===e.type)return Promise.all(o.filter(e=>!e.voided).map(async n=>{let r=DZ(e,n,S++);return t[r.id]=await a[e.type].getInitialValue(r,{orders:[n]},D),r}));let i=n.diagnoses.filter(n=>!n.voided&&!Sg.includes(n?.diagnosis?.coded.uuid)&&n.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(i.map(async n=>{let S=parseInt(n.formFieldPath.split("_")[1]),r=DZ(e,n,S);return t[r.id]=await a[e.type].getInitialValue(r,{diagnoses:[n]},D),Sg.includes(n.diagnosis.coded.uuid)||Sg.push(n.diagnosis.coded.uuid),r})):Promise.all(r.map(async n=>{let r=DZ(e,n,S++);return await Promise.all(r.questions.map(async S=>{t[S.id]=await a[e.type].getInitialValue(S,{obs:[n]},D)})),D1.push(n.uuid),[r,...r.questions]})).then(e=>e.flat())}function ST(e){return e.filter(e=>"diagnosis"===e.type&&nm(e)).map(e=>e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function SO(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class SR{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,n){return Promise.resolve({})}constructor(e){SO(this,"formJson",void 0),SO(this,"domainObjectValue",void 0),this.formJson=e}}var SI=t(45278),SN=t(18348),Sj=t(92049),SP=t(53098),SF="[object String]";let SU=function(e){return"string"==typeof e||!(0,Sj.A)(e)&&(0,SP.A)(e)&&(0,SN.A)(e)==SF};function SB(e){let[n,t]=(0,g.useState)(null),[D,S]=(0,g.useState)(!0),[a,r]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=new AbortController;return!nl(e.encounter)&&SU(e.encounter)?(0,o.openmrsFetch)(`${o.restBaseUrl}/encounter/${e.encounter}?v=${i.RZ}`,{signal:n.signal}).then(e=>{t(e.data),S(!1)}).catch(e=>{r(e)}):(nl(e.encounter)||t(e.encounter),S(!1)),()=>{n.abort()}},[e.encounter]),{encounter:n,error:a,isLoading:D}}var Sz=t(54225);function SV(){let{data:e,error:n,isLoading:t}=(0,Sz.A)(`${o.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,o.openmrsFetch),D=e?.data.results.find(e=>"Clinician"===e.name);return D?{encounterRole:D,error:n,isLoading:t}:{encounterRole:e?.data.results[0],error:n,isLoading:t}}var SH=t(59324);let SW=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)))",t=`${o.restBaseUrl}/programenrollment?patient=${e}&v=${n}`,{data:D,error:S,isLoading:a}=(0,SH.Ay)(e?t:null,o.openmrsFetch),r=D?.data?.results.length>0?D?.data.results.sort((e,n)=>n.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:r?.filter(e=>!e.dateCompleted),error:S,isLoading:a}},Sq=(e,n)=>{let{activePrograms:t,error:D,isLoading:S}=SW(n.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:t,errorFetchingPatientPrograms:D,isLoadingPatientPrograms:S}};function SG(e){let[n,t]=(0,g.useState)(!0),{encounter:D,isLoading:S}=SB(e.formJson),{encounterRole:a,isLoading:r}=SV(),{isLoadingPatientPrograms:o,patientPrograms:i}=Sq(e.patient?.id,e.formJson);return(0,g.useEffect)(()=>{t(o||S||r)},[o,S,r]),{data:{encounter:D,patientPrograms:i,encounterRole:a},isLoading:n,error:null,updateContext:e=>{e(e=>(e.processor.domainObjectValue=D,{...e,domainObjectValue:D,customDependencies:{...e.customDependencies,patientPrograms:i,defaultEncounterRole:a}}))}}}let SK={checkbox:[],toggle:!1,text:""},SY=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class SQ extends SR{prepareFormSchema(e){let n=new Set;function t(e,D,S,a){e.id&&n.add(e.id),e.inlineRendering=e.inlineRendering??D.inlineRendering??S.inlineRendering??a.inlineRendering,e.readonly=e.readonly??D.readonly??S.readonly??a.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,t(n,D,S,a)))}return e.pages.forEach(n=>{n.sections.forEach(D=>{D.questions.forEach(S=>{t(S,D,n,e)})})}),SJ(e,n),e}async processSubmission(e,n){let{encounterRole:t,encounterProvider:D,encounterDate:S,encounterLocation:a}=Sw(e),r=(e,n,t)=>(0,o.translateFrom)(SI.L,e,n,t),i=Sh(e.formFields,a),g=Sf(e,S,t,D,a);try{await Promise.all(Sp(e.patient,i)),i?.length&&(0,o.showSnackbar)({title:r("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let n=Sm(e.formFields);await Promise.all(Sy(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,tl.j)(n);return Promise.reject({title:r("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let n=Sb(e.formFields,e.patient,e.customDependencies.patientPrograms),t=await await Sv(n);t?.length&&(0,o.showSnackbar)({title:r("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(n){let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:t}=await (0,nj.saveEncounter)(n,g,g.uuid),D=t.orders.map(e=>e.orderNumber),S=t.diagnoses.map(e=>e.display);D.length&&(0,o.showSnackbar)({title:r("ordersSaved","Order(s) saved successfully"),subtitle:D.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 D=await S$(e.formFields,t,n);D?.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,tl.j)(n);return Promise.reject({title:r("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return t}catch(n){console.error("Error saving encounter",n);let e=(0,tl.j)(n);return Promise.reject({title:r("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:SG}}async getInitialValues(e){let{domainObjectValue:n,formFields:t,formFieldAdapters:D}=e,S={},a=[];if(n){await Promise.all(t.map(async t=>{let r=D[t.type];if(t.meta.initialValue?.omrsObject&&!nl(t.meta.initialValue.refinedValue)){S[t.id]=t.meta.initialValue.refinedValue;return}if(r){nf(t,"repeating")&&!t.meta?.repeat?.isClone&&a.push(t);let D=null;try{D=await r.getInitialValue(t,n,e),t.meta.initialValue.refinedValue=D}catch(e){console.error(e)}if("obsGroup"===t.type)return;if(nl(D)?nl(t.questionOptions.defaultValue)?S[t.id]=SK[t.questionOptions.rendering]??"":S[t.id]=Sk(t):S[t.id]=D,t.questionOptions.calculate?.calculateExpression)try{await SZ(t,S,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${t.type}`)}));let r=await Promise.all(a.flatMap(t=>SE(t,n,S,e))).then(e=>e.flat());t.push(...r)}else{let n=t.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),a=[];await Promise.all(n.map(async n=>{let t=D[n.type];if(S[n.id]=SK[n.questionOptions.rendering]??null,nl(S[n.id])&&SY.includes(n.type))try{S[n.id]=await t.getInitialValue(n,null,e)}catch(e){console.error(e)}n.questionOptions.defaultValue&&(S[n.id]=Sk(n)),n.questionOptions.calculate?.calculateExpression&&a.push(n)})),await Promise.all(a.map(async n=>{try{await SZ(n,S,e)}catch(e){console.error(e)}}))}return S}async loadDependencies(e,n){let{patient:t,formJson:D}=e,S=await (0,nj.getPreviousEncounter)(t?.id,D.encounterType);return n(e=>({...e,previousDomainObjectValue:S})),e}async getHistoricalValue(e,n){let{formFields:t,sessionMode:D,patient:S,methods:{getValues:a},formFieldAdapters:r,previousDomainObjectValue:o,visit:i}=n,g={value:e,type:"field"},s=r[e.type];if(e.historicalExpression){let n=await n4(e.historicalExpression,g,t,a(),{mode:D,patient:S,previousEncounter:o,visit:i});return n?tr(e,n):null}return o&&e.questionOptions.enablePreviousValue?await s.getPreviousValue(e,o,n):null}}async function SZ(e,n,t){let{formFields:D,sessionMode:S,patient:a,visit:r}=t,o=e.questionOptions.calculate.calculateExpression,i={value:e,type:"field"},g={mode:S,patient:a,visit:r},s=await n4(o,i,D,n,g);nl(s)||(n[e.id]=s)}function SJ(e,n){let t=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function D(e,D){for(let S of e.matchAll(t)){let e=S[2];n.has(e)&&console.error(`The calculateExpression for the field '${D}' 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&&D(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 SX=t(77541);function S1(e){let{formFields:n,formFieldValidators:t,patient:D,sessionMode:S,addInvalidField:a,updateFormField:r,methods:{getValues:o,trigger:i}}=e,g=o();return 0===n.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(o=>{let i=t[o.type];if(i){let t=i.validate(e,g[e.id],{formFields:n,values:g,expressionContext:{patient:D,mode:S},...o}).filter(e=>"error"===e.resultType);return t.length&&(e.meta.submission={...e.meta.submission,errors:t},r(e),a(e)),t}})).filter(e=>!!e).length}async function S0(e,n,t,D,S){return Promise.all(e.map(async({postAction:e,config:a,actionId:r,enabled:i})=>{try{let S=[];if(n)if(n.forEach(e=>{e?.data&&S.push(e.data),e?.uuid&&S.push(e)}),S.length)(!i||(0,SX.g)(i,S))&&await e.applyAction({patient:t,sessionMode:D,encounters:S},a);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,tl.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 S2({patientUuid:e,formUuid:n,setIsSubmitting:t,setIsValidating:D}){let{t:S}=(0,nD.useTranslation)();(0,g.useEffect)(()=>{let a=a=>{let{formUuid:r,patientUuid:o,action:i}=a.detail;if(!i||!r||!o)return void(0,tl.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(i){case"onSubmit":t(!0);break;case"validateForm":D(!0);break;default:(0,tl.N)(Error(`Unsupported form action: "${i}"`),S("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",a),()=>{window.removeEventListener("ampath-form-action",a)}},[t,D,n,e])}function S3(e){let[n,t]=(0,g.useState)([]);return(0,g.useEffect)(()=>{let n=[];e?.length&&e.map(e=>{let t="string"==typeof e?e:e.actionId;a5(t)?.then(D=>n.push({postAction:D,config:e.config,actionId:t,enabled:e.enabled}))}),t(n)},[e]),n}let S4=(0,g.createContext)(void 0),S8=({patient:e,patientUUID:n,sessionMode:t,sessionDate:D,formJson:S,workspaceLayout:a,location:r,provider:i,visit:l,isFormExpanded:d=!0,children:c,formSubmissionProps:u,hideFormCollapseToggle:f,handleConfirmQuestionDeletion:h,setIsFormDirty:p})=>{let{t:m}=(0,nD.useTranslation)(),y=(0,g.useRef)(),b=(0,g.useRef)({}),v=(0,o.useLayoutType)(),{isSubmitting:$,setIsSubmitting:w,onSubmit:_,onError:A,handleClose:M}=u,[x,L]=(0,g.useState)(!1),C=S3(S.postSubmissionActions),k=new AbortController,E=(0,g.useCallback)((e,n,t)=>{n?b.current[e]=t:y.current=t},[]),T=(0,g.useRef)({EncounterFormProcessor:SQ}),O=(0,g.useCallback)(()=>{let e=[y.current,...Object.values(b.current)],n=e.every(e=>S1(e));return{forms:e,isValid:n}},[]);return S2({patientUuid:n,formUuid:S?.uuid,setIsSubmitting:w,setIsValidating:L}),(0,g.useEffect)(()=>{x&&(O(),L(!1))},[x,O]),(0,g.useEffect)(()=>{if($){let{forms:n,isValid:D}=O();D?Promise.all(n.map(e=>e.processor.processSubmission(e,k))).then(async n=>{u.setIsSubmitting(!1),"edit"===t?(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}),C&&await S0(C,n,e,t,m),f(),_?_(n):M()}).catch(e=>{w(!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)}):w(!1)}return()=>{k.abort()}},[$,O]),s().createElement(S4.Provider,{value:{patient:e,sessionMode:t,sessionDate:D,formJson:S,formProcessors:T.current,layoutType:v,workspaceLayout:a,visit:l,location:r,provider:i,isFormExpanded:d,registerForm:E,handleConfirmQuestionDeletion:h,setIsFormDirty:p}},T.current&&c)},S9=()=>{let e=(0,g.useContext)(S4);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e};var S7=t(49530),S6={};S6.styleTagTransform=_(),S6.setAttributes=b(),S6.insert=m().bind(null,"head"),S6.domAPI=h(),S6.insertStyleElement=$(),u()(S7.A,S6);let S5=S7.A&&S7.A.locals?S7.A.locals:void 0,ae=function({question:e,rows:n,handleDelete:t,handleAdd:D,questionIndex:S}){let{t:a}=(0,nD.useTranslation)();return s().createElement("div",{className:S5.actionButtons},S>0&&s().createElement(L.$nd,{className:S5.button,kind:"danger",onClick:t},s().createElement("span",null,a("remove","Remove"))),S===n.length-1&&s().createElement(L.$nd,{className:S5.button,iconDescription:a("add","Add"),kind:"primary",disabled:DX(e.questionOptions.repeatOptions?.limit,n.length),onClick:D},s().createElement("span",null,e.questionOptions.repeatOptions?.addText||a("add","Add"))))};var an=t(54357),at={};at.styleTagTransform=_(),at.setAttributes=b(),at.insert=m().bind(null,"head"),at.domAPI=h(),at.insertStyleElement=$(),u()(an.A,at);let aD=an.A&&an.A.locals?an.A.locals:void 0,aS={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function aa(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function ar(e){return{...e,questionOptions:{...e.questionOptions,rendering:aS[e.type]||null}}}let ao=({field:e})=>{let[n,t]=(0,g.useState)([]),D=ty(),{handleConfirmQuestionDeletion:S}=S9(),{patient:a,sessionMode:r,formFieldAdapters:i,formFields:l,methods:{getValues:d,setValue:c,unregister:u},addFormField:f,removeFormField:h,deletedFields:p,setDeletedFields:m,visit:y}=D;(0,g.useEffect)(()=>{t(l.filter(n=>n.questionOptions.concept===e.questionOptions.concept&&n.id.startsWith(e.id)&&!n.meta?.repeat?.wasDeleted))},[l,e]);let b=(0,g.useCallback)(S=>{let o=[];function g(e){e.hide?.hideWhenExpression&&(e.isHidden=n3(e.hide.hideWhenExpression,{value:e,type:"field"},[...l,...o],d(),{mode:r,patient:a,visit:y})),e.questionOptions.calculate?.calculateExpression&&n4(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...l,...o],d(),{mode:r,patient:a,visit:y}).then(n=>{nl(n)||(c(e.id,n),i[e.type]?.transformFieldValue(e,n,D))})}let s=DZ(e,null,S);o.push(s),"obsGroup"===s.type&&s.questions?.forEach(e=>{o.push(e)}),o.forEach(e=>{g(e),f(e)}),t([...n,s])},[l,e,n,D]),v=e=>{e.meta.initialValue?.omrsObject?(i[e.type]?.transformFieldValue(e,null,D),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(n=>{n.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},i[n.type]?.transformFieldValue(n,null,D)})):(nh(e),u(e.id),e.questions?.forEach(e=>u(e.id))),t(n.filter(n=>n.id!==e.id)),m([...p,e]),h(e.id)},$=e=>{if(S&&"function"==typeof S){let n=S(e);n&&"function"==typeof n.then&&"function"==typeof n.catch?n.then(()=>v(e)).catch(()=>(0,o.createErrorHandler)()):"boolean"==typeof n?n&&v(e):v(e)}else v(e)},w=(0,g.useMemo)(()=>n.map((t,D)=>{let S=s().createElement(tP,{fieldId:t.id,valueAdapter:i[t.type],repeatOptions:{targetRendering:ar(t).questionOptions.rendering}});return s().createElement("div",{key:t.id+"_wrapper"},0!==D&&s().createElement("div",null,s().createElement("hr",{className:aD.divider})),s().createElement("div",{className:aD.nodeContainer},S),!ny(r)&&s().createElement(ae,{question:t,rows:n,questionIndex:D,handleDelete:()=>{$(t)},handleAdd:()=>{b(n.reduce((n,t)=>{let D=Number(t.id.slice(e.id.length+1));return Number.isFinite(D)?Math.max(n,D):n},0)+1)}}))}),[n]);return!e.isHidden&&w&&aa(e)?s().createElement(s().Fragment,null,s().createElement("div",null,w)):null};var ai=t(92137),ag=t(18401),as={};as.styleTagTransform=_(),as.setAttributes=b(),as.insert=m().bind(null,"head"),as.domAPI=h(),as.insertStyleElement=$(),u()(ag.A,as);let al=ag.A&&ag.A.locals?ag.A.locals:void 0;var ad=t(10272),ac={};ac.styleTagTransform=_(),ac.setAttributes=b(),ac.insert=m().bind(null,"head"),ac.domAPI=h(),ac.insertStyleElement=$(),u()(ad.A,ac);let au=ad.A&&ad.A.locals?ad.A.locals:void 0;var af=t(59184),ah=t(63654);function ap({bytesContentFamily:e,removeFileCb:n,...t}){let D=(0,g.useMemo)(()=>{switch(e){case"image":return am;case"pdf":return ay;default:return ab}},[]);return s().createElement("div",{className:au.thumbnail},s().createElement(D,t),s().createElement(L.$nd,{kind:"ghost",className:au.removeButton,onClick:n},s().createElement(af.R9,{size:16,className:au.closeIcon})))}function am(e){return s().createElement("img",{className:au.imageThumbnail,src:e.src,alt:e.title})}function ay(e){return s().createElement("div",{className:au.pdfThumbnail,role:"button",tabIndex:0},s().createElement(ah.aD,{size:24}))}function ab(e){return s().createElement("div",{className:au.pdfThumbnail,role:"button",tabIndex:0},s().createElement(ah.WZ,{size:24}))}let av=[{name:"drug",baseControlComponent:DW},{name:"problem",baseControlComponent:DW},{name:"encounter-provider",baseControlComponent:DW},{name:"encounter-location",baseControlComponent:DW},{name:"select-concept-answers",baseControlComponent:DW},{name:"encounter-role",baseControlComponent:DW}],a$=[{name:"text",component:DO},{name:"textarea",component:DC},{name:"select",component:DA},{name:"checkbox",component:Dc},{name:"radio",component:Dv},{name:"date",component:Dn},{name:"datetime",component:Dn},{name:"number",component:Dp},{name:"content-switcher",component:t7},{name:"toggle",component:Dj},{name:"workspace-launcher",component:DY},{name:"group",component:tV},{name:"repeating",component:ao},{name:"markdown",component:Dg},{name:"fixed-value",component:Dt},{name:"ui-select-extended",component:DW},{name:"file",component:({field:e,value:n,setFieldValue:t})=>{let{t:D}=(0,nD.useTranslation)(),{sessionMode:S}=ty(),a="tablet"===(0,o.useLayoutType)(),r=(0,g.useCallback)(()=>{let D=(0,o.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),t([...n||[],e]),D(),Promise.resolve()),closeModal:()=>{D()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[n,e]),i=(0,g.useCallback)(e=>{let D=[...n],S=D[e];S.uuid?D[e]={...S,voided:!0}:D.splice(e,1),t(D)},[n]);return ny(S)&&!n?s().createElement(tZ,{label:D(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):s().createElement("div",null,s().createElement("div",{className:d()(al.label,"cds--label")},s().createElement(t9,{field:e})),!ny(S)&&s().createElement("div",null,s().createElement(L.$nd,{className:al.uploadButton,kind:a?"ghost":"tertiary",onClick:r,renderIcon:e=>s().createElement(ai.OM,{size:16,...e})},e.questionOptions.buttonLabel?D(e.questionOptions.buttonLabel):D("addFile","Add file"))),s().createElement("div",{className:al.thumbnailGrid},n&&n.filter(e=>!e.voided).map((e,n)=>s().createElement("div",{className:al.thumbnailContainer},s().createElement(ap,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>i(n)})))))}},...DF.map(e=>({name:e.name,component:av.find(n=>n.name===e.name).baseControlComponent}))],aw={validate:(e,n,t)=>{let D=new Date,S=n?[]:ng.validate(e,n);return S.length?S:n&&!(0,th.H)(t?.allowFutureDates)&&n.getTime&&n.getTime()>D.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},a_=[{name:"default_value",component:St},{name:"form_field",component:ng},{name:"date",component:aw},{name:"js_expression",component:{validate:function(e,n,t){let D="value.invalid",S="Invalid value",a="Field has warnings";return t.expressionContext.myValue=n,Object.keys(t).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(r=>{let o="failsWhenExpression"===r;return n3(t[r],{value:e,type:"field"},t.formFields,{...t.values,[e.id]:n},t.expressionContext)?[{resultType:o?"error":"warning",errCode:o?D:null,message:t.message?t.message:o?S:a}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,n,t){let{referenceQuestionId:D,referenceQuestionAnswers:S,values:a,formFields:r,message:o}=t,i=a[r.find(e=>e.id===D).id];return nl(n)||S.includes(i)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:o}]}}}];function aA(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class aM{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 t=n.split("?");n=`${t[0]}/${e}?${t[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){aA(this,"url",void 0),this.url=e}}class ax extends aM{fetchData(e,n){if(nl(n?.class)&&nl(n?.concept)&&!n?.useSetMembersByConcept&&nl(e))return Promise.resolve([]);let t=`${o.restBaseUrl}/concept?name=&searchType=fuzzy&v=custom:(uuid,display,conceptClass:(uuid,display))`;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=");return t=`${D[0]}/${n.concept}?v=custom:(uuid,setMembers:(uuid,display))`,(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)}constructor(){super(`${o.restBaseUrl}/concept?v=custom:(uuid,display,conceptClass:(uuid,display))`)}}class aL extends aM{fetchData(e,n,t){let D=this.url,S=D.split("?");return n?.tag&&(D=`${S[0]}?tag=${n.tag}&${S[1]}`),t&&(D=`${S[0]}/${t}?${S[1]}`),(0,o.openmrsFetch)(e?`${D}&q=${e}`:D).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${o.restBaseUrl}/location?v=custom:(uuid,display)`)}}class aC extends aM{async fetchData(e,n){let t="v=custom:(uuid,display)",D=`${o.restBaseUrl}/provider?${t}`,{data:S}=await (0,o.openmrsFetch)(e?`${D}&q=${e}`:D);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 ak extends aM{fetchSingleItem(e){return(0,o.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,n){let t=this.buildUrl(n.referencedValue||n.concept);return(0,o.openmrsFetch)(t).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 aE extends aM{async fetchData(e,n){let t="v=custom:(uuid,display,name)",D=`${o.restBaseUrl}/encounterrole?${t}`,{data:S}=await (0,o.openmrsFetch)(e?`${D}&q=${e}`:D);return S?.results}constructor(){super(null)}}let aT=[{name:"location_datasource",component:new aL},{name:"drug_datasource",component:new ax},{name:"problem_datasource",component:new ax},{name:"select_concept_answers_datasource",component:new ak},{name:"provider_datasource",component:new aC},{name:"encounter_role_datasource",component:new aE}],aO=[{name:"ProgramEnrollmentSubmissionAction",load:()=>t.e("4831").then(t.bind(t,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>t.e("7484").then(t.bind(t,26679))}];function aR(e,n,t){if("programState"===e.type){let e=t.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},t.meta=e}try{aN(e),aP(e),aF(e),aU(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>aR(e,n,t)):e.questions.forEach(e=>aR(e,n,t))),e.meta.pageId=n.id}catch(e){console.error(e)}}function aI(e){let n=[];return e?.forEach(e=>{if(n.push(e),"inlineDate"!==e.type&&(0,th.H)(e.questionOptions?.showDate)){let t={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(t)}}),n}function aN(e){aj(e,"readonly"),aj(e,"required"),aj(e,"unspecified"),aj(e.questionOptions,"disallowDecimals"),aj(e.questionOptions,"isSearchable"),aj(e.questionOptions,"isTransient"),aj(e.questionOptions,"enablePreviousValue"),aj(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function aj(e,n){if(e&&"string"==typeof e[n]){let t=e[n].trim().toLowerCase();("true"===t||"false"===t)&&(e[n]="true"===t)}return e}function aP(e){!nf(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 aF(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=nf(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":aq(e)}}function aU(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":aB(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":aV(e);break;case"repeating":case"group":az(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 aB(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,th.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),nf(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function az(e){nf(e,"group")&&e.questions?.length&&e.questions.forEach(az),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function aV(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function aH(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 aW(e){let n=[];return e?.forEach(e=>{if(n.push(e),"obsComment"!==e.type&&(0,th.H)(e.questionOptions?.showComment)){let t={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(t)}}),n}function aq(e){("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type)&&(e.questionOptions.datasource={name:"problem_datasource",config:{class:e.questionOptions.diagnosis?.conceptClasses}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource)}function aG(e,n){Object.entries(n).forEach(([n,t])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===n?e.questionOptions.defaultValue=t:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===n&&(e.questionOptions.defaultValue=t)})})})})})}let aK=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,n)=>(aj(e,"readonly"),e.pages.forEach((n,t)=>{let D=n.label??"";n.id=`page-${D.replace(/\s/g,"")}-${t}`,aj(n,"readonly"),n.sections&&n.sections.forEach(t=>{t.questions=aI(t.questions),t.questions=aW(t.questions),aj(t,"readonly"),aj(t,"isExpanded"),t?.questions?.forEach((t,D)=>aR(t,n,e))})}),n&&"object"==typeof n&&aG(e,n),e.meta?.programs&&aH(e),e)}}];function aY(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].provider}return null}function aQ(e){if(e&&e.encounterProviders?.length){let n=e.encounterProviders.length-1;return e.encounterProviders[n].encounterRole}return null}function aZ(e,n){return D7(e,n)||!nl(e.meta.submission.newValue.obsDatetime)}let aJ=[{type:"obs",component:D0},{type:"control",component:{getDisplayValue:(e,n)=>n,transformFieldValue:function(e,n,t){return null},getInitialValue:function(e,n,t){return null},getPreviousValue:function(e,n,t){return null},tearDown:function(){}}},{type:"obsGroup",component:D0},{type:"testOrder",component:Sr},{type:"programState",component:{transformFieldValue:function(e,n,t){if(nh(e),e.meta?.initialValue?.omrsObject?.uuid===n||nl(n))return null;e.meta.submission.newValue={state:n,startDate:nr()().format()}},getInitialValue:function(e,n,t){let D=t.customDependencies.patientPrograms?.find(n=>n.program.uuid===e.questionOptions.programUuid);if(D?.states?.length>0){let n=D.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,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){return n&&n.location?.uuid?n.location.uuid:t.location.uuid},getPreviousValue:function(e,n,t){let D=n??t.previousDomainObjectValue;return{value:D?.location?.uuid,display:D?.location?.name}},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){let D=aY(n);return D?.uuid?D.uuid:t.currentProvider?.uuid},getPreviousValue:function(e,n,t){let D=aY(n??t.previousDomainObjectValue);return{value:D?.uuid,display:D?.name}},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){let D=n??t.domainObjectValue;return D?aQ(D)?.uuid:t.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,n,t){let D=n??t.previousDomainObjectValue;if(D){let e=aQ(D);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,t){let D=t.getFormField(e.meta.targetField),S=t.methods.getValues(D.id),a=D.meta.initialValue?.omrsObject;if(D.meta.submission?.newValue)nl(n)&&!aZ(D,S)?D.meta.submission.newValue=null:D.meta.submission.newValue.comment=n;else if(!nm(D)&&a){if(nl(n)&&nl(a.comment))return null;let e=D8(D,S);D.meta.submission={newValue:{...e,comment:n}}}return null},getInitialValue:function(e,n,t){if(n??t.domainObjectValue){let n=e.id.split("_obs_comment")[0],D=t.formFields.find(e=>e.id===n);return D?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,n,t){np(e,n,null)},getInitialValue:function(e,n,t){return n?.encounterDatetime?new Date(n.encounterDatetime):t.sessionDate},getPreviousValue:function(e,n,t){if(n?.encounterDatetime){let t=new Date(n.encounterDatetime);return{value:t,display:this.getDisplayValue(e,t)}}return null},getDisplayValue:function(e,n){return(0,o.formatDate)(n)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,n,t){let D=t.getFormField(e.meta.targetField),S=t.methods.getValues(D.id),a=n instanceof Date?(0,o.toOmrsIsoString)(n):n;if(D.meta.submission?.newValue)nl(a)&&!aZ(D,S)?D.meta.submission.newValue=null:D.meta.submission.newValue.obsDatetime=a;else if(!nm(D)&&D.meta.initialValue?.omrsObject){if(nl(n)&&nl(D.meta.initialValue.omrsObject?.obsDatetime))return null;let e=D8(D,S);D.meta.submission={newValue:{...e,obsDatetime:a}}}},getInitialValue:function(e,n,t){if(n??t.domainObjectValue){let n=e.id.split("_inline_date")[0],D=t.formFields.find(e=>e.id===n),S=D?.meta.initialValue?.omrsObject;if(S?.obsDatetime)return(0,o.parseDate)(S.obsDatetime)}return null},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?(0,o.formatDate)(n):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,n,t){return(nh(e),e.meta.initialValue?.refinedValue===n||nl(n))?null:(e.meta.submission.newValue={identifier:n,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:t.location},e.meta.submission.newValue)},getInitialValue:function(e,n,t){let D=t.patient?.identifier?.find(n=>n.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:D,refinedValue:D?.value}},D?.value},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,n,t){return(nh(e),e.meta.initialValue?.refinedValue===n||nl(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,t){let D=t.patient?.extension?.find(n=>n.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:D,refinedValue:D?.valueString||D?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,n,t){return null},getDisplayValue:function(e,n){return n?.display?n.display:n},tearDown:function(){}}},{type:"diagnosis",component:Ss}],aX={},a1={},a0={},a2={},a3={},a4={};async function a8(e){if(a1[e])return a1[e];let n=a$.find(n=>n.name===e||n?.alias===e)?.component;if(!n){let t=await rD().controls.find(n=>n.name===e||n?.alias===e)?.load?.();n=t?.default}return a1[e]=n,n}function a9(e){return rS(e)&&!nf(e,"file")?(e.disabled=!0,e.isDisabled=!0,a8("text")):a8(e.questionOptions.rendering)}async function a7(e){if(a0[e])return a0[e];let n=aJ.find(n=>n.type===e)?.component;if(!n){let t=await rD().fieldValueAdapters.find(n=>n.type===e)?.load?.();n=t?.default}return a0[e]=n,n}async function a6(){let e=[],n=a4;if(Object.keys(n).length)return Object.values(n);let t=rD().formSchemaTransformers||[];return e.push(...(await Promise.all(t.map(async e=>{let n=await e.load?.();return n?.default}))).filter(e=>void 0!==e)),e.push(...aK.map(e=>e.component)),e.forEach(e=>{a4[aK.find(n=>n.component===e).name]=e}),e}async function a5(e){let n=a2[e];if(n)return n;let t=aO.find(n=>n.name===e);if(t){let n=t.load,D=await n();return a2[e]=D.default,D.default}let D=rD().postSubmissionActions.find(n=>n.name===e);if(D){let n=D.load,t=await n();return a2[e]=t.default,t.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function re(e){if(aX[e])return aX[e];let n=a_.find(n=>n.name===e)?.component;if(!n){let t=await rD().fieldValidators.find(n=>n.name===e)?.load?.();n=t?.default}return aX[e]=n,n}async function rn(e){if(a3[e])return a3[e];let n=aT.find(n=>n.name===e)?.component;if(!n){let t=DU(e);if(t)n=aT.find(e=>e.name===t.datasource.name)?.component;else{let t=await rD().dataSources.find(n=>n.name===e)?.load?.();if(!t)throw Error("Datasource not found");n=t.default}}return a3[e]=n,n}function rt(){return rD().expressionHelpers}function rD(){return(0,o.getGlobalStore)(i.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function rS(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function ra(e,n,t,D,S){let[a,r]=(0,g.useState)(null),[o,i]=(0,g.useState)(rs(e,n));return(0,g.useEffect)(()=>{let a=new AbortController,o=e=>{if(e?.translations){let n=window.i18next.language;window.i18next.addResourceBundle(n,SI.L,e.translations,!0,!0)}r(e)};return rr(e,n,D,S).then(e=>{o({...e,encounter:t})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),i(Error("Error loading form JSON: "+e.message)))}),()=>{a.abort()}},[D,e,n,t]),{formJson:a,isLoading:!a&&!o,formError:o}}async function rr(e,n,t,D){let S=await (0,nj.fetchOpenMRSForm)(e),a=await (0,nj.fetchClobData)(S),r=await a6(),o=a?{...a,uuid:S.uuid}:rd(n),i=ro(o);rg(o,await ri(i,t));let g=rf(o),s=await rh(g),l=g.reduce((e,n)=>(e[n.formName]=n.alias,e),{});return rm(o,rp(s),l),rl(o,r,t,D)}function ro(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function ri(e,n){return Promise.all(e.map(e=>rr(e,null,n)))}function rg(e,n){n.forEach(n=>{let t=e.pages.find(e=>e.subform?.name===n.name);t&&(t.subform.form=n)})}function rs(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 rl(e,n=[],t,S){return rc(e,t),n.reduce((e,n)=>n.transform(e,S),e),ru(e),D(t,e)}function rd(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function rc(e,n){for(let t=e.pages.length-1;t>=0;t--){let D=e.pages[t];(0,th.H)(D.isSubform)&&!(0,th.H)(D.isHidden)&&D.subform?.form?.encounterType===e.encounterType&&(D.subform.form.pages.filter(e=>!(0,th.H)(e.isSubform)),e.pages.splice(t,1,...rl(D.subform.form,[],n).pages))}}function ru(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function rf(e){let n=e?.referencedForms;return n||[]}async function rh(e){return Promise.all(e.map(e=>rr(e.formName,null,null)))}function rp(e){let n=new Map;return e.forEach(e=>{n.set(e.name,e)}),n}function rm(e,n,t){n.forEach((n,D)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===D||e.reference.form===t[D])){let t=ry(e,n);Object.assign(e,t)}})})})}function ry(e,n){let t,D=n.pages.filter(n=>n.label===e.reference.page);if(D.length>0){let n=D[0].sections.filter(n=>n.label===e.reference.section);n.length>0&&(t=n[0])}return rb(t,e.reference)}function rb(e,n){if(n?.excludeQuestions){let t=n.excludeQuestions;e.questions=e.questions.filter(e=>!t.includes(e.id))}return e}var rv=t(76922);function r$(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class rw{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(){r$(this,"scrollablePagesSubject",new rv.BehaviorSubject([])),r$(this,"pagesWithErrorsSubject",new rv.BehaviorSubject(new Set)),r$(this,"activePagesSubject",new rv.BehaviorSubject(new Set)),r$(this,"evaluatedPagesVisibilitySubject",new rv.BehaviorSubject(null))}}let r_=new rw,rA=new Set;function rM(e){e&&Object.values(e).forEach(e=>{rA.add(e)})}function rx(){rA.forEach(e=>{try{e.tearDown()}catch(e){}}),rA.clear(),r_.clear()}function rL(e){let[n,t]=(0,g.useState)(void 0),D=(0,g.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),S=(0,g.useCallback)(e=>{t(e.detail.value)},[]);return(0,g.useEffect)(()=>{let n=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(n)},[e]),(0,g.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",S),()=>{window.removeEventListener("openmrs:form-collapse-toggle",S)}),[]),{isFormExpanded:n,hideFormCollapseToggle:D}}let rC=26.25,rk=32.25,rE=48.25;function rT(e){let[n,t]=(0,g.useState)(0),D=(0,g.useMemo)(()=>n<=rC?"narrow":n<=rk?"wider":n<=rE?"extra-wide":"ultra-wide",[n]);return(0,g.useLayoutEffect)(()=>{let n=()=>{let n=e.current?.parentElement?.offsetWidth,D=parseInt(getComputedStyle(document.documentElement).fontSize);n&&t(nw(n,D))};n();let D=new ResizeObserver(e=>{n()});return e.current?.parentElement&&D.observe(e.current?.parentElement),()=>{D.disconnect()}},[e]),D}let rO=()=>{let[e,n]=(0,g.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,g.useEffect)(()=>{let e=[r_.getScrollablePagesObservable().subscribe(e=>{n(n=>({...n,pages:e,hasMultiplePages:e.length>1}))}),r_.getPagesWithErrorsObservable().subscribe(e=>{n(n=>({...n,pagesWithErrors:Array.from(e)}))}),r_.getActivePagesObservable().subscribe(e=>{n(n=>({...n,activePages:Array.from(e)}))}),r_.getEvaluatedPagesVisibilityObservable().subscribe(e=>{n(n=>({...n,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function rR(e){let n=new Date,t=n.getFullYear()-e.getFullYear();return n.getMonth()<e.getMonth()||n.getMonth()===e.getMonth()&&n.getDate()<e.getDate()?t-1:t}let rI={female:"F",male:"M",other:"O",unknown:"U"},rN=e=>{let{patient:n,isLoading:t,error:D}=(0,o.usePatient)(e);return n&&!t&&(n.age=rR(new Date(n?.birthDate)),n.sex=rI[n.gender]??"U"),{patient:n,isLoadingPatient:t,patientError:D}},rj=(e,n,t)=>{let[D,S]=(0,g.useState)(!1),[a,r]=(0,g.useState)(""),{loadDependencies:o}=e;return(0,g.useEffect)(()=>{let e=!1;return o&&(S(!0),o(n,t).then(()=>{e||S(!1)}).catch(n=>{e||(r(n),(0,tl.N)(n,"Encountered error while loading dependencies"))})),()=>{e=!0}},[o]),{isLoading:D,error:a}},rP=(e,n,t)=>{let[D,S]=(0,g.useState)(!0),[a,r]=(0,g.useState)({}),[o,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{e&&!n&&t.formFields?.length&&Object.keys(t.formFieldAdapters).length&&!Object.keys(a).length&&e.getInitialValues(t).then(e=>{r(e),S(!1)}).catch(e=>{console.error(e),i(e),S(!1)})},[e,n,t,a]),{isLoadingInitialValues:D,initialValues:a,error:o}};var rF=t(20767),rU={};rU.styleTagTransform=_(),rU.setAttributes=b(),rU.insert=m().bind(null,"head"),rU.domAPI=h(),rU.insertStyleElement=$(),u()(rF.A,rU);let rB=rF.A&&rF.A.locals?rF.A.locals:void 0,rz=({section:e})=>{let{formFieldAdapters:n}=ty(),t=(0,g.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return s().createElement("div",{className:rB.section},e.questions.map(e=>n[e.type]?s().createElement("div",{key:`${t}-${e.id}`,className:rB.sectionBody},s().createElement(tP,{key:e.id,fieldId:e.id,valueAdapter:n[e.type]})):null))};var rV=t(20594),rH=!!("u">typeof window&&window.document&&window.document.createElement);function rW(){if(!rH||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),t=function(){};window.addEventListener("testPassiveEventSupport",t,n),window.removeEventListener("testPassiveEventSupport",t,n)}catch(e){}return e}var rq=void 0;function rG(){return void 0===rq&&(rq=rW()),rq}function rK(e){if(e)return rG()?e:!!e.capture}function rY(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function rQ(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function rZ(e){this.target=e,this.events={}}rZ.prototype.getEventHandlers=function(){return function(e,n){var t=String(e)+" "+String(rY(n));return this.events[t]||(this.events[t]={handlers:[],handleEvent:void 0},this.events[t].nextHandlers=this.events[t].handlers),this.events[t]}}(),rZ.prototype.handleEvent=function(){return function(e,n,t){var D=this.getEventHandlers(e,n);D.handlers=D.nextHandlers,D.handlers.forEach(function(e){e&&e(t)})}}(),rZ.prototype.add=function(){return function(e,n,t){var D=this,S=this.getEventHandlers(e,t);rQ(S),0===S.nextHandlers.length&&(S.handleEvent=this.handleEvent.bind(this,e,t),this.target.addEventListener(e,S.handleEvent,t)),S.nextHandlers.push(n);var a=!0;return function(){return function(){if(a){a=!1,rQ(S);var r=S.nextHandlers.indexOf(n);S.nextHandlers.splice(r,1),0===S.nextHandlers.length&&(D.target&&D.target.removeEventListener(e,S.handleEvent,t),S.handleEvent=void 0)}}}()}}();var rJ="__consolidated_events_handlers__";function rX(e,n,t,D){e[rJ]||(e[rJ]=new rZ(e));var S=rK(D);return e[rJ].add(n,t,S)}var r1=t(23286);function r0(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function r2(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function r3(e,n){var t=r2(e);if("number"==typeof t)return t;var D=r0(e);if("number"==typeof D)return D*n}var r4="above",r8="inside",r9="below",r7="invisible";function r6(e){return"string"==typeof e.type}var r5="<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 oe(e,n){if(e&&!r6(e)&&!n)throw Error(r5)}function on(e){return e.viewportBottom-e.viewportTop==0?r7:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?r8:e.viewportBottom<e.waypointTop?r9:e.waypointTop<e.viewportTop?r4:r7}var ot=[];function oD(e){ot.push(e),r||(r=setTimeout(function(){var e;for(r=null;e=ot.shift();)e()},0));var n=!0;return function(){if(n){n=!1;var t=ot.indexOf(e);-1!==t&&(ot.splice(t,1),!ot.length&&r&&(clearTimeout(r),r=null))}}}function oS(e){return"window"===e?t.g.window:e}var oa="u">typeof window,or={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},oo=function(e){function n(n){var t;return(t=e.call(this,n)||this).refElement=function(e){t._ref=e},t}(0,rV.A)(n,e);var t=n.prototype;return t.componentDidMount=function(){var e=this;oa&&(this.cancelOnNextTick=oD(function(){e.cancelOnNextTick=null;var n=e.props,t=n.children;n.debug,oe(t,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=rX(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=rX(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},t.componentDidUpdate=function(){var e=this;oa&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=oD(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},t.componentWillUnmount=function(){oa&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},t._findScrollableAncestor=function(){var e=this.props,n=e.horizontal,t=e.scrollableAncestor;if(t)return oS(t);for(var D=this._ref;D.parentNode&&(D=D.parentNode)!==document.body;){var S=window.getComputedStyle(D),a=(n?S.getPropertyValue("overflow-x"):S.getPropertyValue("overflow-y"))||S.getPropertyValue("overflow");if("auto"===a||"scroll"===a||"overlay"===a)return D}return window},t._handleScroll=function(e){if(this._ref){var n=this._getBounds(),t=on(n),D=this._previousPosition,S=this.props,a=(S.debug,S.onPositionChange),r=S.onEnter,o=S.onLeave,i=S.fireOnRapidScroll;if(this._previousPosition=t,D!==t){var g={currentPosition:t,previousPosition:D,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom};a.call(this,g),t===r8?r.call(this,g):D===r8&&o.call(this,g);var s=D===r9&&t===r4,l=D===r4&&t===r9;i&&(s||l)&&(r.call(this,{currentPosition:r8,previousPosition:D,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}),o.call(this,{currentPosition:t,previousPosition:r8,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}))}}},t._getBounds=function(){var e,n,t=this.props,D=t.horizontal;t.debug;var S=this._ref.getBoundingClientRect(),a=S.left,r=S.top,o=S.right,i=S.bottom,g=D?a:r,s=D?o:i;this.scrollableAncestor===window?(e=D?window.innerWidth:window.innerHeight,n=0):(e=D?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,n=D?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var l=this.props,d=l.bottomOffset,c=r3(l.topOffset,e),u=r3(d,e),f=n+e;return{waypointTop:g,waypointBottom:s,viewportTop:n+c,viewportBottom:f-u}},t.render=function(){var e=this,n=this.props.children;if(!n)return s().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(r6(n)||(0,r1.isForwardRef)(n)){var t=function(t){e.refElement(t),n.ref&&("function"==typeof n.ref?n.ref(t):n.ref.current=t)};return s().cloneElement(n,{ref:t})}return s().cloneElement(n,{innerRef:this.refElement})},n}(s().PureComponent);oo.above=r4,oo.below=r9,oo.inside=r8,oo.invisible=r7,oo.defaultProps=or,oo.displayName="Waypoint";var oi=t(38374),og={};og.styleTagTransform=_(),og.setAttributes=b(),og.insert=m().bind(null,"head"),og.domAPI=h(),og.insertStyleElement=$(),u()(oi.A,og);let os=oi.A&&oi.A.locals?oi.A.locals:void 0;function ol({section:e,sectionIndex:n,visibleSections:t,isFormExpanded:D}){let{t:S}=(0,nD.useTranslation)(),[a,r]=(0,g.useState)(D);return(0,g.useEffect)(()=>{r(D)},[D]),s().createElement(L.AsP,{title:S(e.label),open:a,className:d()(os.sectionContainer,{[os.firstSection]:0===n,[os.lastSection]:n===t.length-1})},s().createElement("div",{className:os.formSection},s().createElement(rz,{section:e})))}let od=function({page:e,isFormExpanded:n}){let{t}=(0,nD.useTranslation)(),[D,S]=(0,g.useState)(!1),a=(0,g.useMemo)(()=>e.sections.filter(e=>{let n=e.questions.some(e=>!(0,th.H)(e.isHidden));return!(0,th.H)(e.isHidden)&&n}),[e.sections]),r=()=>S(!D);return(0,g.useEffect)(()=>(S(!n),()=>{r_.removeInactivePage(e.id)}),[n]),s().createElement("div",null,s().createElement(oo,{key:e.id,onEnter:()=>r_.addActivePage(e.id),onLeave:()=>r_.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},s().createElement("div",{id:e.id,className:os.pageContent},s().createElement("div",{className:os.pageHeader,onClick:r},s().createElement("p",{className:os.pageTitle},t(e.label),s().createElement("span",{className:os.collapseIconWrapper},D?s().createElement(o.ChevronDownIcon,{className:os.collapseIcon,"aria-label":"Expand"}):s().createElement(o.ChevronUpIcon,{className:os.collapseIcon,"aria-label":"Collapse"})))),s().createElement("div",{className:d()({[os.hiddenAccordion]:D,[os.accordionContainer]:!D})},s().createElement(L.nD3,null,a.map((e,t)=>s().createElement(ol,{key:`section-${e.label}`,section:e,sectionIndex:t,visibleSections:a,isFormExpanded:n})))))))},oc={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},ou=(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}},of=(e,n)=>{let{formFields:t,patient:D,sessionMode:S,visit:a}=n,[r,o]=(0,g.useState)(n.formJson),[i,s]=(0,g.useState)(!1),l=(0,g.useMemo)(()=>t?.map(n=>{let r={value:n,type:"field"},o={patient:D,mode:S,visit:a};if(n.hide?.hideWhenExpression){let D=n3(n.hide.hideWhenExpression,r,t,e,o);n.isHidden=D,Array.isArray(n.questions)&&n.questions.forEach(e=>{e.isHidden=D})}else n.isHidden=!1;"object"==typeof n.required&&"conditionalRequired"===n.required.type?n.isRequired=te(n,t,e):n.isRequired=(0,th.H)(n.required),"object"==typeof n.disabled&&n.disabled.disableWhenExpression?n.isDisabled=n3(n.disabled.disableWhenExpression,r,t,e,o):n.isDisabled=(0,th.H)(n.disabled),n.validators?.some(e=>"conditionalAnswered"===e.type)&&n5(n,t),n.questionOptions.answers?.filter(e=>!nl(e.hide?.hideWhenExpression)).forEach(n=>{n.isHidden=n3(n.hide.hideWhenExpression,r,t,e,o)}),n.questionOptions.answers?.filter(e=>!nl(e.disable?.disableWhenExpression)).forEach(n=>{n.disable.isDisabled=n3(n.disable?.disableWhenExpression,r,t,e,o)}),"string"==typeof n.readonly&&oh(n.readonly)&&(n.meta.readonlyExpression=n.readonly,n.readonly=n3(n.readonly,r,t,e,o));let i=n.questionOptions.repeatOptions?.limitExpression;return"repeating"!==n.questionOptions.rendering||nl(i)||(n.questionOptions.repeatOptions.limit=n3(i,r,t,e,o)),n}),[e,t,D,S]);return(0,g.useEffect)(()=>{n.formJson?.pages?.forEach(n=>{n.hide?tt({value:n,type:"page"},t,e,S,D,n3,null):n.isHidden=!1,n?.sections?.forEach(n=>{n.hide?tt({value:n,type:"section"},t,e,S,D,n3,null):n.isHidden=!1})}),o(n$(n.formJson)),s(!0)},[n.formJson,t]),{evaluatedFormJson:r,evaluatedFields:l,evaluatedPagesVisibility:i}};function oh(e){return"true"!==e&&"false"!==e}function op(e,n){let t=(0,g.useCallback)(n=>{e({type:"ADD_FORM_FIELD",value:n})},[]),D=(0,g.useCallback)(t=>{if(t.meta.groupId){let e=n.find(e=>e.id===t.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===t.id?t:e),D(e))}e({type:"UPDATE_FORM_FIELD",value:(0,DQ.A)(t)})},[n]),S=(0,g.useCallback)(e=>n.find(n=>n.id===e),[n.length]),a=(0,g.useCallback)(n=>{e({type:"REMOVE_FORM_FIELD",value:n})},[]),r=(0,g.useCallback)(n=>{e({type:"SET_INVALID_FIELDS",value:n})},[]),o=(0,g.useCallback)(n=>{e({type:"ADD_INVALID_FIELD",value:n})},[]),i=(0,g.useCallback)(n=>{e({type:"REMOVE_INVALID_FIELD",value:n})},[]);return{addFormField:t,updateFormField:D,getFormField:S,removeFormField:a,setInvalidFields:r,addInvalidField:o,removeInvalidField:i,setForm:(0,g.useCallback)(n=>{e({type:"SET_FORM_JSON",value:n$(n)})},[]),setDeletedFields:(0,g.useCallback)(n=>{e({type:"SET_DELETED_FIELDS",value:n})},[])}}let om=({processorContext:e,initialValues:n,isSubForm:t,setIsLoadingFormDependencies:D})=>{let{evaluatedFields:S,evaluatedFormJson:a,evaluatedPagesVisibility:r}=of(n,e),{registerForm:o,setIsFormDirty:i,workspaceLayout:l,isFormExpanded:d}=S9(),c=nt({defaultValues:n,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:u}}=c,[{formFields:f,invalidFields:h,formJson:p,deletedFields:m},y]=(0,g.useReducer)(ou,{...oc,formFields:S,formJson:a}),{addFormField:b,updateFormField:v,getFormField:$,removeFormField:w,setInvalidFields:_,addInvalidField:A,removeInvalidField:M,setForm:x,setDeletedFields:L}=op(y,f);(0,g.useEffect)(()=>{let e=p.pages.filter(e=>!e.isSubform).map(e=>e);r_.updateScrollablePages(e)},[p.pages]),(0,g.useEffect)(()=>{r_.setEvaluatedPagesVisibility(r)},[r]),(0,g.useEffect)(()=>{r_.updatePagesWithErrors(h.map(e=>e.meta.pageId))},[h]);let C=(0,g.useMemo)(()=>({...e,workspaceLayout:l,methods:c,formFields:f,formJson:p,invalidFields:h,deletedFields:m,addFormField:b,updateFormField:v,getFormField:$,removeFormField:w,setInvalidFields:_,addInvalidField:A,removeInvalidField:M,setForm:x,setDeletedFields:L}),[e,l,c,f,p,h,m]);return(0,g.useEffect)(()=>{o(p.name,t,C)},[p.name,t,C]),(0,g.useEffect)(()=>{i(u)},[u]),s().createElement(tm,C,p.pages.map(e=>e.isSubform||to(e)?e.isSubform&&e.subform?.form?s().createElement(ok,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:D}):s().createElement(od,{key:e.label,page:e,isFormExpanded:d}):null))},oy=({context:e,setContext:n,useCustomHooks:t,setIsLoadingCustomHooks:D})=>{let{isLoading:S=!1,error:a=null,data:r,updateContext:o}=t(e);return(0,g.useEffect)(()=>{!S&&o&&(o(n),D(!1))},[S]),null};function ob(e){let[n,t]=(0,g.useMemo)(()=>{let n=[],t=new Set,D=e=>{let n=[],t=new Set,D=(e,S)=>{let a=S?{...e,meta:{...e.meta,groupId:S}}:e;n.push(a),a.questionOptions?.concept&&t.add(a.questionOptions.concept),a.questionOptions?.answers?.forEach(e=>{e.concept&&t.add(e.concept)}),"obsGroup"===a.type&&a.questions&&a.questions.forEach(e=>{D(e,a.id)})};return e.forEach(e=>D(e)),{flattenedFields:n,conceptReferences:t}};return e.pages?.forEach(e=>e.sections?.forEach(e=>{if(e.questions){let{flattenedFields:S,conceptReferences:a}=D(e.questions);n.push(...S),a.forEach(e=>t.add(e))}})),[n,t]},[e]);return{formFields:n,conceptReferences:t}}let ov="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function o$(e){let{data:n,error:t,isLoading:D}=(0,SH.Ay)([`${o.restBaseUrl}/conceptreferences?v=${ov}`,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,g.useMemo)(()=>n?.data?Object.values(n.data):void 0,[n]),isLoading:D,error:t}}function ow(e){let[n,t]=(0,g.useState)();return(0,g.useEffect)(()=>{let n=new Set;e.forEach(e=>{e.validators?.forEach(e=>n.add(e.type))});let D=Array.from(n);Promise.all(D.map(e=>re(e))).then(e=>{t(Object.assign({},...e.map((e,n)=>({[D[n]]:e}))))})},[e]),n}function o_(e,n){return(0,g.useMemo)(()=>e.length&&n?.length?e.map(e=>{let t=tS(e.questionOptions.concept,n);return e.questionOptions.concept=t?t.uuid:e.questionOptions.concept,e.label=e.label?e.label:t?.display,i.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&t?.conceptClass?.display==="Question"&&t?.answers?.length&&(e.questionOptions.answers=t.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:t},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let t=tS(e.concept,n);return{...e,concept:t?t.uuid:e.concept,label:e.label?e.label:t?.display}})),e}):e??[],[n,e])}let oA=e=>{let[n,t]=(0,g.useState)({});return(0,g.useEffect)(()=>{let n=new Set;e.forEach(e=>{n.add(e.type)});let D=Array.from(n);Promise.all(D.map(e=>a7(e))).then(e=>{t(Object.assign({},...D.map((n,t)=>({[n]:e[t]}))))})},[e]),n};var oM=t(24464),ox={};ox.styleTagTransform=_(),ox.setAttributes=b(),ox.insert=m().bind(null,"head"),ox.domAPI=h(),ox.insertStyleElement=$(),u()(oM.A,ox);let oL=oM.A&&oM.A.locals?oM.A.locals:void 0,oC=()=>{let{t:e}=(0,nD.useTranslation)();return s().createElement("div",{className:oL.loaderContainer},s().createElement(L.OuH,{className:oL.loader,description:`${e("loading","Loading")} ...`}))},ok=({formJson:e,isSubForm:n=!1,setIsLoadingFormDependencies:t})=>{let{patient:D,sessionMode:S,formProcessors:a,layoutType:r,location:o,provider:i,sessionDate:l,visit:d}=S9(),c=(0,g.useMemo)(()=>{let n,t=a[e.processor];return t?n=new t(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),n=new SQ(e)),n.prepareFormSchema(e),n},[a,e.processor]),[u,f]=(0,g.useState)({patient:D,formJson:e,sessionMode:S,layoutType:r,location:o,currentProvider:i,processor:c,sessionDate:l,visit:d,formFields:[],formFieldAdapters:{},formFieldValidators:{}}),{t:h}=(0,nD.useTranslation)(),{formFields:p,conceptReferences:m}=ob(e),{concepts:y,isLoading:b}=o$(Array.from(m)),v=o_(p,y),$=oA(p),w=ow(p),{isLoading:_}=rj(c,u,f),A=c.getCustomHooks().useCustomHooks,[M,x]=(0,g.useState)(!!A),[L,C]=(0,g.useState)(!0),{isLoadingInitialValues:k,initialValues:E,error:T}=rP(c,_||M||b,u);return(0,g.useEffect)(()=>{let e=_||M||b||k;t(e),C(e)},[_,M,b,k]),(0,g.useEffect)(()=>{f(e=>({...e,...$&&{formFieldAdapters:$},...w&&{formFieldValidators:w},...v?.length?{formFields:v}:p?.length?{formFields:p}:{}}))},[$,w,p,v]),(0,g.useEffect)(()=>{(0,tl.N)(T,h("errorLoadingInitialValues","Error loading initial values"))},[T]),(0,g.useEffect)(()=>{$&&rM($)},[$]),s().createElement(s().Fragment,null,A&&s().createElement(oy,{context:u,setContext:f,useCustomHooks:A,setIsLoadingCustomHooks:x}),L&&!n?s().createElement(oC,null):s().createElement(om,{processorContext:u,initialValues:E,isSubForm:n,setIsLoadingFormDependencies:t}))};var oE=t(94963),oT={};oT.styleTagTransform=_(),oT.setAttributes=b(),oT.insert=m().bind(null,"head"),oT.domAPI=h(),oT.insertStyleElement=$(),u()(oE.A,oT);let oO=oE.A&&oE.A.locals?oE.A.locals:void 0,oR=({patient:e,hideActionsOverflow:n})=>s().createElement("div",{className:oO.patientBannerContainer},s().createElement(o.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:n}})),oI=({pages:e,defaultPage:n,activePages:t,evaluatedPagesVisibility:D})=>{let[S,a]=(0,g.useState)(null),[r,o]=(0,g.useState)(!1),[i,s]=(0,g.useState)(null),l=(0,g.useRef)(!0);return(0,g.useEffect)(()=>{r||!D||((()=>{let t=e.find(({label:e})=>e===n);if(t&&!t.isHidden)a(t.id),ta(t.id);else{let n=e.find(e=>!e.isHidden);n&&a(n.id)}})(),o(!0))},[e,n,D,r]),(0,g.useEffect)(()=>{let e=null;return r&&(e=setTimeout(()=>{l.current=!1},200)),()=>{e&&clearTimeout(e)}},[r]),(0,g.useEffect)(()=>{if(l.current)return;let n=null;if(i&&t.includes(i)){a(i),n=setTimeout(()=>{s(null)},100);return}return!i&&t.length>0&&a(t.reduce((n,t)=>e.findIndex(e=>e.id===n)<e.findIndex(e=>e.id===t)?n:t)),()=>{n&&clearTimeout(n)}},[t,i,e]),{currentActivePage:S,requestPage:(0,g.useCallback)(e=>{l.current=!1,s(e),a(e),ta(e)},[])}};var oN=t(16265),oj={};oj.styleTagTransform=_(),oj.setAttributes=b(),oj.insert=m().bind(null,"head"),oj.domAPI=h(),oj.insertStyleElement=$(),u()(oN.A,oj);let oP=oN.A&&oN.A.locals?oN.A.locals:void 0;function oF({page:e,currentActivePage:n,pagesWithErrors:t,requestPage:D}){let{t:S}=(0,nD.useTranslation)(),a=e.id===n,r=t.includes(e.id),i="tablet"===(0,o.useLayoutType)();return s().createElement("div",{className:d()(oP.pageLink,{[oP.activePage]:a&&!r,[oP.errorPage]:r&&!a,[oP.activeErrorPage]:r&&a,[oP.pageLinkTablet]:i})},s().createElement("button",{onClick:n=>{n.preventDefault(),D(e.id)}},s().createElement("span",null,S(e.label))))}let oU=({defaultPage:e,isFormSubmitting:n,sessionMode:t,onCancel:D,handleClose:S,hideFormCollapseToggle:a,hideControls:r})=>{let{t:i}=(0,nD.useTranslation)(),{pages:l,pagesWithErrors:c,activePages:u,evaluatedPagesVisibility:f}=rO(),{currentActivePage:h,requestPage:p}=oI({pages:l,defaultPage:e,activePages:u,evaluatedPagesVisibility:f}),m=(0,o.useLayoutType)(),y=(0,g.useMemo)(()=>"tablet"===m?"lg":"sm",[m]);return s().createElement("div",{className:oP.sidebar},l.filter(e=>to(e)).map(e=>s().createElement(oF,{key:e.id,page:e,currentActivePage:h,pagesWithErrors:c,requestPage:p})),"view"!==t&&!r&&s().createElement("hr",{className:oP.divider}),!r&&s().createElement("div",{className:oP.sideNavActions},"view"!==t&&s().createElement(L.$nd,{className:oP.saveButton,disabled:n,type:"submit",size:y},n?s().createElement(L.OuH,{description:i("submitting","Submitting")+"..."}):s().createElement("span",null,`${i("save","Save")}`)),s().createElement(L.$nd,{className:d()(oP.closeButton,{[oP.topMargin]:"view"===t}),kind:"tertiary",onClick:()=>{D?.(),S?.(),a()},size:y},"view"===t?i("close","Close"):i("cancel","Cancel"))))};var oB=t(7356),oz={};oz.styleTagTransform=_(),oz.setAttributes=b(),oz.insert=m().bind(null,"head"),oz.domAPI=h(),oz.insertStyleElement=$(),u()(oB.A,oz);let oV=oB.A&&oB.A.locals?oB.A.locals:void 0,oH=({formJson:e,patientUUID:n,formUUID:t,encounterUUID:D,visit:S,formSessionIntent:a,mode:r,onSubmit:i,onCancel:l,handleClose:c,handleConfirmQuestionDeletion:u,markFormAsDirty:f,hideControls:h=!1,hidePatientBanner:p=!1,preFilledQuestions:m})=>{let{t:y}=(0,nD.useTranslation)(),b=(0,o.useSession)(),v=(0,g.useRef)(null),$=(0,g.useMemo)(()=>new Date,[]),w=rT(v),{patient:_,isLoadingPatient:A}=rN(n),[M,x]=(0,g.useState)(!1),[C,k]=(0,g.useState)(!1),[E,T]=(0,g.useState)(!1),O=nl(r)?nl(D)?"enter":"edit":r,{isFormExpanded:R,hideFormCollapseToggle:I}=rL(O),{hasMultiplePages:N}=rO(),{formJson:j,isLoading:P,formError:F}=ra(t,e,D,a,m),U=(0,g.useMemo)(()=>!p&&_&&"ultra-wide"===w&&"embedded-view"!==r,[_,r,w,p]),B=(0,g.useMemo)(()=>["narrow"].includes(w),[w]),z=(0,g.useMemo)(()=>"embedded-view"!==r&&!M&&null!==N&&(B||!N),[r,B,M,N]),V=(0,g.useMemo)(()=>"embedded-view"!==r&&!M&&null!==N&&!B&&N,[B,M,N]);(0,g.useEffect)(()=>{(0,tl.N)(F,y("errorLoadingFormSchema","Error loading form schema"))},[F]),(0,g.useEffect)(()=>()=>{rx()},[]),(0,g.useEffect)(()=>{f?.(E)},[E]);let H=(0,g.useCallback)(e=>{e.preventDefault(),k(!0)},[]);return s().createElement("form",{ref:v,noValidate:!0,className:d()("cds--form",oV.form),onSubmit:H},A||P?s().createElement(oC,null):s().createElement(S8,{patient:_,patientUUID:n,sessionMode:O,sessionDate:$,formJson:j,workspaceLayout:"ultra-wide"===w?"maximized":"minimized",location:b?.sessionLocation,provider:b?.currentProvider,visit:S,handleConfirmQuestionDeletion:u,isFormExpanded:R,formSubmissionProps:{isSubmitting:C,setIsSubmitting:k,onSubmit:i,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:I,setIsFormDirty:T},s().createElement("div",{className:oV.formContainer},M&&s().createElement("div",{className:oV.linearActivity},s().createElement("div",{className:oV.indeterminate})),s().createElement("div",{className:oV.formContent},V&&s().createElement(oU,{isFormSubmitting:C,sessionMode:r,defaultPage:j.defaultPage,onCancel:l,handleClose:c,hideFormCollapseToggle:I,hideControls:h}),s().createElement("div",{className:oV.formContentInner},U&&s().createElement(oR,{patient:_,hideActionsOverflow:!0}),j.markdown&&s().createElement("div",{className:oV.markdownContainer},s().createElement(Di,{markdown:j.markdown})),s().createElement("div",{className:oV.formBody},s().createElement(ok,{formJson:j,setIsLoadingFormDependencies:x})),z&&!h&&s().createElement(L.Te$,{className:oV.minifiedButtons},s().createElement(L.$nd,{kind:"secondary",onClick:()=>{l&&l(),c&&c(),I()}},"view"===r?y("close","Close"):y("cancel","Cancel")),s().createElement(L.$nd,{className:oV.saveButton,disabled:M||C||"view"===r,kind:"primary",type:"submit"},C?s().createElement(L.OuH,{description:y("submitting","Submitting")+"..."}):s().createElement("span",null,`${y("save","Save")}`))))))))},oW=function(e){return s().createElement(nD.I18nextProvider,{i18n:window.i18next,defaultNS:SI.L},s().createElement(oH,e))}},6232(e,n,t){"use strict";function D(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)}t.d(n,{H:()=>D,O:()=>S})},10578(e,n,t){"use strict";t.d(n,{N:()=>S,j:()=>a});var D=t(53870);function S(e,n){if(e){let t=a(e).join(", ");console.error(e),(0,D.showSnackbar)({subtitle:t,title:n,kind:"error",isLowContrast:!1})}}function a(e){let n=e?.responseBody?.error?.fieldErrors,t=e?.responseBody?.error?.globalErrors;return n&&0!==Object.keys(n).length||t?t?.length?t.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 t={};return e.forEach(e=>{let D=n.obs?.find(n=>n.formFieldPath.includes(e))?.value;"object"==typeof D&&(D=D.uuid),D&&(D=formatValue(D)),t[e]=D}),t}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,t){e=t.nmd(e),function(){var e="ace",n=function(){return this}();if(!n&&"u">typeof window&&(n=window),e||"u"<typeof requirejs){var t=function(e,n,D){"string"!=typeof e?t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(D=n),t.modules[e]||(t.payloads[e]=D,t.modules[e]=null))};t.modules={},t.payloads={};var D=function(e,n,t){if("string"==typeof n){var D=r(e,n);if(void 0!=D)return t&&t(),D}else if("[object Array]"===Object.prototype.toString.call(n)){for(var a=[],o=0,i=n.length;o<i;++o){var g=r(e,n[o]);if(void 0==g&&S.original)return;a.push(g)}return t&&t.apply(null,a)||!0}},S=function(e,n){var t=D("",e,n);return void 0==t&&S.original?S.original.apply(this,arguments):t},a=function(e,n){if(-1!==n.indexOf("!")){var t=n.split("!");return a(e,t[0])+"!"+a(e,t[1])}if("."==n.charAt(0))for(n=e.split("/").slice(0,-1).join("/")+"/"+n;-1!==n.indexOf(".")&&D!=n;){var D=n;n=n.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return n},r=function(e,n){n=a(e,n);var S=t.modules[n];if(!S){if("function"==typeof(S=t.payloads[n])){var r={},o={id:n,uri:"",exports:r,packaged:!0};r=S(function(e,t){return D(n,e,t)},r,o)||o.exports,t.modules[n]=r,delete t.payloads[n]}S=t.modules[n]=r||S}return S};o(e)}function o(e){var D=n;e&&(n[e]||(n[e]={}),D=n[e]),D.define&&D.define.packaged||(t.original=D.define,D.define=t,D.define.packaged=!0),D.require&&D.require.packaged||(S.original=D.require,D.require=S,D.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,n,t){function D(e,n,t){Object.defineProperty(e,n,{value:t,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||D(String.prototype,"startsWith",function(e,n){return n=n||0,this.lastIndexOf(e,n)===n}),String.prototype.endsWith||D(String.prototype,"endsWith",function(e,n){var t=this;(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var D=t.indexOf(e,n);return -1!==D&&D===n}),String.prototype.repeat||D(String.prototype,"repeat",function(e){for(var n="",t=this;e>0;)1&e&&(n+=t),(e>>=1)&&(t+=t);return n}),String.prototype.includes||D(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),t=1;t<arguments.length;t++){var D=arguments[t];null!=D&&Object.keys(D).forEach(function(e){n[e]=D[e]})}return n}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(n){return e[n]})}),Array.prototype.find||D(Array.prototype,"find",function(e){for(var n=this.length,t=arguments[1],D=0;D<n;D++){var S=this[D];if(e.call(t,S,D,this))return S}}),Array.prototype.findIndex||D(Array.prototype,"findIndex",function(e){for(var n=this.length,t=arguments[1],D=0;D<n;D++){var S=this[D];if(e.call(t,S,D,this))return D}}),Array.prototype.includes||D(Array.prototype,"includes",function(e,n){return -1!=this.indexOf(e,n)}),Array.prototype.fill||D(Array.prototype,"fill",function(e){for(var n=this,t=n.length>>>0,D=arguments[1],S=0|D,a=S<0?Math.max(t+S,0):Math.min(S,t),r=arguments[2],o=void 0===r?t:0|r,i=o<0?Math.max(t+o,0):Math.min(o,t);a<i;)n[a]=e,a++;return n}),Array.of||D(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,n,t){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,n,t){n.deepCopy=function e(n){if("object"!=typeof n||!n)return n;if(Array.isArray(n)){t=[];for(var t,D=0;D<n.length;D++)t[D]=e(n[D]);return t}if("[object Object]"!==Object.prototype.toString.call(n))return n;for(var D in t={},n)t[D]=e(n[D]);return t}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,n,t){"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 t="";n>0;)1&n&&(t+=e),(n>>=1)&&(e+=e);return t};var D=/^\s\s*/,S=/\s\s*$/;n.stringTrimLeft=function(e){return e.replace(D,"")},n.stringTrimRight=function(e){return e.replace(S,"")},n.copyObject=function(e){var n={};for(var t in e)n[t]=e[t];return n},n.copyArray=function(e){for(var n=[],t=0,D=e.length;t<D;t++)e[t]&&"object"==typeof e[t]?n[t]=this.copyObject(e[t]):n[t]=e[t];return n},n.deepCopy=e("./deep_copy").deepCopy,n.arrayToMap=function(e){for(var n={},t=0;t<e.length;t++)n[e[t]]=1;return n},n.createMap=function(e){var n=Object.create(null);for(var t in e)n[t]=e[t];return n},n.arrayRemove=function(e,n){for(var t=0;t<=e.length;t++)n===e[t]&&e.splice(t,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 t=[];return e.replace(n,function(e){t.push({offset:arguments[arguments.length-2],length:e.length})}),t},n.deferredCall=function(e){var n=null,t=function(){n=null,e()},D=function(e){return D.cancel(),n=setTimeout(t,e||0),D};return D.schedule=D,D.call=function(){return this.cancel(),e(),D},D.cancel=function(){return clearTimeout(n),n=null,D},D.isPending=function(){return n},D},n.delayedCall=function(e,n){var t=null,D=function(){t=null,e()},S=function(e){null==t&&(t=setTimeout(D,e||n))};return S.delay=function(e){t&&clearTimeout(t),t=setTimeout(D,e||n)},S.schedule=S,S.call=function(){this.cancel(),e()},S.cancel=function(){t&&clearTimeout(t),t=null},S.isPending=function(){return t},S},n.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},n.skipEmptyMatch=function(e,n,t){return t&&e.codePointAt(n)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,n,t){"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 D="object"==typeof navigator?navigator:{},S=(/mac|win|linux/i.exec(D.platform)||["other"])[0].toLowerCase(),a=D.userAgent||"",r=D.appName||"";n.isWin="win"==S,n.isMac="mac"==S,n.isLinux="linux"==S,n.isIE="Microsoft Internet Explorer"==r||r.indexOf("MSAppHost")>=0?parseFloat((a.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((a.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),n.isOldIE=n.isIE&&n.isIE<9,n.isGecko=n.isMozilla=a.match(/ Gecko\/\d+/),n.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),n.isWebKit=parseFloat(a.split("WebKit/")[1])||void 0,n.isChrome=parseFloat(a.split(" Chrome/")[1])||void 0,n.isSafari=parseFloat(a.split(" Safari/")[1])&&!n.isChrome||void 0,n.isEdge=parseFloat(a.split(" Edge/")[1])||void 0,n.isAIR=a.indexOf("AdobeAIR")>=0,n.isAndroid=a.indexOf("Android")>=0,n.isChromeOS=a.indexOf(" CrOS ")>=0,n.isIOS=/iPad|iPhone|iPod/.test(a)&&!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,t){"use strict";var D,S=e("./useragent"),a="http://www.w3.org/1999/xhtml";n.buildDom=function e(n,t,D){if("string"==typeof n&&n){var S=document.createTextNode(n);return t&&t.appendChild(S),S}if(!Array.isArray(n))return n&&n.appendChild&&t&&t.appendChild(n),n;if("string"!=typeof n[0]||!n[0]){for(var a=[],r=0;r<n.length;r++){var o=e(n[r],t,D);o&&a.push(o)}return a}var i=document.createElement(n[0]),g=n[1],s=1;g&&"object"==typeof g&&!Array.isArray(g)&&(s=2);for(var r=s;r<n.length;r++)e(n[r],i,D);return 2==s&&Object.keys(g).forEach(function(e){var n=g[e];"class"===e?i.className=Array.isArray(n)?n.join(" "):n:"function"==typeof n||"value"==e||"$"==e[0]?i[e]=n:"ref"===e?D&&(D[n]=i):"style"===e?"string"==typeof n&&(i.style.cssText=n):null!=n&&i.setAttribute(e,n)}),t&&t.appendChild(i),i},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||a,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,t){n.hasCssClass(e,t)||(e.className+=" "+t)},n.removeCssClass=function(e,n){for(var t=e.className.split(/\s+/g);;){var D=t.indexOf(n);if(-1==D)break;t.splice(D,1)}e.className=t.join(" ")},n.toggleCssClass=function(e,n){for(var t=e.className.split(/\s+/g),D=!0;;){var S=t.indexOf(n);if(-1==S)break;D=!1,t.splice(S,1)}return D&&t.push(n),e.className=t.join(" "),D},n.setCssClass=function(e,t,D){D?n.addCssClass(e,t):n.removeCssClass(e,t)},n.hasCssString=function(e,n){var t,D=0;if(t=(n=n||document).querySelectorAll("style")){for(;D<t.length;)if(t[D++].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){i(e[0],e[1])})}function i(e,t,S){if(!("u"<typeof document)){if(r){if(S)o();else if(!1===S)return r.push([e,t])}if(!D){var a=S;S&&S.getRootNode&&(a=S.getRootNode())&&a!=S||(a=document);var i=a.ownerDocument||a;if(t&&n.hasCssString(t,a))return null;t&&(e+="\n/*# sourceURL=ace/css/"+t+" */");var g=n.createElement("style");g.appendChild(i.createTextNode(e)),t&&(g.id=t),a==i&&(a=n.getDocumentHead(i)),a.insertBefore(g,a.firstChild)}}}if(n.useStrictCSP=function(e){D=e,!1==e?o():r||(r=[])},n.importCssString=i,n.importCssStylsheet=function(e,t){n.buildDom(["link",{rel:"stylesheet",href:e}],n.getDocumentHead(t))},n.scrollbarWidth=function(e){var t=n.createElement("ace_inner");t.style.width="100%",t.style.minWidth="0px",t.style.height="200px",t.style.display="block";var D=n.createElement("ace_outer"),S=D.style;S.position="absolute",S.left="-10000px",S.overflow="hidden",S.width="200px",S.minWidth="0px",S.height="150px",S.display="block",D.appendChild(t);var a=e&&e.documentElement||document&&document.documentElement;if(!a)return 0;a.appendChild(D);var r=t.offsetWidth;S.overflow="scroll";var o=t.offsetWidth;return r===o&&(o=D.clientWidth),a.removeChild(D),r-o},n.computedStyle=function(e,n){return window.getComputedStyle(e,"")||{}},n.setStyle=function(e,n,t){e[n]!==t&&(e[n]=t)},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 g=document.createElement("div");n.HI_DPI&&void 0!==g.style.transform&&(n.HAS_CSS_TRANSFORMS=!0),S.isEdge||void 0===g.style.animationName||(n.HAS_CSS_ANIMATION=!0),g=null}n.HAS_CSS_TRANSFORMS?n.translate=function(e,n,t){e.style.transform="translate("+Math.round(n)+"px, "+Math.round(t)+"px)"}:n.translate=function(e,n,t){e.style.top=Math.round(t)+"px",e.style.left=Math.round(n)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=e("./dom");n.get=function(e,n){var t=new XMLHttpRequest;t.open("GET",e,!0),t.onreadystatechange=function(){4===t.readyState&&n(t.responseText)},t.send(null)},n.loadScript=function(e,n){var t=D.getDocumentHead(),S=document.createElement("script");S.src=e,t.appendChild(S),S.onload=S.onreadystatechange=function(e,t){(t||!S.readyState||"loaded"==S.readyState||"complete"==S.readyState)&&(S=S.onload=S.onreadystatechange=null,t||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,t){"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 t in n)e[t]=n[t];return e},n.implement=function(e,t){n.mixin(e,t)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,n,t){"use strict";var D={},S=function(){this.propagationStopped=!0},a=function(){this.defaultPrevented=!0};D._emit=D._dispatchEvent=function(e,n){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var t=this._eventRegistry[e]||[],D=this._defaultHandlers[e];if(t.length||D){"object"==typeof n&&n||(n={}),n.type||(n.type=e),n.stopPropagation||(n.stopPropagation=S),n.preventDefault||(n.preventDefault=a),t=t.slice();for(var r=0;r<t.length&&(t[r](n,this),!n.propagationStopped);r++);if(D&&!n.defaultPrevented)return D(n,this)}},D._signal=function(e,n){var t=(this._eventRegistry||{})[e];if(t){t=t.slice();for(var D=0;D<t.length;D++)t[D](n,this)}},D.once=function(e,n){var t=this;if(this.on(e,function D(){t.off(e,D),n.apply(null,arguments)}),!n)return new Promise(function(e){n=e})},D.setDefaultHandler=function(e,n){var t=this._defaultHandlers;if(t||(t=this._defaultHandlers={_disabled_:{}}),t[e]){var D=t[e],S=t._disabled_[e];S||(t._disabled_[e]=S=[]),S.push(D);var a=S.indexOf(n);-1!=a&&S.splice(a,1)}t[e]=n},D.removeDefaultHandler=function(e,n){var t=this._defaultHandlers;if(t){var D=t._disabled_[e];if(t[e]==n)D&&this.setDefaultHandler(e,D.pop());else if(D){var S=D.indexOf(n);-1!=S&&D.splice(S,1)}}},D.on=D.addEventListener=function(e,n,t){this._eventRegistry=this._eventRegistry||{};var D=this._eventRegistry[e];return D||(D=this._eventRegistry[e]=[]),-1==D.indexOf(n)&&D[t?"unshift":"push"](n),n},D.off=D.removeListener=D.removeEventListener=function(e,n){this._eventRegistry=this._eventRegistry||{};var t=this._eventRegistry[e];if(t){var D=t.indexOf(n);-1!==D&&t.splice(D,1)}},D.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=D}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,n,t){n.reportError=function(e,n){var t=Error(e);t.data=n,"object"==typeof console&&console.error&&console.error(t),setTimeout(function(){throw t})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,n,t){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,t){var D,S,a=e("./oop"),r=e("./event_emitter").EventEmitter,o=e("./report_error").reportError,i=e("./default_english_messages").defaultEnglishMessages,g={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 t=this.$options;e=Object.keys(t).filter(function(e){return!t[e].hidden})}return e.forEach(function(e){n[e]=this.getOption(e)},this),n},setOption:function(e,n){if(this["$"+e]!==n){var t=this.$options[e];if(!t)return s('misspelled option "'+e+'"');if(t.forwardTo)return this[t.forwardTo]&&this[t.forwardTo].setOption(e,n);t.handlesSet||(this["$"+e]=n),t&&t.set&&t.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]:s('misspelled option "'+e+'"')}};function s(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var l=function(){function e(){this.$defaultOptions={},D=i,S="dollarSigns"}return e.prototype.defineOptions=function(e,n,t){return e.$options||(this.$defaultOptions[n]=e.$options={}),Object.keys(t).forEach(function(n){var D=t[n];"string"==typeof D&&(D={forwardTo:D}),D.name||(D.name=n),e.$options[D.name]=D,"initialValue"in D&&(e["$"+D.name]=D.initialValue)}),a.implement(e,g),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(n){var t=e.$options[n];"value"in t&&e.setOption(n,t.value)})},e.prototype.setDefaultValue=function(e,n,t){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][n])break;if(!this.$defaultOptions[e][n])return!1}var D=this.$defaultOptions[e]||(this.$defaultOptions[e]={});D[n]&&(D.forwardTo?this.setDefaultValue(D.forwardTo,n,t):D[n].value=t)},e.prototype.setDefaultValues=function(e,n){Object.keys(n).forEach(function(t){this.setDefaultValue(e,t,n[t])},this)},e.prototype.setMessages=function(e,n){D=e,n&&n.placeholders&&(S=n.placeholders)},e.prototype.nls=function(e,n,t){!D[e]&&(s("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+n+"'."),D[n]||s("No message found for the default string '"+n+"' in the provided messages. Falling back to the default English message."));var a=D[e]||D[n]||n;return t&&("dollarSigns"===S&&(a=a.replace(/\$(\$|[\d]+)/g,function(e,n){return"$"==n?"$":t[n]})),"curlyBrackets"===S&&(a=a.replace(/\{([^\}]+)\}/g,function(e,n){return t[n]}))),a},e}();l.prototype.warn=s,l.prototype.reportError=o,a.implement(l.prototype,r),n.AppConfig=l}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,n,t){t.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,t){"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,t){var D,S=e("./lib/lang"),a=e("./lib/net"),r=e("./lib/dom");t.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 t=e.split("/"),D="snippets"==(n=n||t[t.length-2]||"")?"/":"-",S=t[t.length-1];if("worker"==n&&"-"==D){var a=RegExp("^"+n+"[\\-_]|[\\-_]"+n+"$","g");S=S.replace(a,"")}(!S||S==n)&&t.length>1&&(S=t[t.length-2]);var r=o[n+"Path"];return null==r?r=o.basePath:"/"==D&&(n=D=""),r&&"/"!=r.slice(-1)&&(r+="/"),r+n+D+S+this.get("suffix")},n.setModuleUrl=function(e,n){return o.$moduleUrls[e]=n};var i=function(n,t){return"ace/theme/textmate"===n||"./theme/textmate"===n?t(null,e("./theme/textmate")):D?D(n,t):void console.error("loader is not configured")};n.setLoader=function(e){D=e},n.dynamicModules=Object.create(null),n.$loading={},n.$loaded={},n.loadModule=function(e,t){if(Array.isArray(e))var D,S=e[0],r=e[1];else if("string"==typeof e)var r=e;var o=function(e){if(e&&!n.$loading[r])return t&&t(e);if(n.$loading[r]||(n.$loading[r]=[]),n.$loading[r].push(t),!(n.$loading[r].length>1)){var D=function(){i(r,function(e,t){t&&(n.$loaded[r]=t),n._emit("load.module",{name:r,module:t});var D=n.$loading[r];n.$loading[r]=null,D.forEach(function(e){e&&e(t)})})};if(!n.get("packaged"))return D();a.loadScript(n.moduleUrl(r,S),D),g()}};if(n.dynamicModules[r])n.dynamicModules[r]().then(function(e){e.default?o(e.default):o(e)});else{try{D=this.$require(r)}catch(e){}o(D||n.$loaded[r])}},n.$require=function(e){if("function"==typeof t.require)return t.require(e)},n.setModuleLoader=function(e,t){n.dynamicModules[e]=t};var g=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"),g=function(){})};n.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,n,t){"use strict";e("./lib/fixoldbrowsers");var D=e("./config");D.setLoader(function(n,t){e([n],function(e){t(null,e)})});var S=function(){return this||"u">typeof window&&window}();function a(n){if(S&&S.document){D.set("packaged",n||e.packaged||t.packaged||S.define&&define.packaged);var a={},o="",i=document.currentScript||document._currentScript,g=i&&i.ownerDocument||document;i&&i.src&&(o=i.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var s=g.getElementsByTagName("script"),l=0;l<s.length;l++){var d=s[l],c=d.src||d.getAttribute("src");if(c){for(var u=d.attributes,f=0,h=u.length;f<h;f++){var p=u[f];0===p.name.indexOf("data-ace-")&&(a[r(p.name.replace(/^data-ace-/,""))]=p.value)}var m=c.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);m&&(o=m[1])}}for(var y in o&&(a.base=a.base||o,a.packaged=!0),a.basePath=a.base,a.workerPath=a.workerPath||a.base,a.modePath=a.modePath||a.base,a.themePath=a.themePath||a.base,delete a.base,a)void 0!==a[y]&&D.set(y,a[y])}}function r(e){return e.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}t.exports=function(n){D.init=a,D.$require=e,n.require=e,"function"==typeof define&&(n.define=define)},a(!0)}),ace.define("ace/range",["require","exports","module"],function(e,n,t){"use strict";var D=function(){function e(e,n,t,D){this.start={row:e,column:n},this.end={row:t,column:D}}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,t=e.end,D=e.start;return 1==(n=this.compare(t.row,t.column))?1==(n=this.compare(D.row,D.column))?2:+(0==n):-1==n?-2:-1==(n=this.compare(D.row,D.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,t){if(this.end.row>t)var D={row:t+1,column:0};else if(this.end.row<n)var D={row:n,column:0};if(this.start.row>t)var S={row:t+1,column:0};else if(this.start.row<n)var S={row:n,column:0};return e.fromPoints(S||this.start,D||this.end)},e.prototype.extend=function(n,t){var D=this.compare(n,t);if(0==D)return this;if(-1==D)var S={row:n,column:t};else var a={row:n,column:t};return e.fromPoints(S||this.start,a||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 t=n.documentToScreenPosition(this.start),D=n.documentToScreenPosition(this.end);return new e(t.row,t.column,D.row,D.column)},e.prototype.moveBy=function(e,n){this.start.row+=e,this.start.column+=n,this.end.row+=e,this.end.column+=n},e}();D.fromPoints=function(e,n){return new D(e.row,e.column,n.row,n.column)},D.comparePoints=function(e,n){return e.row-n.row||e.column-n.column},n.Range=D}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,n,t){"use strict";for(var D=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:"*"}},a={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++)a["Digit"+r]=48+r,a["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);a["Key"+o.toUpperCase()]=r,S.PRINTABLE_KEYS[r]=o}for(var r=1;r<13;r++)a["F"+r]=111+r,S.FUNCTION_KEYS[111+r]="F"+r;var i={Shift:16,Control:17,Alt:18,Meta:224};for(var g in i)a[g]=a[g+"Left"]=a[g+"Right"]=i[g];for(var s in n.$codeToKeyCode=a,S.PRINTABLE_KEYS[173]="-",S.FUNCTION_KEYS){var l=S.FUNCTION_KEYS[s].toLowerCase();S[l]=parseInt(s,10)}for(var s in S.PRINTABLE_KEYS){var l=S.PRINTABLE_KEYS[s].toLowerCase();S[l]=parseInt(s,10)}D.mixin(S,S.MODIFIER_KEYS),D.mixin(S,S.PRINTABLE_KEYS),D.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-",D.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,t){"use strict";var D,S=e("./keys"),a=e("./useragent"),r=null,o=0;function i(){D=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return D={passive:!1},!0}})}catch(e){}}function g(){return void 0==D&&i(),D}function s(e,n,t){this.elem=e,this.type=n,this.callback=t}s.prototype.destroy=function(){d(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var l=n.addListener=function(e,n,t,D){e.addEventListener(n,t,g()),D&&D.$toDestroy.push(new s(e,n,t))},d=n.removeListener=function(e,n,t){e.removeEventListener(n,t,g())};function c(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function u(e,n,t){var D=c(n);if(!t&&n.code&&(t=S.$codeToKeyCode[n.code]||t),!a.isMac&&r){if(n.getModifierState&&(n.getModifierState("OS")||n.getModifierState("Win"))&&(D|=8),r.altGr)if((3&D)==3)return;else r.altGr=0;if(18===t||17===t){var i=n.location;17===t&&1===i?1==r[t]&&(o=n.timeStamp):18===t&&3===D&&2===i&&n.timeStamp-o<50&&(r.altGr=!0)}}if(t in S.MODIFIER_KEYS&&(t=-1),D||13!==t||3!==n.location||(e(n,D,-t),!n.defaultPrevented)){if(a.isChromeOS&&8&D){if(e(n,D,t),n.defaultPrevented)return;D&=-9}return(!!D||t in S.FUNCTION_KEYS||t in S.PRINTABLE_KEYS)&&e(n,D,t)}}function f(){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||a.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},n.capture=function(e,n,t){var D=e&&e.ownerDocument||document;function S(e){n&&n(e),t&&t(e),d(D,"mousemove",n),d(D,"mouseup",S),d(D,"dragstart",S)}return l(D,"mousemove",n),l(D,"mouseup",S),l(D,"dragstart",S),S},n.addMouseWheelListener=function(e,n,t){l(e,"wheel",function(e){var t=.15,D=e.deltaX||0,S=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=D*t,e.wheelY=S*t;break;case e.DOM_DELTA_LINE:var a=15;e.wheelX=15*D,e.wheelY=S*a;break;case e.DOM_DELTA_PAGE:var r=150;e.wheelX=150*D,e.wheelY=S*r}n(e)},t)},n.addMultiMouseDownListener=function(e,t,D,S,r){var o,i,g,s=0,d={2:"dblclick",3:"tripleclick",4:"quadclick"};function c(e){if(0!==n.getButton(e)?s=0:e.detail>1?++s>4&&(s=1):s=1,a.isIE){var r=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-i)>5;(!g||r)&&(s=1),g&&clearTimeout(g),g=setTimeout(function(){g=null},t[s-1]||600),1==s&&(o=e.clientX,i=e.clientY)}if(e._clicks=s,D[S]("mousedown",e),s>4)s=0;else if(s>1)return D[S](d[s],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){l(e,"mousedown",c,r)})},n.getModifierString=function(e){return S.KEY_MODS[c(e)]},n.addCommandKeyListener=function(e,t,D){var S=null;l(e,"keydown",function(e){r[e.keyCode]=(r[e.keyCode]||0)+1;var n=u(t,e,e.keyCode);return S=e.defaultPrevented,n},D),l(e,"keypress",function(e){S&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(n.stopEvent(e),S=null)},D),l(e,"keyup",function(e){r[e.keyCode]=null},D),r||(f(),l(window,"focus",f))},"object"==typeof window&&window.postMessage&&!a.isOldIE){var h=1;n.nextTick=function(e,t){t=t||window;var D="zero-timeout-message-"+h++,S=function(a){a.data==D&&(n.stopPropagation(a),d(t,"message",S),e())};l(t,"message",S),t.postMessage(D,"*")}}n.$idleBlocked=!1,n.onIdle=function(e,t){return setTimeout(function t(){n.$idleBlocked?setTimeout(t,100):e()},t)},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,t){"use strict";var D;t.exports={lineMode:!1,pasteCancelled:function(){return!!(D&&D>Date.now()-50)||(D=!1)},cancel:function(){D=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,t){"use strict";var D=e("../lib/event"),S=e("../config").nls,a=e("../lib/useragent"),r=e("../lib/dom"),o=e("../lib/lang"),i=e("../clipboard"),g=a.isChrome<18,s=a.isIE,l=a.isChrome>63,d=400,c=e("../lib/keys"),u=c.KEY_MODS,f=a.isIOS,h=f?/\s/:/\n/,p=a.isMobile;n.TextInput=function(e,n){var t,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,b=!1,v=!1,$=!1,w="";p||(m.style.fontSize="1px");var _=!1,A=!1,M="",x=0,L=0,C=0,k=Number.MAX_SAFE_INTEGER,E=Number.MIN_SAFE_INTEGER,T=0;try{var O=document.activeElement===m}catch(e){}this.setNumberOfExtraLines=function(e){if(k=Number.MAX_SAFE_INTEGER,E=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 t="";n.$textInputAriaLabel&&(t+="".concat(n.$textInputAriaLabel,", ")),n.session&&(t+=S("text-input.aria-label","Cursor at row $0",[n.session.selection.cursor.row+1])),m.setAttribute("aria-label",t)}},this.setAriaOptions({role:"textbox"}),D.addListener(m,"blur",function(e){A||(n.onBlur(e),O=!1)},n),D.addListener(m,"focus",function(e){if(!A){if(O=!0,a.isEdge)try{if(!document.hasFocus())return}catch(e){}n.onFocus(e),a.isEdge?setTimeout(I):I()}},n),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:n.renderer.enableKeyboardAccessibility}),w||l||"browser"==this.$focusScroll)return m.focus({preventScroll:!0});var e=m.style.top;m.style.position="fixed",m.style.top="0px";try{var t=0!=m.getBoundingClientRect().top}catch(e){return}var D=[];if(t)for(var S=m.parentElement;S&&1==S.nodeType;)D.push(S),S.setAttribute("ace_nocontext","true"),S=!S.parentElement&&S.getRootNode?S.getRootNode().host:S.parentElement;m.focus({preventScroll:!0}),t&&D.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,t=e&&e.command&&e.command.name;if("insertstring"!=t){var D=t&&(e.docChanged||e.selectionChanged);v&&D&&(M=m.value="",Y()),I()}});var R=function(e,t){for(var D=t,S=1;S<=e-k&&S<2*T+1;S++)D+=n.session.getLine(e-S).length+1;return D},I=f?function(e){if(O&&(!y||e)&&!$){e||(e="");var t="\n ab"+e+"cde fg\n";t!=m.value&&(m.value=M=t);var D=4,S=4+(e.length||+!n.selection.isEmpty());(x!=D||L!=S)&&m.setSelectionRange(D,S),x=D,L=S}}:function(){if(!v&&!$&&(O||F)){v=!0;var e=0,t=0,D="";if(n.session){var S=n.selection,a=S.getRange(),r=S.cursor.row;r===E+1?E=(k=E+1)+2*T:r===k-1?k=(E=k-1)-2*T:(r<k-1||r>E+1)&&(k=r>T?r-T:0,E=r>T?r+T:2*T);for(var o=[],i=k;i<=E;i++)o.push(n.session.getLine(i));if(D=o.join("\n"),e=R(a.start.row,a.start.column),t=R(a.end.row,a.end.column),a.start.row<k){var g=n.session.getLine(k-1);e=a.start.row<k-1?0:e,t+=g.length+1,D=g+"\n"+D}else if(a.end.row>E){var s=n.session.getLine(E+1);t=(a.end.row>E+1?s.length:a.end.column)+(D.length+1),D=D+"\n"+s}else p&&r>0&&(D="\n"+D,t+=1,e+=1);D.length>d&&(e<d&&t<d?D=D.slice(0,d):(D="\n",e==t?e=t=0:(e=0,t=1)));var l=D+"\n\n";l!=M&&(m.value=M=l,x=L=l.length)}if(F&&(x=m.selectionStart,L=m.selectionEnd),L!=t||x!=e||m.selectionEnd!=L)try{m.setSelectionRange(e,t),x=e,L=t}catch(e){}v=!1}};this.resetSelection=I,O&&n.onFocus();var N=function(e){return 0===e.selectionStart&&e.selectionEnd>=M.length&&e.value===M&&M&&e.selectionEnd!==L},j=function(e){!v&&(y?y=!1:N(m)?(n.selectAll(),I()):p&&m.selectionStart!=x&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,t){if(F&&(F=!1),b)return I(),e&&n.onPaste(e),b=!1,"";for(var D=m.selectionStart,S=m.selectionEnd,r=x,o=M.length-L,i=e,g=e.length-D,s=e.length-S,l=0;r>0&&M[l]==e[l];)l++,r--;for(i=i.slice(l),l=1;o>0&&M.length-l>x-1&&M[M.length-l]==e[e.length-l];)l++,o--;g-=l-1,s-=l-1;var d=i.length-l+1;if(d<0&&(r=-d,d=0),i=i.slice(0,d),!t&&!i&&!g&&!r&&!o&&!s)return"";$=!0;var c=!1;return a.isAndroid&&". "==i&&(i=" ",c=!0),(!i||r||o||g||s)&&!_?n.onTextInput(i,{extendLeft:r,extendRight:o,restoreStart:g,restoreEnd:s}):n.onTextInput(i),$=!1,M=e,x=D,L=S,C=s,c?"\n":i},B=function(e){if(v)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return n.execCommand("undo");if("historyRedo"==e.inputType)return n.execCommand("redo")}var t=m.value,D=U(t,!0);(t.length>d+100||h.test(D)||p&&x<1&&x==L)&&I()},z=function(e,n,t){var D=e.clipboardData||window.clipboardData;if(D&&!g){var S=s||t?"Text":"text/plain";try{if(n)return!1!==D.setData(S,n);return D.getData(S)}catch(e){if(!t)return z(e,n,!0)}}},V=function(e,t){var S=n.getCopyText();if(!S)return D.preventDefault(e);z(e,S)?(f&&(I(S),y=S,setTimeout(function(){y=!1},10)),t?n.onCut():n.onCopy(),D.preventDefault(e)):(y=!0,m.value=S,m.select(),setTimeout(function(){y=!1,I(),t?n.onCut():n.onCopy()}))},H=function(e){V(e,!0)},W=function(e){V(e,!1)},q=function(e){var t=z(e);i.pasteCancelled()||("string"==typeof t?(t&&n.onPaste(t,e),a.isIE&&setTimeout(I),D.preventDefault(e)):(m.value="",b=!0))};D.addCommandKeyListener(m,function(e,t,D){if(!v)return n.onCommandKey(e,t,D)},n),D.addListener(m,"select",j,n),D.addListener(m,"input",B,n),D.addListener(m,"cut",H,n),D.addListener(m,"copy",W,n),D.addListener(m,"paste",q,n),"oncut"in m&&"oncopy"in m&&"onpaste"in m||D.addListener(e,"keydown",function(e){if((!a.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:W(e);break;case 86:q(e);break;case 88:H(e)}},n);var G=function(e){if(!v&&n.onCompositionStart&&!n.$readOnly&&(v={},!_)){e.data&&(v.useTextareaForIME=!1),setTimeout(K,0),n._signal("compositionStart"),n.on("mousedown",Q);var t=n.getSelectionRange();t.end.row=t.start.row,t.end.column=t.start.column,v.markerRange=t,v.selectionStart=x,n.onCompositionStart(v),v.useTextareaForIME?(M=m.value="",x=0,L=0):(m.msGetInputContext&&(v.context=m.msGetInputContext()),m.getInputContext&&(v.context=m.getInputContext()))}},K=function(){if(v&&n.onCompositionUpdate&&!n.$readOnly){if(_)return Q();v.useTextareaForIME?n.onCompositionUpdate(m.value):(U(m.value),v.markerRange&&(v.context&&(v.markerRange.start.column=v.selectionStart=v.context.compositionStartOffset),v.markerRange.end.column=v.markerRange.start.column+L-v.selectionStart+C))}},Y=function(e){n.onCompositionEnd&&!n.$readOnly&&(v=!1,n.onCompositionEnd(),n.off("mousedown",Q),e&&B())};function Q(){A=!0,m.blur(),m.focus(),A=!1}var Z=o.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&m.value.length<m.selectionStart&&(v||(M=m.value),x=L=-1,I()),Z()}function X(){clearTimeout(t),t=setTimeout(function(){w&&(m.style.cssText=w,w=""),n.renderer.$isMousePressed=!1,n.renderer.$keepTextAreaAtCursor&&n.renderer.$moveTextAreaToCursor()},0)}D.addListener(m,"compositionstart",G,n),D.addListener(m,"compositionupdate",K,n),D.addListener(m,"keyup",J,n),D.addListener(m,"keydown",Z,n),D.addListener(m,"compositionend",Y,n),this.getElement=function(){return m},this.setCommandMode=function(e){_=e,m.readOnly=!1},this.setReadOnly=function(e){_||(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){w||(w=m.style.cssText),m.style.cssText=(S?"z-index:100000;":"")+(a.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+L)*n.renderer.characterWidth*.5+"px;";var o=n.container.getBoundingClientRect(),i=r.computedStyle(n.container),g=o.top+(parseInt(i.borderTopWidth)||0),s=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-g-m.clientHeight-2,d=function(e){r.translate(m,e.clientX-s-2,Math.min(e.clientY-g-2,l))};d(e),"mousedown"==e.type&&(n.renderer.$isMousePressed=!0,clearTimeout(t),a.isWin&&D.capture(n.container,d,X))},this.onContextMenuClose=X;var ee=function(e){n.textInput.onContextMenu(e),X()};function en(e,n,t){var D=null,S=!1;t.addEventListener("keydown",function(e){D&&clearTimeout(D),S=!0},!0),t.addEventListener("keyup",function(e){D=setTimeout(function(){S=!1},100)},!0);var a=function(e){if(document.activeElement===t&&!S&&!v&&!n.$mouseHandler.isMousePressed&&!y){var D=t.selectionStart,a=t.selectionEnd,r=null,o=0;if(0==D?r=c.up:1==D?r=c.home:a>L&&"\n"==M[a]?r=c.end:D<x&&" "==M[D-1]?(r=c.left,o=u.option):D<x||D==x&&L!=x&&D==a?r=c.left:a>L&&M.slice(0,a).split("\n").length>2?r=c.down:a>L&&" "==M[a-1]?(r=c.right,o=u.option):(a>L||a==L&&L!=x&&D==a)&&(r=c.right),D!==a&&(o|=u.shift),r){if(!n.onCommandKey({},o,r)&&n.commands){r=c.keyCodeToString(r);var i=n.commands.findKeyCommand(o,r);i&&n.execCommand(i)}x=D,L=a,I("")}}};document.addEventListener("selectionchange",a),n.on("destroy",function(){document.removeEventListener("selectionchange",a)})}D.addListener(m,"mouseup",ee,n),D.addListener(m,"mousedown",function(e){e.preventDefault(),X()},n),D.addListener(n.renderer.scroller,"contextmenu",ee,n),D.addListener(m,"contextmenu",ee,n),f&&en(e,n,m),this.destroy=function(){m.parentElement&&m.parentElement.removeChild(m)}},n.$setUserAgentForTests=function(e,n){p=e,f=n}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,n,t){"use strict";var D=e("../lib/useragent"),S=0,a=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(),t=e.getDocumentPosition();this.mousedownEvent=e;var S=this.editor,a=e.getButton();if(0!==a){(S.getSelectionRange().isEmpty()||1==a)&&S.selection.moveToPosition(t),2==a&&(S.textInput.onContextMenu(e.domEvent),D.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(t,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,n){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var t=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?t.selection.selectToPosition(e):n||t.selection.moveToPosition(e),n||this.select(),t.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,n=this.editor,t=n.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var D=this.$clickSelection.comparePoint(t);if(-1==D)e=this.$clickSelection.end;else if(1==D)e=this.$clickSelection.start;else{var S=i(this.$clickSelection,t);t=S.cursor,e=S.anchor}n.selection.setSelectionAnchor(e.row,e.column)}n.selection.selectToPosition(t),n.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var n,t=this.editor,D=t.renderer.screenToTextCoordinates(this.x,this.y),S=t.selection[e](D.row,D.column);if(this.$clickSelection){var a=this.$clickSelection.comparePoint(S.start),r=this.$clickSelection.comparePoint(S.end);if(-1==a&&r<=0)n=this.$clickSelection.end,(S.end.row!=D.row||S.end.column!=D.column)&&(D=S.start);else if(1==r&&a>=0)n=this.$clickSelection.start,(S.start.row!=D.row||S.start.column!=D.column)&&(D=S.end);else if(-1==a&&1==r)D=S.end,n=S.start;else{var o=i(this.$clickSelection,D);D=o.cursor,n=o.anchor}t.selection.setSelectionAnchor(n.row,n.column)}t.selection.selectToPosition(D),t.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(),t=this.editor,D=t.session.getBracketRange(n);D?(D.isEmpty()&&(D.start.column--,D.end.column++),this.setState("select")):(D=t.selection.getWordRange(n.row,n.column),this.setState("selectByWords")),this.$clickSelection=D,this.select()},e.prototype.onTripleClick=function(e){var n=e.getDocumentPosition(),t=this.editor;this.setState("selectByLines");var D=t.getSelectionRange();D.isMultiLine()&&D.contains(n.row,n.column)?(this.$clickSelection=t.selection.getLineRange(D.start.row),this.$clickSelection.end=t.selection.getLineRange(D.end.row).end):this.$clickSelection=t.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 t=this.$lastScroll,D=e.domEvent.timeStamp,S=D-t.t,r=S?e.wheelX/S:t.vx,o=S?e.wheelY/S:t.vy;S<a&&(r=(r+t.vx)/2,o=(o+t.vy)/2);var i=Math.abs(r/o),g=!1;if(i>=1&&n.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(g=!0),i<=1&&n.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(g=!0),g?t.allowed=D:D-t.allowed<a&&(Math.abs(r)<=1.5*Math.abs(t.vx)&&Math.abs(o)<=1.5*Math.abs(t.vy)?(g=!0,t.allowed=D):t.allowed=0),t.t=D,t.vx=r,t.vy=o,g)return n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function o(e,n,t,D){return Math.sqrt(Math.pow(t-e,2)+Math.pow(D-n,2))}function i(e,n){if(e.start.row==e.end.row)var t=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 t=2*n.row-e.start.row-e.end.row;else var t=n.column-4;return t<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,t){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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},a=e("./lib/dom");e("./lib/event");var r=e("./range").Range,o=e("./lib/scroll").preventParentScroll,i="ace_tooltip",g=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=a.createElement("div"),this.$element.className=i,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){a.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=i+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,n,t){null!=e&&this.setText(e),null!=n&&null!=t&&this.setPosition(n,t),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=i,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}(),s=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,t,D,a=[];try{for(var r=S(this.popups),o=r.next();!o.done;o=r.next()){var i=o.value,g=!0;try{for(var s=(t=void 0,S(a)),l=s.next();!l.done;l=s.next()){var d=l.value;if(this.doPopupsOverlap(d,i)){g=!1;break}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(D=s.return)&&D.call(s)}finally{if(t)throw t.error}}g?a.push(i):i.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 t=e.getElement().getBoundingClientRect(),D=n.getElement().getBoundingClientRect();return t.left<D.right&&t.right>D.left&&t.top<D.bottom&&t.bottom>D.top},e}());n.popupManager=s,n.Tooltip=g,n.HoverTooltip=function(e){function n(n){void 0===n&&(n=document.body);var t=e.call(this,n)||this;t.timeout=void 0,t.lastT=0,t.idleTime=350,t.lastEvent=void 0,t.onMouseOut=t.onMouseOut.bind(t),t.onMouseMove=t.onMouseMove.bind(t),t.waitForHover=t.waitForHover.bind(t),t.hide=t.hide.bind(t);var D=t.getElement();return D.style.whiteSpace="pre-wrap",D.style.pointerEvents="auto",D.addEventListener("mouseout",t.onMouseOut),D.tabIndex=-1,D.addEventListener("blur",(function(){D.contains(document.activeElement)||this.hide()}).bind(t)),D.addEventListener("wheel",o),t}return D(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 t=n.$mouseHandler.isMousePressed;if(this.isOpen){var D=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(D.row,D.column)||t||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||t||(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,t=e.getDocumentPosition(),D=n.session.getLine(t.row);if(t.column==D.length){var S=n.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),a=n.session.documentToScreenPosition(t.row,t.column);if(a.column!=S.column||a.row!=S.row)return!0}return!1},n.prototype.setDataProvider=function(e){this.$gatherData=e},n.prototype.showForRange=function(e,n,t,D){var S=10;if((!D||D==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var a=e.renderer;this.isOpen||(s.addPopup(this),this.$registerCloseEvents(),this.setTheme(a.theme)),this.isOpen=!0,this.addMarker(n,e.session),this.range=r.fromPoints(n.start,n.end);var o=a.textToScreenCoordinates(n.start.row,n.start.column),i=a.scroller.getBoundingClientRect();o.pageX<i.left&&(o.pageX=i.left);var g=this.getElement();g.innerHTML="",g.appendChild(t),g.style.maxHeight="",g.style.display="block";var l=g.clientHeight,d=g.clientWidth,c=window.innerHeight-o.pageY-a.lineHeight,u=!0;o.pageY-l<0&&o.pageY<c&&(u=!1),g.style.maxHeight=(u?o.pageY:c)-S+"px",g.style.top=u?"":o.pageY+a.lineHeight+"px",g.style.bottom=u?window.innerHeight-o.pageY+"px":"",g.style.left=Math.min(o.pageX,window.innerWidth-d-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,s.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}(g)}),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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},a=e("../lib/dom"),r=e("../lib/event"),o=e("../tooltip").Tooltip,i=e("../config").nls;e("../lib/lang"),n.GutterHandler=function(e){var n,t,D=e.editor,S=D.renderer.$gutterLayer,o=new g(D);function i(){var n=t.getDocumentPosition().row;if(n==D.session.getLength()){var a=D.renderer.pixelToScreenCoordinates(0,t.y).row,r=t.$pos;if(a>D.session.documentToScreenRow(r.row,r.column))return s()}if(o.showTooltip(n),o.isOpen)if(D.on("mousewheel",s),e.$tooltipFollowsMouse)l(t);else{var i=t.getGutterRow(),g=S.$lines.get(i);if(g){var d=g.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),c=o.getElement().style;c.left=d.right+"px",c.top=d.bottom+"px"}else l(t)}}function s(){n&&(n=clearTimeout(n)),o.isOpen&&(o.hideTooltip(),D.off("mousewheel",s))}function l(e){o.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(n){if(D.isFocused()&&0==n.getButton()&&"foldWidgets"!=S.getRegion(n)){var t=n.getDocumentPosition().row,a=D.session.selection;if(n.getShiftKey())a.selectTo(t,0);else{if(2==n.domEvent.detail)return D.selectAll(),n.preventDefault();e.$clickSelection=D.selection.getLineRange(t)}return e.setState("selectByLines"),e.captureMouse(n),n.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(D){var S=D.domEvent.target||D.domEvent.srcElement;if(a.hasCssClass(S,"ace_fold-widget"))return s();o.isOpen&&e.$tooltipFollowsMouse&&l(D),t=D,n||(n=setTimeout(function(){n=null,t&&!e.isMousePressed?i():s()},50))}),r.addListener(D.renderer.$gutter,"mouseout",function(e){t=null,o.isOpen&&!n&&(n=setTimeout(function(){n=null,s()},50))},D),D.on("changeSession",s),D.on("input",s)};var g=function(e){function n(n){var t=e.call(this,n.container)||this;return t.editor=n,t}return D(n,e),n.prototype.setPosition=function(e,n){var t=window.innerWidth||document.documentElement.clientWidth,D=window.innerHeight||document.documentElement.clientHeight,S=this.getWidth(),a=this.getHeight();n+=15,(e+=15)+S>t&&(e-=e+S-t),n+a>D&&(n-=20+a),o.prototype.setPosition.call(this,e,n)},Object.defineProperty(n,"annotationLabels",{get:function(){return{error:{singular:i("gutter-tooltip.aria-label.error.singular","error"),plural:i("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:i("gutter-tooltip.aria-label.security.singular","security finding"),plural:i("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:i("gutter-tooltip.aria-label.warning.singular","warning"),plural:i("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:i("gutter-tooltip.aria-label.info.singular","information message"),plural:i("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:i("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:i("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),n.prototype.showTooltip=function(e){var t=this.editor.renderer.$gutterLayer,D=t.$annotations[e];o=D?{displayText:Array.from(D.displayText),type:Array.from(D.type)}:{displayText:[],type:[]};var S=t.session.getFoldLine(e);if(S&&t.$showFoldedAnnotations){for(var r,o,i,g={error:[],security:[],warning:[],info:[],hint:[]},s={error:1,security:2,warning:3,info:4,hint:5},l=e+1;l<=S.end.row;l++)if(t.$annotations[l])for(var d=0;d<t.$annotations[l].text.length;d++){var c=t.$annotations[l].type[d];g[c].push(t.$annotations[l].text[d]),(!i||s[c]<s[i])&&(i=c)}if(["error","security","warning"].includes(i)){var u="".concat(n.annotationsToSummaryString(g)," in folded code.");o.displayText.push(u),o.type.push(i+"_fold")}}if(0===o.displayText.length)return this.hide();for(var f={error:[],security:[],warning:[],info:[],hint:[]},h=t.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",l=0;l<o.displayText.length;l++){var p=a.createElement("span"),m=a.createElement("span");(r=m.classList).add.apply(r,["ace_".concat(o.type[l]),h]),m.setAttribute("aria-label","".concat(n.annotationLabels[o.type[l].replace("_fold","")].singular)),m.setAttribute("role","img"),m.appendChild(a.createTextNode(" ")),p.appendChild(m),p.appendChild(a.createTextNode(o.displayText[l])),p.appendChild(a.createElement("br")),f[o.type[l].replace("_fold","")].push(p)}var y=this.getElement();a.removeChildren(y),f.error.forEach(function(e){return y.appendChild(e)}),f.security.forEach(function(e){return y.appendChild(e)}),f.warning.forEach(function(e){return y.appendChild(e)}),f.info.forEach(function(e){return y.appendChild(e)}),f.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 t,D,a=[],r=["error","security","warning","info","hint"];try{for(var o=S(r),i=o.next();!i.done;i=o.next()){var g=i.value;if(e[g].length){var s=1===e[g].length?n.annotationLabels[g].singular:n.annotationLabels[g].plural;a.push("".concat(e[g].length," ").concat(s))}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(D=o.return)&&D.call(o)}finally{if(t)throw t.error}}return a.join(", ")},n}(o);n.GutterTooltip=g}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,n,t){"use strict";var D=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(){D.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){D.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 D.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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/event"),a=e("../lib/useragent"),r=200,o=200,i=5;function g(e){var n,t,g,l,d,c=e.editor,u=D.createElement("div");u.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",u.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(n){e[n]=this[n]},this),c.on("mousedown",this.onMouseDown.bind(e));var f,h,p,m,y,b,v=c.container,$=0;function w(e,n){var t=Date.now(),D=!n||e.row!=n.row,S=!n||e.column!=n.column;!l||D||S?(c.moveCursorToPosition(e),l=t,d={x:h,y:p}):s(d.x,d.y,h,p)>i?l=null:t-l>=o&&(c.renderer.scrollCursorIntoView(),l=null)}function _(e,n){var t=Date.now(),D=c.renderer.layerConfig.lineHeight,S=c.renderer.layerConfig.characterWidth,a=c.renderer.scroller.getBoundingClientRect(),o={x:{left:h-a.left,right:a.right-h},y:{top:p-a.top,bottom:a.bottom-p}},i=Math.min(o.x.left,o.x.right),s=Math.min(o.y.top,o.y.bottom),l={row:e.row,column:e.column};i/S<=2&&(l.column+=o.x.left<o.x.right?-3:2),s/D<=1&&(l.row+=o.y.top<o.y.bottom?-1:1);var d=e.row!=l.row,u=e.column!=l.column,f=!n||e.row!=n.row;d||u&&!f?g?t-g>=r&&c.renderer.scrollCursorIntoView(l):g=t:g=null}function A(){var e=b;w(b=c.renderer.screenToTextCoordinates(h,p),e),_(b,e)}function M(){y=c.selection.toOrientedRange(),f=c.session.addMarker(y,"ace_selection",c.getSelectionStyle()),c.clearSelection(),c.isFocused()&&c.renderer.$cursorLayer.setBlinking(!1),clearInterval(m),A(),m=setInterval(A,20),$=0,S.addListener(document,"mousemove",C)}function x(){clearInterval(m),c.session.removeMarker(f),f=null,c.selection.fromOrientedRange(y),c.isFocused()&&!t&&c.$resetCursorStyle(),y=null,b=null,$=0,g=null,l=null,S.removeListener(document,"mousemove",C)}this.onDragStart=function(e){if(this.cancelDrag||!v.draggable){var n=this;return setTimeout(function(){n.startSelect(),n.captureMouse(e)},0),e.preventDefault()}y=c.getSelectionRange();var D=e.dataTransfer;D.effectAllowed=c.getReadOnly()?"copy":"copyMove",c.container.appendChild(u),D.setDragImage&&D.setDragImage(u,0,0),setTimeout(function(){c.container.removeChild(u)}),D.clearData(),D.setData("Text",c.session.getTextRange()),t=!0,this.setState("drag")},this.onDragEnd=function(e){if(v.draggable=!1,t=!1,this.setState(null),!c.getReadOnly()){var D=e.dataTransfer.dropEffect;n||"move"!=D||c.session.remove(c.getSelectionRange()),c.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!c.getReadOnly()&&k(e.dataTransfer))return h=e.clientX,p=e.clientY,f||M(),$++,e.dataTransfer.dropEffect=n=E(e),S.preventDefault(e)},this.onDragOver=function(e){if(!c.getReadOnly()&&k(e.dataTransfer))return h=e.clientX,p=e.clientY,!f&&(M(),$++),null!==L&&(L=null),e.dataTransfer.dropEffect=n=E(e),S.preventDefault(e)},this.onDragLeave=function(e){if(--$<=0&&f)return x(),n=null,S.preventDefault(e)},this.onDrop=function(e){if(b){var D=e.dataTransfer;if(t)switch(n){case"move":y=y.contains(b.row,b.column)?{start:b,end:b}:c.moveText(y,b);break;case"copy":y=c.moveText(y,b,!0)}else{var a=D.getData("Text");y={start:b,end:c.session.insert(b,a)},c.focus(),n=null}return x(),S.preventDefault(e)}},S.addListener(v,"dragstart",this.onDragStart.bind(e),c),S.addListener(v,"dragend",this.onDragEnd.bind(e),c),S.addListener(v,"dragenter",this.onDragEnter.bind(e),c),S.addListener(v,"dragover",this.onDragOver.bind(e),c),S.addListener(v,"dragleave",this.onDragLeave.bind(e),c),S.addListener(v,"drop",this.onDrop.bind(e),c);var L=null;function C(){null==L&&(L=setTimeout(function(){null!=L&&f&&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 E(e){var n=["copy","copymove","all","uninitialized"],t=["move","copymove","linkmove","all","uninitialized"],D=a.isMac?e.altKey:e.ctrlKey,S="uninitialized";try{S=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return D&&n.indexOf(S)>=0?r="copy":t.indexOf(S)>=0?r="move":n.indexOf(S)>=0&&(r="copy"),r}}function s(e,n,t,D){return Math.sqrt(Math.pow(t-e,2)+Math.pow(D-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=a.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var n=this.editor.container;if(a.isIE&&"dragReady"==this.state){var t=s(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>3&&n.dragDrop()}if("dragWait"===this.state){var t=s(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>0&&(n.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var n=this.editor,t=e.inSelection(),D=e.getButton(),S=e.domEvent.detail||1;if(1===S&&0===D&&t){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()?(a.isWebKit&&(this.cancelDrag=!0,n.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(g.prototype),n.DragdropHandler=g}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,n,t){"use strict";var D=e("./mouse_event").MouseEvent,S=e("../lib/event"),a=e("../lib/dom");n.addTouchListeners=function(e,n){var t,r,o,i,g,s,l,d,c,u="scroll",f=0,h=0,p=0,m=0;function y(){var e=window.navigator&&window.navigator.clipboard,t=!1,D=function(){var D=n.getCopyText(),r=n.session.getUndoManager().hasUndo();c.replaceChild(a.buildDom(t?["span",!D&&S("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],D&&S("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],D&&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"]),c.firstChild)},S=function(e){return n.commands.canExecute(e,n)},r=function(S){var a=S.target.getAttribute("action");if("more"==a||!t)return t=!t,D();"paste"==a?e.readText().then(function(e){n.execCommand(a,e)}):a&&(("cut"==a||"copy"==a)&&(e?e.writeText(n.getCopyText()):document.execCommand("copy")),n.execCommand(a)),c.firstChild.style.display="none",t=!1,"openCommandPalette"!=a&&n.focus()};c=a.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){u="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 b(){if(!n.getOption("enableMobileMenu")){c&&v();return}c||y();var e=n.selection.cursor,t=n.renderer.textToScreenCoordinates(e.row,e.column),D=n.renderer.textToScreenCoordinates(0,0).pageX,S=n.renderer.scrollLeft,a=n.container.getBoundingClientRect();c.style.top=t.pageY-a.top-3+"px",t.pageX-a.left<a.width-70?(c.style.left="",c.style.right="10px"):(c.style.right="",c.style.left=D+S-a.left+"px"),c.style.display="",c.firstChild.style.display="none",n.on("input",v)}function v(e){c&&(c.style.display="none"),n.off("input",v)}function $(){clearTimeout(g=null);var e=n.selection.getRange(),t=e.contains(l.row,l.column);(e.isEmpty()||!t)&&(n.selection.moveToPosition(l),n.selection.selectWord()),u="wait",b()}function w(){clearTimeout(g=null),n.selection.moveToPosition(l);var e=h>=2?n.selection.getLineRange(l.row):n.session.getBracketRange(l);e&&!e.isEmpty()?n.selection.setRange(e):n.selection.selectWord(),u="wait"}function _(){f+=60,s=setInterval(function(){f--<=0&&(clearInterval(s),s=null),.01>Math.abs(p)&&(p=0),.01>Math.abs(m)&&(m=0),f<20&&(p*=.9),f<20&&(m*=.9);var e=n.session.getScrollTop();n.renderer.scrollBy(10*p,10*m),e==n.session.getScrollTop()&&(f=0)},10)}S.addListener(e,"contextmenu",function(e){if(d){var t=n.textInput.getElement();t.focus()}},n),S.addListener(e,"touchstart",function(e){var S=e.touches;if(g||S.length>1){clearTimeout(g),g=null,o=-1,u="zoom";return}d=n.$mouseHandler.isMousePressed=!0;var a=n.renderer.layerConfig.lineHeight,s=n.renderer.layerConfig.lineHeight,c=e.timeStamp;i=c;var y=S[0],b=y.clientX,v=y.clientY;if(Math.abs(t-b)+Math.abs(r-v)>a&&(o=-1),t=e.clientX=b,r=e.clientY=v,p=m=0,l=new D(e,n).getDocumentPosition(),c-o<500&&1==S.length&&!f)h++,e.preventDefault(),e.button=0,w();else{h=0;var _=n.selection.cursor,A=n.selection.isEmpty()?_:n.selection.anchor,M=n.renderer.$cursorLayer.getPixelPosition(_,!0),x=n.renderer.$cursorLayer.getPixelPosition(A,!0),L=n.renderer.scroller.getBoundingClientRect(),C=n.renderer.layerConfig.offset,k=n.renderer.scrollLeft,E=function(e,n){return(e/=s)*e+(n=n/a-.75)*n};if(e.clientX<L.left){u="zoom";return}var T=E(e.clientX-L.left-M.left+k,e.clientY-L.top-M.top+C),O=E(e.clientX-L.left-x.left+k,e.clientY-L.top-x.top+C);T<3.5&&O<3.5&&(u=T>O?"cursor":"anchor"),u=O<3.5?"anchor":T<3.5?"cursor":"scroll",g=setTimeout($,450)}o=c},n),S.addListener(e,"touchend",function(e){d=n.$mouseHandler.isMousePressed=!1,s&&clearInterval(s),"zoom"==u?(u="",f=0):g?(n.selection.moveToPosition(l),f=0,b()):"scroll"==u?(_(),v()):b(),clearTimeout(g),g=null},n),S.addListener(e,"touchmove",function(e){g&&(clearTimeout(g),g=null);var S=e.touches;if(!(S.length>1)&&"zoom"!=u){var a=S[0],o=t-a.clientX,s=r-a.clientY;if("wait"==u)if(!(o*o+s*s>4))return e.preventDefault();else u="cursor";t=a.clientX,r=a.clientY,e.clientX=a.clientX,e.clientY=a.clientY;var l=e.timeStamp,d=l-i;if(i=l,"scroll"==u){var c=new D(e,n);c.speed=1,c.wheelX=o,c.wheelY=s,10*Math.abs(o)<Math.abs(s)&&(o=0),10*Math.abs(s)<Math.abs(o)&&(s=0),0!=d&&(p=o/d,m=s/d),n._emit("mousewheel",c),c.propagationStopped||(p=m=0)}else{var f=new D(e,n).getDocumentPosition();"cursor"==u?n.selection.moveCursorToPosition(f):"anchor"==u&&n.selection.setSelectionAnchor(f.row,f.column),n.renderer.scrollCursorIntoView(f),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,t){"use strict";var D=e("../lib/event"),S=e("../lib/useragent"),a=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,o=e("./mouse_event").MouseEvent,i=e("./dragdrop_handler").DragdropHandler,g=e("./touch_handler").addTouchListeners,s=e("../config"),l=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var n=this;this.editor=e,new a(this),new r(this),new i(this);var t=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();D.addListener(o,"click",this.onMouseEvent.bind(this,"click"),e),D.addListener(o,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),D.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),D.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),g(e.container,e);var s=e.renderer.$gutter;D.addListener(s,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),D.addListener(s,"click",this.onMouseEvent.bind(this,"gutterclick"),e),D.addListener(s,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),D.addListener(s,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),D.addListener(o,"mousedown",t,e),D.addListener(s,"mousedown",t,e),S.isIE&&e.renderer.scrollBarV&&(D.addListener(e.renderer.scrollBarV.element,"mousedown",t,e),D.addListener(e.renderer.scrollBarH.element,"mousedown",t,e)),e.on("mousemove",function(t){if(!n.state&&!n.$dragDelay&&n.$dragEnabled){var D=e.renderer.screenToTextCoordinates(t.x,t.y),S=e.session.selection.getRange(),a=e.renderer;!S.isEmpty()&&S.insideStart(D.row,D.column)?a.setCursorStyle("default"):a.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 t=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;t&&t.length&&this.editor._emit(e,new o(n,this.editor))},e.prototype.onMouseWheel=function(e,n){var t=new o(n,this.editor);t.speed=2*this.$scrollSpeed,t.wheelX=n.wheelX,t.wheelY=n.wheelY,this.editor._emit(e,t)},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 t=this.editor,a=this.editor.renderer;a.$isMousePressed=!0;var r=this,i=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}},g=function(e){t.off("beforeEndOperation",l),clearInterval(d),t.session&&s(),r[r.state+"End"]&&r[r.state+"End"](e),r.state="",r.isMousePressed=a.$isMousePressed=!1,a.$keepTextAreaAtCursor&&a.$moveTextAreaToCursor(),r.$onCaptureMouseMove=r.releaseMouse=null,e&&r.onMouseEvent("mouseup",e),t.endOperation()},s=function(){r[r.state]&&r[r.state](),r.$mouseMoved=!1};if(S.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){g(e)});var l=function(e){r.releaseMouse&&t.curOp.command.name&&t.curOp.selectionChanged&&(r[r.state+"End"]&&r[r.state+"End"](),r.state="",r.releaseMouse())};t.on("beforeEndOperation",l),t.startOperation({command:{name:"mouse"}}),r.$onCaptureMouseMove=i,r.releaseMouse=D.capture(this.editor.container,i,g);var d=setInterval(s,20)},e.prototype.cancelContextMenu=function(){var e=(function(n){(!n||!n.domEvent||"contextmenu"==n.domEvent.type)&&(this.editor.off("nativecontextmenu",e),n&&n.domEvent&&D.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,s.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,t){"use strict";var D=e("../lib/dom");n.FoldHandler=function(){return function(e){e.on("click",function(n){var t=n.getDocumentPosition(),S=e.session,a=S.getFoldAt(t.row,t.column,1);a&&(n.getAccelKey()?S.removeFold(a):S.expandFold(a),n.stop());var r=n.domEvent&&n.domEvent.target;r&&D.hasCssClass(r,"ace_inline_button")&&D.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 t=n.getDocumentPosition().row,D=e.session;D.foldWidgets&&D.foldWidgets[t]&&e.session.onFoldWidgetClick(t,n),e.isFocused()||e.focus(),n.stop()}}),e.on("gutterdblclick",function(n){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(n)){var t=n.getDocumentPosition().row,D=e.session,S=D.getParentFoldRangeData(t,!0),a=S.range||S.firstRange;if(a){t=a.start.row;var r=D.getFoldAt(t,D.getLine(t).length,1);r?D.removeFold(r):(D.addFold("...",a),e.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}n.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,n,t){"use strict";var D=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 t=this.$handlers.indexOf(e);-1!=t&&this.$handlers.splice(t,1),void 0==n?this.$handlers.push(e):this.$handlers.splice(n,0,e),-1==t&&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(t){return t.getStatusText&&t.getStatusText(n,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,n,t,D){for(var a,r=!1,o=this.$editor.commands,i=this.$handlers.length;i--&&(!(a=this.$handlers[i].handleKeyboard(this.$data,e,n,t,D))||!a.command||((r="null"==a.command||o.exec(a.command,this.$editor,a.args,D))&&D&&-1!=e&&!0!=a.passEvent&&!0!=a.command.passEvent&&S.stopEvent(D),!r)););return r||-1!=e||(a={command:"insertstring"},r=o.exec("insertstring",this.$editor,n)),r&&this.$editor._signal&&this.$editor._signal("keyboardActivity",a),r},e.prototype.onCommandKey=function(e,n,t){var S=D.keyCodeToString(t);return this.$callKeyboardHandlers(n,S,t,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,n,t){"use strict";var D=0,S=0,a=!1,r=!1,o=!1,i=[[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]],g=[[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]],s=0,l=1,d=0,c=1,u=2,f=3,h=4,p=5,m=6,y=7,b=8,v=9,$=10,w=11,_=12,A=13,M=14,x=15,L=16,C=17,k=18,E=[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,t,s){var l=D?g:i,d=null,c=null,u=null,f=0,h=null,y=null,v=-1,$=null,w=null,_=[];if(!s)for($=0,s=[];$<t;$++)s[$]=N(e[$]);for(w=0,S=D,a=!1,r=!1,o=!1;w<t;w++){if(d=f,_[w]=c=I(e,s,_,w),h=240&(f=l[d][c]),f&=15,n[w]=u=l[f][5],h>0)if(16==h){for($=v;$<w;$++)n[$]=1;v=-1}else v=-1;if(y=l[f][6])-1==v&&(v=w);else if(v>-1){for($=v;$<w;$++)n[$]=u;v=-1}s[w]==p&&(n[w]=0),S|=u}if(o){for($=0;$<t;$++)if(s[$]==m){n[$]=D;for(var A=$-1;A>=0;A--)if(s[A]==b)n[A]=D;else break}}}function R(e,n,t){if(!(S<e)){if(1==e&&D==l&&!r)return void t.reverse();for(var a,o,i,g,s=t.length,d=0;d<s;){if(n[d]>=e){for(a=d+1;a<s&&n[a]>=e;)a++;for(o=d,i=a-1;o<i;o++,i--)g=t[o],t[o]=t[i],t[i]=g;d=a}d++}}}function I(e,n,t,S){var i,g,s,l,E=n[S];switch(E){case d:case c:a=!1;case h:case f:return E;case u:return a?f:u;case y:return a=!0,c;case b:return h;case v:if(S<1||S+1>=n.length||(i=t[S-1])!=u&&i!=f||(g=n[S+1])!=u&&g!=f)return h;return a&&(g=f),g==i?g:h;case $:if((i=S>0?t[S-1]:p)==u&&S+1<n.length&&n[S+1]==u)return u;return h;case w:if(S>0&&t[S-1]==u)return u;if(a)return h;for(l=S+1,s=n.length;l<s&&n[l]==w;)l++;if(l<s&&n[l]==u)return u;return h;case _:for(s=n.length,l=S+1;l<s&&n[l]==_;)l++;if(l<s){var T=e[S],O=T>=1425&&T<=2303||64286==T;if(i=n[l],O&&(i==c||i==y))return c}if(S<1||(i=n[S-1])==p)return h;return t[S-1];case p:return a=!1,r=!0,D;case m:return o=!0,h;case A:case M:case L:case C:case x:a=!1;case k:return h}}function N(e){var n=e.charCodeAt(0),t=n>>8;if(0==t)return n>191?d:E[n];if(5==t)return/[\u0591-\u05f4]/.test(e)?c:d;if(6==t)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return _;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return f;else if(1642==n)return w;else if(/[\u06f0-\u06f9]/.test(e))return u;else return y;if(32==t&&n<=8287)return T[255&n];if(254==t)return n>=65136?y:h;return h}n.L=0,n.R=c,n.EN=u,n.ON_R=3,n.AN=4,n.R_H=5,n.B=6,n.RLE=7,n.DOT="\xb7",n.doBidiReorder=function(e,t,S){if(e.length<2)return{};var a=e.split(""),r=Array(a.length),o=Array(a.length),i=[];D=S?l:s,O(a,i,a.length,t);for(var g=0;g<r.length;r[g]=g,g++);R(2,i,r),R(1,i,r);for(var g=0;g<r.length-1;g++)t[g]===f?i[g]=n.AN:i[g]===c&&(t[g]>y&&t[g]<A||t[g]===h||t[g]===k)?i[g]=n.ON_R:g>0&&"ل"===a[g-1]&&/\u0622|\u0623|\u0625|\u0627/.test(a[g])&&(i[g-1]=i[g]=n.R_H,g++);a[a.length-1]===n.DOT&&(i[a.length-1]=n.B),""===a[0]&&(i[0]=n.RLE);for(var g=0;g<r.length;g++)o[g]=i[r[g]];return{logicalFromVisual:r,bidiLevels:o}},n.hasBidiCharacters=function(e,n){for(var t=!1,D=0;D<e.length;D++)n[D]=N(e.charAt(D)),t||n[D]!=c&&n[D]!=y&&n[D]!=f||(t=!0);return t},n.getVisualFromLogicalIdx=function(e,n){for(var t=0;t<n.logicalFromVisual.length;t++)if(n.logicalFromVisual[t]==e)return t;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,n,t){"use strict";var D=e("./lib/bidiutil"),S=e("./lib/lang"),a=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;n.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=D,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=a.test(e.getValue())}return e.prototype.isBidiRow=function(e,n,t){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(n,t),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&a.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 t=this.session.$getRowCacheIndex(n,this.currentRow);t>=0&&(e=this.session.$docRowCache[t])}return e},e.prototype.getSplitIndex=function(){var e=0,n=this.session.$screenRowCache;if(n.length)for(var t,D=this.session.$getRowCacheIndex(n,this.currentRow);this.currentRow-e>0&&(t=this.session.$getRowCacheIndex(n,this.currentRow-e-1))===D;)D=t,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,n){void 0===e&&(e=this.getDocumentRow());var t=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 a=this.session.$wrapData[e];a&&(void 0===n&&(n=this.getSplitIndex()),n>0&&a.length?(this.wrapIndent=a.indent,this.wrapOffset=this.wrapIndent*this.charWidths[D.L],this.line=n<a.length?this.line.substring(a[n-1],a[n]):this.line.substring(a[a.length-1])):this.line=this.line.substring(0,a[n]),n==a.length&&(this.line+=this.showInvisibles?t:D.DOT))}else this.line+=this.showInvisibles?t:D.DOT;var r,o=this.session,i=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+i):2,i+=r-1,S.stringRepeat(D.DOT,r)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==D.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=[];D.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=D.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,t=e.$measureCharWidth("ה");this.charWidths[D.L]=this.charWidths[D.EN]=this.charWidths[D.ON_R]=n,this.charWidths[D.R]=this.charWidths[D.AN]=t,this.charWidths[D.R_H]=.45*t,this.charWidths[D.B]=this.charWidths[D.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 t=e.getCursorPosition(),D=e.selection.getSelectionAnchor().row;D<=t.row;D++)n||e.session.getLine(D).charAt(0)!==e.session.$bidiHandler.RLE?n&&e.session.getLine(D).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:D},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(D,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var n=+(this.line.charAt(0)===this.RLE),t=e>n?this.session.getOverwrite()?e:e-1:n,S=D.getVisualFromLogicalIdx(t,this.bidiMap),a=this.bidiMap.bidiLevels,r=0;!this.session.getOverwrite()&&e<=n&&a[S]%2!=0&&S++;for(var o=0;o<S;o++)r+=this.charWidths[a[o]];return!this.session.getOverwrite()&&e>n&&a[S]%2==0&&(r+=this.charWidths[a[S]]),this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(r+=this.rtlLineOffset),r},e.prototype.getSelections=function(e,n){var t,D=this.bidiMap,S=D.bidiLevels,a=[],r=0,o=Math.min(e,n)-this.wrapIndent,i=Math.max(e,n)-this.wrapIndent,g=!1,s=!1,l=0;this.wrapIndent&&(r+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var d,c=0;c<S.length;c++)d=D.logicalFromVisual[c],t=S[c],(g=d>=o&&d<i)&&!s?l=r:!g&&s&&a.push({left:l,width:r-l}),r+=this.charWidths[t],s=g;if(g&&c===S.length&&a.push({left:l,width:r-l}),this.isRtlDir)for(var u=0;u<a.length;u++)a[u].left+=this.rtlLineOffset;return a},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var n=0,e=Math.max(e,0),t=0,D=0,S=this.bidiMap.bidiLevels,a=this.charWidths[S[D]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>t+a/2;){if(t+=a,D===S.length-1){a=0;break}a=this.charWidths[S[++D]]}return D>0&&S[D-1]%2!=0&&S[D]%2==0?(e<t&&D--,n=this.bidiMap.logicalFromVisual[D]):D>0&&S[D-1]%2==0&&S[D]%2!=0?n=1+(e>t?this.bidiMap.logicalFromVisual[D]:this.bidiMap.logicalFromVisual[D-1]):this.isRtlDir&&D===S.length-1&&0===a&&S[D-1]%2==0||!this.isRtlDir&&0===D&&S[D]%2!=0?n=1+this.bidiMap.logicalFromVisual[D]:(D>0&&S[D-1]%2!=0&&0!==a&&D--,n=this.bidiMap.logicalFromVisual[D]),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/lang"),a=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 t=n?e.end:e.start,D=n?e.start:e.end;this.$setSelection(t.row,t.column,D.row,D.column)},e.prototype.$setSelection=function(e,n,t,D){if(!this.$silent){var S=this.$isEmpty,a=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,n),this.cursor.setPosition(t,D),this.$isEmpty=!r.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||S!=this.$isEmpty||a)&&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 t=e||this.lead;e=t.row,n=t.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 t,D="number"==typeof e?e:this.lead.row,S=this.session.getFoldLine(D);return(S?(D=S.start.row,t=S.end.row):t=D,!0===n)?new r(D,0,t,this.session.getLine(t).length):new r(D,0,t+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,t){var D=e.column,S=e.column+n;return t<0&&(D=e.column-n,S=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(D,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 t=this.session.getTabSize();this.wouldMoveIntoSoftTab(n,t,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-t):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 t=this.session.getTabSize(),n=this.lead;this.wouldMoveIntoSoftTab(n,t,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,t):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,n=this.lead.column,t=this.session.documentToScreenRow(e,n),D=this.session.screenToDocumentPosition(t,0),S=this.session.getDisplayLine(e,null,D.row,D.column).match(/^\s*/);S[0].length==n||this.session.$useEmacsStyleLineStart||(D.column+=S[0].length),this.moveCursorToPosition(D)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,n=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==n.column){var t=this.session.getLine(n.row);if(n.column==t.length){var D=t.search(/\s+$/);D>0&&(n.column=D)}}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,t=this.doc.getLine(e),D=t.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(D)&&(n+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,D=t.substring(n)),n>=t.length){this.moveCursorTo(e,t.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(D)&&(n+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,n)},e.prototype.moveCursorLongWordLeft=function(){var e,n=this.lead.row,t=this.lead.column;if(e=this.session.getFoldAt(n,t,-1))return void this.moveCursorTo(e.start.row,e.start.column);var D=this.session.getFoldStringAt(n,t,-1);null==D&&(D=this.doc.getLine(n).substring(0,t));var a=S.stringReverse(D);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(a)&&(t-=this.session.nonTokenRe.lastIndex,a=a.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),t<=0){this.moveCursorTo(n,0),this.moveCursorLeft(),n>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(a)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(n,t)},e.prototype.$shortWordEndIndex=function(e){var n,t=0,D=/\s/,S=this.session.tokenRe;if(S.lastIndex=0,this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{for(;(n=e[t])&&D.test(n);)t++;if(t<1){for(S.lastIndex=0;(n=e[t])&&!S.test(n);)if(S.lastIndex=0,t++,D.test(n))if(t>2){t--;break}else{for(;(n=e[t])&&D.test(n);)t++;if(t>2)break}}}return S.lastIndex=0,t},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,n=this.lead.column,t=this.doc.getLine(e),D=t.substring(n),S=this.session.getFoldAt(e,n,1);if(S)return this.moveCursorTo(S.end.row,S.end.column);if(n==t.length){var a=this.doc.getLength();do e++,D=this.doc.getLine(e);while(e<a&&/^\s*$/.test(D));/^\s+/.test(D)||(D=""),n=0}var r=this.$shortWordEndIndex(D);this.moveCursorTo(e,n+r)},e.prototype.moveCursorShortWordLeft=function(){var e,n=this.lead.row,t=this.lead.column;if(e=this.session.getFoldAt(n,t,-1))return this.moveCursorTo(e.start.row,e.start.column);var D=this.session.getLine(n).substring(0,t);if(0===t){do n--,D=this.doc.getLine(n);while(n>0&&/^\s*$/.test(D));t=D.length,/\s+$/.test(D)||(D="")}var a=S.stringReverse(D),r=this.$shortWordEndIndex(a);return this.moveCursorTo(n,t-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 t,D=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===n&&(0!==e&&(this.session.$bidiHandler.isBidiRow(D.row,this.lead.row)?(t=this.session.$bidiHandler.getPosLeft(D.column),D.column=Math.round(t/this.session.$bidiHandler.charWidths[0])):t=D.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?D.column=this.$desiredColumn:this.$desiredColumn=D.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 a=this.session.screenToDocumentPosition(D.row+e,D.column,t);0!==e&&0===n&&a.row===this.lead.row&&(a.column,this.lead.column),this.moveCursorTo(a.row,a.column+n,0===n)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,n,t){var D=this.session.getFoldAt(e,n,1);D&&(e=D.start.row,n=D.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,t||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,n,t){var D=this.session.screenToDocumentPosition(e,n);this.moveCursorTo(D.row,D.column,t)},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 t=this.getCursor();return r.fromPoints(n,t)}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 t=r.fromPoints(e[n].start,e[n].end);e[n].isBackwards&&(t.cursor=t.start),this.addRange(t,!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,D.implement(o.prototype,a),n.Selection=o}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,n,t){"use strict";var D=e("./lib/report_error").reportError,S=2e3,a=function(){function e(e){for(var n in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var t=this.states[n],D=[],S=0,a=this.matchMappings[n]={defaultToken:"text"},r="g",o=[],i=0;i<t.length;i++){var g=t[i];if(g.defaultToken&&(a.defaultToken=g.defaultToken),g.caseInsensitive&&-1===r.indexOf("i")&&(r+="i"),g.unicode&&-1===r.indexOf("u")&&(r+="u"),null!=g.regex){g.regex instanceof RegExp&&(g.regex=g.regex.toString().slice(1,-1));var s=g.regex,l=RegExp("(?:("+s+")|(.))").exec("a").length-2;Array.isArray(g.token)?1==g.token.length||1==l?g.token=g.token[0]:l-1!=g.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:g,groupCount:l-1}),g.token=g.token[0]):(g.tokenArray=g.token,g.token=null,g.onMatch=this.$arrayTokens):"function"!=typeof g.token||g.onMatch||(l>1?g.onMatch=this.$applyToken:g.onMatch=g.token),l>1&&(/\\\d/.test(g.regex)?s=g.regex.replace(/\\([0-9]+)/g,function(e,n){return"\\"+(parseInt(n,10)+S+1)}):(l=1,s=this.removeCapturingGroups(g.regex)),g.splitRegex||"string"==typeof g.token||o.push(g)),a[S]=i,S+=l,D.push(s),g.onMatch||(g.onMatch=null)}}D.length||(a[0]=0,D.push("$")),o.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,r)},this),this.regExps[n]=RegExp("("+D.join(")|(")+")|($)",r)}}return e.prototype.$setMaxTokenCount=function(e){S=0|e},e.prototype.$applyToken=function(e){var n=this.splitRegex.exec(e).slice(1),t=this.token.apply(this,n);if("string"==typeof t)return[{type:t,value:e}];for(var D=[],S=0,a=t.length;S<a;S++)n[S]&&(D[D.length]={type:t[S],value:n[S]});return D},e.prototype.$arrayTokens=function(e){if(!e)return[];var n=this.splitRegex.exec(e);if(!n)return"text";for(var t=[],D=this.tokenArray,S=0,a=D.length;S<a;S++)n[S+1]&&(t[t.length]={type:D[S],value:n[S+1]});return t},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 t=0,D=!1,S={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,n,a,r,o,i){return D?D="]"!=o:o?D=!0:r?(t==S.stack&&(S.end=i+1,S.stack=-1),t--):a&&(t++,1!=a.length&&(S.stack=t,S.start=i)),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 t=n.slice(0);"#tmp"===(n=t[0])&&(t.shift(),n=t.shift())}else var t=[];var D=n||"start",a=this.states[D];a||(D="start",a=this.states[D]);var r=this.matchMappings[D],o=this.regExps[D];o.lastIndex=0;for(var i,g=[],s=0,l=0,d={type:null,value:""};i=o.exec(e);){var c=r.defaultToken,u=null,f=i[0],h=o.lastIndex;if(h-f.length>s){var p=e.substring(s,h-f.length);d.type==c?d.value+=p:(d.type&&g.push(d),d={type:c,value:p})}for(var m=0;m<i.length-2;m++)if(void 0!==i[m+1]){u=a[r[m]],c=u.onMatch?u.onMatch(f,D,t,e):u.token,u.next&&(D="string"==typeof u.next?u.next:u.next(D,t),(a=this.states[D])||(this.reportError("state doesn't exist",D),D="start",a=this.states[D]),r=this.matchMappings[D],s=h,(o=this.regExps[D]).lastIndex=h),u.consumeLineEnd&&(s=h);break}if(f){if("string"==typeof c)u&&!1===u.merge||d.type!==c?(d.type&&g.push(d),d={type:c,value:f}):d.value+=f;else if(c){d.type&&g.push(d),d={type:null,value:""};for(var m=0;m<c.length;m++)g.push(c[m])}}if(s==e.length)break;if(s=h,l++>S){for(l>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:n,line:e});s<e.length;)d.type&&g.push(d),d={value:e.substring(s,s+=500),type:"overflow"};D="start",t=[];break}}return d.type&&g.push(d),t.length>1&&t[0]!==D&&t.unshift("#tmp",D),{tokens:g,state:t.length?t:D}},e}();a.prototype.reportError=D,n.Tokenizer=a}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,n,t){"use strict";var D,S=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,n){if(!n){for(var t in e)this.$rules[t]=e[t];return}for(var t in e){for(var D=e[t],S=0;S<D.length;S++){var a=D[S];(a.next||a.onMatch)&&("string"==typeof a.next&&0!==a.next.indexOf(n)&&(a.next=n+a.next),a.nextState&&0!==a.nextState.indexOf(n)&&(a.nextState=n+a.nextState))}this.$rules[n+t]=D}},this.getRules=function(){return this.$rules},this.embedRules=function(e,n,t,D,a){var r="function"==typeof e?new e().getRules():e;if(D)for(var o=0;o<D.length;o++)D[o]=n+D[o];else for(var i in D=[],r)D.push(n+i);if(this.addRules(r,n),t)for(var g=Array.prototype[a?"push":"unshift"],o=0;o<D.length;o++)g.apply(this.$rules[D[o]],S(t));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 t=0,D=this.$rules;function S(a){var r=D[a];r.processed=!0;for(var o=0;o<r.length;o++){var i=r[o],g=null;Array.isArray(i)&&(g=i,i={}),!i.regex&&i.start&&(i.regex=i.start,i.next||(i.next=[]),i.next.push({defaultToken:i.token},{token:i.token+".end",regex:i.end||i.start,next:"pop"}),i.token=i.token+".start",i.push=!0);var s=i.next||i.push;if(s&&Array.isArray(s)){var l=i.stateName;!l&&("string"!=typeof(l=i.token)&&(l=l[0]||""),D[l]&&(l+=t++)),D[l]=s,i.next=l,S(l)}else"pop"==s&&(i.next=n);if(i.push&&(i.nextState=i.next||i.push,i.next=e,delete i.push),i.rules)for(var d in i.rules)D[d]?D[d].push&&D[d].push.apply(D[d],i.rules[d]):D[d]=i.rules[d];var c="string"==typeof i?i:i.include;if(c&&("$self"===c&&(c="start"),g=Array.isArray(c)?c.map(function(e){return D[e]}):D[c]),g){var u=[o,1].concat(g);i.noEscape&&(u=u.filter(function(e){return!e.next})),r.splice.apply(r,u),o--}i.keywordMap&&(i.token=this.createKeywordMapper(i.keywordMap,i.defaultToken||"text",i.caseInsensitive),delete i.defaultToken)}}Object.keys(D).forEach(S,this)},this.createKeywordMapper=function(e,n,t,D){var S=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(n){for(var a=e[n].split(D||"|"),r=a.length;r--;){var o=a[r];this.$keywordList.push(o),t&&(o=o.toLowerCase()),S[o]=n}},this),e=null,t?function(e){return S[e.toLowerCase()]||n}:function(e){return S[e]||n}},this.getKeywords=function(){return this.$keywords}}).call((D=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),n.TextHighlightRules=D}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,n,t){"use strict";var D;(function(){this.add=function(e,n,t){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][n]=t},this.addBehaviours=function(e){for(var n in e)for(var t in e[n])this.add(n,t,e[n][t])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,n){if("function"==typeof e)var t=new e().getBehaviours(n);else var t=e.getBehaviours(n);this.addBehaviours(t)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var n={},t=0;t<e.length;t++)this.$behaviours[e[t]]&&(n[e[t]]=this.$behaviours[e[t]]);return n}}).call((D=function(){this.$behaviours={}}).prototype),n.Behaviour=D}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=e("./range").Range;n.TokenIterator=function(){function e(e,n,t){this.$session=e,this.$row=n,this.$rowTokens=e.getTokens(n);var D=e.getTokenAt(n,t);this.$tokenIndex=D?D.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,t=e[n].start;if(void 0!==t)return t;for(t=0;n>0;)n-=1,t+=e[n].value.length;return t},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 D(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,t){"use strict";var D,S,a=e("../../lib/oop"),r=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,i=e("../../lib/lang"),g=["text","paren.rparen","rparen","paren","punctuation.operator"],s=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],l={},d={'"':'"',"'":"'"},c=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 D=l[n];D=l[n]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},u=function(e,n,t,D){var S=e.end.row-e.start.row;return{text:t+n+D,selection:[0,e.start.column+1,S,e.end.column+ +!S]}};(S=function(e){e=e||{},this.add("braces","insertion",function(n,t,a,r,o){var g=a.getCursorPosition(),s=r.doc.getLine(g.row);if("{"==o){c(a);var l=a.getSelectionRange(),d=r.doc.getTextRange(l),f=r.getTokenAt(g.row,g.column);if(""!==d&&"{"!==d&&a.getWrapBehavioursEnabled())return u(l,d,"{","}");if(f&&/(?:string)\.quasi|\.xml/.test(f.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(f.type)})||/(string)\.quasi/.test(f.type)&&"$"!==f.value[g.column-f.start-1])return;return S.recordAutoInsert(a,r,"}"),{text:"{}",selection:[1,1]}}if(S.isSaneInsertion(a,r))if(/[\]\}\)]/.test(s[g.column])||a.inMultiSelectMode||e.braces)return S.recordAutoInsert(a,r,"}"),{text:"{}",selection:[1,1]};else return S.recordMaybeInsert(a,r,"{"),{text:"{",selection:[1,1]}}else if("}"==o){c(a);var h=s.substring(g.column,g.column+1);if("}"==h&&null!==r.$findOpeningBracket("}",{column:g.column+1,row:g.row})&&S.isAutoInsertedClosing(g,s,o))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==o||"\r\n"==o){c(a);var p="";S.isMaybeInsertedClosing(g,s)&&(p=i.stringRepeat("}",D.maybeInsertedBrackets),S.clearMaybeInsertedClosing());var h=s.substring(g.column,g.column+1);if("}"===h){var m=r.findMatchingBracket({row:g.row,column:g.column+1},"}");if(!m)return null;var y=this.$getIndent(r.getLine(m.row))}else if(!p)return void S.clearMaybeInsertedClosing();else var y=this.$getIndent(s);var b=y+r.getTabString();return{text:"\n"+b+"\n"+y+p,selection:[1,b.length,1,b.length]}}else S.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,n,t,S,a){var r=S.doc.getTextRange(a);if(!a.isMultiLine()&&"{"==r){if(c(t),"}"==S.doc.getLine(a.start.row).substring(a.end.column,a.end.column+1))return a.end.column++,a;D.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,n,t,D,a){if("("==a){c(t);var r=t.getSelectionRange(),o=D.doc.getTextRange(r);if(""!==o&&t.getWrapBehavioursEnabled())return u(r,o,"(",")");if(S.isSaneInsertion(t,D))return S.recordAutoInsert(t,D,")"),{text:"()",selection:[1,1]}}else if(")"==a){c(t);var i=t.getCursorPosition(),g=D.doc.getLine(i.row);if(")"==g.substring(i.column,i.column+1)&&null!==D.$findOpeningBracket(")",{column:i.column+1,row:i.row})&&S.isAutoInsertedClosing(i,g,a))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,n,t,D,S){var a=D.doc.getTextRange(S);if(!S.isMultiLine()&&"("==a&&(c(t),")"==D.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,t,D,a){if("["==a){c(t);var r=t.getSelectionRange(),o=D.doc.getTextRange(r);if(""!==o&&t.getWrapBehavioursEnabled())return u(r,o,"[","]");if(S.isSaneInsertion(t,D))return S.recordAutoInsert(t,D,"]"),{text:"[]",selection:[1,1]}}else if("]"==a){c(t);var i=t.getCursorPosition(),g=D.doc.getLine(i.row);if("]"==g.substring(i.column,i.column+1)&&null!==D.$findOpeningBracket("]",{column:i.column+1,row:i.row})&&S.isAutoInsertedClosing(i,g,a))return S.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,n,t,D,S){var a=D.doc.getTextRange(S);if(!S.isMultiLine()&&"["==a&&(c(t),"]"==D.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,t,D,S){var a=D.$mode.$quotes||d;if(1==S.length&&a[S]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(S))return;c(t);var r=S,o=t.getSelectionRange(),i=D.doc.getTextRange(o);if(""!==i&&(1!=i.length||!a[i])&&t.getWrapBehavioursEnabled())return u(o,i,r,r);if(!i){var g,s=t.getCursorPosition(),l=D.doc.getLine(s.row),f=l.substring(s.column-1,s.column),h=l.substring(s.column,s.column+1),p=D.getTokenAt(s.row,s.column),m=D.getTokenAt(s.row,s.column+1);if("\\"==f&&p&&/escape/.test(p.type))return null;var y=p&&/string|escape/.test(p.type),b=!m||/string|escape/.test(m.type);if(h==r)(g=y!==b)&&/string\.end/.test(m.type)&&(g=!1);else{if(y&&!b||y&&b)return null;var v=D.$mode.tokenRe;v.lastIndex=0;var $=v.test(f);v.lastIndex=0;var w=v.test(h),_=D.$mode.$pairQuotesAfter;if(!(_&&_[r]&&_[r].test(f))&&$||w||h&&!/[\s;,.})\]\\]/.test(h))return null;var A=l[s.column-2];if(f==r&&(A==r||v.test(A)))return null;g=!0}return{text:g?r+r:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,n,t,D,S){var a=D.$mode.$quotes||d,r=D.doc.getTextRange(S);if(!S.isMultiLine()&&a.hasOwnProperty(r)&&(c(t),D.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,t,D,S){if("doc-start"===e&&("\n"===S||"\r\n"===S)&&t.selection.isEmpty()){var a=t.getCursorPosition();if(0!==a.column){for(var r=D.doc.getLine(a.row),o=D.doc.getLine(a.row+1),i=D.getTokens(a.row),g=0,s=0;s<i.length;s++){g+=i[s].value.length;var l=i[s];if(g>=a.column){if(g===a.column){if(!/\.doc/.test(l.type))return;if(/\*\//.test(l.value)){var d=i[s+1];if(!d||!/\.doc/.test(d.type))return}}var c=a.column-(g-l.value.length),u=l.value.indexOf("*/"),f=l.value.indexOf("/**",u>-1?u+2:0);if(-1!==f&&c>f&&c<f+3||-1!==u&&-1!==f&&c>=u&&c<=f||!/\.doc/.test(l.type))return;break}}var h=this.$getIndent(r);if(/\s*\*/.test(o))if(/^\s*\*/.test(r))return{text:S+h+"* ",selection:[1,2+h.length,1,2+h.length]};else return{text:S+h+" * ",selection:[1,3+h.length,1,3+h.length]};if(/\/\*\*/.test(r.substring(0,a.column)))return{text:S+h+" * "+S+" "+h+"*/",selection:[1,4+h.length,1,4+h.length]}}}})}).isSaneInsertion=function(e,n){var t=e.getCursorPosition(),D=new o(n,t.row,t.column);if(!this.$matchTokenType(D.getCurrentToken()||"text",g)){if(/[)}\]]/.test(e.session.getLine(t.row)[t.column]))return!0;var S=new o(n,t.row,t.column+1);if(!this.$matchTokenType(S.getCurrentToken()||"text",g))return!1}return D.stepForward(),D.getCurrentTokenRow()!==t.row||this.$matchTokenType(D.getCurrentToken()||"text",s)},S.$matchTokenType=function(e,n){return n.indexOf(e.type||e)>-1},S.recordAutoInsert=function(e,n,t){var S=e.getCursorPosition(),a=n.doc.getLine(S.row);this.isAutoInsertedClosing(S,a,D.autoInsertedLineEnd[0])||(D.autoInsertedBrackets=0),D.autoInsertedRow=S.row,D.autoInsertedLineEnd=t+a.substr(S.column),D.autoInsertedBrackets++},S.recordMaybeInsert=function(e,n,t){var S=e.getCursorPosition(),a=n.doc.getLine(S.row);this.isMaybeInsertedClosing(S,a)||(D.maybeInsertedBrackets=0),D.maybeInsertedRow=S.row,D.maybeInsertedLineStart=a.substr(0,S.column)+t,D.maybeInsertedLineEnd=a.substr(S.column),D.maybeInsertedBrackets++},S.isAutoInsertedClosing=function(e,n,t){return D.autoInsertedBrackets>0&&e.row===D.autoInsertedRow&&t===D.autoInsertedLineEnd[0]&&n.substr(e.column)===D.autoInsertedLineEnd},S.isMaybeInsertedClosing=function(e,n){return D.maybeInsertedBrackets>0&&e.row===D.maybeInsertedRow&&n.substr(e.column)===D.maybeInsertedLineEnd&&n.substr(0,e.column)==D.maybeInsertedLineStart},S.popAutoInsertedClosing=function(){D.autoInsertedLineEnd=D.autoInsertedLineEnd.substr(1),D.autoInsertedBrackets--},S.clearMaybeInsertedClosing=function(){D&&(D.maybeInsertedBrackets=0,D.maybeInsertedRow=-1)},a.inherits(S,r),n.CstyleBehaviour=S}),ace.define("ace/unicode",["require","exports","module"],function(e,n,t){"use strict";for(var D=[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,a=[],r=0;r<D.length;r+=2)a.push(S+=D[r]),D[r+1]&&a.push(45,S+=D[r+1]);n.wordChars=String.fromCharCode.apply(null,a)}),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,t){"use strict";var D,S=e("../config"),a=e("../tokenizer").Tokenizer,r=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,i=e("../unicode"),g=e("../lib/lang"),s=e("../token_iterator").TokenIterator,l=e("../range").Range;(function(){this.$defaultBehaviour=new o,this.tokenRe=RegExp("^["+i.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+i.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new a(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,n,t,D){var S=n.doc,a=!0,r=!0,o=1/0,i=n.getTabSize(),s=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var l=this.lineCommentStart.map(g.escapeRegExp).join("|"),d=this.lineCommentStart[0];else var l=g.escapeRegExp(this.lineCommentStart),d=this.lineCommentStart;l=RegExp("^(\\s*)(?:"+l+") ?"),s=n.getUseSoftTabs();var c=function(e,n){var t=e.match(l);if(t){var D=t[1].length,a=t[0].length;!p(e,D,a)&&" "==t[0][a-1]&&a--,S.removeInLine(n,D,a)}},u=d+" ",f=function(e,n){(!a||/\S/.test(e))&&(p(e,o,o)?S.insertInLine({row:n,column:o},u):S.insertInLine({row:n,column:o},d))},h=function(e,n){return l.test(e)},p=function(e,n,t){for(var D=0;n--&&" "==e.charAt(n);)D++;if(D%i!=0)return!1;for(var D=0;" "==e.charAt(t++);)D++;return i>2?D%i!=i-1:D%i==0}}else{if(!this.blockComment)return!1;var d=this.blockComment.start,m=this.blockComment.end,l=RegExp("^(\\s*)(?:"+g.escapeRegExp(d)+")"),y=RegExp("(?:"+g.escapeRegExp(m)+")\\s*$"),f=function(e,n){!h(e,n)&&(!a||/\S/.test(e))&&(S.insertInLine({row:n,column:e.length},m),S.insertInLine({row:n,column:o},d))},c=function(e,n){var t;(t=e.match(y))&&S.removeInLine(n,e.length-t[0].length,e.length),(t=e.match(l))&&S.removeInLine(n,t[1].length,t[0].length)},h=function(e,t){if(l.test(e))return!0;for(var D=n.getTokens(t),S=0;S<D.length;S++)if("comment"===D[S].type)return!0}}function b(e){for(var n=t;n<=D;n++)e(S.getLine(n),n)}var v=1/0;b(function(e,n){var t=e.search(/\S/);-1!==t?(t<o&&(o=t),r&&!h(e,n)&&(r=!1)):v>e.length&&(v=e.length)}),o==1/0&&(o=v,a=!1,r=!1),s&&o%i!=0&&(o=Math.floor(o/i)*i),b(r?c:f)},this.toggleBlockComment=function(e,n,t,D){var S=this.blockComment;if(S){!S.start&&S[0]&&(S=S[0]);var a=new s(n,D.row,D.column),r=a.getCurrentToken();n.selection;var o=n.selection.toOrientedRange();if(r&&/comment/.test(r.type)){for(;r&&/comment/.test(r.type);){var i,g,d,c,u=r.value.indexOf(S.start);if(-1!=u){var f=a.getCurrentTokenRow(),h=a.getCurrentTokenColumn()+u;d=new l(f,h,f,h+S.start.length);break}r=a.stepBackward()}for(var a=new s(n,D.row,D.column),r=a.getCurrentToken();r&&/comment/.test(r.type);){var u=r.value.indexOf(S.end);if(-1!=u){var f=a.getCurrentTokenRow(),h=a.getCurrentTokenColumn()+u;c=new l(f,h,f,h+S.end.length);break}r=a.stepForward()}c&&n.remove(c),d&&(n.remove(d),i=d.start.row,g=-S.start.length)}else g=S.start.length,i=t.start.row,n.insert(t.end,S.end),n.insert(t.start,S.start);o.start.row==i&&(o.start.column+=g),o.end.row==i&&(o.end.column+=g),n.selection.fromOrientedRange(o)}},this.getNextLineIndent=function(e,n,t){return this.$getIndent(n)},this.checkOutdent=function(e,n,t){return!1},this.autoOutdent=function(e,n,t){},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 t=e[n],D=t.prototype.$id,a=S.$modes[D];a||(S.$modes[D]=a=new t),S.$modes[n]||(S.$modes[n]=a),this.$embeds.push(n),this.$modes[n]=a}for(var r=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],o=function(e){!function(n){var t=r[e],D=n[t];n[r[e]]=function(){return this.$delegator(t,arguments,D)}}(i)},i=this,n=0;n<r.length;n++)o(n)},this.$delegator=function(e,n,t){var D=n[0]||"start";if("string"!=typeof D){if(Array.isArray(D[2])){var S=D[2][D[2].length-1],a=this.$modes[S];if(a)return a[e].apply(a,[D[1]].concat([].slice.call(n,1)))}D=D[0]||"start"}for(var r=0;r<this.$embeds.length;r++)if(this.$modes[this.$embeds[r]]){var o=D.split(this.$embeds[r]);if(!o[0]&&o[1]){n[0]=o[1];var a=this.$modes[this.$embeds[r]];return a[e].apply(a,n)}}var i=t.apply(this,n);return t?i:void 0},this.transformAction=function(e,n,t,D,S){if(this.$behaviour){var a=this.$behaviour.getBehaviours();for(var r in a)if(a[r][n]){var o=a[r][n].apply(this,arguments);if(o)return o}}},this.getKeywords=function(e){if(!this.completionKeywords){var n=this.$tokenizer.rules,t=[];for(var D in n)for(var S=n[D],a=0,r=S.length;a<r;a++)if("string"==typeof S[a].token)/keyword|support|storage/.test(S[a].token)&&t.push(S[a].regex);else if("object"==typeof S[a].token){for(var o=0,i=S[a].token.length;o<i;o++)if(/keyword|support|storage/.test(S[a].token[o])){var D=S[a].regex.match(/\(.+?\)/g)[o];t.push(D.substr(1,D.length-2))}}this.completionKeywords=t}return e?t.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,n,t,D){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((D=function(){this.HighlightRules=r}).prototype),n.Mode=D}),ace.define("ace/apply_delta",["require","exports","module"],function(e,n,t){"use strict";n.applyDelta=function(e,n,t){var D=n.start.row,S=n.start.column,a=e[D]||"";switch(n.action){case"insert":if(1===n.lines.length)e[D]=a.substring(0,S)+n.lines[0]+a.substring(S);else{var r=[D,1].concat(n.lines);e.splice.apply(e,r),e[D]=a.substring(0,S)+e[D],e[D+n.lines.length-1]+=a.substring(S)}break;case"remove":var o=n.end.column,i=n.end.row;D===i?e[D]=a.substring(0,S)+a.substring(o):e.splice(D,i-D+1,a.substring(0,S)+e[i].substring(o))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,a=function(){function e(e,n,t){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof n?this.setPosition(n.row,n.column):this.setPosition(n,t)}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,t){if(D=t?{row:e,column:n}:this.$clipPositionToDocument(e,n),this.row!=D.row||this.column!=D.column){var D,S={row:this.row,column:this.column};this.row=D.row,this.column=D.column,this._signal("change",{old:S,value:D})}},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 t={};return e>=this.document.getLength()?(t.row=Math.max(0,this.document.getLength()-1),t.column=this.document.getLine(t.row).length):e<0?(t.row=0,t.column=0):(t.row=e,t.column=Math.min(this.document.getLine(t.row).length,Math.max(0,n))),n<0&&(t.column=0),t},e}();function r(e,n,t){var D=t?e.column<=n.column:e.column<n.column;return e.row<n.row||e.row==n.row&&D}function o(e,n,t){var D="insert"==e.action,S=(D?1:-1)*(e.end.row-e.start.row),a=(D?1:-1)*(e.end.column-e.start.column),o=e.start,i=D?o:e.end;return r(n,o,t)?{row:n.row,column:n.column}:r(i,n,!t)?{row:n.row+S,column:n.column+(n.row==i.row?a:0)}:{row:o.row,column:o.column}}a.prototype.$insertRight=!1,D.implement(a.prototype,S),n.Anchor=a}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./apply_delta").applyDelta,a=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,o=e("./anchor").Anchor,i=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 t=n.length-1;e.end.row-e.start.row==t&&(n[t]=n[t].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 t=this.clippedPos(e.row,e.column),D=this.pos(e.row,e.column+n.length);return this.applyDelta({start:t,end:D,action:"insert",lines:[n]},!0),this.clonePos(D)},e.prototype.clippedPos=function(e,n){var t=this.getLength();void 0===e?e=t:e<0?e=0:e>=t&&(e=t-1,n=void 0);var D=this.getLine(e);return void 0==n&&(n=D.length),{row:e,column:n=Math.min(Math.max(n,0),D.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 t=0;e<this.getLength()?(n=n.concat([""]),t=0):(n=[""].concat(n),e--,t=this.$lines[e].length),this.insertMergedLines({row:e,column:t},n)},e.prototype.insertMergedLines=function(e,n){var t=this.clippedPos(e.row,e.column),D={row:t.row+n.length-1,column:(1==n.length?t.column:0)+n[n.length-1].length};return this.applyDelta({start:t,end:D,action:"insert",lines:n}),this.clonePos(D)},e.prototype.remove=function(e){var n=this.clippedPos(e.start.row,e.start.column),t=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:n,end:t,action:"remove",lines:this.getLinesForRange({start:n,end:t})}),this.clonePos(n)},e.prototype.removeInLine=function(e,n,t){var D=this.clippedPos(e,n),S=this.clippedPos(e,t);return this.applyDelta({start:D,end:S,action:"remove",lines:this.getLinesForRange({start:D,end:S})},!0),this.clonePos(D)},e.prototype.removeFullLines=function(e,n){e=Math.min(Math.max(0,e),this.getLength()-1);var t=(n=Math.min(Math.max(0,n),this.getLength()-1))==this.getLength()-1&&e>0,D=n<this.getLength()-1,S=t?e-1:e,a=t?this.getLine(S).length:0,o=D?n+1:n,i=D?0:this.getLine(o).length,g=new r(S,a,o,i),s=this.$lines.slice(e,n+1);return this.applyDelta({start:g.start,end:g.end,action:"remove",lines:this.getLinesForRange(g)}),s},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 t;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),t=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 t="insert"==e.action;(t?!(e.lines.length<=1)||e.lines[0]:r.comparePoints(e.start,e.end))&&(t&&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 t=e.lines,D=t.length-n+1,S=e.start.row,a=e.start.column,r=0,o=0;r<D;r=o){o+=n-1;var i=t.slice(r,o);i.push(""),this.applyDelta({start:this.pos(S+r,a),end:this.pos(S+o,a=0),action:e.action,lines:i},!0)}e.lines=t.slice(r),e.start.row=S+r,e.start.column=a,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 t=this.$lines||this.getAllLines(),D=this.getNewLineCharacter().length,S=n||0,a=t.length;S<a;S++)if((e-=t[S].length+D)<0)return{row:S,column:e+t[S].length+D};return{row:a-1,column:e+t[a-1].length+D}},e.prototype.positionToIndex=function(e,n){for(var t=this.$lines||this.getAllLines(),D=this.getNewLineCharacter().length,S=0,a=Math.min(e.row,t.length),r=n||0;r<a;++r)S+=t[r].length+D;return S+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();i.prototype.$autoNewLine="",i.prototype.$newLineMode="auto",D.implement(i.prototype,a),n.Document=i}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,n,t){"use strict";var D=e("./lib/oop"),S=e("./lib/event_emitter").EventEmitter,a=function(){function e(e,n){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var t=this;this.$worker=function(){if(t.running){for(var e=new Date,n=t.currentLine,D=-1,S=t.doc,a=n;t.lines[n];)n++;var r=S.getLength(),o=0;for(t.running=!1;n<r;){t.$tokenizeRow(n),D=n;do n++;while(t.lines[n]);if(++o%5==0&&new Date-e>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=n,-1==D&&(D=n),a<=D&&t.fireUpdateEvent(a,D)}}}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 t={first:e,last:n};this._signal("update",{data:t})},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,t=e.end.row-n;if(0===t)this.lines[n]=null;else if("remove"==e.action)this.lines.splice(n,t+1,null),this.states.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.lines.splice.apply(this.lines,D),this.states.splice.apply(this.states,D)}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),t=this.states[e-1],D=this.tokenizer.getLineTokens(n,t,e);return this.states[e]+""!=D.state+""?(this.states[e]=D.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=D.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();D.implement(a.prototype,S),n.BackgroundTokenizer=a}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,n,t){"use strict";var D=e("./lib/lang"),S=e("./range").Range,a=function(){function e(e,n,t){void 0===t&&(t="text"),this.setRegexp(e),this.clazz=n,this.type=t}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,n,t,a){if(this.regExp)for(var r=a.firstRow,o=a.lastRow,i={},g=r;g<=o;g++){var s=this.cache[g];null==s&&((s=D.getMatchOffsets(t.getLine(g),this.regExp)).length>this.MAX_RANGES&&(s=s.slice(0,this.MAX_RANGES)),s=s.map(function(e){return new S(g,e.offset,g,e.offset+e.length)}),this.cache[g]=s.length?s:"");for(var l=s.length;l--;){var d=s[l].toScreenRange(t),c=d.toString();i[c]||(i[c]=!0,n.drawSingleLineMarker(e,d,this.clazz,a))}}},e}();a.prototype.MAX_RANGES=500,n.SearchHighlight=a}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=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,t){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===n||!this.lastDeltas){this.lastDeltas=[];var D=this.$undoStack.length;D>this.$undoDepth-1&&this.$undoStack.splice(0,D-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 t=this.$undoStack,D=t.length;D--;){var S=t[D][0];if(S.id<=e)break;S.id<n&&(S.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,n){for(var t=this.selections,D=t.length;D--;){var S=t[D];if(S.rev<e)return n&&(S=t[D+1]),S}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,n){null==n&&(n=this.$rev+1);for(var t=this.$undoStack,D=null,S=0,a=t.length;a--;){var r=t[a][0];if(r.id<n&&!D&&(D=a+1),r.id<=e){S=a+1;break}}return t.slice(S,D)},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 t=this.$undoStack;if(S(t,t.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var D=t.pop(),a=null;return D&&(a=e.undoChanges(D,n),this.$redoStack.push(D),this.$syncRev()),this.$fromUndo=!1,a}},e.prototype.redo=function(e,n){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var t=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);m(this.$redoStack,t),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var D=this.$redoStack.pop(),S=null;return D&&(S=e.redoChanges(D,n),this.$undoStack.push(D),this.$syncRev()),this.$fromUndo=!1,S},e.prototype.$syncRev=function(){var e=this.$undoStack,n=e[e.length-1],t=n&&n[0].id||0;this.$redoStackBaseRev=t,this.$rev=t},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?g(e):g(this.$undoStack)+"\n---\n"+g(this.$redoStack)},e}();function S(e,n){for(var t=n;t--;){var D=e[t];if(D&&!D[0].ignore){for(;t<n-1;){var S=d(e[t],e[t+1]);e[t]=S[0],e[t+1]=S[1],t++}return!0}}}D.prototype.hasUndo=D.prototype.canUndo,D.prototype.hasRedo=D.prototype.canRedo,D.prototype.isClean=D.prototype.isAtBookmark,D.prototype.markClean=D.prototype.bookmark;var a=e("./range").Range,r=a.comparePoints;function o(e){return{row:e.row,column:e.column}}function i(e){return{start:o(e.start),end:o(e.end),action:e.action,lines:e.lines.slice()}}function g(e){if(Array.isArray(e=e||this))return e.map(g).join("\n");var n="";return e.action?n=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(n=Array.isArray(e.value)?e.value.map(s).join("\n"):s(e.value)),e.start&&(n+=s(e)),(e.id||e.rev)&&(n+=" ("+(e.id||e.rev)+")"),n}function s(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function l(e,n){var t="insert"==e.action,D="insert"==n.action;if(t&&D)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.start,e.start)))return null;u(e,n,1)}else if(t&&!D)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.end,e.start)))return null;u(e,n,-1)}else if(!t&&D)if(r(n.start,e.start)>=0)u(n,e,1);else{if(!(0>=r(n.start,e.start)))return null;u(e,n,1)}else if(!t&&!D)if(r(n.start,e.start)>=0)u(n,e,1);else{if(!(0>=r(n.end,e.start)))return null;u(e,n,-1)}return[n,e]}function d(e,n){for(var t=e.length;t--;)for(var D=0;D<n.length;D++)if(!l(e[t],n[D])){for(;t<e.length;){for(;D--;)l(n[D],e[t]);D=n.length,t++}return[e,n]}return e.selectionBefore=n.selectionBefore=e.selectionAfter=n.selectionAfter=null,[n,e]}function c(e,n){var t,D,S="insert"==e.action,o="insert"==n.action;if(S&&o)0>r(e.start,n.start)?u(n,e,1):u(e,n,1);else if(S&&!o)r(e.start,n.end)>=0?u(e,n,-1):(0>=r(e.start,n.start)||u(e,a.fromPoints(n.start,e.start),-1),u(n,e,1));else if(!S&&o)r(n.start,e.end)>=0?u(n,e,-1):(0>=r(n.start,e.start)||u(n,a.fromPoints(e.start,n.start),-1),u(e,n,1));else if(!S&&!o)if(r(n.start,e.end)>=0)u(n,e,-1);else{if(!(0>=r(n.end,e.start)))return 0>r(e.start,n.start)&&(t=e,e=h(e,n.start)),r(e.end,n.end)>0&&(D=h(e,n.end)),f(n.end,e.start,e.end,-1),D&&!t&&(e.lines=D.lines,e.start=D.start,e.end=D.end,D=e),[n,t,D].filter(Boolean);u(e,n,-1)}return[n,e]}function u(e,n,t){f(e.start,n.start,n.end,t),f(e.end,n.start,n.end,t)}function f(e,n,t,D){e.row==(1==D?n:t).row&&(e.column+=D*(t.column-n.column)),e.row+=D*(t.row-n.row)}function h(e,n){var t=e.lines,D=e.end;e.end=o(n);var S=e.end.row-e.start.row,a=t.splice(S,t.length),r=S?n.column:n.column-e.start.column;return t.push(a[0].substring(0,r)),a[0]=a[0].substr(r),{start:o(n),end:D,lines:a,action:e.action}}function p(e,n){n=i(n);for(var t=e.length;t--;){for(var D=e[t],S=0;S<D.length;S++){var a=c(D[S],n);n=a[0],2!=a.length&&(a[2]?(D.splice(S+1,1,a[1],a[2]),S++):!a[1]&&(D.splice(S,1),S--))}D.length||e.splice(t,1)}return e}function m(e,n){for(var t=0;t<n.length;t++)for(var D=n[t],S=0;S<D.length;S++)p(e,D[S])}a.comparePoints,n.UndoManager=D}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,n,t){"use strict";var D=e("../range").Range;n.FoldLine=function(){function e(e,n){this.foldData=e,Array.isArray(n)?this.folds=n:n=this.folds=[n];var t=n[n.length-1];this.range=new D(n[0].start.row,n[0].start.column,t.end.row,t.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,t){var D,S,a,r=0,o=this.folds,i=!0;null==n&&(n=this.end.row,t=this.end.column);for(var g=0;g<o.length;g++){if(-1==(S=(D=o[g]).range.compareStart(n,t)))return void e(null,n,t,r,i);if((a=!(a=e(null,D.start.row,D.start.column,r,i))&&e(D.placeholder,D.start.row,D.start.column,r))||0===S)return;i=!D.sameRow,r=D.end.column}e(null,n,t,r,i)},e.prototype.getNextFoldTo=function(e,n){for(var t,D,S=0;S<this.folds.length;S++){if(-1==(D=(t=this.folds[S]).range.compareEnd(e,n)))return{fold:t,kind:"after"};if(0===D)return{fold:t,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,n,t){var D,S,a=this.getNextFoldTo(e,n);if(a){if(D=a.fold,"inside"==a.kind&&D.start.column!=n&&D.start.row!=e)window.console&&window.console.log(e,n,D);else if(D.start.row==e){var r=(S=this.folds).indexOf(D);for(0===r&&(this.start.column+=t);r<S.length;r++){if(D=S[r],D.start.column+=t,!D.sameRow)return;D.end.column+=t}this.end.column+=t}}},e.prototype.split=function(n,t){var D=this.getNextFoldTo(n,t);if(!D||"inside"==D.kind)return null;var S=D.fold,a=this.folds,r=this.foldData,o=a.indexOf(S),i=a[o-1];this.end.row=i.end.row,this.end.column=i.end.column;var g=new e(r,a=a.splice(o,a.length-o));return r.splice(r.indexOf(this)+1,0,g),g},e.prototype.merge=function(e){for(var n=e.folds,t=0;t<n.length;t++)this.addFold(n[t]);var D=this.foldData;D.splice(D.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,t=0;t<this.folds.length;t++){var D=this.folds[t];if((e-=D.start.column-n)<0)return{row:D.start.row,column:D.start.column+e};if((e-=D.placeholder.length)<0)return D.start;n=D.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,t){"use strict";var D=e("./range").Range.comparePoints,S=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,n,t){for(var S=this.ranges,a=t||0;a<S.length;a++){var r=S[a],o=D(e,r.end);if(!(o>0)){var i=D(e,r.start);if(0===o)return n&&0!==i?-a-2:a;if(i>0||0===i&&!n)return a;break}}return-a-1},e.prototype.add=function(e){var n=!e.isEmpty(),t=this.pointIndex(e.start,n);t<0&&(t=-t-1);var D=this.pointIndex(e.end,n,t);return D<0?D=-D-1:D++,this.ranges.splice(t,D-t,e)},e.prototype.addList=function(e){for(var n=[],t=e.length;t--;)n.push.apply(n,this.add(e[t]));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=[],t=this.ranges,S=(t=t.sort(function(e,n){return D(e.start,n.start)}))[0],a=1;a<t.length;a++){e=S,S=t[a];var r=D(e.end,S.start);!(r<0)&&(0!=r||e.isEmpty()||S.isEmpty())&&(0>D(e.end,S.end)&&(e.end.row=S.end.row,e.end.column=S.end.column),t.splice(a,1),n.push(S),S=e,a--)}return this.ranges=t,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 t=this.ranges;if(t[0].start.row>n||t[t.length-1].start.row<e)return[];var D=this.pointIndex({row:e,column:0});D<0&&(D=-D-1);var S=this.pointIndex({row:n,column:0},D);S<0&&(S=-S-1);for(var a=[],r=D;r<S;r++)a.push(t[r]);return a},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,t=e.end,D=n.row,S=t.row,a=this.ranges,r=0,o=a.length;r<o;r++){var i=a[r];if(i.end.row>=D)break}if("insert"==e.action)for(var g=S-D,s=-n.column+t.column;r<o;r++){var i=a[r];if(i.start.row>D)break;if(i.start.row==D&&i.start.column>=n.column&&(i.start.column==n.column&&this.$bias<=0||(i.start.column+=s,i.start.row+=g)),i.end.row==D&&i.end.column>=n.column){if(i.end.column==n.column&&this.$bias<0)continue;i.end.column==n.column&&s>0&&r<o-1&&i.end.column>i.start.column&&i.end.column==a[r+1].start.column&&(i.end.column-=s),i.end.column+=s,i.end.row+=g}}else for(var g=D-S,s=n.column-t.column;r<o;r++){var i=a[r];if(i.start.row>S)break;i.end.row<S&&(D<i.end.row||D==i.end.row&&n.column<i.end.column)?(i.end.row=D,i.end.column=n.column):i.end.row==S?i.end.column<=t.column?(g||i.end.column>n.column)&&(i.end.column=n.column,i.end.row=n.row):(i.end.column+=s,i.end.row+=g):i.end.row>S&&(i.end.row+=g),i.start.row<S&&(D<i.start.row||D==i.start.row&&n.column<i.start.column)?(i.start.row=D,i.start.column=n.column):i.start.row==S?i.start.column<=t.column?(g||i.start.column>n.column)&&(i.start.column=n.column,i.start.row=n.row):(i.start.column+=s,i.start.row+=g):i.start.row>S&&(i.start.row+=g)}if(0!=g&&r<o)for(;r<o;r++){var i=a[r];i.start.row+=g,i.end.row+=g}},e}();S.prototype.comparePoints=D,n.RangeList=S}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,n,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}();function S(e,n){e.row-=n.row,0==e.row&&(e.column-=n.column)}function a(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,t){var D=e.call(this)||this;return D.foldLine=null,D.placeholder=t,D.range=n,D.start=n.start,D.end=n.end,D.sameRow=n.start.row==n.end.row,D.subFolds=D.ranges=[],D}return D(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)){a(e,this.start);for(var n=e.start.row,t=e.start.column,D=0,S=-1;D<this.subFolds.length&&1==(S=this.subFolds[D].range.compare(n,t));D++);var r=this.subFolds[D],o=0;if(0==S)if(r.range.containsRange(e))return r.addSubFold(e);else o=1;for(var n=e.range.end.row,t=e.range.end.column,i=D,S=-1;i<this.subFolds.length&&1==(S=this.subFolds[i].range.compare(n,t));i++);0==S&&i++;for(var g=this.subFolds.splice(D,i-D,e),s=0==S?g.length-1:g.length,l=o;l<s;l++)e.addSubFold(g[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,t){"use strict";var D=e("../range").Range,S=e("./fold_line").FoldLine,a=e("./fold").Fold,r=e("../token_iterator").TokenIterator,o=e("../mouse/mouse_event").MouseEvent;n.Folding=function(){this.getFoldAt=function(e,n,t){var D=this.getFoldLine(e);if(!D)return null;for(var S=D.folds,a=0;a<S.length;a++){var r=S[a].range;if(r.contains(e,n)){if(1==t&&r.isEnd(e,n)&&!r.isEmpty()||-1==t&&r.isStart(e,n)&&!r.isEmpty())continue;return S[a]}}},this.getFoldsInRange=function(e){var n=e.start,t=e.end,D=this.$foldData,S=[];n.column+=1,t.column-=1;for(var a=0;a<D.length;a++){var r=D[a].range.compareRange(e);if(2!=r){if(-2==r)break;for(var o=D[a].folds,i=0;i<o.length;i++){var g=o[i];if(-2==(r=g.range.compareRange(e)))break;if(2!=r){if(42==r)break;S.push(g)}}}}return n.column-=1,t.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,t=0;t<n.length;t++)for(var D=0;D<n[t].folds.length;D++)e.push(n[t].folds[D]);return e},this.getFoldStringAt=function(e,n,t,D){if(!(D=D||this.getFoldLine(e)))return null;for(var S,a,r={end:{column:0}},o=0;o<D.folds.length;o++){var i=(a=D.folds[o]).range.compareEnd(e,n);if(-1==i){S=this.getLine(a.start.row).substring(r.end.column,a.start.column);break}if(0===i)return null;r=a}return(S||(S=this.getLine(a.start.row).substring(r.end.column)),-1==t)?S.substring(0,n-r.end.column):1==t?S.substring(n-r.end.column):S},this.getFoldLine=function(e,n){var t=this.$foldData,D=0;for(n&&(D=t.indexOf(n)),-1==D&&(D=0);D<t.length;D++){var S=t[D];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 t=this.$foldData,D=0;for(n&&(D=t.indexOf(n)),-1==D&&(D=0);D<t.length;D++){var S=t[D];if(S.end.row>=e)return S}return null},this.getFoldedRowCount=function(e,n){for(var t=this.$foldData,D=n-e+1,S=0;S<t.length;S++){var a=t[S],r=a.end.row,o=a.start.row;if(r>=n){o<n&&(o>=e?D-=n-o:D=0);break}r>=e&&(o>=e?D-=r-o:D-=r-e+1)}return D},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 t,D=this.$foldData,r=!1;e instanceof a?t=e:(t=new a(n,e)).collapseChildren=n.collapseChildren,this.$clipRangeToDocument(t.range);var o=t.start.row,i=t.start.column,g=t.end.row,s=t.end.column,l=this.getFoldAt(o,i,1),d=this.getFoldAt(g,s,-1);if(l&&d==l)return l.addSubFold(t);l&&!l.range.isStart(o,i)&&this.removeFold(l),d&&!d.range.isEnd(g,s)&&this.removeFold(d);var c=this.getFoldsInRange(t.range);c.length>0&&(this.removeFolds(c),t.collapseChildren||c.forEach(function(e){t.addSubFold(e)}));for(var u=0;u<D.length;u++){var f=D[u];if(g==f.start.row){f.addFold(t),r=!0;break}if(o==f.end.row){if(f.addFold(t),r=!0,!t.sameRow){var h=D[u+1];h&&h.start.row==g&&f.merge(h)}break}if(g<=f.start.row)break}return r||(f=this.$addFoldLine(new S(this.$foldData,t))),this.$useWrapMode?this.$updateWrapData(f.start.row,f.start.row):this.$updateRowLengthCache(f.start.row,f.start.row),this.$modified=!0,this._signal("changeFold",{data:t,action:"add"}),t},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var n=e.foldLine,t=n.start.row,D=n.end.row,S=this.$foldData,a=n.folds;if(1==a.length)S.splice(S.indexOf(n),1);else if(n.range.isEnd(e.end.row,e.end.column))a.pop(),n.end.row=a[a.length-1].end.row,n.end.column=a[a.length-1].end.column;else if(n.range.isStart(e.start.row,e.start.column))a.shift(),n.start.row=a[0].start.row,n.start.column=a[0].start.column;else if(e.sameRow)a.splice(a.indexOf(e),1);else{var r=n.split(e.start.row,e.start.column);(a=r.folds).shift(),r.start.row=a[0].start.row,r.start.column=a[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(t,D):this.$updateRowLengthCache(t,D)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var n=[],t=0;t<e.length;t++)n.push(e[t]);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)t=new D(0,0,this.getLength(),0),null==n&&(n=!0);else if("number"==typeof e)t=new D(e,0,e,this.getLine(e).length);else if("row"in e)t=D.fromPoints(e,e);else{if(Array.isArray(e))return S=[],e.forEach(function(e){S=S.concat(this.unfold(e))},this),S;t=e}for(var t,S=this.getFoldsInRangeList(t),a=S;1==S.length&&0>D.comparePoints(S[0].start,t.start)&&D.comparePoints(S[0].end,t.end)>0;)this.expandFolds(S),S=this.getFoldsInRangeList(t);if(!1!=n?this.removeFolds(S):this.expandFolds(S),a.length)return a},this.isRowFolded=function(e,n){return!!this.getFoldLine(e,n)},this.getRowFoldEnd=function(e,n){var t=this.getFoldLine(e,n);return t?t.end.row:e},this.getRowFoldStart=function(e,n){var t=this.getFoldLine(e,n);return t?t.start.row:e},this.getFoldDisplayLine=function(e,n,t,D,S){null==D&&(D=e.start.row),null==S&&(S=0),null==n&&(n=e.end.row),null==t&&(t=this.getLine(n).length);var a=this.doc,r="";return e.walk(function(e,n,t,o){if(!(n<D)){if(n==D){if(t<S)return;o=Math.max(S,o)}null!=e?r+=e:r+=a.getLine(n).substring(o,t)}},n,t),r},this.getDisplayLine=function(e,n,t,D){var S,a=this.getFoldLine(e);return a?this.getFoldDisplayLine(a,e,n,t,D):(S=this.doc.getLine(e)).substring(D||0,n||S.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(n){var t=n.folds.map(function(e){return e.clone()});return new S(e,t)})},this.toggleFold=function(e){var n,t,D=this.selection.getRange();if(D.isEmpty()){var S=D.start;if(n=this.getFoldAt(S.row,S.column))return void this.expandFold(n);(t=this.findMatchingBracket(S))?1==D.comparePoint(t)?D.end=t:(D.start=t,D.start.column++,D.end.column--):(t=this.findMatchingBracket({row:S.row,column:S.column+1}))?(1==D.comparePoint(t)?D.end=t:D.start=t,D.start.column++):D=this.getCommentFoldRange(S.row,S.column)||D}else{var a=this.getFoldsInRange(D);if(e&&a.length)return void this.expandFolds(a);1==a.length&&(n=a[0])}if(n||(n=this.getFoldAt(D.start.row,D.start.column)),n&&n.range.toString()==D.toString())return void this.expandFold(n);var r="...";if(!D.isMultiLine()){if((r=this.getTextRange(D)).length<4)return;r=r.trim().substring(0,2)+".."}this.addFold(r,D)},this.getCommentFoldRange=function(e,n,t){var S=new r(this,e,n),a=S.getCurrentToken(),o=a&&a.type;if(a&&/^comment|string/.test(o)){"comment"==(o=o.match(/comment|string/)[0])&&(o+="|doc-start|\\.doc");var i=new RegExp(o),g=new D;if(1!=t){do a=S.stepBackward();while(a&&i.test(a.type));a=S.stepForward()}g.start.row=S.getCurrentTokenRow(),g.start.column=S.getCurrentTokenColumn()+a.value.length,S=new r(this,e,n);var s=this.getState(S.$row);if(-1!=t){var l=-1;do if(a=S.stepForward(),-1==l){var d=this.getState(S.$row);s.toString()!==d.toString()&&(l=S.$row)}else if(S.$row>l)break;while(a&&i.test(a.type));a=S.stepBackward()}else a=S.getCurrentToken();return g.end.row=S.getCurrentTokenRow(),g.end.column=S.getCurrentTokenColumn(),g}},this.foldAll=function(e,n,t,D){void 0==t&&(t=1e5);var S=this.foldWidgets;if(S){n=n||this.getLength(),e=e||0;for(var a=e;a<n;a++)if((null==S[a]&&(S[a]=this.getFoldWidget(a)),"start"==S[a])&&(!D||D(a))){var r=this.getFoldWidgetRange(a);r&&r.isMultiLine()&&r.end.row<=n&&r.start.row>=e&&(a=r.end.row,r.collapseChildren=t,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 t=e.getTokens(n),D=0;D<t.length;D++){var S=t[D];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 t=this.foldWidgets;if(!t||n&&t[e])return{};for(var D,S=e-1;S>=0;){var a=t[S];if(null==a&&(a=t[S]=this.getFoldWidget(S)),"start"==a){var r=this.getFoldWidgetRange(S);if(D||(D=r),r&&r.end.row>=e)break}S--}return{range:-1!==S&&r,firstRange:D}},this.onFoldWidgetClick=function(e,n){n instanceof o&&(n=n.domEvent);var t={children:n.shiftKey,all:n.ctrlKey||n.metaKey,siblings:n.altKey};if(!this.$toggleFoldWidget(e,t)){var D=n.target||n.srcElement;D&&/ace_fold-widget/.test(D.className)&&(D.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,n){if(this.getFoldWidget){var t=this.getFoldWidget(e),D=this.getLine(e),S="end"===t?-1:1,a=this.getFoldAt(e,-1===S?0:D.length,S);if(a)return n.children||n.all?this.removeFold(a):this.expandFold(a),a;var r=this.getFoldWidgetRange(e,!0);if(r&&!r.isMultiLine()&&(a=this.getFoldAt(r.start.row,r.start.column,1))&&r.isEqual(a.range))return this.removeFold(a),a;if(n.siblings){var o=this.getParentFoldRangeData(e);if(o.range)var i=o.range.start.row+1,g=o.range.end.row;this.foldAll(i,g,1e4*!!n.all)}else n.children?(g=r?r.end.row:this.getLength(),this.foldAll(e+1,g,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 t=this.$toggleFoldWidget(n,{});if(!t){var D=this.getParentFoldRangeData(n,!0);if(t=D.range||D.firstRange){n=t.start.row;var S=this.getFoldAt(n,this.getLine(n).length,1);S?this.removeFold(S):this.addFold("...",t)}}},this.updateFoldWidgets=function(e){var n=e.start.row,t=e.end.row-n;if(0===t)this.foldWidgets[n]=null;else if("remove"==e.action)this.foldWidgets.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,D)}},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,t){"use strict";var D=e("../token_iterator").TokenIterator,S=e("../range").Range;n.BracketMatch=function(){this.findMatchingBracket=function(e,n){if(0==e.column)return null;var t=n||this.getLine(e.row).charAt(e.column-1);if(""==t)return null;var D=t.match(/([\(\[\{])|([\)\]\}])/);return D?D[1]?this.$findClosingBracket(D[1],e):this.$findOpeningBracket(D[2],e):null},this.getBracketRange=function(e){var n,t=this.getLine(e.row),D=!0,a=t.charAt(e.column-1),r=a&&a.match(/([\(\[\{])|([\)\]\}])/);if(r||(a=t.charAt(e.column),e={row:e.row,column:e.column+1},r=a&&a.match(/([\(\[\{])|([\)\]\}])/),D=!1),!r)return null;if(r[1]){var o=this.$findClosingBracket(r[1],e);if(!o)return null;n=S.fromPoints(e,o),!D&&(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),!D&&(n.start.column++,n.end.column--),n.cursor=n.start}return n},this.getMatchingBracketRanges=function(e,n){var t=this.getLine(e.row),D=/([\(\[\{])|([\)\]\}])/,a=!n&&t.charAt(e.column-1),r=a&&a.match(D);if(r||(a=(void 0===n||n)&&t.charAt(e.column),e={row:e.row,column:e.column+1},r=a&&a.match(D)),!r)return null;var o=new S(e.row,e.column-1,e.row,e.column),i=r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e);return i?[o,new S(i.row,i.column,i.row,i.column+1)]:[o]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,n,t){var S=this.$brackets[e],a=1,r=new D(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){t||(t=RegExp("(\\.?"+o.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var i=n.column-r.getCurrentTokenColumn()-2,g=o.value;;){for(;i>=0;){var s=g.charAt(i);if(s==S){if(0==(a-=1))return{row:r.getCurrentTokenRow(),column:i+r.getCurrentTokenColumn()}}else s==e&&(a+=1);i-=1}do o=r.stepBackward();while(o&&!t.test(o.type));if(null==o)break;i=(g=o.value).length-1}return null}},this.$findClosingBracket=function(e,n,t){var S=this.$brackets[e],a=1,r=new D(this,n.row,n.column),o=r.getCurrentToken();if(o||(o=r.stepForward()),o){t||(t=RegExp("(\\.?"+o.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var i=n.column-r.getCurrentTokenColumn();;){for(var g=o.value,s=g.length;i<s;){var l=g.charAt(i);if(l==S){if(0==(a-=1))return{row:r.getCurrentTokenRow(),column:i+r.getCurrentTokenColumn()}}else l==e&&(a+=1);i+=1}do o=r.stepForward();while(o&&!t.test(o.type));if(null==o)break;i=0}return null}},this.getMatchingTags=function(e){var n=new D(this,e.row,e.column),t=this.$findTagName(n);if(t){var S=n.stepBackward();return"<"===S.value?this.$findClosingTag(n,t):this.$findOpeningTag(n,t)}},this.$findTagName=function(e){var n=e.getCurrentToken(),t=!1,D=!1;if(n&&-1===n.type.indexOf("tag-name"))do(n=D?e.stepBackward():e.stepForward())&&("/>"===n.value?D=!0:-1!==n.type.indexOf("tag-name")&&(t=!0));while(n&&!t);return n},this.$findClosingTag=function(e,n){var t,D=n.value,a=n.value,r=0,o=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);n=e.stepForward();var i=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+n.value.length),g=!1;do{if(-1!==(t=n).type.indexOf("tag-close")&&!g){var s=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);g=!0}if(n=e.stepForward()){if(">"===n.value&&!g){var s=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);g=!0}if(-1!==n.type.indexOf("tag-name")){if(a===(D=n.value)){if("<"===t.value)r++;else if("</"===t.value&&--r<0){e.stepBackward();var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);n=e.stepForward();var d=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 c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(a===D&&"/>"===n.value&&--r<0)var l=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),d=l,c=d,s=new S(i.end.row,i.end.column,i.end.row,i.end.column+1)}}while(n&&r>=0);if(o&&s&&l&&c&&i&&d)return{openTag:new S(o.start.row,o.start.column,s.end.row,s.end.column),closeTag:new S(l.start.row,l.start.column,c.end.row,c.end.column),openTagName:i,closeTagName:d}},this.$findOpeningTag=function(e,n){var t=e.getCurrentToken(),D=n.value,a=0,r=e.getCurrentTokenRow(),o=e.getCurrentTokenColumn(),i=o+2,g=new S(r,o,r,i);e.stepForward();var s=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=t,r=e.getCurrentTokenRow(),i=(o=e.getCurrentTokenColumn())+n.value.length,t=e.stepBackward(),n){if(-1!==n.type.indexOf("tag-name")){if(D===n.value)if("<"===t.value){if(++a>0){var d=new S(r,o,r,i),c=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do n=e.stepForward();while(n&&">"!==n.value);var u=new S(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===t.value&&a--}else if("/>"===n.value){for(var f=0,h=t;h;){if(-1!==h.type.indexOf("tag-name")&&h.value===D){a--;break}if("<"===h.value)break;h=e.stepBackward(),f++}for(var p=0;p<f;p++)e.stepForward()}}while(t&&a<=0);if(c&&u&&g&&l&&d&&s)return{openTag:new S(c.start.row,c.start.column,u.end.row,u.end.column),closeTag:new S(g.start.row,g.start.column,l.end.row,l.end.column),openTagName:d,closeTagName:s}}}}}),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/lang"),a=e("./bidihandler").BidiHandler,r=e("./config"),o=e("./lib/event_emitter").EventEmitter,i=e("./selection").Selection,g=e("./mode/text").Mode,s=e("./range").Range,l=e("./document").Document,d=e("./background_tokenizer").BackgroundTokenizer,c=e("./search_highlight").SearchHighlight,u=e("./undomanager").UndoManager,f=function(){function e(n,t){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 d(new g().getTokenizer(),this);var D=this;this.bgTokenizer.on("update",function(e){D._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 i(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new a(this),r.resetOptions(this),this.setMode(t),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,t=this.$getRowCacheIndex(this.$docRowCache,e)+1;n>t&&(this.$docRowCache.splice(t,n),this.$screenRowCache.splice(t,n))},e.prototype.$getRowCacheIndex=function(e,n){for(var t=0,D=e.length-1;t<=D;){var S=t+D>>1,a=e[S];if(n>a)t=S+1;else{if(!(n<a))return S;D=S-1}}return t-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 t=new u;t.$undoStack=n.history.undo,t.$redoStack=n.history.redo,t.mark=n.history.mark,t.$rev=n.history.rev;var D=new e(n.value);return n.folds.forEach(function(e){D.addFold("...",s.fromPoints(e.start,e.end))}),D.setAnnotations(n.annotations),D.setBreakpoints(n.breakpoints),D.setMode(n.mode),D.setScrollLeft(n.scrollLeft),D.setScrollTop(n.scrollTop),D.setUndoManager(t),D.selection.fromJSON(n.selection),D},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 t,D=this.bgTokenizer.getTokens(e),S=0;if(null==n){var a=D.length-1;S=this.getLine(e).length}else for(var a=0;a<D.length&&!((S+=D[a].value.length)>=n);a++);return(t=D[a])?(t.index=a,t.start=S-t.value.length,t):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,t,D){var S=this.$markerId++,a={range:e,type:t||"line",renderer:"function"==typeof t?t:null,clazz:n,inFront:!!D,id:S};return D?(this.$frontMarkers[S]=a,this._signal("changeFrontMarker")):(this.$backMarkers[S]=a,this._signal("changeBackMarker")),S},e.prototype.addDynamicMarker=function(e,n){if(e.update){var t=this.$markerId++;return e.id=t,e.inFront=!!n,n?(this.$frontMarkers[t]=e,this._signal("changeFrontMarker")):(this.$backMarkers[t]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var n=this.$frontMarkers[e]||this.$backMarkers[e];if(n){var t=n.inFront?this.$frontMarkers:this.$backMarkers;delete t[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 c(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(n)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,n,t,D){"number"!=typeof n&&(t=n,n=e),t||(t="ace_step");var S=new s(e,0,n,1/0);return S.id=this.addMarker(S,t,"fullLine",D),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 t=this.getLine(e),D=!1;if(n>0&&(D=!!t.charAt(n-1).match(this.tokenRe)),D||(D=!!t.charAt(n).match(this.tokenRe)),D)var S=this.tokenRe;else if(/^\s+$/.test(t.slice(n-1,n+1)))var S=/\s/;else var S=this.nonTokenRe;var a=n;if(a>0){do a--;while(a>=0&&t.charAt(a).match(S));a++}for(var r=n;r<t.length&&t.charAt(r).match(S);)r++;return new s(e,a,e,r)},e.prototype.getAWordRange=function(e,n){for(var t=this.getWordRange(e,n),D=this.getLine(t.end.row);D.charAt(t.end.column).match(/[ \t]/);)t.end.column+=1;return t},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 t=e,D=t.path}else D=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new g),this.$modes[D]&&!t){this.$onChangeMode(this.$modes[D]),n&&n();return}this.$modeId=D,r.loadModule(["mode",D],(function(e){if(this.$modeId!==D)return n&&n();this.$modes[D]&&!t?this.$onChangeMode(this.$modes[D]):e&&e.Mode&&(e=new e.Mode(t),t||(this.$modes[D]=e,e.$id=D),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 t=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var D=e.getTokenizer();if(void 0!==D.on){var S=this.onReloadTokenizer.bind(this);D.on("update",S)}this.bgTokenizer.setTokenizer(D),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:t,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(),t=this.$rowLengthCache,D=0,S=0,a=this.$foldData[S],r=a?a.start.row:1/0,o=n.length,i=0;i<o;i++){if(i>r){if((i=a.end.row+1)>=o)break;r=(a=this.$foldData[S++])?a.start.row:1/0}null==t[i]&&(t[i]=this.$getStringScreenWidth(n[i])[0]),t[i]>D&&(D=t[i])}this.screenWidth=D}},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 t=e.length-1;-1!=t;t--){var D=e[t];"insert"==D.action||"remove"==D.action?this.doc.revertDelta(D):D.folds&&this.addFolds(D.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 t=0;t<e.length;t++){var D=e[t];("insert"==D.action||"remove"==D.action)&&this.doc.$safeApplyDelta(D)}!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 t(e){return n?"insert"!==e.action:"insert"===e.action}for(var D,S,a=0;a<e.length;a++){var r=e[a];if(r.start){if(!D){D=t(r)?s.fromPoints(r.start,r.end):s.fromPoints(r.start,r.start);continue}t(r)?(S=r.start,-1==D.compare(S.row,S.column)&&D.setStart(S),S=r.end,1==D.compare(S.row,S.column)&&D.setEnd(S)):(S=r.start,-1==D.compare(S.row,S.column)&&(D=s.fromPoints(r.start,r.start)))}}return D},e.prototype.replace=function(e,n){return this.doc.replace(e,n)},e.prototype.moveText=function(e,n,t){var D=this.getTextRange(e),S=this.getFoldsInRange(e),a=s.fromPoints(n,n);if(!t){this.remove(e);var r=e.start.row-e.end.row,o=r?-e.end.column:e.start.column-e.end.column;o&&(a.start.row==e.end.row&&a.start.column>e.end.column&&(a.start.column+=o),a.end.row==e.end.row&&a.end.column>e.end.column&&(a.end.column+=o)),r&&a.start.row>=e.end.row&&(a.start.row+=r,a.end.row+=r)}if(a.end=this.insert(a.start,D),S.length){var i=e.start,g=a.start,r=g.row-i.row,o=g.column-i.column;this.addFolds(S.map(function(e){return(e=e.clone()).start.row==i.row&&(e.start.column+=o),e.end.row==i.row&&(e.end.column+=o),e.start.row+=r,e.end.row+=r,e}))}return a},e.prototype.indentRows=function(e,n,t){t=t.replace(/\t/g,this.getTabString());for(var D=e;D<=n;D++)this.doc.insertInLine({row:D,column:0},t)},e.prototype.outdentRows=function(e){for(var n=e.collapseRows(),t=new s(0,0,0,0),D=this.getTabSize(),S=n.start.row;S<=n.end.row;++S){var a=this.getLine(S);t.start.row=S,t.end.row=S;for(var r=0;r<D&&" "==a.charAt(r);++r);r<D&&" "==a.charAt(r)?(t.start.column=r,t.end.column=r+1):(t.start.column=0,t.end.column=r),this.remove(t)}},e.prototype.$moveLines=function(e,n,t){if(e=this.getRowFoldStart(e),n=this.getRowFoldEnd(n),t<0){var D=this.getRowFoldStart(e+t);if(D<0)return 0;var S=D-e}else if(t>0){var D=this.getRowFoldEnd(n+t);if(D>this.doc.getLength()-1)return 0;var S=D-n}else{e=this.$clipRowToDocument(e);var S=(n=this.$clipRowToDocument(n))-e+1}var a=new s(e,0,n,Number.MAX_VALUE),r=this.getFoldsInRange(a).map(function(e){return e=e.clone(),e.start.row+=S,e.end.row+=S,e}),o=0==t?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 t=this.doc.getLength();e>=t?(e=t-1,n=this.doc.getLine(t-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 t=this.$wrapLimitRange;t.max<0&&(t={min:n,max:n});var D=this.$constrainWrapLimit(e,t.min,t.max);return D!=this.$wrapLimit&&D>1&&(this.$wrapLimit=D,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,n,t){return n&&(e=Math.max(n,e)),t&&(e=Math.min(t,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,t=e.action,D=e.start,S=e.end,a=D.row,r=S.row,o=r-a,i=null;if(this.$updating=!0,0!=o)if("remove"===t){this[n?"$wrapData":"$rowLengthCache"].splice(a,o);var g=this.$foldData;i=this.getFoldsInRange(e),this.removeFolds(i);var s=this.getFoldLine(S.row),l=0;if(s){s.addRemoveChars(S.row,S.column,D.column-S.column),s.shiftRow(-o);var d=this.getFoldLine(a);d&&d!==s&&(d.merge(s),s=d),l=g.indexOf(s)+1}for(;l<g.length;l++){var s=g[l];s.start.row>=S.row&&s.shiftRow(-o)}r=a}else{var c=Array(o);c.unshift(a,0);var u=n?this.$wrapData:this.$rowLengthCache;u.splice.apply(u,c);var g=this.$foldData,s=this.getFoldLine(a),l=0;if(s){var f=s.range.compareInside(D.row,D.column);0==f?(s=s.split(D.row,D.column))&&(s.shiftRow(o),s.addRemoveChars(r,0,S.column-D.column)):-1==f&&(s.addRemoveChars(a,0,S.column-D.column),s.shiftRow(o)),l=g.indexOf(s)+1}for(;l<g.length;l++){var s=g[l];s.start.row>=a&&s.shiftRow(o)}}else{o=Math.abs(e.start.column-e.end.column),"remove"===t&&(i=this.getFoldsInRange(e),this.removeFolds(i),o=-o);var s=this.getFoldLine(a);s&&s.addRemoveChars(a,D.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(a,r):this.$updateRowLengthCache(a,r),i},e.prototype.$updateRowLengthCache=function(e,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[n]=null},e.prototype.$updateWrapData=function(e,n){var t,D,S=this.doc.getAllLines(),a=this.getTabSize(),r=this.$wrapData,o=this.$wrapLimit,i=e;for(n=Math.min(n,S.length-1);i<=n;)(D=this.getFoldLine(i,D))?(t=[],D.walk((function(e,n,D,a){var r;if(null!=e){(r=this.$getDisplayTokens(e,t.length))[0]=m;for(var o=1;o<r.length;o++)r[o]=y}else r=this.$getDisplayTokens(S[n].substring(a,D),t.length);t=t.concat(r)}).bind(this),D.end.row,S[D.end.row].length+1),r[D.start.row]=this.$computeWrapSplits(t,o,a),i=D.end.row+1):(t=this.$getDisplayTokens(S[i]),r[i]=this.$computeWrapSplits(t,o,a),i++)},e.prototype.$computeWrapSplits=function(e,n,t){if(0==e.length)return[];var D=[],S=e.length,a=0,r=0,o=this.$wrapAsCode,i=this.$indentedSoftWrap,g=n<=Math.max(2*t,8)||!1===i?0:Math.floor(n/2);function s(){var n=0;if(0===g)return n;if(i)for(var D=0;D<e.length;D++){var S=e[D];if(S==v)n+=1;else if(S==$)n+=t;else if(S==w)continue;else break}return o&&!1!==i&&(n+=t),Math.min(n,g)}function l(n){for(var t=n-a,S=a;S<n;S++){var o=e[S];(12===o||2===o)&&(t-=1)}D.length||(D.indent=d=s()),r+=t,D.push(r),a=n}for(var d=0;S-a>n-d;){var c=a+n-d;if(e[c-1]>=v&&e[c]>=v){l(c);continue}if(e[c]==m||e[c]==y){for(;c!=a-1&&e[c]!=m;c--);if(c>a){l(c);continue}for(c=a+n;c<e.length&&e[c]==y;c++);if(c==e.length)break;l(c);continue}for(var u=Math.max(c-(n-(n>>2)),a-1);c>u&&e[c]<m;)c--;if(o){for(;c>u&&e[c]<m;)c--;for(;c>u&&e[c]==b;)c--}else for(;c>u&&e[c]<v;)c--;if(c>u){l(++c);continue}e[c=a+n]==p&&c--,l(c-d)}return D},e.prototype.$getDisplayTokens=function(e,n){var t,D=[];n=n||0;for(var S=0;S<e.length;S++){var a=e.charCodeAt(S);if(9==a){t=this.getScreenTabSize(D.length+n),D.push($);for(var r=1;r<t;r++)D.push(w)}else 32==a?D.push(v):a>39&&a<48||a>57&&a<64?D.push(b):a>=4352&&_(a)?D.push(h,p):D.push(h)}return D},e.prototype.$getStringScreenWidth=function(e,n,t){var D,S;if(0==n)return[0,0];for(null==n&&(n=1/0),t=t||0,S=0;S<e.length&&(9==(D=e.charCodeAt(S))?t+=this.getScreenTabSize(t):D>=4352&&_(D)?t+=2:t+=1,!(t>n));S++);return[t,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),t=this.$wrapData[n.row];return t.length&&t[0]<n.column?t.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 t=this.documentToScreenRow(e,n);return this.getScreenLastRowColumn(t)},e.prototype.getDocumentLastRowColumnPosition=function(e,n){var t=this.documentToScreenRow(e,n);return this.screenToDocumentPosition(t,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,t){if(e<0)return{row:0,column:0};var D,S,a=0,r=0,o=0,i=0,g=this.$screenRowCache,s=this.$getRowCacheIndex(g,e),l=g.length;if(l&&s>=0)var o=g[s],a=this.$docRowCache[s],d=e>g[l-1];else var d=!l;for(var c=this.getLength()-1,u=this.getNextFoldLine(a),f=u?u.start.row:1/0;o<=e&&!(o+(i=this.getRowLength(a))>e)&&!(a>=c);)o+=i,++a>f&&(a=u.end.row+1,f=(u=this.getNextFoldLine(a,u))?u.start.row:1/0),d&&(this.$docRowCache.push(a),this.$screenRowCache.push(o));if(u&&u.start.row<=a)D=this.getFoldDisplayLine(u),a=u.start.row;else{if(o+i<=e||a>c)return{row:c,column:this.getLine(c).length};D=this.getLine(a),u=null}var h=0,p=Math.floor(e-o);if(this.$useWrapMode){var m=this.$wrapData[a];m&&(S=m[p],p>0&&m.length&&(h=m.indent,r=m[p-1]||m[m.length-1],D=D.substring(r)))}return(void 0!==t&&this.$bidiHandler.isBidiRow(o+p,a,p)&&(n=this.$bidiHandler.offsetToCol(t)),r+=this.$getStringScreenWidth(D,n-h)[1],this.$useWrapMode&&r>=S&&(r=S-1),u)?u.idxToPosition(r):{row:a,column:r}},e.prototype.documentToScreenPosition=function(e,n){if(void 0===n)var t=this.$clipPositionToDocument(e.row,e.column);else t=this.$clipPositionToDocument(e,n);e=t.row,n=t.column;var D=0,S=null,a=null;(a=this.getFoldAt(e,n,1))&&(e=a.start.row,n=a.start.column);var r,o=0,i=this.$docRowCache,g=this.$getRowCacheIndex(i,e),s=i.length;if(s&&g>=0)var o=i[g],D=this.$screenRowCache[g],l=e>i[s-1];else var l=!s;for(var d=this.getNextFoldLine(o),c=d?d.start.row:1/0;o<e;){if(o>=c){if((r=d.end.row+1)>e)break;c=(d=this.getNextFoldLine(r,d))?d.start.row:1/0}else r=o+1;D+=this.getRowLength(o),o=r,l&&(this.$docRowCache.push(o),this.$screenRowCache.push(D))}var u="";d&&o>=c?(u=this.getFoldDisplayLine(d,e,n),S=d.start.row):(u=this.getLine(e).substring(0,n),S=e);var f=0;if(this.$useWrapMode){var h=this.$wrapData[S];if(h){for(var p=0;u.length>=h[p];)D++,p++;u=u.substring(h[p-1]||0,u.length),f=p>0?h.indent:0}}return this.lineWidgets&&this.lineWidgets[o]&&this.lineWidgets[o].rowsAbove&&(D+=this.lineWidgets[o].rowsAbove),{row:D,column:f+this.$getStringScreenWidth(u)[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 t=this.$wrapData.length,D=0,S=0,n=this.$foldData[S++],a=n?n.start.row:1/0;D<t;){var r=this.$wrapData[D];e+=r?r.length+1:1,++D>a&&(D=n.end.row+1,a=(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,t,D){var S,a;if(0===t)return[0,0];for(t||(t=1/0),D=D||0,a=0;a<n.length&&(" "===(S=n.charAt(a))?D+=this.getScreenTabSize(D):D+=e.getCharacterWidth(S),!(D>t));a++);return[D,a]})},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}();f.$uid=0,f.prototype.$modes=r.$modes,f.prototype.getValue=f.prototype.toString,f.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},f.prototype.$overwrite=!1,f.prototype.$mode=null,f.prototype.$modeId=null,f.prototype.$scrollTop=0,f.prototype.$scrollLeft=0,f.prototype.$wrapLimit=80,f.prototype.$useWrapMode=!1,f.prototype.$wrapLimitRange={min:null,max:null},f.prototype.lineWidgets=null,f.prototype.isFullWidth=_,D.implement(f.prototype,o);var h=1,p=2,m=3,y=4,b=9,v=10,$=11,w=12;function _(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(f.prototype),e("./edit_session/bracket_match").BracketMatch.call(f.prototype),r.defineOptions(f.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=f}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,n,t){"use strict";var D=e("./lib/lang"),S=e("./lib/oop"),a=e("./range").Range;function r(e,n){var t=D.supportsLookbehind();function S(e,D){if(void 0===D&&(D=!0),(t&&n.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||n.regExp)return t&&n.$supportsUnicodeFlag?D?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var a=Array.from(e),r=a[0],o=a[a.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 D.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var n=this.$options,t=this.$matchIterator(e,n);if(!t)return!1;var D=null;return t.forEach(function(e,t,S,r){return D=new a(e,t,S,r),!(t==r&&n.start&&n.start.start&&!1!=n.skipCurrent&&D.isEqual(n.start))||(D=null,!1)}),D},e.prototype.findAll=function(e){var n=this.$options;if(!n.needle)return[];this.$assembleRegExp(n);var t=n.range,S=t?e.getLines(t.start.row,t.end.row):e.doc.getAllLines(),r=[],o=n.re;if(n.$isMultiLine){var i,g=o.length,s=S.length-g;e:for(var l=o.offset||0;l<=s;l++){for(var d=0;d<g;d++)if(-1==S[l+d].search(o[d]))continue e;var c=S[l],u=S[l+g-1],f=c.length-c.match(o[0])[0].length,h=u.match(o[g-1])[0].length;i&&i.end.row===l&&i.end.column>f||(r.push(i=new a(l,f,l+g-1,h)),g>2&&(l=l+g-2))}}else for(var p=0;p<S.length;p++)for(var m=D.getMatchOffsets(S[p],o),d=0;d<m.length;d++){var y=m[d];r.push(new a(p,y.offset,p,y.offset+y.length))}if(t){for(var b=t.start.column,v=t.end.column,p=0,d=r.length-1;p<d&&r[p].start.column<b&&0==r[p].start.row;)p++;for(var $=t.end.row-t.start.row;p<d&&r[d].end.column>v&&r[d].end.row==$;)d--;for(r=r.slice(p,d+1),p=0,d=r.length;p<d;p++)r[p].start.row+=t.start.row,r[p].end.row+=t.start.row}return r},e.prototype.replace=function(e,n){var t=this.$options,D=this.$assembleRegExp(t);if(t.$isMultiLine)return n;if(D){var S=D.exec(e);if(!S||S[0].length!=e.length)return null;if(t.regExp||(n=n.replace(/\$/g,"$$$$")),n=e.replace(D,n),t.preserveCase){n=n.split("");for(var a=Math.min(e.length,e.length);a--;){var r=e[a];r&&r.toLowerCase()!=r?n[a]=n[a].toUpperCase():n[a]=n[a].toLowerCase()}n=n.join("")}return n}},e.prototype.$assembleRegExp=function(e,n){if(e.needle instanceof RegExp)return e.re=e.needle;var t=e.needle;if(!e.needle)return e.re=!1;e.regExp||(t=D.escapeRegExp(t));var S=e.caseSensitive?"gm":"gmi";try{RegExp(t,"u"),e.$supportsUnicodeFlag=!0,S+="u"}catch(n){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(t=r(t,e)),e.$isMultiLine=!n&&/[\n\r]/.test(t),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(t,S);try{var a=new RegExp(t,S)}catch(e){a=!1}return e.re=a},e.prototype.$assembleMultilineRegExp=function(e,n){for(var t=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),D=[],S=0;S<t.length;S++)try{D.push(new RegExp(t[S],n))}catch(e){return!1}return D},e.prototype.$matchIterator=function(e,n){var t=this.$assembleRegExp(n);if(!t)return!1;var S=!0==n.backwards,a=!1!=n.skipCurrent,r=t.unicode,o=n.range,i=n.start;i||(i=o?o[S?"end":"start"]:e.selection.getRange()),i.start&&(i=i[a!=S?"end":"start"]);var g=o?o.start.row:0,s=o?o.end.row:e.getLength()-1;if(S)var l=function(e){var t=i.row;if(!c(t,i.column,e)){for(t--;t>=g;t--)if(c(t,Number.MAX_VALUE,e))return;if(!1!=n.wrap){for(t=s,g=i.row;t>=g;t--)if(c(t,Number.MAX_VALUE,e))return}}};else var l=function(e){var t=i.row;if(!c(t,i.column,e)){for(t+=1;t<=s;t++)if(c(t,0,e))return;if(!1!=n.wrap){for(t=g,s=i.row;t<=s;t++)if(c(t,0,e))return}}};if(n.$isMultiLine)var d=t.length,c=function(n,D,a){var r=S?n-d+1:n;if(!(r<0||r+d>e.getLength())){var o=e.getLine(r),i=o.search(t[0]);if((S||!(i<D))&&-1!==i){for(var g=1;g<d;g++)if(-1==(o=e.getLine(r+g)).search(t[g]))return;var s=o.match(t[d-1])[0].length;if((!S||!(s>D))&&a(r,i,r+d-1,s))return!0}}};else if(S)var c=function(n,S,a){var o,i=e.getLine(n),g=[],s=0;for(t.lastIndex=0;o=t.exec(i);){var l=o[0].length;if(s=o.index,!l){if(s>=i.length)break;t.lastIndex=s+=D.skipEmptyMatch(i,s,r)}if(o.index+l>S)break;g.push(o.index,l)}for(var d=g.length-1;d>=0;d-=2){var c=g[d-1],l=g[d];if(a(n,c,n,c+l))return!0}};else var c=function(n,S,a){var o,i,g=e.getLine(n);for(t.lastIndex=S;i=t.exec(g);){var s=i[0].length;if(a(n,o=i.index,n,o+s))return!0;if(!s&&(t.lastIndex=o+=D.skipEmptyMatch(g,o,r),o>=g.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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("../lib/keys"),a=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,t){this.platform=n||(a.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=t},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 t=e&&("string"==typeof e?e:e.name);e=this.commands[t],n||delete this.commands[t];var D=this.commandKeyBinding;for(var S in D){var a=D[S];if(a==e)delete D[S];else if(Array.isArray(a)){var r=a.indexOf(e);-1!=r&&(a.splice(r,1),1==a.length&&(D[S]=a[0]))}}},e.prototype.bindKey=function(e,n,t){if("object"==typeof e&&e&&(void 0==t&&(t=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 D="";if(-1!=e.indexOf(" ")){var S=e.split(/\s+/);e=S.pop(),S.forEach(function(e){var n=this.parseKeys(e),t=r[n.hashId]+n.key;D+=(D?" ":"")+t,this._addCommandToBinding(D,"chainKeys")},this),D+=" "}var a=this.parseKeys(e),o=r[a.hashId]+a.key;this._addCommandToBinding(D+o,n,t)},this)}},e.prototype._addCommandToBinding=function(e,n,t){var D,S=this.commandKeyBinding;if(n)if(!S[e]||this.$singleCommand)S[e]=n;else{Array.isArray(S[e])?-1!=(D=S[e].indexOf(n))&&S[e].splice(D,1):S[e]=[S[e]],"number"!=typeof t&&(t=i(n));var a=S[e];for(D=0;D<a.length&&!(i(a[D])>t);D++);a.splice(D,0,n)}else delete S[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(n){var t=e[n];if(t){if("string"==typeof t)return this.bindKey(t,n);"function"==typeof t&&(t={exec:t}),"object"==typeof t&&(t.name||(t.name=n),this.addCommand(t))}},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}),t=n.pop(),D=S[t];if(S.FUNCTION_KEYS[D])t=S.FUNCTION_KEYS[D].toLowerCase();else if(!n.length)return{key:t,hashId:-1};else if(1==n.length&&"shift"==n[0])return{key:t.toUpperCase(),hashId:-1};for(var a=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;a|=o}return{key:t,hashId:a}},e.prototype.findKeyCommand=function(e,n){var t=r[e]+n;return this.commandKeyBinding[t]},e.prototype.handleKeyboard=function(e,n,t,D){if(!(D<0)){var S=r[n]+t,a=this.commandKeyBinding[S];return(e.$keyChain&&(e.$keyChain+=" "+S,a=this.commandKeyBinding[e.$keyChain]||a),a&&("chainKeys"==a||"chainKeys"==a[a.length-1]))?(e.$keyChain=e.$keyChain||S,{command:"null"}):(e.$keyChain&&(n&&4!=n||1!=t.length?(-1==n||D>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-S.length-1)),{command:a})}},e.prototype.getStatusText=function(e,n){return n.$keyChain||""},e}();function i(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var g=function(e){function n(n,t){var D=e.call(this,n,t)||this;return D.$singleCommand=!0,D}return D(n,e),n}(o);g.call=function(e,n,t){o.prototype.$init.call(e,n,t,!0)},o.call=function(e,n,t){o.prototype.$init.call(e,n,t,!1)},n.HashHandler=g,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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("../lib/oop"),a=e("../keyboard/hash_handler").MultiHashHandler,r=e("../lib/event_emitter").EventEmitter,o=function(e){function n(n,t){var D=e.call(this,t,n)||this;return D.byName=D.commands,D.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)}),D}return D(n,e),n.prototype.exec=function(e,n,t){if(Array.isArray(e)){for(var D=e.length;D--;)if(this.exec(e[D],n,t))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:t};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}(a);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,t){"use strict";var D=e("../lib/lang"),S=e("../config"),a=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(D.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(),t=n?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),S=n?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),r=e.session.doc.getLine(t.row).length,o=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,i=e.session.doc.getLine(t.row),g=t.row+1;g<=S.row+1;g++){var s=D.stringTrimLeft(D.stringTrimRight(e.session.doc.getLine(g)));0!==s.length&&(s=" "+s),i+=s}S.row+1<e.session.doc.getLength()-1&&(i+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new a(t.row,0,S.row+2,0),i),o>0?(e.selection.moveCursorTo(t.row,t.column),e.selection.selectTo(t.row,t.column+o)):(r=e.session.doc.getLine(t.row).length>r?r+1:r,e.selection.moveCursorTo(t.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,t=e.session.doc.getLine(n).length,D=e.selection.rangeList.ranges,S=[];D.length<1&&(D=[e.selection.getRange()]);for(var r=0;r<D.length;r++)r==D.length-1&&(D[r].end.row!==n||D[r].end.column!==t)&&S.push(new a(D[r].end.row,D[r].end.column,n,t)),0===r?(0!==D[r].start.row||0!==D[r].start.column)&&S.push(new a(0,0,D[r].start.row,D[r].start.column)):S.push(new a(D[r-1].end.row,D[r-1].end.column,D[r].start.row,D[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,t){"use strict";var D=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 t=this.session.lineWidgets;t&&t.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 t=n.lineWidgets;if(t&&e.action){for(var D=e.data,S=D.start.row,a=D.end.row,r="add"==e.action,o=S+1;o<a;o++)t[o]&&(t[o].hidden=r);t[a]&&(r?t[S]?t[a].hidden=r:t[S]=t[a]:(t[S]==t[a]&&(t[S]=void 0),t[a].hidden=r))}},e.prototype.updateOnChange=function(e){var n=this.session.lineWidgets;if(n){var t=e.start.row,D=e.end.row-t;if(0===D);else if("remove"==e.action){var S=n.splice(t+1,D);!n[t]&&S[S.length-1]&&(n[t]=S.pop()),S.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var a=Array(D);n[t]&&null!=n[t].column&&e.start.column>n[t].column&&t++,a.unshift(t,0),n.splice.apply(n,a),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var n=!0;e.forEach(function(e,t){if(e)for(n=!1,e.row=t;e.$oldWidget;)e.$oldWidget.row=t,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=D.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=D.createElement("div"),e.el.textContent=e.text),e.el&&(D.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&D.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 t=this.session.getFoldAt(e.row,0);if(e.$fold=t,t){var S=this.session.lineWidgets;e.row!=t.end.row||S[t.start.row]?e.hidden=!0:S[t.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,t=n&&n[e],D=[];t;)D.push(t),t=t.$oldWidget;return D},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,n){var t=this.session._changedWidgets,D=n.layerConfig;if(t&&t.length){for(var S=1/0,a=0;a<t.length;a++){var r=t[a];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/D.characterWidth));var o=r.h/D.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 t=n.layerConfig,D=this.session.lineWidgets;if(D){for(var S=Math.min(this.firstRow,t.firstRow),a=Math.max(this.lastRow,t.lastRow,D.length);S>0&&!D[S];)S--;this.firstRow=t.firstRow,this.lastRow=t.lastRow,n.$cursorLayer.config=t;for(var r=S;r<=a;r++){var o=D[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 i=n.$cursorLayer.getPixelPosition({row:r,column:0},!0).top;o.coverLine||(i+=t.lineHeight*this.session.getRowLineCount(o.row)),o.el.style.top=i-t.offset+"px";var g=o.coverGutter?0:n.gutterWidth;o.fixedWidth||(g-=n.scrollLeft),o.el.style.left=g+"px",o.fullWidth&&o.screenWidth&&(o.el.style.minWidth=t.width+2*t.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,t){"use strict";var D=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===D.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=D.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),t=this.$findNearestAnnotation(e);if(null!==n||null!==t){if(null===n&&null!==t){this.activeRowIndex=t,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==n&&null===t){this.activeRowIndex=n,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(t-e)<Math.abs(n-e)){this.activeRowIndex=t,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 a(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===D.tab)return void e.preventDefault();if(e.keyCode===D.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===D.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===D.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===D.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===D.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===D.enter||e.keyCode===D.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 t=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),S=this.annotationTooltip.getElement().style;S.left=t.right+"px",S.top=t.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)),t="none"!==this.$getFoldWidget(e).style.display;return n&&t},e.prototype.$isAnnotationVisible=function(e){var n=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),t="none"!==this.$getAnnotation(e).style.display;return n&&t},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 t=this.$findNearestFoldWidget(this.activeRowIndex);if(null==t)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=t,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 a=function(){function e(e,n){this.gutterKeyboardHandler=n,this.domEvent=e}return e.prototype.getKey=function(){return D.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=a}),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,t){"use strict";var D=this&&this.__values||function(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],D=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&D>=e.length&&(e=void 0),{value:e&&e[D++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/lang"),o=e("./lib/useragent"),i=e("./keyboard/textinput").TextInput,g=e("./mouse/mouse_handler").MouseHandler,s=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,d=e("./edit_session").EditSession,c=e("./search").Search,u=e("./range").Range,f=e("./lib/event_emitter").EventEmitter,h=e("./commands/command_manager").CommandManager,p=e("./commands/default_commands").commands,m=e("./config"),y=e("./token_iterator").TokenIterator,b=e("./line_widgets").LineWidgets,v=e("./keyboard/gutter_handler").GutterKeyboardHandler,$=e("./config").nls,w=e("./clipboard"),_=e("./lib/keys"),A=function(){function e(n,t,D){this.session,this.$toDestroy=[];var S=n.getContainerElement();this.container=S,this.renderer=n,this.id="editor"+ ++e.$uid,this.commands=new h(o.isMac?"mac":"win",p),"object"==typeof document&&(this.textInput=new i(n.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new g(this),new s(this)),this.keyBinding=new l(this),this.$search=new c().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(t||D&&D.session||new d("")),m.resetOptions(this),D&&this.setOptions(D),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,t=n&&n.scrollIntoView;if(t){switch(t){case"center-animate":t="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var D=this.selection.getRange(),S=this.renderer.layerConfig;(D.start.row>=S.lastRow||D.end.row<=S.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==t&&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,t=this.$mergeableCommands,D=n.command&&e.command.name==n.command.name;if("insertstring"==e.command.name){var S=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),D=D&&this.mergeNextCommand&&(!/\s/.test(S)||/\s/.test(n.args)),this.mergeNextCommand=!0}else D=D&&-1!==t.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(D=!1),D?this.session.mergeUndoDeltas=!0:-1!==t.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 t=this;m.loadModule(["keybinding",e],function(D){t.$keybindingId==e&&t.keyBinding.setKeyboardHandler(D&&D.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 t=this.session.getSelection();t.off("changeCursor",this.$onCursorChange),t.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")||a.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 t=e.getCursorPosition(),D=e.getKeyboardHandler(),S=D&&D.$getDirectionForHighlight&&D.$getDirectionForHighlight(e),a=n.getMatchingBracketRanges(t,S);if(!a){var r=new y(n,t.row,t.column).getCurrentToken();if(r&&/\b(?:tag-open|tag-name)/.test(r.type)){var o=n.getMatchingTags(t);o&&(a=[o.openTagName.isEmpty()?o.openTag:o.openTagName,o.closeTagName.isEmpty()?o.closeTag:o.closeTagName])}}if(!a&&n.$mode.getMatching&&(a=n.$mode.getMatching(e.session)),!a){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var i="ace_bracket";Array.isArray(a)?1==a.length&&(i="ace_error_bracket"):a=[a],2==a.length&&(0==u.comparePoints(a[0].end,a[1].start)?a=[u.fromPoints(a[0].start,a[1].end)]:0==u.comparePoints(a[0].start,a[1].end)&&(a=[u.fromPoints(a[1].start,a[0].end)])),n.$bracketHighlight={ranges:a,markerIds:a.map(function(e){return n.addMarker(e,i,"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,t=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,t,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 t=new u(e.row,e.column,e.row,1/0);t.id=n.addMarker(t,"ace_active-line","screenLine"),n.$highlightLineMarker=t}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 t=this.selection.getRange(),D=this.getSelectionStyle();n.$selectionMarker=n.addMarker(t,"ace_selection",D)}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 t=n.start.column,D=n.end.column,S=e.getLine(n.start.row),a=S.substring(t,D);if(!(a.length>5e3)&&/[\w\d]/.test(a)){var r=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:a}),o=S.substring(t-1,D+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(),t=!1;if(!e&&this.$copyWithEmptySelection){t=!0;for(var D=this.selection.getAllRanges(),S=0;S<D.length;S++){var a=D[S];S&&D[S-1].start.row==a.start.row||(e+=this.session.getLine(a.start.row)+n)}}var r={text:e};return this._signal("copy",r),w.lineMode=!!t&&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 t={text:e,event:n};this.commands.exec("paste",this,t)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var n=e.text,t=n===w.lineMode,D=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)t?D.insert({row:this.selection.lead.row,column:0},n):this.insert(n);else if(t)this.selection.rangeList.ranges.forEach(function(e){D.insert({row:e.start.row,column:0},n)});else{var S=n.split(/\r\n|\r|\n/),a=this.selection.rangeList.ranges,r=2==S.length&&(!S[0]||!S[1]);if(S.length!=a.length||r)return this.commands.exec("insertstring",this,n);for(var o=a.length;o--;){var i=a[o];i.isEmpty()||D.remove(i),D.insert(i.start,S[o])}}},e.prototype.execCommand=function(e,n){return this.commands.exec(e,this,n)},e.prototype.insert=function(e,n){var t=this.session,D=t.getMode(),S=this.getCursorPosition();if(this.getBehavioursEnabled()&&!n){var a=D.transformAction(t.getState(S.row),"insertion",this,t,e);a&&(e===a.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=a.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var r=u.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=t.getLine(S.row);if(S.column>o.search(/\S|$/)){var i=o.substr(S.column).search(/\S|$/);t.doc.removeInLine(S.row,S.column,S.column+i)}}this.clearSelection();var g=S.column,s=t.getState(S.row),o=t.getLine(S.row),l=D.checkOutdent(s,o,e);if(t.insert(S,e),a&&a.selection&&(2==a.selection.length?this.selection.setSelectionRange(new u(S.row,g+a.selection[0],S.row,g+a.selection[1])):this.selection.setSelectionRange(new u(S.row+a.selection[0],a.selection[1],S.row+a.selection[2],a.selection[3]))),this.$enableAutoIndent){if(t.getDocument().isNewLine(e)){var d=D.getNextLineIndent(s,o.slice(0,S.column),t.getTabString());t.insert({row:S.row+1,column:0},d)}l&&D.autoOutdent(s,t,S.row)}},e.prototype.autoIndent=function(){for(var e=this.session,n=e.getMode(),t=this.selection.isEmpty()?[new u(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),D="",S="",a="",r=e.getTabString(),o=0;o<t.length;o++)for(var i=t[o].start.row,g=t[o].end.row,s=i;s<=g;s++){s>0&&(D=e.getState(s-1),S=e.getLine(s-1),a=n.getNextLineIndent(D,S,r));var l=e.getLine(s),d=n.$getIndent(l);if(a!==d){if(d.length>0){var c=new u(s,0,s,d.length);e.remove(c)}a.length>0&&e.insert({row:s,column:0},a)}n.autoOutdent(D,e,s)}},e.prototype.onTextInput=function(e,n){if(!n)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var t=this.applyComposition.bind(this,e,n);this.selection.rangeCount?this.forEachSelection(t):t(),this.endOperation()},e.prototype.applyComposition=function(e,n){if(n.extendLeft||n.extendRight){var t=this.selection.getRange();t.start.column-=n.extendLeft,t.end.column+=n.extendRight,t.start.column<0&&(t.start.row--,t.start.column+=this.session.getLine(t.start.row).length+1),this.selection.setRange(t),e||t.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),n.restoreStart||n.restoreEnd){var t=this.selection.getRange();t.start.column-=n.restoreStart,t.end.column-=n.restoreEnd,this.selection.setRange(t)}},e.prototype.onCommandKey=function(e,n,t){return this.keyBinding.onCommandKey(e,n,t)},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 t=this.session,D=t.getState(n.start.row),S=t.getMode().transformAction(D,"deletion",this,t,n);if(0===n.end.column){var a=t.getTextRange(n);if("\n"==a[a.length-1]){var r=t.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 b(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,t=this.getCursorPosition(),D=t.column;if(0!==D){var S=this.session.getLine(t.row);D<S.length?(e=S.charAt(D)+S.charAt(D-1),n=new u(t.row,D-1,t.row,D+1)):(e=S.charAt(D-1)+S.charAt(D-2),n=new u(t.row,D-2,t.row,D)),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(),t=this.session.getTextRange(n);this.session.replace(n,t.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var n=this.getSelectionRange(),t=this.session.getTextRange(n);this.session.replace(n,t.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,n=this.getSelectionRange();if(n.start.row<n.end.row){var t=this.$getSelectedRows();e.indentRows(t.first,t.last," ");return}if(n.start.column<n.end.column){var D=e.getTextRange(n);if(!/^\s+$/.test(D)){var t=this.$getSelectedRows();e.indentRows(t.first,t.last," ");return}}var S=e.getLine(n.start.row),a=n.start,o=e.getTabSize(),i=e.documentToScreenColumn(a.row,a.column);if(this.session.getUseSoftTabs())var g=o-i%o,s=r.stringRepeat(" ",g);else{for(var g=i%o;" "==S[n.start.column-1]&&g;)n.start.column--,g--;this.selection.setSelectionRange(n),s=" "}return this.insert(s)},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,t=[],D=e.first;D<=e.last;D++)t.push(n.getLine(D));t.sort(function(e,n){return e.toLowerCase()<n.toLowerCase()?-1:+(e.toLowerCase()>n.toLowerCase())});for(var S=new u(0,0,0,0),D=e.first;D<=e.last;D++){var a=n.getLine(D);S.start.row=D,S.end.row=D,S.end.column=a.length,n.replace(S,t[D-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),t=this.getSelectionRange();this.session.getMode().toggleBlockComment(n,this.session,t,e)},e.prototype.getNumberAt=function(e,n){var t=/[\-]?[0-9]+(?:\.[0-9]+)?/g;t.lastIndex=0;for(var D=this.session.getLine(e);t.lastIndex<n;){var S=t.exec(D);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,t=this.selection.getCursor().column,D=new u(n,t-1,n,t),S=this.session.getTextRange(D);if(!isNaN(parseFloat(S))&&isFinite(S)){var a=this.getNumberAt(n,t);if(a){var r=a.value.indexOf(".")>=0?a.start+a.value.indexOf(".")+1:a.end,o=a.start+a.value.length-r,i=parseFloat(a.value);i*=Math.pow(10,o),r!==a.end&&t<r?e*=Math.pow(10,a.end-t-1):e*=Math.pow(10,a.end-t),i+=e;var g=(i/=Math.pow(10,o)).toFixed(o),s=new u(n,a.start,n,a.end);this.session.replace(s,g),this.moveCursorTo(n,Math.max(a.start+1,t+g.length-a.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,n=this.selection.getCursor().row,t=this.selection.getCursor().column;this.selection.selectWord();var D=this.getSelectedText(),S=this.selection.getWordRange().start.column,a=D.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=t-S-1;o<0&&(o=0);var i=0,g=0,s=this;D.match(/[A-Za-z0-9_]+/)&&a.forEach(function(e,t){g=i+e.length,o>=i&&o<=g&&(D=e,s.selection.clearSelection(),s.moveCursorTo(n,i+S),s.selection.selectTo(n,g+S)),i=g});for(var l=this.$toggleWordPairs,d=0;d<l.length;d++)for(var c=l[d],u=0;u<=1;u++){var f=+!u,h=D.match(RegExp("^\\s?_?("+r.escapeRegExp(c[u])+")\\s?$","i"));h&&D.match(RegExp("([_]|^|\\s)("+r.escapeRegExp(h[1])+")($|\\s)","g"))&&(e=D.replace(RegExp(r.escapeRegExp(c[u]),"i"),function(e){var n=c[f];return e.toUpperCase()==e?n=n.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(n=n.substr(0,0)+c[f].charAt(0).toUpperCase()+n.substr(1)),n}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,n){var t=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),S=n;S<0&&(S=0);var a,r,o,i=0,g=0;try{for(var s=D(t),l=s.next();!l.done;l=s.next()){var d=l.value;if(g=i+d.length,S>=i&&S<=g&&d.match(/((?:https?|ftp):\/\/[\S]+)/)){o=d.replace(/[\s:.,'";}\]]+$/,"");break}i=g}}catch(e){a={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.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,t=e.getRange(),D=e.isBackwards();if(t.isEmpty()){var S=t.start.row;n.duplicateLines(S,S)}else{var a=D?t.start:t.end,r=n.insert(a,n.getTextRange(t));t.start=a,t.end=r,e.setSelectionRange(t,D)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,n,t){return this.session.moveText(e,n,t)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,n){var t,D,S=this.selection;if(!S.inMultiSelectMode||this.inVirtualSelectionMode){var a=S.toOrientedRange();t=this.$getSelectedRows(a),D=this.session.$moveLines(t.first,t.last,n?0:e),n&&-1==e&&(D=0),a.moveBy(D,0),S.fromOrientedRange(a)}else{var r=S.rangeList.ranges;S.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var o=0,i=0,g=r.length,s=0;s<g;s++){var l=s;r[s].moveBy(o,0);for(var d=(t=this.$getSelectedRows(r[s])).first,c=t.last;++s<g;){i&&r[s].moveBy(i,0);var u=this.$getSelectedRows(r[s]);if(n&&u.first!=c||!n&&u.first>c+1)break;c=u.last}for(s--,o=this.session.$moveLines(d,c,n?0:e),n&&-1==e&&(l=s+1);l<=s;)r[l].moveBy(o,0),l++;n||(o=0),i+=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 t=this.renderer,D=this.renderer.layerConfig,S=e*Math.floor(D.height/D.lineHeight);!0===n?this.selection.$moveSelection(function(){this.moveCursorBy(S,0)}):!1===n&&(this.selection.moveCursorBy(S,0),this.selection.clearSelection());var a=t.scrollTop;t.scrollBy(0,S*D.lineHeight),null!=n&&t.scrollCursorIntoView(null,.5),t.animateScrolling(a)},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,t,D){this.renderer.scrollToLine(e,n,t,D)},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 t,D,S,a,r=this.getCursorPosition(),o=new y(this.session,r.row,r.column),i=o.getCurrentToken(),g=0;i&&-1!==i.type.indexOf("tag-name")&&(i=o.stepBackward());var s=i||o.stepForward();if(s){var l=!1,d={},c=r.column-s.start,f={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g)){for(;c<s.value.length&&!l;c++)if(f[s.value[c]])switch(isNaN(d[D=f[s.value[c]]+"."+s.type.replace("rparen","lparen")])&&(d[D]=0),s.value[c]){case"(":case"[":case"{":d[D]++;break;case")":case"]":case"}":d[D]--,-1===d[D]&&(t="bracket",l=!0)}}else -1!==s.type.indexOf("tag-name")&&(isNaN(d[s.value])&&(d[s.value]=0),"<"===i.value&&g>1?d[s.value]++:"</"===i.value&&d[s.value]--,-1===d[s.value]&&(t="tag",l=!0));l||(i=s,g++,s=o.stepForward(),c=0)}while(s&&!l);if(t){if("bracket"===t)!(S=this.session.getBracketRange(r))&&(a=(S=new u(o.getCurrentTokenRow(),o.getCurrentTokenColumn()+c-1,o.getCurrentTokenRow(),o.getCurrentTokenColumn()+c-1)).start,(n||a.row===r.row&&2>Math.abs(a.column-r.column))&&(S=this.session.getBracketRange(a)));else if("tag"===t){if(!s||-1===s.type.indexOf("tag-name"))return;if(0===(S=new u(o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2,o.getCurrentTokenRow(),o.getCurrentTokenColumn()-2)).compare(r.row,r.column)){var h=this.session.getMatchingTags(r);h&&(h.openTag.contains(r.row,r.column)?a=(S=h.closeTag).start:(S=h.openTag,a=h.closeTag.start.row===r.row&&h.closeTag.start.column===r.column?S.end:S.start))}a=a||S.start}a=S&&S.cursor||a,a&&(e?S&&n?this.selection.setRange(S):S&&S.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(a.row,a.column):this.selection.moveTo(a.row,a.column))}}},e.prototype.gotoLine=function(e,n,t){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,t)},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 t=this.$search.find(this.session),D=0;return t&&(this.$tryReplace(t,e)&&(D=1),this.selection.setSelectionRange(t),this.renderer.scrollSelectionIntoView(t.start,t.end)),D},e.prototype.replaceAll=function(e,n){n&&this.$search.set(n);var t=this.$search.findAll(this.session),D=0;if(!t.length)return D;var S=this.getSelectionRange();this.selection.moveTo(0,0);for(var a=t.length-1;a>=0;--a)this.$tryReplace(t[a],e)&&D++;return this.selection.setSelectionRange(S),D},e.prototype.$tryReplace=function(e,n){var t=this.session.getTextRange(e);return null!==(n=this.$search.replace(t,n))?(e.end=this.session.replace(e,n),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,n,t){n||(n={}),"string"==typeof e||e instanceof RegExp?n.needle=e:"object"==typeof e&&S.mixin(n,e);var D=this.selection.getRange();null==n.needle&&((e=this.session.getTextRange(D)||this.$search.$options.needle)||(D=this.session.getWordRange(D.start.row,D.start.column),e=this.session.getTextRange(D)),this.$search.set({needle:e})),this.$search.set(n),n.start||this.$search.set({start:D});var a=this.$search.find(this.session);return n.preventScroll?a:a?(this.revealRange(a,t),a):void(n.backwards?D.start=D.end:D.end=D.start,this.selection.setRange(D))},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 t=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==n&&this.renderer.animateScrolling(t)},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,t=this,D=!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 a=this.on("changeSelection",function(){D=!0}),r=this.renderer.on("beforeRender",function(){D&&(n=t.renderer.container.getBoundingClientRect())}),o=this.renderer.on("afterRender",function(){if(D&&n&&(t.isFocused()||t.searchBox&&t.searchBox.isFocused())){var e=t.renderer,a=e.$cursorLayer.$pixelPos,r=e.layerConfig,o=a.top-r.offset;null!=(D=a.top>=0&&o+n.top<0||(!(a.top<r.height)||!(a.top+n.top+r.lineHeight>window.innerHeight))&&null)&&(S.style.top=o+"px",S.style.left=a.left+"px",S.style.height=r.lineHeight+"px",S.scrollIntoView(D)),D=n=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",a),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,a.setCssClass(n.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,n,t){var D=this;m.loadModule("ace/ext/prompt",function(S){S.prompt(D,e,n,t)})},e}();A.$uid=0,A.prototype.curOp=null,A.prototype.prevOp={},A.prototype.$mergeableCommands=["backspace","del","insertstring"],A.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(A.prototype,f),m.defineOptions(A.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?M.attach(this):M.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?M.attach(this):M.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),a.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),a.addCssClass(this.container,"ace_hasPlaceholder");var n=a.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,t={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},D=function(e){if(e.target==this.renderer.scroller&&e.keyCode===_.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",$("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",$("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",D.bind(this)),this.commands.addCommand(t),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",$("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",$("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 v(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",D.bind(this)),this.commands.removeCommand(t),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 M={getText:function(e,n){return(Math.abs(e.selection.lead.row-n)||n+1+(n<9?"\xb7":""))+""},getWidth:function(e,n,t){return Math.max(n.toString().length,(t.lastRow+1).toString().length,2)*t.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=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=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){D.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,t){var D=Math.floor(n.firstRowScreen*n.lineHeight/this.canvasHeight);return t.documentToScreenRow(e,0)*n.lineHeight-D*this.canvasHeight},e.prototype.computeLineHeight=function(e,n,t){return n.lineHeight*t.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=D.createFragment(this.element),t=0;t<e.length;t++)n.appendChild(e[t].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=D.createFragment(this.element),t=0;t<e.length;t++)n.appendChild(e[t].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,t,S){var a=this.cellCache.pop();if(!a){var r=D.createElement("div");S&&S(r),this.element.appendChild(r),a={element:r,text:"",row:e}}return a.row=e,a},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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/oop"),a=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,o=e("./lines").Lines,i=e("../config").nls,g=function(){function e(e){this.element=D.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 t=e[n],D=t.row,S=this.$annotations[D];S||(S=this.$annotations[D]={text:[],type:[],displayText:[]});var r=t.text,o=t.text,i=t.type;r=r?a.escapeHTML(r):t.html||"",o=o||t.html||"",-1===S.text.indexOf(r)&&(S.text.push(r),S.type.push(i),S.displayText.push(o));var g=t.className;g?S.className=g:"error"===i?S.className=" ace_error":"security"!==i||/\bace_error\b/.test(S.className)?"warning"!==i||/\bace_(error|security)\b/.test(S.className)?"info"!==i||S.className?"hint"!==i||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,t=e.end.row-n;if(0===t);else if("remove"==e.action)this.$annotations.splice(n,t+1,null);else{var D=Array(t+1);D.unshift(n,1),this.$annotations.splice.apply(this.$annotations,D)}}},e.prototype.update=function(e){this.config=e;var n=this.session,t=e.firstRow,D=Math.min(e.lastRow+e.gutterOffset,n.getLength()-1);this.oldLastRow=D,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var S=n.getNextFoldLine(t),a=S?S.start.row:1/0,r=null,o=-1,i=t;;){if(i>a&&(i=S.end.row+1,a=(S=n.getNextFoldLine(i,S))?S.start.row:1/0),i>D){for(;this.$lines.getLength()>o+1;)this.$lines.pop();break}(r=this.$lines.get(++o))?r.row=i:(r=this.$lines.createCell(i,e,this.session,s),this.$lines.push(r)),this.$renderCell(r,e,S,i),i++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var n=this.session,t=n.gutterRenderer||this.$renderer,D=n.$firstLineNumber,S=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||n.$useWrapMode)&&(S=n.getLength()+D-1);var a=t?t.getWidth(n,S,e):S.toString().length*e.characterWidth,r=this.$padding||this.$computePadding();(a+=r.left+r.right)===this.gutterWidth||isNaN(a)||(this.gutterWidth=a,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",a))},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 t=0;t<n.length;t++){var D=n[t];if(D.row>=this.$cursorRow){if(D.row>this.$cursorRow){var S=this.session.getFoldLine(this.$cursorRow);if(t>0&&S&&S.start.row==n[t-1].row)D=n[t-1];else break}D.element.className="ace_gutter-active-line "+D.element.className,this.$cursorCell=D;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 t=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),D=this.oldLastRow;if(this.oldLastRow=t,!n||D<e.firstRow||t<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(D>t)for(var S=this.session.getFoldedRowCount(t+1,D);S>0;S--)this.$lines.pop();e.firstRow<n.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,n.firstRow-1)),t>D&&this.$lines.push(this.$renderLines(e,D+1,t)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,n,t){for(var D=[],S=n,a=this.session.getNextFoldLine(S),r=a?a.start.row:1/0;S>r&&(S=a.end.row+1,r=(a=this.session.getNextFoldLine(S,a))?a.start.row:1/0),!(S>t);){var o=this.$lines.createCell(S,e,this.session,s);this.$renderCell(o,e,a,S),D.push(o),S++}return D},e.prototype.$renderCell=function(e,n,t,S){var a,r=e.element,o=this.session,g=r.childNodes[0],s=r.childNodes[1],l=r.childNodes[2],d=l.firstChild,c=o.$firstLineNumber,u=o.$breakpoints,f=o.$decorations,h=o.gutterRenderer||this.$renderer,p=this.$showFoldWidgets&&o.foldWidgets,m=t?t.start.row:Number.MAX_VALUE,y=n.lineHeight+"px",b=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",v=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",$=(h?h.getText(o,S):S+c).toString();if(this.$highlightGutterLine&&(S==this.$cursorRow||t&&S<this.$cursorRow&&S>=m&&this.$cursorRow<=t.end.row)&&(b+="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)),u[S]&&(b+=u[S]),f[S]&&(b+=f[S]),this.$annotations[S]&&S!==m&&(b+=this.$annotations[S].className),p){var w=p[S];null==w&&(w=p[S]=o.getFoldWidget(S))}if(w){var _="ace_fold-widget ace_"+w,A="start"==w&&S==m&&S<t.end.row;if(A){_+=" ace_closed";for(var M="",x=!1,L=S+1;L<=t.end.row;L++)if(this.$annotations[L]){if(" ace_error"===this.$annotations[L].className){x=!0,M=" ace_error_fold";break}" ace_security"===this.$annotations[L].className?(x=!0,M=" ace_security_fold"):" ace_warning"===this.$annotations[L].className&&" ace_security_fold"!==M&&(x=!0,M=" ace_warning_fold")}b+=M}else _+=" ace_open";s.className!=_&&(s.className=_),D.setStyle(s.style,"height",y),D.setStyle(s.style,"display","inline-block"),s.setAttribute("role","button"),s.setAttribute("tabindex","-1");var C=o.getFoldWidgetRange(S);C?s.setAttribute("aria-label",i("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[C.start.row+1,C.end.row+1])):t?s.setAttribute("aria-label",i("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[t.start.row+1,t.end.row+1])):s.setAttribute("aria-label",i("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[S+1])),A?(s.setAttribute("aria-expanded","false"),s.setAttribute("title",i("gutter.code-folding.closed.title","Unfold code"))):(s.setAttribute("aria-expanded","true"),s.setAttribute("title",i("gutter.code-folding.open.title","Fold code")))}else s&&(D.setStyle(s.style,"display","none"),s.setAttribute("tabindex","0"),s.removeAttribute("role"),s.removeAttribute("aria-label"));if(x&&this.$showFoldedAnnotations){switch(l.className="ace_gutter_annotation",d.className=v,d.className+=M,D.setStyle(d.style,"height",y),D.setStyle(l.style,"display","block"),D.setStyle(l.style,"height",y),M){case" ace_error_fold":a=i("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security_fold":a=i("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning_fold":a=i("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$])}l.setAttribute("aria-label",a),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else if(this.$annotations[S]){switch(l.className="ace_gutter_annotation",d.className=v,this.$useSvgGutterIcons?d.className+=this.$annotations[S].className:r.classList.add(this.$annotations[S].className.replace(" ","")),D.setStyle(d.style,"height",y),D.setStyle(l.style,"display","block"),D.setStyle(l.style,"height",y),this.$annotations[S].className){case" ace_error":a=i("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security":a=i("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning":a=i("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$]);break;case" ace_info":a=i("gutter.annotation.aria-label.info","Info, read annotations row $0",[$]);break;case" ace_hint":a=i("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[$])}l.setAttribute("aria-label",a),l.setAttribute("tabindex","-1"),l.setAttribute("role","button")}else D.setStyle(l.style,"display","none"),l.removeAttribute("aria-label"),l.removeAttribute("role"),l.setAttribute("tabindex","0");return $!==g.data&&(g.data=$),r.className!=b&&(r.className=b),D.setStyle(e.element.style,"height",this.$lines.computeLineHeight(S,n,o)+"px"),D.setStyle(e.element.style,"top",this.$lines.computeLineTop(S,n,o)+"px"),e.text=$,"none"===l.style.display&&"none"===s.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?D.addCssClass(this.element,"ace_folding-enabled"):D.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=D.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(),t=this.element.getBoundingClientRect();return e.x<n.left+t.left?"markers":this.$showFoldWidgets&&e.x>t.right-n.right?"foldWidgets":void 0},e}();function s(e){var n=document.createTextNode("");e.appendChild(n);var t=D.createElement("span");e.appendChild(t);var S=D.createElement("span");e.appendChild(S);var a=D.createElement("span");return S.appendChild(a),e}g.prototype.$fixedWidth=!1,g.prototype.$highlightGutterLine=!0,g.prototype.$renderer="",g.prototype.$showLineNumbers=!0,g.prototype.$showFoldWidgets=!0,S.implement(g.prototype,r),n.Gutter=g}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,n,t){"use strict";var D=e("../range").Range,S=e("../lib/dom"),a=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 t=-1!=this.i&&this.element.childNodes[this.i];t?this.i++:(t=document.createElement("div"),this.element.appendChild(t),this.i=-1),t.style.cssText=n,t.className=e},e.prototype.update=function(e){if(e){for(var n in this.config=e,this.i=0,this.markers){var t,D=this.markers[n];if(!D.range){D.update(t,this,this.session,e);continue}var S=D.range.clipRows(e.firstRow,e.lastRow);if(!S.isEmpty())if(S=S.toScreenRange(this.session),D.renderer){var a=this.$getTop(S.start.row,e),r=this.$padding+S.start.column*e.characterWidth;D.renderer(t,S,r,a,e)}else"fullLine"==D.type?this.drawFullLineMarker(t,S,D.clazz,e):"screenLine"==D.type?this.drawScreenLineMarker(t,S,D.clazz,e):S.isMultiLine()?"text"==D.type?this.drawTextMarker(t,S,D.clazz,e):this.drawMultiLineMarker(t,S,D.clazz,e):this.drawSingleLineMarker(t,S,D.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,t,S,a){for(var o=this.session,i=n.start.row,g=n.end.row,s=i,l=0,d=0,c=o.getScreenLastRowColumn(s),u=new D(s,n.start.column,s,d);s<=g;s++)u.start.row=u.end.row=s,u.start.column=s==i?n.start.column:o.getRowWrapIndent(s),u.end.column=c,l=d,d=c,c=s+1<g?o.getScreenLastRowColumn(s+1):s==g?0:n.end.column,this.drawSingleLineMarker(e,u,t+(s==i?" ace_start":"")+" ace_br"+r(s==i||s==i+1&&n.start.column,l<d,d>c,s==g),S,+(s!=g),a)},e.prototype.drawMultiLineMarker=function(e,n,t,D,S){var a=this.$padding,r=D.lineHeight,o=this.$getTop(n.start.row,D),i=a+n.start.column*D.characterWidth;if(S=S||"",this.session.$bidiHandler.isBidiRow(n.start.row)){var g=n.clone();g.end.row=g.start.row,g.end.column=this.session.getLine(g.start.row).length,this.drawBidiSingleLineMarker(e,g,t+" ace_br1 ace_start",D,null,S)}else this.elt(t+" ace_br1 ace_start","height:"+r+"px;right:"+a+"px;top:"+o+"px;left:"+i+"px;"+(S||""));if(this.session.$bidiHandler.isBidiRow(n.end.row)){var g=n.clone();g.start.row=g.end.row,g.start.column=0,this.drawBidiSingleLineMarker(e,g,t+" ace_br12",D,null,S)}else{o=this.$getTop(n.end.row,D);var s=n.end.column*D.characterWidth;this.elt(t+" ace_br12","height:"+r+"px;width:"+s+"px;top:"+o+"px;left:"+a+"px;"+(S||""))}if(!((r=(n.end.row-n.start.row-1)*D.lineHeight)<=0)){o=this.$getTop(n.start.row+1,D);var l=!!n.start.column|8*!n.end.column;this.elt(t+(l?" ace_br"+l:""),"height:"+r+"px;right:"+a+"px;top:"+o+"px;left:"+a+"px;"+(S||""))}},e.prototype.drawSingleLineMarker=function(e,n,t,D,S,a){if(this.session.$bidiHandler.isBidiRow(n.start.row))return this.drawBidiSingleLineMarker(e,n,t,D,S,a);var r=D.lineHeight,o=(n.end.column+(S||0)-n.start.column)*D.characterWidth,i=this.$getTop(n.start.row,D),g=this.$padding+n.start.column*D.characterWidth;this.elt(t,"height:"+r+"px;width:"+o+"px;top:"+i+"px;left:"+g+"px;"+(a||""))},e.prototype.drawBidiSingleLineMarker=function(e,n,t,D,S,a){var r=D.lineHeight,o=this.$getTop(n.start.row,D),i=this.$padding;this.session.$bidiHandler.getSelections(n.start.column,n.end.column).forEach(function(e){this.elt(t,"height:"+r+"px;width:"+(e.width+(S||0))+"px;top:"+o+"px;left:"+(i+e.left)+"px;"+(a||""))},this)},e.prototype.drawFullLineMarker=function(e,n,t,D,S){var a=this.$getTop(n.start.row,D),r=D.lineHeight;n.start.row!=n.end.row&&(r+=this.$getTop(n.end.row,D)-a),this.elt(t,"height:"+r+"px;top:"+a+"px;left:0;right:0;"+(S||""))},e.prototype.drawScreenLineMarker=function(e,n,t,D,S){var a=this.$getTop(n.start.row,D),r=D.lineHeight;this.elt(t,"height:"+r+"px;top:"+a+"px;left:0;right:0;"+(S||""))},e}();function r(e,n,t,D){return!!e|2*!!n|4*!!t|8*!!D}a.prototype.$padding=0,n.Marker=a}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,n,t){var D=new Set(["text","rparen","lparen"]);n.isTextToken=function(e){return D.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,t){"use strict";var D=e("../lib/oop"),S=e("../lib/dom"),a=e("../lib/lang"),r=e("./lines").Lines,o=e("../lib/event_emitter").EventEmitter,i=e("../config").nls,g=e("./text_util").isTextToken,s=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],t=1;t<e+1;t++)if(this.showTabs){var D=this.dom.createElement("span");D.className="ace_invisible ace_invisible_tab",D.textContent=a.stringRepeat(this.TAB_CHAR,t),n.push(D)}else n.push(this.dom.createTextNode(a.stringRepeat(" ",t),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?a.stringRepeat(this.SPACE_CHAR,this.tabSize):a.stringRepeat(" ",this.tabSize),i=this.showTabs?" ace_invisible ace_invisible_tab":"",g=this.showTabs?a.stringRepeat(this.TAB_CHAR,this.tabSize):o,D=this.dom.createElement("span");D.className=S+r,D.textContent=o,this.$tabStrings[" "]=D;var D=this.dom.createElement("span");D.className=S+i,D.textContent=g,this.$tabStrings[" "]=D}},e.prototype.updateLines=function(e,n,t){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var D=Math.max(n,e.firstRow),S=Math.min(t,e.lastRow),a=this.element.childNodes,r=0,o=e.firstRow;o<D;o++){var i=this.session.getFoldLine(o);if(i)if(i.containsRow(D)){D=i.start.row;break}else o=i.end.row;r++}for(var g=!1,o=D,i=this.session.getNextFoldLine(o),s=i?i.start.row:1/0;o>s&&(o=i.end.row+1,s=(i=this.session.getNextFoldLine(o,i))?i.start.row:1/0),!(o>S);){var l=a[r++];if(l){this.dom.removeChildren(l),this.$renderLine(l,o,o==s&&i),g&&(l.style.top=this.$lines.computeLineTop(o,e,this.session)+"px");var d=e.lineHeight*this.session.getRowLength(o)+"px";l.style.height!=d&&(g=!0,l.style.height=d)}o++}if(g)for(;r<this.$lines.cells.length;){var c=this.$lines.cells[r++];c.element.style.top=this.$lines.computeLineTop(c.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 t=e.lastRow,D=n?n.lastRow:-1;if(!n||D<e.firstRow||t<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,t){for(var D=[],a=n,r=this.session.getNextFoldLine(a),o=r?r.start.row:1/0;a>o&&(a=r.end.row+1,o=(r=this.session.getNextFoldLine(a,r))?r.start.row:1/0),!(a>t);){var i=this.$lines.createCell(a,e,this.session),g=i.element;this.dom.removeChildren(g),S.setStyle(g.style,"height",this.$lines.computeLineHeight(a,e,this.session)+"px"),S.setStyle(g.style,"top",this.$lines.computeLineTop(a,e,this.session)+"px"),this.$renderLine(g,a,a==o&&r),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",D.push(i),a++}return D},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var n=e.firstRow,t=e.lastRow,D=this.$lines;D.getLength();)D.pop();D.push(this.$renderLinesFragment(e,n,t))},e.prototype.$renderToken=function(e,n,t,D){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,s=this.dom.createFragment(this.element),l=0;S=o.exec(D);){var d=S[1],c=S[2],u=S[3],f=S[4],h=S[5];if(r.showSpaces||!c){var p=l!=S.index?D.slice(l,S.index):"";if(l=S.index+S[0].length,p&&s.appendChild(this.dom.createTextNode(p,this.element)),d){var m=r.session.getScreenTabSize(n+S.index);s.appendChild(r.$tabStrings[m].cloneNode(!0)),n+=m-1}else if(c)if(r.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=a.stringRepeat(r.SPACE_CHAR,c.length),s.appendChild(y)}else s.appendChild(this.dom.createTextNode(c,this.element));else if(u){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=a.stringRepeat(r.SPACE_CHAR,u.length),s.appendChild(y)}else if(f){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:f,s.appendChild(y)}else if(h){n+=1;var y=this.dom.createElement("span");y.style.width=2*r.config.characterWidth+"px",y.className="ace_cjk",y.textContent=h,s.appendChild(y)}}}if(s.appendChild(this.dom.createTextNode(l?D.slice(l):D,this.element)),g(t.type))e.appendChild(s);else{var b="ace_"+t.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==t.type&&(y.style.width=t.value.length*this.config.characterWidth+"px",y.setAttribute("title",i("inline-fold.closed.title","Unfold code"))),y.className=b,y.appendChild(s),e.appendChild(y)}return n+D.length},e.prototype.renderIndentGuide=function(e,n,t){var D=n.search(this.$indentGuideRe);if(D<=0||D>=t)return n;if(" "==n[0]){for(var S=(D-=D%this.tabSize)/this.tabSize,a=0;a<S;a++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(D)}if(" "==n[0]){for(var a=0;a<D;a++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),n.substr(D)}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(),t=/^\s*/.exec(this.session.doc.getLine(n.row))[0].length,D=Math.floor(t/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:D,start:n.row};var S=this.session.$bracketHighlight;if(S){for(var a=this.session.$bracketHighlight.ranges,r=0;r<a.length;r++)if(n.row!==a[r].start.row){this.$highlightIndentGuideMarker.end=a[r].start.row,n.row>a[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],i=/^\s*/.exec(o)[0].length;if(""!==o&&(this.$highlightIndentGuideMarker.end=r,i<=t))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,n=0;n<e.length;n++){var t=e[n].element.childNodes;if(t.length>0){for(var D=0;D<t.length;D++)if(t[D].classList&&t[D].classList.contains("ace_indent-guide-active")){t[D].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,n){if(""!==this.session.doc.getLine(e.row)){var t=e.element.childNodes;if(t){var D=t[n-1];D&&D.classList&&D.classList.contains("ace_indent-guide")&&D.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 t=0;t<e.length;t++){var D=e[t];if(this.$highlightIndentGuideMarker.end&&D.row>=this.$highlightIndentGuideMarker.start+1){if(D.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(D,n)}}else for(var t=e.length-1;t>=0;t--){var D=e[t];if(this.$highlightIndentGuideMarker.end&&D.row<this.$highlightIndentGuideMarker.start){if(D.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(D,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,t){var D=0,S=0,r=t[0],o=0,i=this.$createLineElement();e.appendChild(i);for(var g=0;g<n.length;g++){var s=n[g],l=s.value;if(0==g&&this.displayIndentGuides){if(D=l.length,!(l=this.renderIndentGuide(i,l,r)))continue;D-=l.length}if(D+l.length<r)o=this.$renderToken(i,o,s,l),D+=l.length;else{for(;D+l.length>=r;)o=this.$renderToken(i,o,s,l.substring(0,r-D)),l=l.substring(r-D),D=r,i=this.$createLineElement(),e.appendChild(i),i.appendChild(this.dom.createTextNode(a.stringRepeat("\xa0",t.indent),this.element)),o=0,r=t[++S]||Number.MAX_VALUE;0!=l.length&&(D+=l.length,o=this.$renderToken(i,o,s,l))}}t[t.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(i,o,null,"",!0)},e.prototype.$renderSimpleLine=function(e,n){for(var t=0,D=0;D<n.length;D++){var S=n[D],a=S.value;if(0!=D||!this.displayIndentGuides||(a=this.renderIndentGuide(e,a))){if(t+a.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,t,S,a);t=this.$renderToken(e,t,S,a)}}},e.prototype.$renderOverflowMessage=function(e,n,t,D,S){t&&this.$renderToken(e,n,t,D.slice(0,this.MAX_LINE_LENGTH-n));var a=this.dom.createElement("span");a.className="ace_inline_button ace_keyword ace_toggle_wrap",a.textContent=S?"<hide>":"<click to see more...>",e.appendChild(a)},e.prototype.$renderLine=function(e,n,t){if(t||!1==t||(t=this.session.getFoldLine(n)),t)var D=this.$getFoldLineTokens(n,t);else var D=this.session.getTokens(n);var S=e;if(D.length){var a=this.session.getRowSplitData(n);if(a&&a.length){this.$renderWrappedLine(e,D,a);var S=e.lastChild}else{var S=e;this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S)),this.$renderSimpleLine(S,D)}}else this.$useLineGroups()&&(S=this.$createLineElement(),e.appendChild(S));if(this.showEOL&&S){t&&(n=t.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 t=this.session,D=[];function S(e,n,t){for(var S=0,a=0;a+e[S].value.length<n;)if(a+=e[S].value.length,++S==e.length)return;if(a!=n){var r=e[S].value.substring(n-a);r.length>t-n&&(r=r.substring(0,t-n)),D.push({type:e[S].type,value:r}),a=n+r.length,S+=1}for(;a<t&&S<e.length;){var r=e[S].value;r.length+a>t?D.push({type:e[S].type,value:r.substring(0,t-a)}):D.push(e[S]),a+=r.length,S+=1}}var a=t.getTokens(e);return n.walk(function(e,n,r,o,i){null!=e?D.push({type:"fold",value:e}):(i&&(a=t.getTokens(n)),a.length&&S(a,o,r))},n.end.row,this.session.getLine(n.end.row).length),D},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();s.prototype.EOF_CHAR="\xb6",s.prototype.EOL_CHAR_LF="\xac",s.prototype.EOL_CHAR_CRLF="\xa4",s.prototype.EOL_CHAR=s.prototype.EOL_CHAR_LF,s.prototype.TAB_CHAR="—",s.prototype.SPACE_CHAR="\xb7",s.prototype.$padding=0,s.prototype.MAX_LINE_LENGTH=1e4,s.prototype.showInvisibles=!1,s.prototype.showSpaces=!1,s.prototype.showTabs=!1,s.prototype.showEOL=!1,s.prototype.displayIndentGuides=!0,s.prototype.$highlightIndentGuides=!0,s.prototype.$tabStrings=[],s.prototype.destroy={},s.prototype.onChangeTabSize=s.prototype.$computeTabString,D.implement(s.prototype,o),n.Text=s}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,n,t){"use strict";var D=e("../lib/dom"),S=function(){function e(e){this.element=D.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(),D.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var n=this.cursors,t=n.length;t--;)D.setStyle(n[t].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&&D.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,D.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,D.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=D.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,D.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,D.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,D.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&&D.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),D.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 t=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(t.row,e.row)?this.session.$bidiHandler.getPosLeft(t.column):t.column*this.config.characterWidth),top:(t.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,t=0,S=0;(void 0===n||0===n.length)&&(n=[{cursor:null}]);for(var t=0,a=n.length;t<a;t++){var r=this.getPixelPosition(n[t].cursor,!0);if(!(r.top>e.height+e.offset)&&!(r.top<0)||!(t>1)){var o=this.cursors[S++]||this.addCursor(),i=o.style;this.drawCursor?this.drawCursor(o,r,e,n[t],this.session):this.isCursorInView(r,e)?(D.setStyle(i,"display","block"),D.translate(o,r.left,r.top),D.setStyle(i,"width",Math.round(e.characterWidth)+"px"),D.setStyle(i,"height",e.lineHeight+"px")):D.setStyle(i,"display","none")}}for(;this.cursors.length>S;)this.removeCursor();var g=this.session.getOverwrite();this.$setOverwrite(g),this.$pixelPos=r,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?D.addCssClass(this.element,"ace_overwrite-cursors"):D.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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,i=32768,g=function(){function e(e,n){this.element=a.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+n,this.inner=a.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(g.prototype,o);var s=function(e){function n(n,t){var D=e.call(this,n,"-v")||this;return D.scrollTop=0,D.scrollHeight=0,t.$scrollbarWidth=D.width=a.scrollbarWidth(n.ownerDocument),D.inner.style.width=D.element.style.width=(D.width||15)+5+"px",D.$minWidth=0,D}return D(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>i?(this.coeff=i/e,e=i):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}(g);s.prototype.setInnerHeight=s.prototype.setScrollHeight;var l=function(e){function n(n,t){var D=e.call(this,n,"-h")||this;return D.scrollLeft=0,D.height=t.$scrollbarWidth,D.inner.style.height=D.element.style.height=(D.height||15)+5+"px",D}return D(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}(g);n.ScrollBar=s,n.ScrollBarV=s,n.ScrollBarH=l,n.VScrollBar=s,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,t){"use strict";var D=this&&this.__extends||function(){var e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function D(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(D.prototype=t.prototype,new D)}}(),S=e("./lib/oop"),a=e("./lib/dom"),r=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter;a.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 i=function(){function e(e,n){this.element=a.createElement("div"),this.element.className="ace_sb"+n,this.inner=a.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(i.prototype,o);var g=function(e){function n(n,t){var D=e.call(this,n,"-v")||this;return D.scrollTop=0,D.scrollHeight=0,D.parent=n,D.width=D.VScrollWidth,D.renderer=t,D.inner.style.width=D.element.style.width=(D.width||15)+"px",D.$minWidth=0,D}return D(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var t=this,D=n.clientY,S=function(e){D=e.clientY},a=function(){clearInterval(s)},o=n.clientY,i=this.thumbTop,g=function(){if(void 0!==D){var e=t.scrollTopFromThumbTop(i+D-o);e!==t.scrollTop&&t._emit("scroll",{data:e})}};r.capture(this.inner,S,a);var s=setInterval(g,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}(i);g.prototype.setInnerHeight=g.prototype.setScrollHeight;var s=function(e){function n(n,t){var D=e.call(this,n,"-h")||this;return D.scrollLeft=0,D.scrollWidth=0,D.height=D.HScrollHeight,D.inner.style.height=D.element.style.height=(D.height||12)+"px",D.renderer=t,D}return D(n,e),n.prototype.onMouseDown=function(e,n){if("mousedown"===e&&0===r.getButton(n)&&2!==n.detail){if(n.target===this.inner){var t=this,D=n.clientX,S=function(e){D=e.clientX},a=function(){clearInterval(s)},o=n.clientX,i=this.thumbLeft,g=function(){if(void 0!==D){var e=t.scrollLeftFromThumbLeft(i+D-o);e!==t.scrollLeft&&t._emit("scroll",{data:e})}};r.capture(this.inner,S,a);var s=setInterval(g,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}(i);s.prototype.setInnerWidth=s.prototype.setScrollWidth,n.ScrollBar=g,n.ScrollBarV=g,n.ScrollBarH=s,n.VScrollBar=g,n.HScrollBar=s}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,n,t){"use strict";var D=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 t=this;this._flush=function(e){t.pending=!1;var n=t.changes;if(n&&(D.blockIdle(100),t.changes=0,t.onRender(n)),t.changes){if(t.$recursionLimit--<0)return;t.schedule()}else t.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(D.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,t){var D=e("../lib/oop"),S=e("../lib/dom"),a=e("../lib/lang"),r=e("../lib/event"),o=e("../lib/useragent"),i=e("../lib/event_emitter").EventEmitter,g=512,s="function"==typeof ResizeObserver,l=200,d=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=a.stringRepeat("X",g),this.$characterSize={width:0,height:0},s?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/g};return 0===n.width||0===n.height?null:n},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=a.stringRepeat(e,g),this.$main.getBoundingClientRect().width/g},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 t(e,n,t){var D=e[1]*n[0]-e[0]*n[1];return[(-n[1]*t[0]+n[0]*t[1])/D,(e[1]*t[0]-e[0]*t[1])/D]}function D(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 a(e,n){return[e*n[0],e*n[1]]}function r(e){var n=e.getBoundingClientRect();return[n.left,n.top]}e&&(e=a(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var o=r(this.els[0]),i=r(this.els[1]),g=r(this.els[2]),s=r(this.els[3]),d=t(D(s,i),D(s,g),D(S(i,g),S(s,o))),c=a(1+d[0],D(i,o)),u=a(1+d[1],D(g,o));if(n){var f=n,h=d[0]*f[0]/l+d[1]*f[1]/l+1,p=S(a(f[0],c),a(f[1],u));return S(a(1/h/l,p),o)}var m=D(e,o),y=t(D(c,a(d[0],m)),D(u,a(d[1],m)),m);return a(l,y)},e}();d.prototype.$characterSize={width:0,height:0},D.implement(d.prototype,i),n.FontMetrics=d}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,n,t){t.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,t){"use strict";var D=e("../lib/dom"),S=e("../lib/oop"),a=e("../lib/event_emitter").EventEmitter,r=function(){function e(e,n){this.canvas=D.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 t=this.canvas.getContext("2d");function D(e,n){return e.priority<n.priority?-1:+(e.priority>n.priority)}var S=this.renderer.session.$annotations;if(t.clearRect(0,0,this.canvas.width,this.canvas.height),S){var a={info:1,warning:2,error:3};S.forEach(function(e){e.priority=a[e.type]||null}),S=S.sort(D);for(var r=this.renderer.session.$foldData,o=0;o<S.length;o++){var i=S[o].row,g=this.compensateFoldRows(i,r),s=Math.round((i-g)*this.lineHeight*this.heightRatio),l=Math.round((i-g)*this.lineHeight*this.heightRatio),d=Math.round(((i-g)*this.lineHeight+this.lineHeight)*this.heightRatio);if(d-l<this.minDecorationHeight){var c=(l+d)/2|0;c<this.halfMinDecorationHeight?c=this.halfMinDecorationHeight:c+this.halfMinDecorationHeight>this.canvasHeight&&(c=this.canvasHeight-this.halfMinDecorationHeight),l=Math.round(c-this.halfMinDecorationHeight),d=Math.round(c+this.halfMinDecorationHeight)}t.fillStyle=n[S[o].type]||null,t.fillRect(0,s,this.canvasWidth,d-l)}}var u=this.renderer.session.selection.getCursor();if(u){var g=this.compensateFoldRows(u.row,r),s=Math.round((u.row-g)*this.lineHeight*this.heightRatio);t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,s,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,n){var t=0;if(n&&n.length>0)for(var D=0;D<n.length;D++)e>n[D].start.row&&e<n[D].end.row?t+=e-n[D].start.row:e>=n[D].end.row&&(t+=n[D].end.row-n[D].start.row);return t},e}();S.implement(r.prototype,a),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,t){"use strict";var D=e("./lib/oop"),S=e("./lib/dom"),a=e("./lib/lang"),r=e("./config"),o=e("./layer/gutter").Gutter,i=e("./layer/marker").Marker,g=e("./layer/text").Text,s=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,d=e("./scrollbar").VScrollBar,c=e("./scrollbar_custom").HScrollBar,u=e("./scrollbar_custom").VScrollBar,f=e("./renderloop").RenderLoop,h=e("./layer/font_metrics").FontMetrics,p=e("./lib/event_emitter").EventEmitter,m=e("./css/editor-css"),y=e("./layer/decorators").Decorator,b=e("./lib/useragent"),v=e("./layer/text_util").isTextToken;S.importCssString(m,"ace_editor.css",!1);var $=function(){function e(e,n){var t=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 i(this.content);var D=this.$textLayer=new g(this.content);this.canvas=D.element,this.$markerFront=new i(this.content),this.$cursorLayer=new s(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new d(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new h(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){t.updateCharacterSize(),t.onResize(!0,t.gutterWidth,t.$size.width,t.$size.height),t._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=!b.isIOS,this.$loop=new f(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,t){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(!t)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,t,D){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var S=this.container;D||(D=S.clientHeight||S.scrollHeight),!D&&this.$maxLines&&this.lineHeight>1&&(!S.style.height||"0px"==S.style.height)&&(S.style.height="1px",D=S.clientHeight||S.scrollHeight),t||(t=S.clientWidth||S.scrollWidth);var a=this.$updateCachedSize(e,n,t,D);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!t&&!D)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(a|this.$changes,!0):this.$loop.schedule(a|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,t,D){D-=this.$extraHeight||0;var a=0,r=this.$size,o={width:r.width,height:r.height,scrollerHeight:r.scrollerHeight,scrollerWidth:r.scrollerWidth};if(D&&(e||r.height!=D)&&(r.height=D,a|=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",a|=this.CHANGE_SCROLL),t&&(e||r.width!=t)){a|=this.CHANGE_SIZE,r.width=t,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,t-n-this.scrollBarV.getWidth()-this.margin.h),S.setStyle(this.$gutter.style,"left",this.margin.left+"px");var i=this.scrollBarV.getWidth()+"px";S.setStyle(this.scrollBarH.element.style,"right",i),S.setStyle(this.scroller.style,"right",i),S.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(r.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(a|=this.CHANGE_FULL)}return r.$dirty=!t||!D,a&&this._signal("resize",o),a},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 t=this.$cursorLayer.$pixelPos;if(t){n&&n.markerRange&&(t=this.$cursorLayer.getPixelPosition(n.markerRange.start,!0));var D=this.layerConfig,a=t.top,r=t.left;a-=D.offset;var o=n&&n.useTextareaForIME||b.isMobile?this.lineHeight:1;if(a<0||a>D.height-o)return void S.translate(this.textarea,0,0);var i=1,g=this.$size.height-o;if(n)if(n.useTextareaForIME){var s=this.textarea.value;i=this.characterWidth*this.session.$getStringScreenWidth(s)[0]}else a+=this.lineHeight+2;else a+=this.lineHeight;r-=this.scrollLeft,r>this.$size.scrollerWidth-i&&(r=this.$size.scrollerWidth-i),r+=this.gutterWidth+this.margin.left,S.setStyle(e,"height",o+"px"),S.setStyle(e,"width",i+"px"),S.translate(this.textarea,Math.min(r,this.$size.scrollerWidth-i),Math.min(a,g))}}},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,t,D){var S=this.scrollMargin;S.top=0|e,S.bottom=0|n,S.right=0|D,S.left=0|t,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,t,D){var S=this.margin;S.top=0|e,S.bottom=0|n,S.right=0|D,S.left=0|t,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 t=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(),t.firstRow!=this.layerConfig.firstRow&&t.firstRowScreen==this.layerConfig.firstRowScreen){var D=this.scrollTop+(t.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;D>0&&(this.scrollTop=D,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}t=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),S.translate(this.content,-this.scrollLeft,-t.offset);var a=t.width+2*this.$padding+"px",r=t.minHeight+"px";S.setStyle(this.content.style,"width",a),S.setStyle(this.content.style,"height",r)}if(e&this.CHANGE_H_SCROLL&&(S.translate(this.content,-this.scrollLeft,-t.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(t),this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t),this.$markerBack.update(t),this.$markerFront.update(t),this.$cursorLayer.update(t),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(t):this.$textLayer.scrollLines(t),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(t):this.$gutterLayer.scrollLines(t)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t),this.$markerBack.update(t),this.$markerFront.update(t),this.$cursorLayer.update(t),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(t),this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(t),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(t)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(t),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(t),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(t),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,n=this.$maxLines*this.lineHeight,t=Math.min(n,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(t+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&t>this.$maxPixelHeight&&(t=this.$maxPixelHeight);var D=!(t<=2*this.lineHeight)&&e>n;if(t!=this.desiredHeight||this.$size.height!=this.desiredHeight||D!=this.$vScroll){D!=this.$vScroll&&(this.$vScroll=D,this.scrollBarV.setVisible(D));var S=this.container.clientWidth;this.container.style.height=t+"px",this.$updateCachedSize(!0,this.$gutterWidth,S,t),this.desiredHeight=t,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,n,t=this.session,D=this.$size,S=D.height<=2*this.lineHeight,a=this.session.getScreenLength()*this.lineHeight,r=this.$getLongestLine(),o=!S&&(this.$hScrollBarAlwaysVisible||D.scrollerWidth-r-2*this.$padding<0),i=this.$horizScroll!==o;i&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var g=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var s=D.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(D.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;a+=l;var d=this.scrollMargin;this.session.setScrollTop(Math.max(-d.top,Math.min(this.scrollTop,a-D.scrollerHeight+d.bottom))),this.session.setScrollLeft(Math.max(-d.left,Math.min(this.scrollLeft,r+2*this.$padding-D.scrollerWidth+d.right)));var c=!S&&(this.$vScrollBarAlwaysVisible||D.scrollerHeight-a+l<0||this.scrollTop>d.top),u=g!==c;u&&(this.$vScroll=c,this.scrollBarV.setVisible(c));var f=this.scrollTop%this.lineHeight,h=Math.ceil(s/this.lineHeight)-1,p=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),m=p+h,y=this.lineHeight;p=t.screenToDocumentRow(p,0);var b=t.getFoldLine(p);b&&(p=b.start.row),e=t.documentToScreenRow(p,0),n=t.getRowLength(p)*y,m=Math.min(t.screenToDocumentRow(m,0),t.getLength()-1),s=D.scrollerHeight+t.getRowLength(m)*y+n,f=this.scrollTop-e*y;var v=0;return(this.layerConfig.width!=r||i)&&(v=this.CHANGE_H_SCROLL),(i||u)&&(v|=this.$updateCachedSize(!0,this.gutterWidth,D.width,D.height),this._signal("scrollbarVisibilityChanged"),u&&(r=this.$getLongestLine())),this.layerConfig={width:r,padding:this.$padding,firstRow:p,firstRowScreen:e,lastRow:m,lineHeight:y,characterWidth:this.characterWidth,minHeight:s,maxHeight:a,offset:f,gutterOffset:y?Math.max(0,Math.ceil((f+D.height-D.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(r-this.$padding),v},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,n=this.$changedLines.lastRow;this.$changedLines=null;var t=this.layerConfig;if(!(e>t.lastRow+1)&&!(n<t.firstRow)){if(n===1/0){this.$showGutter&&this.$gutterLayer.update(t),this.$textLayer.update(t);return}return this.$textLayer.updateLines(t,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,t){this.scrollCursorIntoView(e,t),this.scrollCursorIntoView(n,t)},e.prototype.scrollCursorIntoView=function(e,n,t){if(0!==this.$size.scrollerHeight){var D=this.$cursorLayer.getPixelPosition(e),S=D.left,a=D.top,r=t&&t.top||0,o=t&&t.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var i=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;i+r>a?(n&&i+r>a+this.lineHeight&&(a-=n*this.$size.scrollerHeight),0===a&&(a=-this.scrollMargin.top),this.session.setScrollTop(a)):i+this.$size.scrollerHeight-o<a+this.lineHeight&&(n&&i+this.$size.scrollerHeight-o<a-this.lineHeight&&(a+=n*this.$size.scrollerHeight),this.session.setScrollTop(a+this.lineHeight+o-this.$size.scrollerHeight));var g=this.scrollLeft,s=2*this.layerConfig.characterWidth;S-s<g?((S-=s)<this.$padding+s&&(S=-this.scrollMargin.left),this.session.setScrollLeft(S)):(S+=s,g+this.$size.scrollerWidth<S+this.characterWidth?this.session.setScrollLeft(Math.round(S+this.characterWidth-this.$size.scrollerWidth)):g<=this.$padding&&S-g<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 t=this.$cursorLayer.getPixelPosition(e),D=this.$size.scrollerHeight-this.lineHeight,S=t.top-D*(n||0);return this.session.setScrollTop(S),S},e.prototype.$calcSteps=function(e,n){var t=0,D=this.STEPS,S=[],a=function(e,n,t){return t*(Math.pow(e-1,3)+1)+n};for(t=0;t<D;++t)S.push(a(t/this.STEPS,e,n-e));return S},e.prototype.scrollToLine=function(e,n,t,D){var S=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;n&&(S-=this.$size.scrollerHeight/2);var a=this.scrollTop;this.session.setScrollTop(S),!1!==t&&this.animateScrolling(a,D)},e.prototype.animateScrolling=function(e,n){var t=this.scrollTop;if(this.$animatedScroll){var D=this;if(e!=t){if(this.$scrollAnimation){var S=this.$scrollAnimation.steps;if(S.length&&(e=S[0])==t)return}var a=D.$calcSteps(e,t);this.$scrollAnimation={from:e,to:t,steps:a},clearInterval(this.$timer),D.session.setScrollTop(a.shift()),D.session.$scrollTop=t,this.$timer=setInterval(function(){return D.$stopAnimation?void r():D.session?void(a.length?(D.session.setScrollTop(a.shift()),D.session.$scrollTop=t):null!=t?(D.session.$scrollTop=-1,D.session.setScrollTop(t),t=null):r()):clearInterval(D.$timer)},10)}}function r(){D.$timer=clearInterval(D.$timer),D.$scrollAnimation=null,D.$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 t={top:0,left:0},D=this.$fontMetrics.transformCoordinates([e,n]);e=D[1]-this.gutterWidth-this.margin.left,n=D[0]}else t=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-t.left-this.$padding,a=S/this.characterWidth,r=Math.floor((n+this.scrollTop-t.top)/this.lineHeight),o=this.$blockCursor?Math.floor(a):Math.round(a);return{row:r,column:o,side:a-o>0?1:-1,offsetX:S}},e.prototype.screenToTextCoordinates=function(e,n){if(this.$hasCssTransforms){var t={top:0,left:0},D=this.$fontMetrics.transformCoordinates([e,n]);e=D[1]-this.gutterWidth-this.margin.left,n=D[0]}else t=this.scroller.getBoundingClientRect();var S=e+this.scrollLeft-t.left-this.$padding,a=S/this.characterWidth,r=this.$blockCursor?Math.floor(a):Math.round(a),o=Math.floor((n+this.scrollTop-t.top)/this.lineHeight);return this.session.screenToDocumentPosition(o,Math.max(r,0),S)},e.prototype.textToScreenCoordinates=function(e,n){var t=this.scroller.getBoundingClientRect(),D=this.session.documentToScreenPosition(e,n),S=this.$padding+(this.session.$bidiHandler.isBidiRow(D.row,e)?this.session.$bidiHandler.getPosLeft(D.column):Math.round(D.column*this.characterWidth)),a=D.row*this.lineHeight;return{pageX:t.left+S-this.scrollLeft,pageY:t.top+a-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 t=this.session.selection.cursor,D=n||{row:t.row,column:t.column};this.removeGhostText();var a=this.$calculateWrappedTextChunks(e,D);this.addToken(a[0].text,"ghost_text",D.row,D.column),this.$ghostText={text:e,position:{row:D.row,column:D.column}};var r=S.createElement("div");if(a.length>1){var o,i=this.hideTokensAfterPosition(D.row,D.column);a.slice(1).forEach(function(e){var n=S.createElement("div"),t=S.createElement("span");t.className="ace_ghost_text",e.wrapped&&(n.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),t.appendChild(S.createTextNode(e.text)),n.appendChild(t),r.appendChild(n),o=n}),i.forEach(function(e){var n=S.createElement("span");v(e.type)||(n.className="ace_"+e.type.replace(/\./g," ace_")),n.appendChild(S.createTextNode(e.value)),o.appendChild(n)}),this.$ghostTextWidget={el:r,row:D.row,column:D.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var g=this.$cursorLayer.getPixelPosition(D,!0),s=this.container.getBoundingClientRect().height,l=a.length*this.lineHeight;if(l<s-g.top)return;l<s?this.scrollBy(0,(a.length-1)*this.lineHeight):this.scrollToRow(D.row)}},e.prototype.$calculateWrappedTextChunks=function(e,n){var t=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;t=t<=0?60:t;for(var D=e.split(/\r?\n/),S=[],a=0;a<D.length;a++){var r=this.session.$getDisplayTokens(D[a],n.column),o=this.session.$computeWrapSplits(r,t,this.session.$tabSize);if(o.length>0){var i=0;o.push(D[a].length);for(var g=0;g<o.length;g++){var s=D[a].slice(i,o[g]);S.push({text:s,wrapped:!0}),i=o[g]}}else S.push({text:D[a],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,t,D){var S=this.session;S.bgTokenizer.lines[t]=null;var a={type:n,value:e},r=S.getTokens(t);if(null!=D&&r.length)for(var o=0,i=0;i<r.length;i++){var g=r[i];if(D<=(o+=g.value.length)){var s=g.value.length-(o-D),l=g.value.slice(0,s),d=g.value.slice(s);r.splice(i,1,{type:g.type,value:l},a,{type:g.type,value:d});break}}else r.push(a);this.updateLines(t,t)},e.prototype.hideTokensAfterPosition=function(e,n){for(var t=this.session.getTokens(e),D=0,S=!1,a=[],r=0;r<t.length;r++){var o=t[r];if(D+=o.value.length,"ghost_text"!==o.type){if(S){a.push({type:o.type,value:o.value}),o.type="hidden_token";continue}D===n&&(S=!0)}}return this.updateLines(e,e),a},e.prototype.removeExtraToken=function(e,n){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,n){var t=this;if(this.$themeId=e,t._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)a(e);else{var D=e||this.$options.theme.initialValue;r.loadModule(["theme",D],a)}function a(D){if(t.$themeId!=e)return n&&n();if(!D||!D.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");D.$id&&(t.$themeId=D.$id),S.importCssString(D.cssText,D.cssClass,t.container),t.theme&&S.removeCssClass(t.container,t.theme.cssClass);var a="padding"in D?D.padding:"padding"in(t.theme||{})?4:t.$padding;t.$padding&&a!=t.$padding&&t.setPadding(a),t.$theme=D.cssClass,t.theme=D,S.addCssClass(t.container,D.cssClass),S.setCssClass(t.container,"ace_dark",D.isDark),t.$size&&(t.$size.width=0,t.$updateSizeAsync()),t._dispatchEvent("themeLoaded",{theme:D}),n&&n(),b.isSafari&&t.scroller&&(t.scroller.style.background="red",t.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 u(this.container,this),this.scrollBarH=new c(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 d(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=a.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(n){var t=n[0].contentRect.width,D=n[0].contentRect.height;Math.abs(e.$size.width-t)>1||Math.abs(e.$size.height-D)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();$.prototype.CHANGE_CURSOR=1,$.prototype.CHANGE_MARKER=2,$.prototype.CHANGE_GUTTER=4,$.prototype.CHANGE_SCROLL=8,$.prototype.CHANGE_LINES=16,$.prototype.CHANGE_TEXT=32,$.prototype.CHANGE_SIZE=64,$.prototype.CHANGE_MARKER_BACK=128,$.prototype.CHANGE_MARKER_FRONT=256,$.prototype.CHANGE_FULL=512,$.prototype.CHANGE_H_SCROLL=1024,$.prototype.$changes=0,$.prototype.$padding=null,$.prototype.$frozen=!1,$.prototype.STEPS=8,D.implement($.prototype,p),r.defineOptions($.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:!b.isMobile&&!b.isIE}}),n.VirtualRenderer=$}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,n,t){"use strict";var D=e("../lib/oop"),S=e("../lib/net"),a=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 t=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return t.append(n),t.getBlob("application/javascript")}}function i(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 g=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(){D.implement(this,a),this.$createWorkerFromOldConfig=function(n,t,D,S,a){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),r.get("packaged")||!e.toUrl)S=S||r.moduleUrl(t,"worker");else{var o=this.$normalizePath;S=S||o(e.toUrl("ace/worker/worker.js",null,"_"));var g={};n.forEach(function(n){g[n]=o(e.toUrl(n,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=i(S),a&&this.send("importScripts",a),this.$worker.postMessage({init:!0,tlns:g,module:t,classname:D}),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 t=this.callbacks[n.id];t&&(t(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,t){if(t){var D=this.callbackId++;this.callbacks[D]=t,n.push(D)}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(g.prototype),n.UIWorkerClient=function(e,n,t){var D=null,S=!1,o=Object.create(a),i=[],s=new g({messageBuffer:i,terminate:function(){},postMessage:function(e){i.push(e),D&&(S?setTimeout(l):l())}});s.setEmitSync=function(e){S=e};var l=function(){var e=i.shift();e.command?D[e.command].apply(D,e.args):e.event&&o._signal(e.event,e.data)};return o.postMessage=function(e){s.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(D=new e[t](o);i.length;)l()}),s},n.WorkerClient=g,n.createWorker=i}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,n,t){"use strict";var D=e("./range").Range,S=e("./lib/event_emitter").EventEmitter,a=e("./lib/oop"),r=function(){function e(e,n,t,D,S,a){var r=this;this.length=n,this.session=e,this.doc=e.getDocument(),this.mainClass=S,this.othersClass=a,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=D,this.$onCursorChange=function(){setTimeout(function(){r.onCursorChange()})},this.$pos=t;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,t=this.session;this.selectionBefore=t.selection.toJSON(),t.selection.inMultiSelectMode&&t.selection.toSingleRange(),this.pos=n.createAnchor(this.$pos.row,this.$pos.column);var S=this.pos;S.$insertRight=!0,S.detach(),S.markerId=t.addMarker(new D(S.row,S.column,S.row,S.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(t){var D=n.createAnchor(t.row,t.column);D.$insertRight=!0,D.detach(),e.others.push(D)}),t.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,n=this;this.othersActive=!0,this.others.forEach(function(t){t.markerId=e.addMarker(new D(t.row,t.column,t.row,t.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 t="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,a=n.start.column-this.pos.column;if(this.updateAnchors(e),S&&(this.length+=t),S&&!this.session.$fromUndo){if("insert"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],i={row:o.row,column:o.column+a};this.doc.insertMergedLines(i,e.lines)}else if("remove"===e.action)for(var r=this.others.length-1;r>=0;r--){var o=this.others[r],i={row:o.row,column:o.column+a};this.doc.remove(new D(i.row,i.column,i.row,i.column-t))}}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,t=function(t,S){n.removeMarker(t.markerId),t.markerId=n.addMarker(new D(t.row,t.column,t.row,t.column+e.length),S,null,!1)};t(this.pos,this.mainClass);for(var S=this.others.length;S--;)t(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,t=0;t<n;t++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();a.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,t){var D=e("../lib/event"),S=e("../lib/useragent");function a(e,n){return e.row==n.row&&e.column==n.column}n.onMouseDown=function(e){var n=e.domEvent,t=n.altKey,r=n.shiftKey,o=n.ctrlKey,i=e.getAccelKey(),g=e.getButton();if(o&&S.isMac&&(g=n.button),e.editor.inMultiSelectMode&&2==g)return void e.editor.textInput.onContextMenu(e.domEvent);if(!o&&!t&&!i){0===g&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===g){var s=e.editor,l=s.selection,d=s.inMultiSelectMode,c=e.getDocumentPosition(),u=l.getCursor(),f=e.inSelection()||l.isEmpty()&&a(c,u),h=e.x,p=e.y,m=function(e){h=e.clientX,p=e.clientY},y=s.session,b=s.renderer.pixelToScreenCoordinates(h,p),v=b;if(s.$mouseHandler.$enableJumpToDef)o&&t||i&&t?_=r?"block":"add":t&&s.$blockSelectEnabled&&(_="block");else if(i&&!t){if(_="add",!d&&r)return}else t&&s.$blockSelectEnabled&&(_="block");if(_&&S.isMac&&n.ctrlKey&&s.$mouseHandler.cancelContextMenu(),"add"==_){if(!d&&f)return;if(!d){var $=l.toOrientedRange();s.addSelectionMarker($)}var w=l.rangeList.rangeAtPoint(c);s.inVirtualSelectionMode=!0,r&&(w=null,$=l.ranges[0]||$,s.removeSelectionMarker($)),s.once("mouseup",function(){var e=l.toOrientedRange();w&&e.isEmpty()&&a(w.cursor,e.cursor)?l.substractPoint(e.cursor):(r?l.substractPoint($.cursor):$&&(s.removeSelectionMarker($),l.addRange($)),l.addRange(e)),s.inVirtualSelectionMode=!1})}else if("block"==_){e.stop(),s.inVirtualSelectionMode=!0;var _,A,M=[],x=function(){var e=s.renderer.pixelToScreenCoordinates(h,p),n=y.screenToDocumentPosition(e.row,e.column,e.offsetX);a(v,e)&&a(n,l.lead)||(v=e,s.selection.moveToPosition(n),s.renderer.scrollCursorIntoView(),s.removeSelectionMarkers(M),M=l.rectangularRangeBlock(v,b),s.$mouseHandler.$clickSelection&&1==M.length&&M[0].isEmpty()&&(M[0]=s.$mouseHandler.$clickSelection.clone()),M.forEach(s.addSelectionMarker,s),s.updateSelectionMarkers())};d&&!i?l.toSingleRange():!d&&i&&(A=l.toOrientedRange(),s.addSelectionMarker(A)),r?b=y.documentToScreenPosition(l.lead):l.moveToPosition(c),v={row:-1,column:-1};var L=function(e){x(),clearInterval(k),s.removeSelectionMarkers(M),M.length||(M=[l.toOrientedRange()]),A&&(s.removeSelectionMarker(A),l.toSingleRange(A));for(var n=0;n<M.length;n++)l.addRange(M[n]);s.inVirtualSelectionMode=!1,s.$mouseHandler.$clickSelection=null},C=x;D.capture(s.container,m,L);var k=setInterval(function(){C()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,n,t){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,t){var D=e("./range_list").RangeList,S=e("./range").Range,a=e("./selection").Selection,r=e("./mouse/multi_select_handler").onMouseDown,o=e("./lib/event"),i=e("./lib/lang"),g=e("./commands/multi_select_commands");n.commands=g.defaultCommands.concat(g.multiSelectCommands);var s=new(e("./search")).Search;function l(e,n,t){return s.$options.wrap=!0,s.$options.needle=n,s.$options.backwards=-1==t,s.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 t=this.toOrientedRange();if(this.rangeList.add(t),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),n||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(t),this.$onAddRange(t)}e.cursor||(e.cursor=e.end);var D=this.rangeList.add(e);return this.$onAddRange(e),D.length&&this.$onRemoveRange(D),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 t=e.length;t--;){var D=this.ranges.indexOf(e[t]);this.ranges.splice(D,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 D,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=[],t=0;t<e.length;t++){var D=e[t],a=D.start.row,r=D.end.row;if(a===r)n.push(D.clone());else{for(n.push(new S(a,D.start.column,a,this.session.getLine(a).length));++a<r;)n.push(this.getLineRange(a,!0));n.push(new S(r,0,r,D.end.column))}0!=t||this.isBackwards()||(n=n.reverse())}this.toSingleRange();for(var t=n.length;t--;)this.addRange(n[t])},this.joinSelections=function(){var e=this.rangeList.ranges,n=e[e.length-1],t=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(t,n.cursor==n.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,n=e[e.length-1],t=S.fromPoints(e[0].start,n.end);this.toSingleRange(),this.setSelectionRange(t,n.cursor==n.start)}else{var D=this.session.documentToScreenPosition(this.cursor),a=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(D,a).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,n,t){var D,a=[],r=e.column<n.column;if(r)var o=e.column,i=n.column,g=e.offsetX,s=n.offsetX;else var o=n.column,i=e.column,g=n.offsetX,s=e.offsetX;var l=e.row<n.row;if(l)var d=e.row,u=n.row;else var d=n.row,u=e.row;o<0&&(o=0),d<0&&(d=0),d==u&&(t=!0);for(var f=d;f<=u;f++){var h=S.fromPoints(this.session.screenToDocumentPosition(f,o,g),this.session.screenToDocumentPosition(f,i,s));if(h.isEmpty()){if(D&&c(h.end,D))break;D=h.end}h.cursor=r?h.start:h.end,a.push(h)}if(l&&a.reverse(),!t){for(var p=a.length-1;a[p].isEmpty()&&p>0;)p--;if(p>0)for(var m=0;a[m].isEmpty();)m++;for(var y=p;y>=m;y--)a[y].isEmpty()&&a.splice(y,1)}return a}}).call(a.prototype);var d=e("./editor").Editor;function c(e,n){return e.row==n.row&&e.column==n.column}function u(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(g.defaultCommands),f(e))}function f(e){if(e.textInput){var n=e.textInput.getElement(),t=!1;o.addListener(n,"keydown",function(n){var S=18==n.keyCode&&!(n.ctrlKey||n.shiftKey||n.metaKey);e.$blockSelectEnabled&&S?t||(e.renderer.setMouseCursor("crosshair"),t=!0):t&&D()},e),o.addListener(n,"keyup",D,e),o.addListener(n,"blur",D,e)}function D(n){t&&(e.renderer.setMouseCursor(""),t=!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,t=e.length;t--;){var D=e[t];if(D.marker){this.session.removeMarker(D.marker);var S=n.indexOf(D);-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(g.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(g.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var n=e.command,t=e.editor;if(t.multiSelect){if(n.multiSelectAction)"forEach"==n.multiSelectAction?D=t.forEachSelection(n,e.args):"forEachLine"==n.multiSelectAction?D=t.forEachSelection(n,e.args,!0):"single"==n.multiSelectAction?(t.exitMultiSelectMode(),D=n.exec(t,e.args||{})):D=n.multiSelectAction(t,e.args||{});else{var D=n.exec(t,e.args||{});t.multiSelect.addRange(t.multiSelect.toOrientedRange()),t.multiSelect.mergeOverlappingRanges()}return D}},this.forEachSelection=function(e,n,t){if(!this.inVirtualSelectionMode){var D,S=t&&t.keepOrder,r=!0==t||t&&t.$byLines,o=this.session,i=this.selection,g=i.rangeList,s=(S?i:g).ranges;if(!s.length)return e.exec?e.exec(this,n||{}):e(this,n||{});var l=i._eventRegistry;i._eventRegistry={};var d=new a(o);this.inVirtualSelectionMode=!0;for(var c=s.length;c--;){if(r)for(;c>0&&s[c].start.row==s[c-1].end.row;)c--;d.fromOrientedRange(s[c]),d.index=c,this.selection=o.selection=d;var u=e.exec?e.exec(this,n||{}):e(this,n||{});D||void 0===u||(D=u),d.toOrientedRange(s[c])}d.detach(),this.selection=o.selection=i,this.inVirtualSelectionMode=!1,i._eventRegistry=l,i.mergeOverlappingRanges(),i.ranges[0]&&i.fromOrientedRange(i.ranges[0]);var f=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),f&&f.from==f.to&&this.renderer.animateScrolling(f.from),D}},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,t=[],D=0;D<n.length;D++)t.push(this.session.getTextRange(n[D]));var S=this.session.getDocument().getNewLineCharacter();(e=t.join(S)).length==(t.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 t=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||n!=this.multiSelect.anchor){var D=n==this.multiSelect.anchor?t.cursor==t.start?t.end:t.start:t.cursor;D.row!=n.row||this.session.$clipPositionToDocument(D.row,D.column).column!=n.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,n,t){if((n=n||{}).needle=e||n.needle,void 0==n.needle){var D=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();n.needle=this.session.getTextRange(D)}this.$search.set(n);var S=this.$search.findAll(this.session);if(!S.length)return 0;var a=this.multiSelect;t||a.toSingleRange(S[0]);for(var r=S.length;r--;)a.addRange(S[r],!0);return D&&a.rangeList.rangeAtPoint(D.start)&&a.addRange(D,!0),S.length},this.selectMoreLines=function(e,n){var t=this.selection.toOrientedRange(),D=t.cursor==t.end,a=this.session.documentToScreenPosition(t.cursor);this.selection.$desiredColumn&&(a.column=this.selection.$desiredColumn);var r=this.session.screenToDocumentPosition(a.row+e,a.column);if(t.isEmpty())var o=r;else var i=this.session.documentToScreenPosition(D?t.end:t.start),o=this.session.screenToDocumentPosition(i.row+e,i.column);if(D){var g=S.fromPoints(r,o);g.cursor=g.start}else{var g=S.fromPoints(o,r);g.cursor=g.end}if(g.desiredColumn=a.column,this.selection.inMultiSelectMode){if(n)var s=t.cursor}else this.selection.addRange(t);this.selection.addRange(g),s&&this.selection.substractPoint(s)},this.transposeSelections=function(e){for(var n=this.session,t=n.multiSelect,D=t.ranges,S=D.length;S--;){var a=D[S];if(a.isEmpty()){var r=n.getWordRange(a.start.row,a.start.column);a.start.row=r.start.row,a.start.column=r.start.column,a.end.row=r.end.row,a.end.column=r.end.column}}t.mergeOverlappingRanges();for(var o=[],S=D.length;S--;){var a=D[S];o.unshift(n.getTextRange(a))}e<0?o.unshift(o.pop()):o.push(o.shift());for(var S=D.length;S--;){var a=D[S],i=a.clone();n.replace(a,o[S]),a.start.row=i.start.row,a.start.column=i.start.column}t.fromOrientedRange(t.ranges[0])},this.selectMore=function(e,n,t){var D=this.session,S=D.multiSelect.toOrientedRange();if(!S.isEmpty()||((S=D.getWordRange(S.start.row,S.start.column)).cursor=-1==e?S.start:S.end,this.multiSelect.addRange(S),!t)){var a=D.getTextRange(S),r=l(D,a,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,t=n.ranges,D=-1,a=t.filter(function(e){if(e.cursor.row==D)return!0;D=e.cursor.row});if(t.length&&a.length!=t.length-1){a.forEach(function(e){n.substractPoint(e.cursor)});var r=0,o=1/0,g=t.map(function(n){var t=n.cursor,D=e.getLine(t.row).substr(t.column).search(/\S/g);return -1==D&&(D=0),t.column>r&&(r=t.column),D<o&&(o=D),D});t.forEach(function(n,t){var D=n.cursor,a=r-D.column,s=g[t]-o;a>s?e.insert(D,i.stringRepeat(" ",a-s)):e.remove(new S(D.row,D.column,D.row,D.column-a+s)),n.start.column=n.end.column=r,n.start.row=n.end.row=D.row,n.cursor=n.end}),n.fromOrientedRange(t[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var s=this.selection.getRange(),l=s.start.row,d=s.end.row,c=l==d;if(c){var u,f=this.session.getLength();do u=this.session.getLine(d);while(/[=:]/.test(u)&&++d<f);do u=this.session.getLine(l);while(/[=:]/.test(u)&&--l>0);l<0&&(l=0),d>=f&&(d=f-1)}var h=this.session.removeFullLines(l,d);h=this.$reAlignText(h,c),this.session.insert({row:l,column:0},h.join("\n")+"\n"),c||(s.start.column=0,s.end.column=h[h.length-1].length),this.selection.setRange(s)}},this.$reAlignText=function(e,n){var t,D,S,a=!0,r=!0;return e.map(function(e){var n=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return n?(null==t?(t=n[1].length,D=n[2].length,S=n[3].length):(t+D+S!=n[1].length+n[2].length+n[3].length&&(r=!1),t!=n[1].length&&(a=!1),t>n[1].length&&(t=n[1].length),D<n[2].length&&(D=n[2].length),S>n[3].length&&(S=n[3].length)),n):[e]}).map(n?g:a?r?s:g:l);function o(e){return i.stringRepeat(" ",e)}function g(e){return e[2]?o(t)+e[2]+o(D-e[2].length+S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function s(e){return e[2]?o(t+D-e[2].length)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?o(t)+e[2]+o(S)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(d.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 t=e.oldSession;t&&(t.multiSelect.off("addRange",this.$onAddRange),t.multiSelect.off("removeRange",this.$onRemoveRange),t.multiSelect.off("multiSelect",this.$onMultiSelect),t.multiSelect.off("singleSelect",this.$onSingleSelect),t.multiSelect.lead.off("change",this.$checkMultiselectChange),t.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=u,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){u(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,t){"use strict";var D=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,n,t){var D=e.getLine(t);return this.foldingStartMarker.test(D)?"start":"markbeginend"==n&&this.foldingStopMarker&&this.foldingStopMarker.test(D)?"end":""},this.getFoldWidgetRange=function(e,n,t){return null},this.indentationBlock=function(e,n,t){var S=/\S/,a=e.getLine(n),r=a.search(S);if(-1!=r){for(var o=t||a.length,i=e.getLength(),g=n,s=n;++n<i;){var l=e.getLine(n).search(S);if(-1!=l){if(l<=r){var d=e.getTokenAt(n,0);if(!d||"string"!==d.type)break}s=n}}if(s>g){var c=e.getLine(s).length;return new D(g,o,s,c)}}},this.openingBracketBlock=function(e,n,t,S,a){var r={row:t,column:S+1},o=e.$findClosingBracket(n,r,a);if(o){var i=e.foldWidgets[o.row];return null==i&&(i=e.getFoldWidget(o.row)),"start"==i&&o.row>r.row&&(o.row--,o.column=e.getLine(o.row).length),D.fromPoints(r,o)}},this.closingBracketBlock=function(e,n,t,S,a){var r={row:t,column:S},o=e.$findOpeningBracket(n,r);if(o)return o.column++,r.column--,D.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,t){"use strict";var D=e("../line_widgets").LineWidgets,S=e("../lib/dom"),a=e("../range").Range,r=e("../config").nls;function o(e,n,t){for(var D=0,S=e.length-1;D<=S;){var a=D+S>>1,r=t(n,e[a]);if(r>0)D=a+1;else{if(!(r<0))return a;S=a-1}}return-(D+1)}function i(e,n,t){var D=e.getAnnotations().sort(a.comparePoints);if(D.length){var S=o(D,{row:n,column:-1},a.comparePoints);S<0&&(S=-S-1),S>=D.length?S=t>0?0:D.length-1:0===S&&t<0&&(S=D.length-1);var r=D[S];if(r&&t){if(r.row===n){do r=D[S+=t];while(r&&r.row===n);if(!r)return D.slice()}var i=[];n=r.row;do i[t<0?"unshift":"push"](r),r=D[S+=t];while(r&&r.row==n);return i.length&&i}}}n.showErrorMarker=function(e,n){var t,a=e.session;a.widgetManager||(a.widgetManager=new D(a),a.widgetManager.attach(e));var o=e.getCursorPosition(),g=o.row,s=a.widgetManager.getWidgetsAtRow(g).filter(function(e){return"errorMarker"==e.type})[0];s?s.destroy():g-=n;var l=i(a,g,n);if(l){var d=l[0];o.column=(d.pos&&"number"!=typeof d.column?d.pos.sc:d.column)||0,o.row=d.row,t=e.renderer.$gutterLayer.$annotations[o.row]}else{if(s)return;t={displayText:[r("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(o.row),e.selection.moveToPosition(o);var c={row:o.row,fixedWidth:!0,coverGutter:!0,el:S.createElement("div"),type:"errorMarker"},u=c.el.appendChild(S.createElement("div")),f=c.el.appendChild(S.createElement("div"));f.className="error_widget_arrow "+t.className;var h=e.renderer.$cursorLayer.getPixelPosition(o).left;f.style.left=h+e.renderer.gutterWidth-5+"px",c.el.className="error_widget_wrapper",u.className="error_widget "+t.className,t.displayText.forEach(function(e,n){u.appendChild(S.createTextNode(e)),n<t.displayText.length-1&&u.appendChild(S.createElement("br"))}),u.appendChild(S.createElement("div"));var p=function(e,n,t){if(0===n&&("esc"===t||"return"===t))return c.destroy(),{command:"null"}};c.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(p),a.widgetManager.removeLineWidget(c),e.off("changeSelection",c.destroy),e.off("changeSession",c.destroy),e.off("mouseup",c.destroy),e.off("change",c.destroy))},e.keyBinding.addKeyboardHandler(p),e.on("changeSelection",c.destroy),e.on("changeSession",c.destroy),e.on("mouseup",c.destroy),e.on("change",c.destroy),e.session.widgetManager.addLineWidget(c),c.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:c.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,t){"use strict";e("./loader_build")(n);var D=e("./lib/dom"),S=e("./range").Range,a=e("./editor").Editor,r=e("./edit_session").EditSession,o=e("./undomanager").UndoManager,i=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,t){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 a)return e.env.editor;var r="";if(e&&/input|textarea/i.test(e.tagName)){var o=e;r=o.value,e=D.createElement("pre"),o.parentNode.replaceChild(e,o)}else e&&(r=e.textContent,e.innerHTML="");var g=n.createEditSession(r),s=new a(new i(e),g,t),l={document:g,editor:s,onResize:s.resize.bind(s,null)};return o&&(l.textarea=o),s.on("destroy",function(){l.editor.container.env=null}),s.container.env=s.env=l,s},n.createEditSession=function(e,n){var t=new r(e,n);return t.setUndoManager(new o),t},n.Range=S,n.Editor=a,n.EditSession=r,n.UndoManager=o,n.VirtualRenderer=i,n.version=n.config.version}),function(){ace.require(["ace/ace"],function(n){n&&(n.config.init(!0),n.define=ace.define);var t=function(){return this}();for(var D in!t&&"u">typeof window&&(t=window),!t&&"u">typeof self&&(t=self),t.ace||(t.ace=n),n)n.hasOwnProperty(D)&&(t.ace[D]=n[D]);t.ace.default=t.ace,e&&(e.exports=t.ace)})}()},20047(e,n,t){e=t.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,t){"use strict";var D=e("./lib/dom"),S=e("./lib/oop"),a=e("./lib/event_emitter").EventEmitter,r=e("./lib/lang"),o=e("./range").Range,i=e("./range_list").RangeList,g=e("./keyboard/hash_handler").HashHandler,s=e("./tokenizer").Tokenizer,l=e("./clipboard"),d={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,n,t){var D=e.session.getTextRange();return t?D.replace(/\n\r?([ \t]*\S)/g,"\n"+t+"$1"):D},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:c.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:c.bind(null,{year:"2-digit"}),CURRENT_MONTH:c.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:c.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:c.bind(null,{month:"short"}),CURRENT_DATE:c.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:c.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:c.bind(null,{weekday:"short"}),CURRENT_HOUR:c.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:c.bind(null,{minute:"2-digit"}),CURRENT_SECOND:c.bind(null,{second:"2-digit"})};function c(e){var n=new Date().toLocaleString("en-us",e);return 1==n.length?"0"+n:n}d.SELECTED_TEXT=d.SELECTION;var u=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=d}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 t(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var D={regex:"/("+t("/")+"+)/",onMatch:function(e,n,t){var D=t[0];return D.fmtString=!0,D.guard=e.slice(1,-1),D.flag="",""},next:"formatString"};return e.$tokenizer=new s({start:[{regex:/\\./,onMatch:function(e,n,t){var D=e[1];return"}"==D&&t.length?e=D:-1!="`$\\".indexOf(D)&&(e=D),[e]}},{regex:/}/,onMatch:function(e,n,t){return[t.length?t.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:n},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,t,D){var S=n(e.substr(1));return D.unshift(S[0]),S},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+t("\\|")+"*\\|",onMatch:function(e,n,t){var D=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return t[0].choices=D,[D[0]]},next:"start"},D,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,n,t){return t.length&&t[0].expectElse?(t[0].expectElse=!1,t[0].ifEnd={elseEnd:t[0]},[t[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,n,t){var D=e[1];return"}"==D&&t.length||-1!="`$\\".indexOf(D)?e=D:"n"==D?e="\n":"t"==D?e=" ":-1!="ulULE".indexOf(D)&&(e={changeCase:D,local:D>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,n,t){var D=t.shift();return D&&(D.flag=e.slice(1,-1)),this.next=D&&D.tabstopId?"start":"",[D||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,n,t){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,n,t){var D={text:e.slice(2)};return t.unshift(D),[D]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,n,t){var D=t.shift();return this.next=D&&D.tabstopId?"start":"",[D||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,n,t){return t[0].formatFunction=e.slice(2,-1),[t.shift()]},next:"formatString"},D,{regex:/:[\?\-+]?/,onMatch:function(e,n,t){"+"==e[1]&&(t[0].ifEnd=t[0]),"?"==e[1]&&(t[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,t){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 D=this.variables[n];return"function"==typeof D&&(D=this.variables[n](e,n,t)),null==D?"":D},e.prototype.tmStrFormat=function(e,n,t){if(!n.fmt)return e;var D=n.flag||"",S=n.guard;S=new RegExp(S,D.replace(/[^gim]/g,""));var a="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(a,t),D="E",S=0;S<n.length;S++){var o=n[S];if("object"==typeof o)if(n[S]="",o.changeCase&&o.local){var i=n[S+1];i&&"string"==typeof i&&("u"==o.changeCase?n[S]=i[0].toUpperCase():n[S]=i[0].toLowerCase(),n[S+1]=i.substr(1))}else o.changeCase&&(D=o.changeCase);else"U"==D?n[S]=o.toUpperCase():"L"==D&&(n[S]=o.toLowerCase())}return r.variables.__=e,n.join("")})},e.prototype.tmFormatFunction=function(e,n,t){return"upcase"==n.formatFunction?e.toUpperCase():"downcase"==n.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,n){for(var t=[],D="",S=!0,a=0;a<e.length;a++){var r=e[a];if("string"==typeof r){t.push(r),"\n"==r?(S=!0,D=""):S&&(D=/^\t*/.exec(r)[0],S=/\S/.test(r));continue}if(r){if(S=!1,r.fmtString){var o=e.indexOf(r,a+1);-1==o&&(o=e.length),r.fmt=e.slice(a+1,o),a=o}if(r.text){var i=this.getVariableValue(n,r.text,D)+"";r.fmtString&&(i=this.tmStrFormat(i,r,n)),r.formatFunction&&(i=this.tmFormatFunction(i,r,n)),i&&!r.ifEnd?(t.push(i),g(r)):!i&&r.ifEnd&&g(r.ifEnd)}else r.elseEnd?g(r.elseEnd):null!=r.tabstopId?t.push(r):null!=r.changeCase&&t.push(r)}}function g(n){var t=e.indexOf(n,a+1);-1!=t&&(a=t)}return t},e.prototype.getDisplayTextForSnippet=function(e,n){return f.call(this,e,n).text},e.prototype.insertSnippetForSelection=function(e,n,t){void 0===t&&(t={});var D=f.call(this,e,n,t),S=e.getSelectionRange(),a=e.session.replace(S,D.text),r=new h(e),o=e.inVirtualSelectionMode&&e.selection.index;r.addTabstops(D.tabstops,S.start,a,o)},e.prototype.insertSnippet=function(e,n,t){void 0===t&&(t={});var D=this;if(e.inVirtualSelectionMode)return D.insertSnippetForSelection(e,n,t);e.forEachSelection(function(){D.insertSnippetForSelection(e,n,t)},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 t=e.getCursorPosition(),D=e.session.getState(t.row);"object"==typeof D&&(D=D[0]),D.substring&&("js-"==D.substring(0,3)?n="javascript":"css-"==D.substring(0,4)?n="css":"php-"==D.substring(0,4)&&(n="php"))}return n},e.prototype.getActiveScopes=function(e){var n=this.$getScope(e),t=[n],D=this.snippetMap;return D[n]&&D[n].includeScopes&&t.push.apply(t,D[n].includeScopes),t.push("_"),t},e.prototype.expandWithTab=function(e,n){var t=this,D=e.forEachSelection(function(){return t.expandSnippetForSelection(e,n)},null,{keepOrder:!0});return D&&e.tabstopManager&&e.tabstopManager.tabNext(),D},e.prototype.expandSnippetForSelection=function(e,n){var t,D=e.getCursorPosition(),S=e.session.getLine(D.row),a=S.substring(0,D.column),r=S.substr(D.column),o=this.snippetMap;return this.getActiveScopes(e).some(function(e){var n=o[e];return n&&(t=this.findMatchingSnippet(n,a,r)),!!t},this),!!t&&(!!n&&!!n.dryRun||(e.session.doc.removeInLine(D.row,D.column-t.replaceBefore.length,D.column+t.replaceAfter.length),this.variables.M__=t.matchBefore,this.variables.T__=t.matchAfter,this.insertSnippetForSelection(e,t.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,n,t){for(var D=e.length;D--;){var S=e[D];if((!S.startRe||S.startRe.test(n))&&(!S.endRe||S.endRe.test(t))&&(S.startRe||S.endRe))return S.matchBefore=S.startRe?S.startRe.exec(n):[""],S.matchAfter=S.endRe?S.endRe.exec(t):[""],S.replaceBefore=S.triggerRe?S.triggerRe.exec(n)[0]:"",S.replaceAfter=S.endTriggerRe?S.endTriggerRe.exec(t)[0]:"",S}},e.prototype.register=function(e,n){var t=this.snippetMap,D=this.snippetNameMap,S=this;function a(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function o(e,n,t){return e=a(e),n=a(n),t?(e=n+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=n)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function i(e){e.scope||(e.scope=n||"_"),t[n=e.scope]||(t[n]=[],D[n]={});var a=D[n];if(e.name){var i=a[e.name];i&&S.unregister(i),a[e.name]=e}t[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(i):Object.keys(e).forEach(function(n){i(e[n])}),this._signal("registerSnippets",{scope:n})},e.prototype.unregister=function(e,n){var t=this.snippetMap,D=this.snippetNameMap;function S(e){var S=D[e.scope||n];if(S&&S[e.name]){delete S[e.name];var a=t[e.scope||n],r=a&&a.indexOf(e);r>=0&&a.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,t=[],D={},S=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;n=S.exec(e);){if(n[1])try{D=JSON.parse(n[1]),t.push(D)}catch(e){}if(n[4])D.content=n[4].replace(/^\t/gm,""),t.push(D),D={};else{var a=n[2],r=n[3];if("regex"==a){var o=/\/((?:[^\/\\]|\\.)*)|$/g;D.guard=o.exec(r)[1],D.trigger=o.exec(r)[1],D.endTrigger=o.exec(r)[1],D.endGuard=o.exec(r)[1]}else"snippet"==a?(D.tabTrigger=r.match(/^\S*/)[0],D.name||(D.name=r)):a&&(D[a]=r)}}return t},e.prototype.getSnippetByName=function(e,n){var t,D=this.snippetNameMap;return this.getActiveScopes(n).some(function(n){var S=D[n];return S&&(t=S[e]),!!t},this),t},e}();S.implement(u.prototype,a);var f=function(e,n,t){void 0===t&&(t={});var D=e.getCursorPosition(),S=e.session.getLine(D.row),a=e.session.getTabString(),r=S.match(/^\s*/)[0];D.column<r.length&&(r=r.slice(0,D.column)),n=n.replace(/\r/g,"");var o=this.tokenizeTmSnippet(n);o=(o=this.resolveVariables(o,e)).map(function(e){return"\n"!=e||t.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,a):e:e+r});var i=[];o.forEach(function(e,n){if("object"==typeof e){var t=e.tabstopId,D=i[t];if(D||((D=i[t]=[]).index=t,D.value="",D.parents={}),-1===D.indexOf(e)){e.choices&&!D.choices&&(D.choices=e.choices),D.push(e);var S=o.indexOf(e,n+1);if(-1!==S){var a=o.slice(n+1,S),r=a.some(function(e){return"object"==typeof e});r&&!D.value?D.value=a:a.length&&(!D.value||"string"!=typeof D.value)&&(D.value=a.join(""))}}}}),i.forEach(function(e){e.length=0});var g={};function s(e){for(var n=[],t=0;t<e.length;t++){var D=e[t];if("object"==typeof D){if(g[D.tabstopId])continue;D=n[e.lastIndexOf(D,t-1)]||{tabstopId:D.tabstopId}}n[t]=D}return n}for(var l=0;l<o.length;l++){var d=o[l];if("object"==typeof d){var c=d.tabstopId,u=i[c],f=o.indexOf(d,l+1);if(g[c]){g[c]===d&&(delete g[c],Object.keys(g).forEach(function(e){u.parents[e]=!0}));continue}g[c]=d;var h=u.value;"string"!=typeof h?h=s(h):d.fmt&&(h=this.tmStrFormat(h,d,e)),o.splice.apply(o,[l+1,Math.max(0,f-l)].concat(h,d)),-1===u.indexOf(d)&&u.push(d)}}var p=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,p+=n.length-1):m+=e.length,y+=e}else e&&(e.start?e.end={row:p,column:m}:e.start={row:p,column:m})}),{text:y,tabstops:i,tokens:o}},h=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],t=this.selectedTabstop||{},D=t.parents||{},S=this.tabstops.slice(),a=0;a<S.length;a++){var r=S[a],o=r==t||D[r.index];if(r.rangeList.$bias=+!o,"remove"==e.action&&r!==t){var i=r.parents&&r.parents[t.index],g=r.rangeList.pointIndex(e.start,i);g=g<0?-g-1:g+1;var s=r.rangeList.pointIndex(e.end,i);s=s<0?-s-1:s-1;for(var l=r.rangeList.ranges.slice(g,s),d=0;d<l.length;d++)this.removeRange(l[d])}r.rangeList.$onChange(e)}var c=this.session;this.$inChange||!n||1!=c.getLength()||c.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var t=this.session,D=t.getTextRange(e.firstNonLinked),S=0;S<e.length;S++){var a=e[S];if(a.linked){var r=a.original,o=n.snippetManager.tmStrFormat(D,r,this.editor);t.replace(a,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,t=this.editor.selection.isEmpty(),D=0;D<this.ranges.length;D++)if(!this.ranges[D].linked){var S=this.ranges[D].contains(e.row,e.column),a=t||this.ranges[D].contains(n.row,n.column);if(S&&a)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var n=this.tabstops.length,t=this.index+(e||1);(t=Math.min(Math.max(t,1),n))==n&&(t=0),this.selectTabstop(t),this.updateTabstopMarkers(),0===t&&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 t=n.firstNonLinked||n;if(n.choices&&(t.cursor=t.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(t);else{var D=this.editor.multiSelect;D.toSingleRange(t);for(var S=0;S<n.length;S++)n.hasLinkedRanges&&n[S].linked||D.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,t){var D=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var S=o.fromPoints(t,t);m(S.start,n),m(S.end,n),e[0]=[S],e[0].index=0}var a=[this.index+1,0],r=this.ranges,g=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,t){var S=this.$openTabstops[t]||e;S.snippetId=g;for(var s=0;s<e.length;s++){var l=e[s],d=o.fromPoints(l.start,l.end||l.start);p(d.start,n),p(d.end,n),d.original=l,d.tabstop=S,r.push(d),S!=e?S.unshift(d):S[s]=d,l.fmtString||S.firstNonLinked&&D?(d.linked=!0,S.hasLinkedRanges=!0):S.firstNonLinked||(S.firstNonLinked=d)}S.firstNonLinked||(S.hasLinkedRanges=!1),S===e&&(a.push(S),this.$openTabstops[t]=S),this.addTabstopMarkers(S),S.rangeList=S.rangeList||new i,S.rangeList.$bias=0,S.rangeList.addList(S)},this),a.length>2&&(this.tabstops.length&&a.push(a.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,a))},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}();h.prototype.keyboardHandler=new g,h.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 p=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};D.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 u,(function(){this.insertSnippet=function(e,t){return n.snippetManager.insertSnippet(this,e,t)},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,t){"use strict";var D=e("../virtual_renderer").VirtualRenderer,S=e("../editor").Editor,a=e("../range").Range,r=e("../lib/event"),o=e("../lib/lang"),i=e("../lib/dom"),g=e("../config").nls,s=e("./../lib/useragent"),l=function(e){return"suggest-aria-id:".concat(e)},d=s.isSafari?"menu":"listbox",c=s.isSafari?"menuitem":"option",u=s.isSafari?"aria-current":"aria-selected",f=function(e){var n=new D(e);n.$maxLines=4;var t=new S(n);return t.setHighlightActiveLine(!1),t.setShowPrintMargin(!1),t.renderer.setShowGutter(!1),t.renderer.setHighlightGutterLine(!1),t.$mouseHandler.$focusTimeout=0,t.$highlightTagPending=!0,t},h=function(){return function(e){var n,t=i.createElement("div"),D=f(t);e&&e.appendChild(t),t.style.display="none",D.renderer.content.style.cursor="default",D.renderer.setStyle("ace_autocomplete"),D.renderer.$textLayer.element.setAttribute("role",d),D.renderer.$textLayer.element.setAttribute("aria-roledescription",g("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),D.renderer.$textLayer.element.setAttribute("aria-label",g("autocomplete.popup.aria-label","Autocomplete suggestions")),D.renderer.textarea.setAttribute("aria-hidden","true"),D.setOption("displayIndentGuides",!1),D.setOption("dragDelay",150);var S=function(){};D.focus=S,D.$isFocused=!0,D.renderer.$cursorLayer.restartTimer=S,D.renderer.$cursorLayer.element.style.opacity="0",D.renderer.$maxLines=8,D.renderer.$keepTextAreaAtCursor=!1,D.setHighlightActiveLine(!1),D.session.highlight(""),D.session.$searchHighlight.clazz="ace_highlight-marker",D.on("mousedown",function(e){var n=e.getDocumentPosition();D.selection.moveToPosition(n),h.start.row=h.end.row=n.row,e.stop()});var s=new a(-1,0,-1,1/0),h=new a(-1,0,-1,1/0);h.id=D.session.addMarker(h,"ace_active-line","fullLine"),D.setSelectOnHover=function(e){e?s.id&&(D.session.removeMarker(s.id),s.id=null):s.id=D.session.addMarker(s,"ace_line-hover","fullLine")},D.setSelectOnHover(!1),D.on("mousemove",function(e){if(!n){n=e;return}if(n.x!=e.x||n.y!=e.y){n=e,n.scrollTop=D.renderer.scrollTop,D.isMouseOver=!0;var t=n.getDocumentPosition().row;s.start.row!=t&&(s.id||D.setRow(t),m(t))}}),D.renderer.on("beforeRender",function(){if(n&&-1!=s.start.row){n.$pos=null;var e=n.getDocumentPosition().row;s.id||D.setRow(e),m(e,!0)}}),D.renderer.on("afterRender",function(){var e=D.getRow(),n=D.renderer.$textLayer,t=n.element.childNodes[e-n.config.firstRow],S=document.activeElement;if(t!==D.selectedNode&&D.selectedNode&&(i.removeCssClass(D.selectedNode,"ace_selected"),S.removeAttribute("aria-activedescendant"),D.selectedNode.removeAttribute(u),D.selectedNode.removeAttribute("id")),D.selectedNode=t,t){i.addCssClass(t,"ace_selected");var a=l(e);t.id=a,n.element.setAttribute("aria-activedescendant",a),S.setAttribute("aria-activedescendant",a),t.setAttribute("role",c),t.setAttribute("aria-roledescription",g("autocomplete.popup.item.aria-roledescription","item")),t.setAttribute("aria-label",D.getData(e).caption||D.getData(e).value),t.setAttribute("aria-setsize",D.data.length),t.setAttribute("aria-posinset",e+1),t.setAttribute("aria-describedby","doc-tooltip"),t.setAttribute(u,"true")}});var p=function(){m(-1)},m=function(e,n){e!==s.start.row&&(s.start.row=s.end.row=e,n||D.session._emit("changeBackMarker"),D._emit("changeHoverMarker"))};D.getHoveredRow=function(){return s.start.row},r.addListener(D.container,"mouseout",function(){D.isMouseOver=!1,p()}),D.on("hide",p),D.on("changeSelection",p),D.session.doc.getLength=function(){return D.data.length},D.session.doc.getLine=function(e){var n=D.data[e];return"string"==typeof n?n:n&&n.value||""};var y=D.session.bgTokenizer;return y.$tokenizeRow=function(e){var n=D.data[e],t=[];if(!n)return t;"string"==typeof n&&(n={value:n});var S=n.caption||n.value||n.name;function a(e,D){e&&t.push({type:(n.className||"")+(D||""),value:e})}for(var r=S.toLowerCase(),o=(D.filterText||"").toLowerCase(),i=0,g=0,s=0;s<=o.length;s++)if(s!=g&&(n.matchMask&1<<s||s==o.length)){var l=o.slice(g,s);g=s;var d=r.indexOf(l,i);if(-1==d)continue;a(S.slice(i,d),""),i=d+l.length,a(S.slice(d,i),"completion-highlight")}return a(S.slice(i,S.length),""),t.push({type:"completion-spacer",value:" "}),n.meta&&t.push({type:"completion-meta",value:n.meta}),n.message&&t.push({type:"completion-message",value:n.message}),t},y.$updateOnChange=S,y.start=S,D.session.$computeWidth=function(){return this.screenWidth=0},D.isOpen=!1,D.isTopdown=!1,D.autoSelect=!0,D.filterText="",D.isMouseOver=!1,D.data=[],D.setData=function(e,n){D.filterText=n||"",D.setValue(o.stringRepeat("\n",e.length),-1),D.data=e||[],D.setRow(0)},D.getData=function(e){return D.data[e]},D.getRow=function(){return h.start.row},D.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),h.start.row!=e&&(D.selection.clearSelection(),h.start.row=h.end.row=e||0,D.session._emit("changeBackMarker"),D.moveCursorTo(e||0,0),D.isOpen&&D._signal("select"))},D.on("changeSelection",function(){D.isOpen&&D.setRow(D.selection.lead.row),D.renderer.scrollCursorIntoView()}),D.hide=function(){this.container.style.display="none",D.anchorPos=null,D.anchor=null,D.isOpen&&(D.isOpen=!1,this._signal("hide"))},D.tryShow=function(e,t,S,a){if(!a&&D.isOpen&&D.anchorPos&&D.anchor&&D.anchorPos.top===e.top&&D.anchorPos.left===e.left&&D.anchor===S)return!0;var r=this.container,o=window.innerHeight,i=window.innerWidth,g=this.renderer,s=g.$maxLines*t*1.4,l={top:0,bottom:0},d=o-e.top-3*this.$borderSize-t,c=e.top-3*this.$borderSize;S||(S=c<=d||d>=s?"bottom":"top"),"top"===S?(l.bottom=e.top-this.$borderSize,l.top=l.bottom-s):"bottom"===S&&(l.top=e.top+t+this.$borderSize,l.bottom=l.top+s);var u=l.top>=0&&l.bottom<=o;if(!a&&!u)return!1;u?g.$maxPixelHeight=null:"top"===S?g.$maxPixelHeight=c:g.$maxPixelHeight=d,"top"===S?(r.style.top="",r.style.bottom=o-l.bottom+"px",D.isTopdown=!1):(r.style.top=l.top+"px",r.style.bottom="",D.isTopdown=!0),r.style.display="";var f=e.left;return f+r.offsetWidth>i&&(f=i-r.offsetWidth),r.style.left=f+"px",r.style.right="",D.isOpen||(D.isOpen=!0,this._signal("show"),n=null),D.anchorPos=e,D.anchor=S,!0},D.show=function(e,n,t){this.tryShow(e,n,t?"bottom":void 0,!0)},D.goTo=function(e){var n=this.getRow(),t=this.session.getLength()-1;switch(e){case"up":n=n<=0?t:n-1;break;case"down":n=n>=t?-1:n+1;break;case"start":n=0;break;case"end":n=t}this.setRow(n)},D.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},D.$imageSize=0,D.$borderSize=1,D}}();i.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=h,n.$singleLineEditor=f,n.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,n,t){"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,t=n.element.childNodes[e-n.config.firstRow];if(t){for(var D="doc-tooltip ",S=0;S<this._lines.length;S++)D+="ace-inline-screenreader-line-".concat(S," ");t.setAttribute("aria-describedby",D)}}).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 t=document.createElement("code");t.setAttribute("id","ace-inline-screenreader-line-".concat(n));var D=document.createTextNode(this._lines[n]);t.appendChild(D),e.appendChild(t)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,n,t){"use strict";var D=e("../snippets").snippetManager,S=e("./inline_screenreader").AceInlineScreenReader;n.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,n,t){if(t=t||"",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 a=n.snippet?D.getDisplayTextForSnippet(e,n.snippet):n.value;return!n.hideInlinePreview&&!!a&&!!a.startsWith(t)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(a),""===(a=a.slice(t.length))?e.removeGhostText():e.setGhostText(a),!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,t){"use strict";n.parForEach=function(e,n,t){var D=0,S=e.length;0===S&&t();for(var a=0;a<S;a++)n(e[a],function(e,n){++D===S&&t(e,n)})};var D=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(e,n,t){t=t||D;for(var S=[],a=n-1;a>=0;a--)if(t.test(e[a]))S.push(e[a]);else break;return S.reverse().join("")},n.retrieveFollowingIdentifier=function(e,n,t){t=t||D;for(var S=[],a=n;a<e.length;a++)if(t.test(e[a]))S.push(e[a]);else break;return S},n.getCompletionPrefix=function(e){var n,t=e.getCursorPosition(),D=e.session.getLine(t.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!n&&e&&(n=this.retrievePrecedingIdentifier(D,t.column,e))}).bind(this))}).bind(this)),n||this.retrievePrecedingIdentifier(D,t.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,t){"use strict";var D=e("./keyboard/hash_handler").HashHandler,S=e("./autocomplete/popup").AcePopup,a=e("./autocomplete/inline").AceInline,r=e("./autocomplete/popup").getAriaId,o=e("./autocomplete/util"),i=e("./lib/lang"),g=e("./lib/dom"),s=e("./snippets").snippetManager,l=e("./config"),d=e("./lib/event"),c=e("./lib/scroll").preventParentScroll,u=function(e,n){n.completer&&n.completer.destroy()},f=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new D,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=i.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=i.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=i.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=i.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=i.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 p(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)),d.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 a,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,t=this.base.column,D=this.editor.getCursorPosition().column,S=this.editor.session.getLine(n).slice(t,D);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 t=this.popup.getData(n);t&&(!e||t.hideInlinePreview)&&this.$seen(t)}},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,t=n.layerConfig.lineHeight,D=n.$cursorLayer.getPixelPosition(this.base,!0);D.left-=this.popup.getTextLeftOffset();var S=e.container.getBoundingClientRect();D.top+=S.top-n.layerConfig.offset,D.left+=S.left-e.renderer.scrollLeft,D.left+=n.gutterWidth;var a={top:D.top,left:D.left};n.$ghostText&&n.$ghostTextWidget&&this.base.row===n.$ghostText.position.row&&(a.top+=n.$ghostTextWidget.el.offsetHeight);var r=e.container.getBoundingClientRect().bottom-t,o=r<a.top?{top:r,left:a.left}:a;this.popup.tryShow(o,t,"bottom")||this.popup.tryShow(D,t,"top")||this.popup.show(D,t)},e.prototype.openPopup=function(e,n,t){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var D,S=this.popup.getRow(),a=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&&(D=this.popup.data.indexOf(a)),D&&-1!==D||(D=0),this.popup.setRow(this.autoSelect?D:-1),D===S&&a!==this.completions.filtered[D]&&this.$onPopupChange();var o=this.inlineRenderer&&this.inlineEnabled;if(D===S&&o){var i=this.popup.getData(this.popup.getRow());this.$updateGhostText(i)}!t&&(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,t=this.editor.textInput.getElement(),D=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),S=this.popup&&this.popup.container;n==t||n.parentNode==S||D||n==this.tooltipNode||e.relatedTarget==t||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 t=this.completions,D=this.getCompletionProvider().insertMatch(this.editor,e,t.filterText,n);return this.completions==t&&this.detach(),D},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 h(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,n){return this.getCompletionProvider().gatherCompletions(e,n)},e.prototype.updateCompletions=function(n,t){if(n&&this.base&&this.completions){var D=this.editor.getCursorPosition(),S=this.editor.session.getTextRange({start:this.base,end:D});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(t&&t.matches){var D=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(D.row,D.column),this.base.$insertRight=!0,this.completions=new p(t.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",n)}var a=this.editor.getSession(),D=this.editor.getCursorPosition(),S=o.getCompletionPrefix(this.editor);this.base=a.doc.createAnchor(D.row,D.column-S.length),this.base.$insertRight=!0;var r={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:S,pos:D}).provideCompletions(this.editor,r,(function(t,D,S){var a=D.filtered,r=o.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),S){if(!a.length){var i=!this.autoShown&&this.emptyMessage;if("function"==typeof i&&(i=this.emptyMessage(r)),i){var g=[{caption:i,value:""}];this.completions=new p(g),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==a.length&&a[0].value==r&&!a[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==a.length)return this.insertMatch(a[0])}this.completions=!S&&this.showLoadingState?new p(e.completionsForLoading.concat(a),D.filterText):D,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,t=n&&(n[e.getHoveredRow()]||n[e.getRow()]),D=null;if(!t||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var S=this.editor.completers.length,a=0;a<S;a++){var r=this.editor.completers[a];if(r.getDocTooltip&&t.completerId===r.id){D=r.getDocTooltip(t);break}}if(D||"string"==typeof t||(D=t),"string"==typeof D&&(D={docText:D}),!D||!(D.docHTML||D.docText))return this.hideDocTooltip();this.showDocTooltip(D)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=g.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",c));var n=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(n.isDark?"ace_dark ":"")+(n.cssClass||"");var t=this.tooltipNode;e.docHTML?t.innerHTML=e.docHTML:e.docText&&(t.textContent=e.docText),t.parentNode||this.popup.container.appendChild(this.tooltipNode);var D=this.popup,S=D.container.getBoundingClientRect();t.style.top=D.container.style.top,t.style.bottom=D.container.style.bottom,t.style.display="block",window.innerWidth-S.right<320?S.left<320?(D.isTopdown?t.style.top=S.bottom+"px":t.style.top=D.container.offsetTop-t.offsetHeight+"px",t.style.left=S.left+"px",t.style.right="",t.style.bottom=""):(t.style.right=window.innerWidth-S.left+"px",t.style.left=""):(t.style.left=S.right+1+"px",t.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",u),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();f.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()}},f.for=function(e){return e.completer instanceof f||(e.completer&&(e.completer.destroy(),e.completer=null),l.get("sharedPopups")?(f.$sharedInstance||(f.$sharedInstance=new f),e.completer=f.$sharedInstance):(e.completer=new f,e.once("destroy",u))),e.completer},f.startCommand={name:"startAutocomplete",exec:function(e,n){var t=f.for(e);t.autoInsert=!1,t.autoSelect=!0,t.autoShown=!1,t.showPopup(e,n),t.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var h=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,n,t){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[n],t)},e.prototype.insertMatch=function(e,n,t){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 D=this.completions.filterText.length,S=0;if(n.range&&n.range.start.row===n.range.end.row&&(D-=this.initialPosition.prefix.length,D+=this.initialPosition.pos.column-n.range.start.column,S+=n.range.end.column-this.initialPosition.pos.column),D||S){a=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var a,r,o=0;r=a[o];o++)r.start.column-=D,r.end.column+=S,e.session.remove(r)}n.snippet?s.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 t=n.value||n;e.execCommand("insertstring",t)},e.prototype.gatherCompletions=function(e,n){var t=e.getSession(),D=e.getCursorPosition(),S=o.getCompletionPrefix(e),a=[];this.completers=e.completers;var r=e.completers.length;return e.completers.forEach(function(i,g){i.getCompletions(e,t,D,S,function(t,D){i.hideInlinePreview&&(D=D.map(function(e){return Object.assign(e,{hideInlinePreview:i.hideInlinePreview})})),!t&&D&&(a=a.concat(D)),n(null,{prefix:o.getCompletionPrefix(e),matches:a,finished:0==--r})})}),!0},e.prototype.provideCompletions=function(e,n,t){var D=(function(e){var D=e.prefix,S=e.matches;this.completions=new p(S),n.exactMatch&&(this.completions.exactMatch=!0),n.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(D),(e.finished||this.completions.filtered.length)&&t(null,this.completions,e.finished)}).bind(this),S=!0,a=null;if(this.gatherCompletions(e,(function(e,n){if(this.active&&(e&&(t(e,[],!0),this.detach()),0===n.prefix.indexOf(n.prefix))){if(S){a=n;return}D(n)}}).bind(this)),S=!1,a){var r=a;a=null,D(r)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),p=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 t=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!==t&&(t=n,!0)}),this.filtered=n},e.prototype.filterCompletions=function(e,n){var t=[],D=n.toUpperCase(),S=n.toLowerCase();n:for(var a,r=0;a=e[r];r++){var o,i,g=!this.ignoreCaption&&a.caption||a.value||a.snippet;if(g){var s=-1,l=0,d=0;if(this.exactMatch){if(n!==g.substr(0,n.length))continue}else{var c=g.toLowerCase().indexOf(S);if(c>-1)d=c;else for(var u=0;u<n.length;u++){var f=g.indexOf(S[u],s+1),h=g.indexOf(D[u],s+1);if((o=f>=0&&(h<0||f<h)?f:h)<0)continue n;(i=o-s-1)>0&&(-1===s&&(d+=10),d+=i,l|=1<<u),s=o}}a.matchMask=l,a.exactMatch=+!d,a.$score=(a.score||0)-d,t.push(a)}}return t},e}();n.Autocomplete=f,n.CompletionProvider=h,n.FilteredList=p}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,n,t){var D=e("../range").Range,S=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function a(e,n){return e.getTextRange(D.fromPoints({row:0,column:0},n)).split(S).length-1}function r(e,n){var t=a(e,n),D=e.getValue().split(S),r=Object.create(null),o=D[t];return D.forEach(function(e,n){if(e&&e!==o){var S=Math.abs(t-n),a=D.length-S;r[e]?r[e]=Math.max(a,r[e]):r[e]=a}}),r}n.getCompletions=function(e,n,t,D,S){var a=r(n,t);S(null,Object.keys(a).map(function(e){return{caption:e,value:e,score:a[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,t){"use strict";var D,S=e("../snippets").snippetManager,a=e("../autocomplete").Autocomplete,r=e("../config"),o=e("../lib/lang"),i=e("../autocomplete/util"),g=e("../autocomplete/text_completer"),s={getCompletions:function(e,n,t,D,S){if(n.$mode.completer)return n.$mode.completer.getCompletions(e,n,t,D,S);var a=e.session.getState(t.row),r=n.$mode.getCompletions(a,n,t,D);S(null,r=r.map(function(e){return e.completerId=s.id,e}))},id:"keywordCompleter"},l=function(e){var n={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,t,D,S){return n[t]=S||""}).replace(/\$(\d+?)/g,function(e,t){return n[t]})},d={getCompletions:function(e,n,t,D,a){var r=[],o=n.getTokenAt(t.row,t.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 i=S.snippetMap,g=[];r.forEach(function(e){for(var n=i[e]||[],t=n.length;t--;){var D=n[t],S=D.name||D.tabTrigger;S&&g.push({caption:S,snippet:D.content,meta:D.tabTrigger&&!D.name?D.tabTrigger+"⇥ ":"snippet",completerId:d.id})}},this),a(null,g)},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"},c=[d,g,s];n.setCompleters=function(e){c.length=0,e&&c.push.apply(c,e)},n.addCompleter=function(e){c.push(e)},n.textCompleter=g,n.keyWordCompleter=s,n.snippetCompleter=d;var u={name:"expandSnippet",exec:function(e){return S.expandWithTab(e)},bindKey:"Tab"},f=function(e,n){h(n.session.$mode)},h=function(e){"string"==typeof e&&(e=r.$modes[e]),e&&(S.files||(S.files={}),p(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(h))},p=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){h("ace/mode/"+e)})))}))},m=function(e){var n=e.editor,t=n.completer&&n.completer.activated;if("backspace"===e.command.name)t&&!i.getCompletionPrefix(n)&&n.completer.detach();else if("insertstring"===e.command.name&&!t){D=e;var S=e.editor.$liveAutocompletionDelay;S?y.delay(S):b(e)}},y=o.delayedCall(function(){b(D)},0),b=function(e){var n=e.editor,t=i.getCompletionPrefix(n),D=e.args,S=i.triggerAutocomplete(n,D);if(t&&t.length>=n.$liveAutocompletionThreshold||S){var r=a.for(n);r.autoShown=!0,r.showPopup(n)}},v=e("../editor").Editor;e("../config").defineOptions(v.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),this.commands.addCommand(a.startCommand)):this.commands.removeCommand(a.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),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(u),this.on("changeMode",f),f(null,this)):(this.commands.removeCommand(u),this.off("changeMode",f))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(n){e&&(e.exports=n)})}()},20009(e,n,t){e=t.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,t){"use strict";var D,S=e("./lib/oop");e("./lib/lang");var a=e("./lib/event_emitter").EventEmitter,r=e("./editor").Editor,o=e("./virtual_renderer").VirtualRenderer,i=e("./edit_session").EditSession;(function(){S.implement(this,a),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 i(e.getDocument(),e.getMode()),t=e.getUndoManager();return n.setUndoManager(t),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 t=null==n?this.$cEditor:this.$editors[n];return this.$editors.some(function(n){return n.session===e})&&(e=this.$cloneSession(e)),t.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,t=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var D=n/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=D+"px",e.container.style.top="0px",e.container.style.left=S*D+"px",e.container.style.height=t+"px",e.resize();else for(var a=t/this.$splits,S=0;S<this.$splits;S++)(e=this.$editors[S]).container.style.width=n+"px",e.container.style.top=S*a+"px",e.container.style.left="0px",e.container.style.height=a+"px",e.resize()}}).call((D=function(e,n,t){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(t||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),n.Split=D}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,n,t){"use strict";t.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(n){e&&(e.exports=n)})}()},62432(e,n,t){ace.config.setModuleUrl("ace/ext/beautify",t(1853)),ace.config.setModuleUrl("ace/ext/code_lens",t(42836)),ace.config.setModuleUrl("ace/ext/command_bar",t(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",t(40275)),ace.config.setModuleUrl("ace/ext/emmet",t(25962)),ace.config.setModuleUrl("ace/ext/error_marker",t(377)),ace.config.setModuleUrl("ace/ext/hardwrap",t(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",t(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",t(97188)),ace.config.setModuleUrl("ace/ext/language_tools",t(10194)),ace.config.setModuleUrl("ace/ext/linking",t(43794)),ace.config.setModuleUrl("ace/ext/modelist",t(71739)),ace.config.setModuleUrl("ace/ext/options",t(43804)),ace.config.setModuleUrl("ace/ext/prompt",t(20706)),ace.config.setModuleUrl("ace/ext/rtl",t(27480)),ace.config.setModuleUrl("ace/ext/searchbox",t(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",t(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",t(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",t(51834)),ace.config.setModuleUrl("ace/ext/split",t(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",t(99729)),ace.config.setModuleUrl("ace/ext/statusbar",t(86397)),ace.config.setModuleUrl("ace/ext/textarea",t(36454)),ace.config.setModuleUrl("ace/ext/themelist",t(85107)),ace.config.setModuleUrl("ace/ext/whitespace",t(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",t(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",t(1832)),ace.config.setModuleUrl("ace/keyboard/vim",t(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",t(98557)),ace.config.setModuleUrl("ace/mode/abap",t(48208)),ace.config.setModuleUrl("ace/mode/abc",t(22128)),ace.config.setModuleUrl("ace/mode/actionscript",t(3871)),ace.config.setModuleUrl("ace/mode/ada",t(87272)),ace.config.setModuleUrl("ace/mode/alda",t(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",t(70029)),ace.config.setModuleUrl("ace/mode/apex",t(24266)),ace.config.setModuleUrl("ace/mode/applescript",t(78831)),ace.config.setModuleUrl("ace/mode/aql",t(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",t(36417)),ace.config.setModuleUrl("ace/mode/asl",t(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",t(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",t(9319)),ace.config.setModuleUrl("ace/mode/astro",t(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",t(5215)),ace.config.setModuleUrl("ace/mode/batchfile",t(182)),ace.config.setModuleUrl("ace/mode/bibtex",t(54316)),ace.config.setModuleUrl("ace/mode/c9search",t(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",t(69563)),ace.config.setModuleUrl("ace/mode/cirru",t(25995)),ace.config.setModuleUrl("ace/mode/clojure",t(81384)),ace.config.setModuleUrl("ace/mode/cobol",t(12307)),ace.config.setModuleUrl("ace/mode/coffee",t(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",t(82540)),ace.config.setModuleUrl("ace/mode/crystal",t(70162)),ace.config.setModuleUrl("ace/mode/csharp",t(86173)),ace.config.setModuleUrl("ace/mode/csound_document",t(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",t(54722)),ace.config.setModuleUrl("ace/mode/csound_score",t(48055)),ace.config.setModuleUrl("ace/mode/csp",t(61634)),ace.config.setModuleUrl("ace/mode/css",t(59119)),ace.config.setModuleUrl("ace/mode/curly",t(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",t(34379)),ace.config.setModuleUrl("ace/mode/d",t(48656)),ace.config.setModuleUrl("ace/mode/dart",t(1647)),ace.config.setModuleUrl("ace/mode/diff",t(30365)),ace.config.setModuleUrl("ace/mode/django",t(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",t(62136)),ace.config.setModuleUrl("ace/mode/dot",t(40631)),ace.config.setModuleUrl("ace/mode/drools",t(36363)),ace.config.setModuleUrl("ace/mode/edifact",t(19906)),ace.config.setModuleUrl("ace/mode/eiffel",t(61933)),ace.config.setModuleUrl("ace/mode/ejs",t(78924)),ace.config.setModuleUrl("ace/mode/elixir",t(91429)),ace.config.setModuleUrl("ace/mode/elm",t(98664)),ace.config.setModuleUrl("ace/mode/erlang",t(18885)),ace.config.setModuleUrl("ace/mode/flix",t(98513)),ace.config.setModuleUrl("ace/mode/forth",t(50379)),ace.config.setModuleUrl("ace/mode/fortran",t(87166)),ace.config.setModuleUrl("ace/mode/fsharp",t(55288)),ace.config.setModuleUrl("ace/mode/fsl",t(96369)),ace.config.setModuleUrl("ace/mode/ftl",t(5474)),ace.config.setModuleUrl("ace/mode/gcode",t(39264)),ace.config.setModuleUrl("ace/mode/gherkin",t(67942)),ace.config.setModuleUrl("ace/mode/gitignore",t(37898)),ace.config.setModuleUrl("ace/mode/glsl",t(2474)),ace.config.setModuleUrl("ace/mode/gobstones",t(70154)),ace.config.setModuleUrl("ace/mode/golang",t(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",t(75542)),ace.config.setModuleUrl("ace/mode/groovy",t(50436)),ace.config.setModuleUrl("ace/mode/haml",t(63920)),ace.config.setModuleUrl("ace/mode/handlebars",t(51526)),ace.config.setModuleUrl("ace/mode/haskell",t(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",t(67784)),ace.config.setModuleUrl("ace/mode/haxe",t(81690)),ace.config.setModuleUrl("ace/mode/hjson",t(44406)),ace.config.setModuleUrl("ace/mode/html",t(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",t(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",t(76542)),ace.config.setModuleUrl("ace/mode/ini",t(88110)),ace.config.setModuleUrl("ace/mode/io",t(91930)),ace.config.setModuleUrl("ace/mode/ion",t(24958)),ace.config.setModuleUrl("ace/mode/jack",t(42901)),ace.config.setModuleUrl("ace/mode/jade",t(55300)),ace.config.setModuleUrl("ace/mode/java",t(29750)),ace.config.setModuleUrl("ace/mode/javascript",t(80437)),ace.config.setModuleUrl("ace/mode/jexl",t(62115)),ace.config.setModuleUrl("ace/mode/json",t(46544)),ace.config.setModuleUrl("ace/mode/json5",t(17965)),ace.config.setModuleUrl("ace/mode/jsoniq",t(78118)),ace.config.setModuleUrl("ace/mode/jsp",t(41705)),ace.config.setModuleUrl("ace/mode/jssm",t(22901)),ace.config.setModuleUrl("ace/mode/jsx",t(73937)),ace.config.setModuleUrl("ace/mode/julia",t(941)),ace.config.setModuleUrl("ace/mode/kotlin",t(86571)),ace.config.setModuleUrl("ace/mode/latex",t(30808)),ace.config.setModuleUrl("ace/mode/latte",t(2986)),ace.config.setModuleUrl("ace/mode/less",t(72799)),ace.config.setModuleUrl("ace/mode/liquid",t(95630)),ace.config.setModuleUrl("ace/mode/lisp",t(85950)),ace.config.setModuleUrl("ace/mode/livescript",t(74703)),ace.config.setModuleUrl("ace/mode/logiql",t(72094)),ace.config.setModuleUrl("ace/mode/logtalk",t(39512)),ace.config.setModuleUrl("ace/mode/lsl",t(94275)),ace.config.setModuleUrl("ace/mode/lua",t(46890)),ace.config.setModuleUrl("ace/mode/luapage",t(81029)),ace.config.setModuleUrl("ace/mode/lucene",t(7616)),ace.config.setModuleUrl("ace/mode/makefile",t(77882)),ace.config.setModuleUrl("ace/mode/markdown",t(21459)),ace.config.setModuleUrl("ace/mode/mask",t(54050)),ace.config.setModuleUrl("ace/mode/matlab",t(35907)),ace.config.setModuleUrl("ace/mode/maze",t(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",t(72268)),ace.config.setModuleUrl("ace/mode/mel",t(66018)),ace.config.setModuleUrl("ace/mode/mips",t(20617)),ace.config.setModuleUrl("ace/mode/mixal",t(98667)),ace.config.setModuleUrl("ace/mode/mushcode",t(61026)),ace.config.setModuleUrl("ace/mode/mysql",t(21630)),ace.config.setModuleUrl("ace/mode/nasal",t(23523)),ace.config.setModuleUrl("ace/mode/nginx",t(16788)),ace.config.setModuleUrl("ace/mode/nim",t(31900)),ace.config.setModuleUrl("ace/mode/nix",t(6135)),ace.config.setModuleUrl("ace/mode/nsis",t(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",t(51481)),ace.config.setModuleUrl("ace/mode/objectivec",t(75466)),ace.config.setModuleUrl("ace/mode/ocaml",t(49088)),ace.config.setModuleUrl("ace/mode/odin",t(5610)),ace.config.setModuleUrl("ace/mode/partiql",t(76557)),ace.config.setModuleUrl("ace/mode/pascal",t(80694)),ace.config.setModuleUrl("ace/mode/perl",t(7135)),ace.config.setModuleUrl("ace/mode/pgsql",t(55707)),ace.config.setModuleUrl("ace/mode/php",t(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",t(49935)),ace.config.setModuleUrl("ace/mode/pig",t(7124)),ace.config.setModuleUrl("ace/mode/plain_text",t(92868)),ace.config.setModuleUrl("ace/mode/plsql",t(24808)),ace.config.setModuleUrl("ace/mode/powershell",t(77823)),ace.config.setModuleUrl("ace/mode/praat",t(46124)),ace.config.setModuleUrl("ace/mode/prisma",t(18114)),ace.config.setModuleUrl("ace/mode/prolog",t(35061)),ace.config.setModuleUrl("ace/mode/properties",t(56059)),ace.config.setModuleUrl("ace/mode/protobuf",t(86305)),ace.config.setModuleUrl("ace/mode/prql",t(58317)),ace.config.setModuleUrl("ace/mode/puppet",t(85804)),ace.config.setModuleUrl("ace/mode/python",t(51652)),ace.config.setModuleUrl("ace/mode/qml",t(11038)),ace.config.setModuleUrl("ace/mode/r",t(438)),ace.config.setModuleUrl("ace/mode/raku",t(4847)),ace.config.setModuleUrl("ace/mode/razor",t(67300)),ace.config.setModuleUrl("ace/mode/rdoc",t(6430)),ace.config.setModuleUrl("ace/mode/red",t(85347)),ace.config.setModuleUrl("ace/mode/redshift",t(36975)),ace.config.setModuleUrl("ace/mode/rhtml",t(7047)),ace.config.setModuleUrl("ace/mode/robot",t(66276)),ace.config.setModuleUrl("ace/mode/rst",t(8781)),ace.config.setModuleUrl("ace/mode/ruby",t(334)),ace.config.setModuleUrl("ace/mode/rust",t(43292)),ace.config.setModuleUrl("ace/mode/sac",t(26329)),ace.config.setModuleUrl("ace/mode/sass",t(52748)),ace.config.setModuleUrl("ace/mode/scad",t(46193)),ace.config.setModuleUrl("ace/mode/scala",t(19366)),ace.config.setModuleUrl("ace/mode/scheme",t(81413)),ace.config.setModuleUrl("ace/mode/scrypt",t(70877)),ace.config.setModuleUrl("ace/mode/scss",t(55146)),ace.config.setModuleUrl("ace/mode/sh",t(77105)),ace.config.setModuleUrl("ace/mode/sjs",t(16042)),ace.config.setModuleUrl("ace/mode/slim",t(58715)),ace.config.setModuleUrl("ace/mode/smarty",t(48146)),ace.config.setModuleUrl("ace/mode/smithy",t(75144)),ace.config.setModuleUrl("ace/mode/snippets",t(33124)),ace.config.setModuleUrl("ace/mode/soy_template",t(23446)),ace.config.setModuleUrl("ace/mode/space",t(29582)),ace.config.setModuleUrl("ace/mode/sparql",t(4911)),ace.config.setModuleUrl("ace/mode/sql",t(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",t(19771)),ace.config.setModuleUrl("ace/mode/stylus",t(60940)),ace.config.setModuleUrl("ace/mode/svg",t(68506)),ace.config.setModuleUrl("ace/mode/swift",t(39215)),ace.config.setModuleUrl("ace/mode/tcl",t(54987)),ace.config.setModuleUrl("ace/mode/terraform",t(31372)),ace.config.setModuleUrl("ace/mode/tex",t(63609)),ace.config.setModuleUrl("ace/mode/text",t(12585)),ace.config.setModuleUrl("ace/mode/textile",t(29541)),ace.config.setModuleUrl("ace/mode/toml",t(69774)),ace.config.setModuleUrl("ace/mode/tsx",t(53135)),ace.config.setModuleUrl("ace/mode/turtle",t(12476)),ace.config.setModuleUrl("ace/mode/twig",t(71255)),ace.config.setModuleUrl("ace/mode/typescript",t(5397)),ace.config.setModuleUrl("ace/mode/vala",t(98124)),ace.config.setModuleUrl("ace/mode/vbscript",t(70801)),ace.config.setModuleUrl("ace/mode/velocity",t(33189)),ace.config.setModuleUrl("ace/mode/verilog",t(36982)),ace.config.setModuleUrl("ace/mode/vhdl",t(98256)),ace.config.setModuleUrl("ace/mode/visualforce",t(7335)),ace.config.setModuleUrl("ace/mode/vue",t(2256)),ace.config.setModuleUrl("ace/mode/wollok",t(29446)),ace.config.setModuleUrl("ace/mode/xml",t(93489)),ace.config.setModuleUrl("ace/mode/xquery",t(27174)),ace.config.setModuleUrl("ace/mode/yaml",t(32113)),ace.config.setModuleUrl("ace/mode/zeek",t(38035)),ace.config.setModuleUrl("ace/mode/zig",t(86882)),ace.config.setModuleUrl("ace/theme/ambiance",t(7890)),ace.config.setModuleUrl("ace/theme/chaos",t(40156)),ace.config.setModuleUrl("ace/theme/chrome",t(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",t(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",t(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",t(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",t(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",t(93008)),ace.config.setModuleUrl("ace/theme/clouds",t(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",t(54131)),ace.config.setModuleUrl("ace/theme/cobalt",t(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",t(63553)),ace.config.setModuleUrl("ace/theme/dawn",t(58732)),ace.config.setModuleUrl("ace/theme/dracula",t(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",t(71791)),ace.config.setModuleUrl("ace/theme/eclipse",t(28409)),ace.config.setModuleUrl("ace/theme/github",t(28573)),ace.config.setModuleUrl("ace/theme/github_dark",t(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",t(50836)),ace.config.setModuleUrl("ace/theme/gob",t(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",t(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",t(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",t(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",t(46925)),ace.config.setModuleUrl("ace/theme/iplastic",t(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",t(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",t(67773)),ace.config.setModuleUrl("ace/theme/kuroir",t(78990)),ace.config.setModuleUrl("ace/theme/merbivore",t(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",t(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",t(61343)),ace.config.setModuleUrl("ace/theme/monokai",t(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",t(63554)),ace.config.setModuleUrl("ace/theme/one_dark",t(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",t(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",t(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",t(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",t(14995)),ace.config.setModuleUrl("ace/theme/terminal",t(91493)),ace.config.setModuleUrl("ace/theme/textmate",t(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",t(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",t(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",t(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",t(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",t(59069)),ace.config.setModuleUrl("ace/theme/twilight",t(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",t(26689)),ace.config.setModuleUrl("ace/theme/xcode",t(26433)),ace.config.setModuleUrl("ace/mode/base_worker",t(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",t(74901)),ace.config.setModuleUrl("ace/mode/css_worker",t(88494)),ace.config.setModuleUrl("ace/mode/html_worker",t(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",t(7182)),ace.config.setModuleUrl("ace/mode/json_worker",t(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",t(55639)),ace.config.setModuleUrl("ace/mode/php_worker",t(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",t(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",t(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",t(67782)),ace.config.setModuleUrl("ace/snippets/abap",t(57909)),ace.config.setModuleUrl("ace/snippets/abc",t(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",t(63178)),ace.config.setModuleUrl("ace/snippets/ada",t(70563)),ace.config.setModuleUrl("ace/snippets/alda",t(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",t(53290)),ace.config.setModuleUrl("ace/snippets/apex",t(64691)),ace.config.setModuleUrl("ace/snippets/applescript",t(86568)),ace.config.setModuleUrl("ace/snippets/aql",t(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",t(64428)),ace.config.setModuleUrl("ace/snippets/asl",t(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",t(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",t(54726)),ace.config.setModuleUrl("ace/snippets/astro",t(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",t(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",t(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",t(34929)),ace.config.setModuleUrl("ace/snippets/c9search",t(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",t(51824)),ace.config.setModuleUrl("ace/snippets/cirru",t(90368)),ace.config.setModuleUrl("ace/snippets/clojure",t(70819)),ace.config.setModuleUrl("ace/snippets/cobol",t(10232)),ace.config.setModuleUrl("ace/snippets/coffee",t(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",t(71241)),ace.config.setModuleUrl("ace/snippets/crystal",t(94925)),ace.config.setModuleUrl("ace/snippets/csharp",t(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",t(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",t(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",t(46326)),ace.config.setModuleUrl("ace/snippets/csp",t(3029)),ace.config.setModuleUrl("ace/snippets/css",t(21452)),ace.config.setModuleUrl("ace/snippets/curly",t(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",t(46790)),ace.config.setModuleUrl("ace/snippets/d",t(32803)),ace.config.setModuleUrl("ace/snippets/dart",t(48138)),ace.config.setModuleUrl("ace/snippets/diff",t(54060)),ace.config.setModuleUrl("ace/snippets/django",t(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",t(58661)),ace.config.setModuleUrl("ace/snippets/dot",t(38180)),ace.config.setModuleUrl("ace/snippets/drools",t(53542)),ace.config.setModuleUrl("ace/snippets/edifact",t(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",t(71020)),ace.config.setModuleUrl("ace/snippets/ejs",t(78027)),ace.config.setModuleUrl("ace/snippets/elixir",t(81672)),ace.config.setModuleUrl("ace/snippets/elm",t(20259)),ace.config.setModuleUrl("ace/snippets/erlang",t(80564)),ace.config.setModuleUrl("ace/snippets/flix",t(38984)),ace.config.setModuleUrl("ace/snippets/forth",t(50528)),ace.config.setModuleUrl("ace/snippets/fortran",t(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",t(60317)),ace.config.setModuleUrl("ace/snippets/fsl",t(60470)),ace.config.setModuleUrl("ace/snippets/ftl",t(64093)),ace.config.setModuleUrl("ace/snippets/gcode",t(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",t(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",t(51069)),ace.config.setModuleUrl("ace/snippets/glsl",t(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",t(19433)),ace.config.setModuleUrl("ace/snippets/golang",t(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",t(90933)),ace.config.setModuleUrl("ace/snippets/groovy",t(28101)),ace.config.setModuleUrl("ace/snippets/haml",t(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",t(63083)),ace.config.setModuleUrl("ace/snippets/haskell",t(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",t(11831)),ace.config.setModuleUrl("ace/snippets/haxe",t(71443)),ace.config.setModuleUrl("ace/snippets/hjson",t(70389)),ace.config.setModuleUrl("ace/snippets/html",t(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",t(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",t(42201)),ace.config.setModuleUrl("ace/snippets/ini",t(36453)),ace.config.setModuleUrl("ace/snippets/io",t(93307)),ace.config.setModuleUrl("ace/snippets/ion",t(4345)),ace.config.setModuleUrl("ace/snippets/jack",t(37832)),ace.config.setModuleUrl("ace/snippets/jade",t(17469)),ace.config.setModuleUrl("ace/snippets/java",t(44967)),ace.config.setModuleUrl("ace/snippets/javascript",t(64472)),ace.config.setModuleUrl("ace/snippets/jexl",t(63542)),ace.config.setModuleUrl("ace/snippets/json",t(50165)),ace.config.setModuleUrl("ace/snippets/json5",t(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",t(60927)),ace.config.setModuleUrl("ace/snippets/jsp",t(36142)),ace.config.setModuleUrl("ace/snippets/jssm",t(44592)),ace.config.setModuleUrl("ace/snippets/jsx",t(33158)),ace.config.setModuleUrl("ace/snippets/julia",t(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",t(94158)),ace.config.setModuleUrl("ace/snippets/latex",t(1075)),ace.config.setModuleUrl("ace/snippets/latte",t(46769)),ace.config.setModuleUrl("ace/snippets/less",t(52466)),ace.config.setModuleUrl("ace/snippets/liquid",t(27191)),ace.config.setModuleUrl("ace/snippets/lisp",t(63635)),ace.config.setModuleUrl("ace/snippets/livescript",t(41122)),ace.config.setModuleUrl("ace/snippets/logiql",t(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",t(27299)),ace.config.setModuleUrl("ace/snippets/lsl",t(38552)),ace.config.setModuleUrl("ace/snippets/lua",t(67401)),ace.config.setModuleUrl("ace/snippets/luapage",t(57030)),ace.config.setModuleUrl("ace/snippets/lucene",t(95437)),ace.config.setModuleUrl("ace/snippets/makefile",t(63275)),ace.config.setModuleUrl("ace/snippets/markdown",t(81586)),ace.config.setModuleUrl("ace/snippets/mask",t(49087)),ace.config.setModuleUrl("ace/snippets/matlab",t(65946)),ace.config.setModuleUrl("ace/snippets/maze",t(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",t(29999)),ace.config.setModuleUrl("ace/snippets/mel",t(17417)),ace.config.setModuleUrl("ace/snippets/mips",t(74332)),ace.config.setModuleUrl("ace/snippets/mixal",t(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",t(31539)),ace.config.setModuleUrl("ace/snippets/mysql",t(59577)),ace.config.setModuleUrl("ace/snippets/nasal",t(49224)),ace.config.setModuleUrl("ace/snippets/nginx",t(82227)),ace.config.setModuleUrl("ace/snippets/nim",t(93243)),ace.config.setModuleUrl("ace/snippets/nix",t(72152)),ace.config.setModuleUrl("ace/snippets/nsis",t(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",t(81136)),ace.config.setModuleUrl("ace/snippets/objectivec",t(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",t(96183)),ace.config.setModuleUrl("ace/snippets/odin",t(91983)),ace.config.setModuleUrl("ace/snippets/partiql",t(78106)),ace.config.setModuleUrl("ace/snippets/pascal",t(79323)),ace.config.setModuleUrl("ace/snippets/perl",t(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",t(98692)),ace.config.setModuleUrl("ace/snippets/php",t(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",t(43416)),ace.config.setModuleUrl("ace/snippets/pig",t(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",t(91365)),ace.config.setModuleUrl("ace/snippets/plsql",t(18423)),ace.config.setModuleUrl("ace/snippets/powershell",t(41273)),ace.config.setModuleUrl("ace/snippets/praat",t(8711)),ace.config.setModuleUrl("ace/snippets/prisma",t(87915)),ace.config.setModuleUrl("ace/snippets/prolog",t(58432)),ace.config.setModuleUrl("ace/snippets/properties",t(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",t(93932)),ace.config.setModuleUrl("ace/snippets/prql",t(79240)),ace.config.setModuleUrl("ace/snippets/puppet",t(35129)),ace.config.setModuleUrl("ace/snippets/python",t(54309)),ace.config.setModuleUrl("ace/snippets/qml",t(31005)),ace.config.setModuleUrl("ace/snippets/r",t(55961)),ace.config.setModuleUrl("ace/snippets/raku",t(42950)),ace.config.setModuleUrl("ace/snippets/razor",t(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",t(62535)),ace.config.setModuleUrl("ace/snippets/red",t(13500)),ace.config.setModuleUrl("ace/snippets/redshift",t(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",t(84064)),ace.config.setModuleUrl("ace/snippets/robot",t(61111)),ace.config.setModuleUrl("ace/snippets/rst",t(43530)),ace.config.setModuleUrl("ace/snippets/ruby",t(12767)),ace.config.setModuleUrl("ace/snippets/rust",t(36729)),ace.config.setModuleUrl("ace/snippets/sac",t(37506)),ace.config.setModuleUrl("ace/snippets/sass",t(82737)),ace.config.setModuleUrl("ace/snippets/scad",t(35400)),ace.config.setModuleUrl("ace/snippets/scala",t(92945)),ace.config.setModuleUrl("ace/snippets/scheme",t(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",t(64128)),ace.config.setModuleUrl("ace/snippets/scss",t(48387)),ace.config.setModuleUrl("ace/snippets/sh",t(13176)),ace.config.setModuleUrl("ace/snippets/sjs",t(68801)),ace.config.setModuleUrl("ace/snippets/slim",t(93390)),ace.config.setModuleUrl("ace/snippets/smarty",t(67831)),ace.config.setModuleUrl("ace/snippets/smithy",t(34577)),ace.config.setModuleUrl("ace/snippets/snippets",t(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",t(93779)),ace.config.setModuleUrl("ace/snippets/space",t(50673)),ace.config.setModuleUrl("ace/snippets/sparql",t(38842)),ace.config.setModuleUrl("ace/snippets/sql",t(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",t(56420)),ace.config.setModuleUrl("ace/snippets/stylus",t(3309)),ace.config.setModuleUrl("ace/snippets/svg",t(82161)),ace.config.setModuleUrl("ace/snippets/swift",t(41200)),ace.config.setModuleUrl("ace/snippets/tcl",t(32384)),ace.config.setModuleUrl("ace/snippets/terraform",t(75607)),ace.config.setModuleUrl("ace/snippets/tex",t(6874)),ace.config.setModuleUrl("ace/snippets/text",t(54012)),ace.config.setModuleUrl("ace/snippets/textile",t(93878)),ace.config.setModuleUrl("ace/snippets/toml",t(49599)),ace.config.setModuleUrl("ace/snippets/tsx",t(22028)),ace.config.setModuleUrl("ace/snippets/turtle",t(86333)),ace.config.setModuleUrl("ace/snippets/twig",t(11078)),ace.config.setModuleUrl("ace/snippets/typescript",t(40344)),ace.config.setModuleUrl("ace/snippets/vala",t(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",t(5368)),ace.config.setModuleUrl("ace/snippets/velocity",t(4896)),ace.config.setModuleUrl("ace/snippets/verilog",t(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",t(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",t(82036)),ace.config.setModuleUrl("ace/snippets/vue",t(36751)),ace.config.setModuleUrl("ace/snippets/wollok",t(12463)),ace.config.setModuleUrl("ace/snippets/xml",t(65690)),ace.config.setModuleUrl("ace/snippets/xquery",t(84835)),ace.config.setModuleUrl("ace/snippets/yaml",t(46716)),ace.config.setModuleUrl("ace/snippets/zeek",t(51174)),ace.config.setModuleUrl("ace/snippets/zig",t(64865))},63282(e,n,t){"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 D=t(4042),S=t(86144),a=t(36653),r=t(72079),o=["/properties"],i="http://json-schema.org/draft-07/schema";class g extends D.default{_addVocabularies(){super._addVocabularies(),S.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(r,o):r;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}n.Ajv=g,e.exports=n=g,e.exports.Ajv=g,Object.defineProperty(n,"__esModule",{value:!0}),n.default=g;var s=t(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var l=t(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 d=t(13558);Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return d.default}});var c=t(34551);Object.defineProperty(n,"MissingRefError",{enumerable:!0,get:function(){return c.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 t{}n._CodeOrName=t,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class D extends t{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=D;class S extends t{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 D&&(e[n.str]=(e[n.str]||0)+1),e),{})}}function a(e,...n){let t=[e[0]],D=0;for(;D<n.length;)i(t,n[D]),t.push(e[++D]);return new S(t)}n._Code=S,n.nil=new S(""),n._=a;let r=new S("+");function o(e,...n){let t=[d(e[0])],D=0;for(;D<n.length;)t.push(r),i(t,n[D]),t.push(r,d(e[++D]));return g(t),new S(t)}function i(e,n){n instanceof S?e.push(...n._items):n instanceof D?e.push(n):e.push(l(n))}function g(e){let n=1;for(;n<e.length-1;){if(e[n]===r){let t=s(e[n-1],e[n+1]);if(void 0!==t){e.splice(n-1,3,t);continue}e[n++]="+"}n++}}function s(e,n){return'""'===n?e:'""'===e?n:"string"==typeof e?n instanceof D||'"'!==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 D?void 0:`"${e}${n.slice(1)}`}function l(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:d(Array.isArray(e)?e.join(","):e)}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c(e){return"string"==typeof e&&n.IDENTIFIER.test(e)?new S(`.${e}`):a`[${e}]`}function u(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=i,n.strConcat=function(e,n){return n.emptyStr()?e:e.emptyStr()?n:o`${e}${n}`},n.stringify=function(e){return new S(d(e))},n.safeStringify=d,n.getProperty=c,n.getEsmExportName=u,n.regexpCode=function(e){return new S(e.toString())}},99029(e,n,t){"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 D=t(41520),S=t(57845);var a=t(41520);Object.defineProperty(n,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(n,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(n,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(n,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(n,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(n,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(n,"Name",{enumerable:!0,get:function(){return a.Name}});var r=t(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 D._Code(">"),GTE:new D._Code(">="),LT:new D._Code("<"),LTE:new D._Code("<="),EQ:new D._Code("==="),NEQ:new D._Code("!=="),NOT:new D._Code("!"),OR:new D._Code("||"),AND:new D._Code("&&"),ADD:new D._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,n){return this}}class i extends o{constructor(e,n,t){super(),this.varKind=e,this.name=n,this.rhs=t}render({es5:e,_n:n}){let t=e?S.varKinds.var:this.varKind,D=void 0===this.rhs?"":` = ${this.rhs}`;return`${t} ${this.name}${D};`+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 D._CodeOrName?this.rhs.names:{}}}class g extends o{constructor(e,n,t){super(),this.lhs=e,this.rhs=n,this.sideEffects=t}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof D.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=T(this.rhs,e,n),this}get names(){return E(this.lhs instanceof D.Name?{}:{...this.lhs.names},this.rhs)}}class s extends g{constructor(e,n,t,D){super(e,t,D),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 d extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let n=this.label?` ${this.label}`:"";return`break${n};`+e}}class c extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class u 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 D._CodeOrName?this.code.names:{}}}class f extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,t)=>n+t.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let t=e[n].optimizeNodes();Array.isArray(t)?e.splice(n,1,...t):t?e[n]=t:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:t}=this,D=t.length;for(;D--;){let S=t[D];S.optimizeNames(e,n)||(O(e,S.names),t.splice(D,1))}return t.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>k(e,n.names),{})}}class h extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class p extends f{}class m extends h{}m.kind="else";class y extends h{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 t;if(this.else=null==(t=this.else)?void 0:t.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 E(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class b extends h{}b.kind="for";class v extends b{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 $ extends b{constructor(e,n,t,D){super(),this.varKind=e,this.name=n,this.from=t,this.to=D}render(e){let n=e.es5?S.varKinds.var:this.varKind,{name:t,from:D,to:a}=this;return`for(${n} ${t}=${D}; ${t}<${a}; ${t}++)`+super.render(e)}get names(){let e=E(super.names,this.from);return E(e,this.to)}}class w extends b{constructor(e,n,t,D){super(),this.loop=e,this.varKind=n,this.name=t,this.iterable=D}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 _ extends h{constructor(e,n,t){super(),this.name=e,this.args=n,this.async=t}render(e){let n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class A extends f{render(e){return"return "+super.render(e)}}A.kind="return";class M extends h{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 t,D;return super.optimizeNames(e,n),null==(t=this.catch)||t.optimizeNames(e,n),null==(D=this.finally)||D.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 h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class L extends h{render(e){return"finally"+super.render(e)}}L.kind="finally";class C{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 p]}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 t=this._extScope.value(e,n);return(this._values[t.prefix]||(this._values[t.prefix]=new Set)).add(t),t}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,t,D){let S=this._scope.toName(n);return void 0!==t&&D&&(this._constants[S.str]=t),this._leafNode(new i(e,S,t)),S}const(e,n,t){return this._def(S.varKinds.const,e,n,t)}let(e,n,t){return this._def(S.varKinds.let,e,n,t)}var(e,n,t){return this._def(S.varKinds.var,e,n,t)}assign(e,n,t){return this._leafNode(new g(e,n,t))}add(e,t){return this._leafNode(new s(e,n.operators.ADD,t))}code(e){return"function"==typeof e?e():e!==D.nil&&this._leafNode(new u(e)),this}object(...e){let n=["{"];for(let[t,S]of e)n.length>1&&n.push(","),n.push(t),(t!==S||this.opts.es5)&&(n.push(":"),(0,D.addCodeArg)(n,S));return n.push("}"),new D._Code(n)}if(e,n,t){if(this._blockNode(new y(e)),n&&t)this.code(n).else().code(t).endIf();else if(n)this.code(n).endIf();else if(t)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 v(e),n)}forRange(e,n,t,D,a=this.opts.es5?S.varKinds.var:S.varKinds.let){let r=this._scope.toName(e);return this._for(new $(a,r,n,t),()=>D(r))}forOf(e,n,t,a=S.varKinds.const){let r=this._scope.toName(e);if(this.opts.es5){let e=n instanceof D.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,D._)`${e}.length`,n=>{this.var(r,(0,D._)`${e}[${n}]`),t(r)})}return this._for(new w("of",a,r,n),()=>t(r))}forIn(e,n,t,a=this.opts.es5?S.varKinds.var:S.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,D._)`Object.keys(${n})`,t);let r=this._scope.toName(e);return this._for(new w("in",a,r,n),()=>t(r))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){let n=new A;if(this._blockNode(n),this.code(e),1!==n.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(e,n,t){if(!n&&!t)throw Error('CodeGen: "try" without "catch" and "finally"');let D=new M;if(this._blockNode(D),this.code(e),n){let e=this.name("e");this._currNode=D.catch=new x(e),n(e)}return t&&(this._currNode=D.finally=new L,this.code(t)),this._endBlockNode(x,L)}throw(e){return this._leafNode(new c(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 t=this._nodes.length-n;if(t<0||void 0!==e&&t!==e)throw Error(`CodeGen: wrong number of nodes: ${t} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=D.nil,t,S){return this._blockNode(new _(e,n,t)),S&&this.code(S).endFunc(),this}endFunc(){return this._endBlockNode(_)}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 t=this._currNode;if(t instanceof e||n&&t 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 t in n)e[t]=(e[t]||0)+(n[t]||0);return e}function E(e,n){return n instanceof D._CodeOrName?k(e,n.names):e}function T(e,n,t){if(e instanceof D.Name)return S(e);if(!a(e))return e;return new D._Code(e._items.reduce((e,n)=>(n instanceof D.Name&&(n=S(n)),n instanceof D._Code?e.push(...n._items):e.push(n),e),[]));function S(e){let D=t[e.str];return void 0===D||1!==n[e.str]?e:(delete n[e.str],D)}function a(e){return e instanceof D._Code&&e._items.some(e=>e instanceof D.Name&&1===n[e.str]&&void 0!==t[e.str])}}function O(e,n){for(let t in n)e[t]=(e[t]||0)-(n[t]||0)}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,D._)`!${P(e)}`}n.CodeGen=C,n.not=R;let I=j(n.operators.AND);n.and=function(...e){return e.reduce(I)};let N=j(n.operators.OR);function j(e){return(n,t)=>n===D.nil?t:t===D.nil?n:(0,D._)`${P(n)} ${e} ${P(t)}`}function P(e){return e instanceof D.Name?e:(0,D._)`(${e})`}n.or=function(...e){return e.reduce(N)}},57845(e,n,t){"use strict";var D;Object.defineProperty(n,"__esModule",{value:!0}),n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;let S=t(41520);class a 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"}(D||(n.UsedValueState=D={})),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,t;if((null==(t=null==(n=this._parent)?void 0:n._prefixes)?void 0:t.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:t}){this.value=e,this.scopePath=(0,S._)`.${new S.Name(n)}[${t}]`}}n.ValueScopeName=o;let i=(0,S._)`\n`;class g extends r{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:S.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,n){var t;if(void 0===n.ref)throw Error("CodeGen: ref must be passed in value");let D=this.toName(e),{prefix:S}=D,a=null!=(t=n.key)?t:n.ref,r=this._values[S];if(r){let e=r.get(a);if(e)return e}else r=this._values[S]=new Map;r.set(a,D);let o=this._scope[S]||(this._scope[S]=[]),i=o.length;return o[i]=n.ref,D.setValue(n,{property:S,itemIndex:i}),D}getValue(e,n){let t=this._values[e];if(t)return t.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,t){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},n,t)}_reduceValues(e,t,r={},o){let i=S.nil;for(let g in e){let s=e[g];if(!s)continue;let l=r[g]=r[g]||new Map;s.forEach(e=>{if(l.has(e))return;l.set(e,D.Started);let r=t(e);if(r){let t=this.opts.es5?n.varKinds.var:n.varKinds.const;i=(0,S._)`${i}${t} ${e} = ${r};${this.opts._n}`}else if(r=null==o?void 0:o(e))i=(0,S._)`${i}${r}${this.opts._n}`;else throw new a(e);l.set(e,D.Completed)})}return i}}n.ValueScope=g},48708(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;let D=t(99029),S=t(94227),a=t(42023);function r(e,t=n.keywordError,S,a){let{it:o}=e,{gen:s,compositeRule:d,allErrors:c}=o,u=l(e,t,S);(null!=a?a:d||c)?i(s,u):g(o,(0,D._)`[${u}]`)}function o(e,t=n.keywordError,D){let{it:S}=e,{gen:r,compositeRule:s,allErrors:d}=S;i(r,l(e,t,D)),s||d||g(S,a.default.vErrors)}function i(e,n){let t=e.const("err",n);e.if((0,D._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,D._)`[${t}]`),(0,D._)`${a.default.vErrors}.push(${t})`),e.code((0,D._)`${a.default.errors}++`)}function g(e,n){let{gen:t,validateName:S,schemaEnv:a}=e;a.$async?t.throw((0,D._)`new ${e.ValidationError}(${n})`):(t.assign((0,D._)`${S}.errors`,n),t.return(!1))}n.keywordError={message:({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`},n.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,D.str)`"${e}" keyword must be ${n} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`},n.reportError=r,n.reportExtraError=o,n.resetErrorsCount=function(e,n){e.assign(a.default.errors,n),e.if((0,D._)`${a.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,D._)`${a.default.vErrors}.length`,n),()=>e.assign(a.default.vErrors,null)))},n.extendErrors=function({gen:e,keyword:n,schemaValue:t,data:S,errsCount:r,it:o}){if(void 0===r)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",r,a.default.errors,r=>{e.const(i,(0,D._)`${a.default.vErrors}[${r}]`),e.if((0,D._)`${i}.instancePath === undefined`,()=>e.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(a.default.instancePath,o.errorPath))),e.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${o.errSchemaPath}/${n}`),o.opts.verbose&&(e.assign((0,D._)`${i}.schema`,t),e.assign((0,D._)`${i}.data`,S))})};let s={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function l(e,n,t){let{createErrors:S}=e.it;return!1===S?(0,D._)`{}`:d(e,n,t)}function d(e,n,t={}){let{gen:D,it:S}=e,a=[c(S,t),u(e,t)];return f(e,n,a),D.object(...a)}function c({errorPath:e},{instancePath:n}){let t=n?(0,D.str)`${e}${(0,S.getErrorPath)(n,S.Type.Str)}`:e;return[a.default.instancePath,(0,D.strConcat)(a.default.instancePath,t)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:t,parentSchema:a}){let r=a?n:(0,D.str)`${n}/${e}`;return t&&(r=(0,D.str)`${r}${(0,S.getErrorPath)(t,S.Type.Str)}`),[s.schemaPath,r]}function f(e,{params:n,message:t},S){let{keyword:r,data:o,schemaValue:i,it:g}=e,{opts:l,propertyName:d,topSchemaRef:c,schemaPath:u}=g;S.push([s.keyword,r],[s.params,"function"==typeof n?n(e):n||(0,D._)`{}`]),l.messages&&S.push([s.message,"function"==typeof t?t(e):t]),l.verbose&&S.push([s.schema,i],[s.parentSchema,(0,D._)`${c}${u}`],[a.default.data,o]),d&&S.push([s.propertyName,d])}},73835(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;let D=t(99029),S=t(13558),a=t(42023),r=t(66939),o=t(94227),i=t(62586);class g{constructor(e){var n;let t;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(t=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==t?void 0:t[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==t?void 0:t.$async,this.refs={}}}function s(e){let n,t,o=d.call(this,e);if(o)return o;let g=(0,r.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:s,lines:l}=this.opts.code,{ownProperties:c}=this.opts,u=new D.CodeGen(this.scope,{es5:s,lines:l,ownProperties:c});e.$async&&(n=u.scopeValue("Error",{ref:S.default,code:(0,D._)`require("ajv/dist/runtime/validation_error").default`}));let f=u.scopeName("validate");e.validateName=f;let h={gen:u,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[D.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,D.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:g,baseId:e.baseId||g,schemaPath:D.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,D._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,i.validateFunctionCode)(h),u.optimize(this.opts.code.optimize);let n=u.toString();t=`${u.scopeRefs(a.default.scope)}return ${n}`,this.opts.code.process&&(t=this.opts.code.process(t,e));let S=Function(`${a.default.self}`,`${a.default.scope}`,t)(this,this.scope.get());if(this.scope.value(f,{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:f,validateCode:n,scopeValues:u._values}),this.opts.unevaluated){let{props:e,items:n}=h;S.evaluated={props:e instanceof D.Name?void 0:e,items:n instanceof D.Name?void 0:n,dynamicProps:e instanceof D.Name,dynamicItems:n instanceof D.Name},S.source&&(S.source.evaluated=(0,D.stringify)(S.evaluated))}return e.validate=S,e}catch(n){throw delete e.validate,delete e.validateName,t&&this.logger.error("Error compiling schema, function code:",t),n}finally{this._compilations.delete(e)}}function l(e){return(0,r.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:s.call(this,e)}function d(e){for(let n of this._compilations)if(c(n,e))return n}function c(e,n){return e.schema===n.schema&&e.root===n.root&&e.baseId===n.baseId}function u(e,n){let t;for(;"string"==typeof(t=this.refs[n]);)n=t;return t||this.schemas[n]||f.call(this,e,n)}function f(e,n){let t=this.opts.uriResolver.parse(n),D=(0,r._getFullPath)(this.opts.uriResolver,t),S=(0,r.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&D===S)return p.call(this,t,e);let a=(0,r.normalizeId)(D),o=this.refs[a]||this.schemas[a];if("string"==typeof o){let n=f.call(this,e,o);if("object"!=typeof(null==n?void 0:n.schema))return;return p.call(this,t,n)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||s.call(this,o),a===(0,r.normalizeId)(n)){let{schema:n}=o,{schemaId:t}=this.opts,D=n[t];return D&&(S=(0,r.resolveUrl)(this.opts.uriResolver,S,D)),new g({schema:n,schemaId:t,root:e,baseId:S})}return p.call(this,t,o)}}n.SchemaEnv=g,n.compileSchema=s,n.resolveRef=function(e,n,t){var D;t=(0,r.resolveUrl)(this.opts.uriResolver,n,t);let S=e.refs[t];if(S)return S;let a=u.call(this,e,t);if(void 0===a){let S=null==(D=e.localRefs)?void 0:D[t],{schemaId:r}=this.opts;S&&(a=new g({schema:S,schemaId:r,root:e,baseId:n}))}if(void 0!==a)return e.refs[t]=l.call(this,a)},n.getCompilingSchema=d,n.resolveSchema=f;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function p(e,{baseId:n,schema:t,root:D}){var S;let a;if((null==(S=e.fragment)?void 0:S[0])!=="/")return;for(let D of e.fragment.slice(1).split("/")){if("boolean"==typeof t)return;let e=t[(0,o.unescapeFragment)(D)];if(void 0===e)return;let S="object"==typeof(t=e)&&t[this.opts.schemaId];!h.has(D)&&S&&(n=(0,r.resolveUrl)(this.opts.uriResolver,n,S))}if("boolean"!=typeof t&&t.$ref&&!(0,o.schemaHasRulesButRef)(t,this.RULES)){let e=(0,r.resolveUrl)(this.opts.uriResolver,n,t.$ref);a=f.call(this,D,e)}let{schemaId:i}=this.opts;if((a=a||new g({schema:t,schemaId:i,root:D,baseId:n})).schema!==a.root.schema)return a}},42023(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(99029);n.default={data:new D.Name("data"),valCxt:new D.Name("valCxt"),instancePath:new D.Name("instancePath"),parentData:new D.Name("parentData"),parentDataProperty:new D.Name("parentDataProperty"),rootData:new D.Name("rootData"),dynamicAnchors:new D.Name("dynamicAnchors"),vErrors:new D.Name("vErrors"),errors:new D.Name("errors"),this:new D.Name("this"),self:new D.Name("self"),scope:new D.Name("scope"),json:new D.Name("json"),jsonPos:new D.Name("jsonPos"),jsonLen:new D.Name("jsonLen"),jsonPart:new D.Name("jsonPart")}},34551(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(66939);class S extends Error{constructor(e,n,t,S){super(S||`can't resolve reference ${t} from id ${n}`),this.missingRef=(0,D.resolveUrl)(e,n,t),this.missingSchema=(0,D.normalizeId)((0,D.getFullPath)(e,this.missingRef))}}n.default=S},66939(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;let D=t(94227),S=t(32017),a=t(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?!i(e):!!n&&g(e)<=n)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e){for(let n in e){if(o.has(n))return!0;let t=e[n];if(Array.isArray(t)&&t.some(i)||"object"==typeof t&&i(t))return!0}return!1}function g(e){let n=0;for(let t in e)if("$ref"===t||(n++,!r.has(t)&&("object"==typeof e[t]&&(0,D.eachItem)(e[t],e=>n+=g(e)),n===1/0)))return 1/0;return n}function s(e,n="",t){!1!==t&&(n=c(n));let D=e.parse(n);return l(e,D)}function l(e,n){return e.serialize(n).split("#")[0]+"#"}n.getFullPath=s,n._getFullPath=l;let d=/#\/?$/;function c(e){return e?e.replace(d,""):""}n.normalizeId=c,n.resolveUrl=function(e,n,t){return t=c(t),e.resolve(n,t)};let u=/^[a-z_][-a-z0-9._]*$/i;n.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};let{schemaId:t,uriResolver:D}=this.opts,r=c(e[t]||n),o={"":r},i=s(D,r,!1),g={},l=new Set;return a(e,{allKeys:!0},(e,n,D,S)=>{if(void 0===S)return;let a=i+n,r=o[S];function s(n){let t=this.opts.uriResolver.resolve;if(n=c(r?t(r,n):n),l.has(n))throw f(n);l.add(n);let D=this.refs[n];return"string"==typeof D&&(D=this.refs[D]),"object"==typeof D?d(e,D.schema,n):n!==c(a)&&("#"===n[0]?(d(e,g[n],n),g[n]=e):this.refs[n]=a),n}function h(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[t]&&(r=s.call(this,e[t])),h.call(this,e.$anchor),h.call(this,e.$dynamicAnchor),o[n]=r}),g;function d(e,n,t){if(void 0!==n&&!S(e,n))throw f(t)}function f(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 t=new Set(["string","number","integer","boolean","null","object","array"]);n.isJSONType=function(e){return"string"==typeof e&&t.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,t){"use strict";var D;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=t(99029),a=t(41520);function r(e,n=e.schema){let{opts:t,self:D}=e;if(!t.strictSchema||"boolean"==typeof n)return;let S=D.RULES.keywords;for(let t in n)S[t]||u(e,`unknown keyword: "${t}"`)}function o(e,n){if("boolean"==typeof e)return!e;for(let t in e)if(n[t])return!0;return!1}function i(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function g(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:e,mergeToName:n,mergeValues:t,resultToName:D}){return(a,r,o,i)=>{let g=void 0===o?r:o instanceof S.Name?(r instanceof S.Name?e(a,r,o):n(a,r,o),o):r instanceof S.Name?(n(a,o,r),r):t(r,o);return i!==S.Name||g instanceof S.Name?g:D(a,g)}}function l(e,n){if(!0===n)return e.var("props",!0);let t=e.var("props",(0,S._)`{}`);return void 0!==n&&d(e,t,n),t}function d(e,n,t){Object.keys(t).forEach(t=>e.assign((0,S._)`${n}${(0,S.getProperty)(t)}`,!0))}n.toHash=function(e){let n={};for(let t of e)n[t]=!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 t in e)if("$ref"!==t&&n.all[t])return!0;return!1},n.schemaRefOrVal=function({topSchemaRef:e,schemaPath:n},t,D,a){if(!a){if("number"==typeof t||"boolean"==typeof t)return t;if("string"==typeof t)return(0,S._)`${t}`}return(0,S._)`${e}${n}${(0,S.getProperty)(D)}`},n.unescapeFragment=function(e){return g(decodeURIComponent(e))},n.escapeFragment=function(e){return encodeURIComponent(i(e))},n.escapeJsonPointer=i,n.unescapeJsonPointer=g,n.eachItem=function(e,n){if(Array.isArray(e))for(let t of e)n(t);else n(e)},n.mergeEvaluated={props:s({mergeNames:(e,n,t)=>e.if((0,S._)`${t} !== true && ${n} !== undefined`,()=>{e.if((0,S._)`${n} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,S._)`${t} || {}`).code((0,S._)`Object.assign(${t}, ${n})`))}),mergeToName:(e,n,t)=>e.if((0,S._)`${t} !== true`,()=>{!0===n?e.assign(t,!0):(e.assign(t,(0,S._)`${t} || {}`),d(e,t,n))}),mergeValues:(e,n)=>!0===e||{...e,...n},resultToName:l}),items:s({mergeNames:(e,n,t)=>e.if((0,S._)`${t} !== true && ${n} !== undefined`,()=>e.assign(t,(0,S._)`${n} === true ? true : ${t} > ${n} ? ${t} : ${n}`)),mergeToName:(e,n,t)=>e.if((0,S._)`${t} !== true`,()=>e.assign(t,!0===n||(0,S._)`${t} > ${n} ? ${t} : ${n}`)),mergeValues:(e,n)=>!0===e||Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})},n.evaluatedPropsToName=l,n.setEvaluated=d;let c={};function u(e,n,t=e.opts.strictSchema){if(t){if(n=`strict mode: ${n}`,!0===t)throw Error(n);e.self.logger.warn(n)}}n.useFunc=function(e,n){return e.scopeValue("func",{ref:n,code:c[n.code]||(c[n.code]=new a._Code(n.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(D||(n.Type=D={})),n.getErrorPath=function(e,n,t){if(e instanceof S.Name){let a=n===D.Num;return t?a?(0,S._)`"[" + ${e} + "]"`:(0,S._)`"['" + ${e} + "']"`:a?(0,S._)`"/" + ${e}`:(0,S._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,S.getProperty)(e).toString():"/"+i(e)},n.checkStrictMode=u},7887(e,n){"use strict";function t(e,n){return n.rules.some(n=>D(e,n))}function D(e,n){var t;return void 0!==e[n.keyword]||(null==(t=n.definition.implements)?void 0:t.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},D){let S=n.RULES.types[D];return S&&!0!==S&&t(e,S)},n.shouldUseGroup=t,n.shouldUseRule=D},28727(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;let D=t(48708),S=t(99029),a=t(42023),r={message:"boolean schema is false"};function o(e,n){let{gen:t,data:S}=e,a={gen:t,keyword:"false schema",data:S,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,D.reportError)(a,r,void 0,n)}n.topBoolOrEmptySchema=function(e){let{gen:n,schema:t,validateName:D}=e;!1===t?o(e,!1):"object"==typeof t&&!0===t.$async?n.return(a.default.data):(n.assign((0,S._)`${D}.errors`,null),n.return(!0))},n.boolOrEmptySchema=function(e,n){let{gen:t,schema:D}=e;!1===D?(t.var(n,!1),o(e)):t.var(n,!0)}},10208(e,n,t){"use strict";var D;Object.defineProperty(n,"__esModule",{value:!0}),n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;let S=t(10396),a=t(7887),r=t(48708),o=t(99029),i=t(94227);function g(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"}(D||(n.DataType=D={})),n.getSchemaTypes=function(e){let n=g(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=g,n.coerceAndCheckDataType=function(e,n){let{gen:t,data:S,opts:r}=e,o=l(n,r.coerceTypes),i=n.length>0&&!(0===o.length&&1===n.length&&(0,a.schemaHasRulesForType)(e,n[0]));if(i){let a=f(n,S,r.strictNumbers,D.Wrong);t.if(a,()=>{o.length?d(e,n,o):p(e)})}return i};let s=new Set(["string","number","integer","boolean","null"]);function l(e,n){return n?e.filter(e=>s.has(e)||"array"===n&&"array"===e):[]}function d(e,n,t){let{gen:D,data:S,opts:a}=e,r=D.let("dataType",(0,o._)`typeof ${S}`),i=D.let("coerced",(0,o._)`undefined`);for(let e of("array"===a.coerceTypes&&D.if((0,o._)`${r} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>D.assign(S,(0,o._)`${S}[0]`).assign(r,(0,o._)`typeof ${S}`).if(f(n,S,a.strictNumbers),()=>D.assign(i,S))),D.if((0,o._)`${i} !== undefined`),t))(s.has(e)||"array"===e&&"array"===a.coerceTypes)&&g(e);function g(e){switch(e){case"string":D.elseIf((0,o._)`${r} == "number" || ${r} == "boolean"`).assign(i,(0,o._)`"" + ${S}`).elseIf((0,o._)`${S} === null`).assign(i,(0,o._)`""`);return;case"number":D.elseIf((0,o._)`${r} == "boolean" || ${S} === null
|
|
6
6
|
|| (${r} == "string" && ${S} && ${S} == +${S})`).assign(i,(0,o._)`+${S}`);return;case"integer":D.elseIf((0,o._)`${r} === "boolean" || ${S} === null
|
|
7
7
|
|| (${r} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(i,(0,o._)`+${S}`);return;case"boolean":D.elseIf((0,o._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(i,!1).elseIf((0,o._)`${S} === "true" || ${S} === 1`).assign(i,!0);return;case"null":D.elseIf((0,o._)`${S} === "" || ${S} === 0 || ${S} === false`),D.assign(i,null);return;case"array":D.elseIf((0,o._)`${r} === "string" || ${r} === "number"
|
|
8
8
|
|| ${r} === "boolean" || ${S} === null`).assign(i,(0,o._)`[${S}]`)}}D.else(),p(e),D.endIf(),D.if((0,o._)`${i} !== undefined`,()=>{D.assign(S,i),c(e,i)})}function c({gen:e,parentData:n,parentDataProperty:t},D){e.if((0,o._)`${n} !== undefined`,()=>e.assign((0,o._)`${n}[${t}]`,D))}function u(e,n,t,S=D.Correct){let a,r=S===D.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${n} ${r} null`;case"array":a=(0,o._)`Array.isArray(${n})`;break;case"object":a=(0,o._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`;break;case"integer":a=i((0,o._)`!(${n} % 1) && !isNaN(${n})`);break;case"number":a=i();break;default:return(0,o._)`typeof ${n} ${r} ${e}`}return S===D.Correct?a:(0,o.not)(a);function i(e=o.nil){return(0,o.and)((0,o._)`typeof ${n} == "number"`,e,t?(0,o._)`isFinite(${n})`:o.nil)}}function f(e,n,t,D){let S;if(1===e.length)return u(e[0],n,t,D);let a=(0,i.toHash)(e);if(a.array&&a.object){let e=(0,o._)`typeof ${n} != "object"`;S=a.null?e:(0,o._)`!${n} || ${e}`,delete a.null,delete a.array,delete a.object}else S=o.nil;for(let e in a.number&&delete a.integer,a)S=(0,o.and)(S,u(e,n,t,D));return S}n.checkDataType=u,n.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:n})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${n}}`};function p(e){let n=m(e);(0,r.reportError)(n,h)}function m(e){let{gen:n,data:t,schema:D}=e,S=(0,i.schemaRefOrVal)(e,D,"type");return{gen:n,keyword:"type",data:t,schema:D.type,schemaCode:S,schemaValue:S,parentSchema:D,params:{},it:e}}n.reportTypeError=p},7870(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.assignDefaults=void 0;let D=t(99029),S=t(94227);function a(e,n,t){let{gen:a,compositeRule:r,data:o,opts:i}=e;if(void 0===t)return;let g=(0,D._)`${o}${(0,D.getProperty)(n)}`;if(r)return void(0,S.checkStrictMode)(e,`default is ignored for: ${g}`);let s=(0,D._)`${g} === undefined`;"empty"===i.useDefaults&&(s=(0,D._)`${s} || ${g} === null || ${g} === ""`),a.if(s,(0,D._)`${g} = ${(0,D.stringify)(t)}`)}n.assignDefaults=function(e,n){let{properties:t,items:D}=e.schema;if("object"===n&&t)for(let n in t)a(e,n,t[n].default);else"array"===n&&Array.isArray(D)&&D.forEach((n,t)=>a(e,t,n.default))}},62586(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getData=n.KeywordCxt=n.validateFunctionCode=void 0;let D=t(28727),S=t(10208),a=t(7887),r=t(10208),o=t(7870),i=t(33673),g=t(24495),s=t(99029),l=t(42023),d=t(66939),c=t(94227),u=t(48708);function f({gen:e,validateName:n,schema:t,schemaEnv:D,opts:S},a){S.code.es5?e.func(n,(0,s._)`${l.default.data}, ${l.default.valCxt}`,D.$async,()=>{e.code((0,s._)`"use strict"; ${b(t,S)}`),p(e,S),e.code(a)}):e.func(n,(0,s._)`${l.default.data}, ${h(S)}`,D.$async,()=>e.code(b(t,S)).code(a))}function h(e){return(0,s._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,s._)`, ${l.default.dynamicAnchors}={}`:s.nil}}={}`}function p(e,n){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,s._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,s._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,s._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,s._)`${l.default.valCxt}.${l.default.rootData}`),n.dynamicRef&&e.var(l.default.dynamicAnchors,(0,s._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,s._)`""`),e.var(l.default.parentData,(0,s._)`undefined`),e.var(l.default.parentDataProperty,(0,s._)`undefined`),e.var(l.default.rootData,l.default.data),n.dynamicRef&&e.var(l.default.dynamicAnchors,(0,s._)`{}`)})}function m(e){let{schema:n,opts:t,gen:D}=e;f(e,()=>{t.$comment&&n.$comment&&E(e),L(e),D.let(l.default.vErrors,null),D.let(l.default.errors,0),t.unevaluated&&y(e),M(e),T(e)})}function y(e){let{gen:n,validateName:t}=e;e.evaluated=n.const("evaluated",(0,s._)`${t}.evaluated`),n.if((0,s._)`${e.evaluated}.dynamicProps`,()=>n.assign((0,s._)`${e.evaluated}.props`,(0,s._)`undefined`)),n.if((0,s._)`${e.evaluated}.dynamicItems`,()=>n.assign((0,s._)`${e.evaluated}.items`,(0,s._)`undefined`))}function b(e,n){let t="object"==typeof e&&e[n.schemaId];return t&&(n.code.source||n.code.process)?(0,s._)`/*# sourceURL=${t} */`:s.nil}function v(e,n){w(e)&&(A(e),$(e))?_(e,n):(0,D.boolOrEmptySchema)(e,n)}function $({schema:e,self:n}){if("boolean"==typeof e)return!e;for(let t in e)if(n.RULES.all[t])return!0;return!1}function w(e){return"boolean"!=typeof e.schema}function _(e,n){let{schema:t,gen:D,opts:S}=e;S.$comment&&t.$comment&&E(e),C(e),k(e);let a=D.const("_errs",l.default.errors);M(e,a),D.var(n,(0,s._)`${a} === ${l.default.errors}`)}function A(e){(0,c.checkUnknownRules)(e),x(e)}function M(e,n){if(e.opts.jtd)return R(e,[],!1,n);let t=(0,S.getSchemaTypes)(e.schema),D=(0,S.coerceAndCheckDataType)(e,t);R(e,t,!D,n)}function x(e){let{schema:n,errSchemaPath:t,opts:D,self:S}=e;n.$ref&&D.ignoreKeywordsWithRef&&(0,c.schemaHasRulesButRef)(n,S.RULES)&&S.logger.warn(`$ref: keywords ignored in schema at path "${t}"`)}function L(e){let{schema:n,opts:t}=e;void 0!==n.default&&t.useDefaults&&t.strictSchema&&(0,c.checkStrictMode)(e,"default is ignored in the schema root")}function C(e){let n=e.schema[e.opts.schemaId];n&&(e.baseId=(0,d.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 E({gen:e,schemaEnv:n,schema:t,errSchemaPath:D,opts:S}){let a=t.$comment;if(!0===S.$comment)e.code((0,s._)`${l.default.self}.logger.log(${a})`);else if("function"==typeof S.$comment){let t=(0,s.str)`${D}/$comment`,S=e.scopeValue("root",{ref:n.root});e.code((0,s._)`${l.default.self}.opts.$comment(${a}, ${t}, ${S}.schema)`)}}function T(e){let{gen:n,schemaEnv:t,validateName:D,ValidationError:S,opts:a}=e;t.$async?n.if((0,s._)`${l.default.errors} === 0`,()=>n.return(l.default.data),()=>n.throw((0,s._)`new ${S}(${l.default.vErrors})`)):(n.assign((0,s._)`${D}.errors`,l.default.vErrors),a.unevaluated&&O(e),n.return((0,s._)`${l.default.errors} === 0`))}function O({gen:e,evaluated:n,props:t,items:D}){t instanceof s.Name&&e.assign((0,s._)`${n}.props`,t),D instanceof s.Name&&e.assign((0,s._)`${n}.items`,D)}function R(e,n,t,D){let{gen:S,schema:o,data:i,allErrors:g,opts:d,self:u}=e,{RULES:f}=u;if(o.$ref&&(d.ignoreKeywordsWithRef||!(0,c.schemaHasRulesButRef)(o,f)))return void S.block(()=>W(e,"$ref",f.all.$ref.definition));function h(c){(0,a.shouldUseGroup)(o,c)&&(c.type?(S.if((0,r.checkDataType)(c.type,i,d.strictNumbers)),I(e,c),1===n.length&&n[0]===c.type&&t&&(S.else(),(0,r.reportTypeError)(e)),S.endIf()):I(e,c),g||S.if((0,s._)`${l.default.errors} === ${D||0}`))}d.jtd||N(e,n),S.block(()=>{for(let e of f.rules)h(e);h(f.post)})}function I(e,n){let{gen:t,schema:D,opts:{useDefaults:S}}=e;S&&(0,o.assignDefaults)(e,n.type),t.block(()=>{for(let t of n.rules)(0,a.shouldUseRule)(D,t)&&W(e,t.keyword,t.definition,n.type)})}function N(e,n){!e.schemaEnv.meta&&e.opts.strictTypes&&(j(e,n),e.opts.allowUnionTypes||P(e,n),F(e,e.dataTypes))}function j(e,n){if(n.length){if(!e.dataTypes.length){e.dataTypes=n;return}n.forEach(n=>{B(e.dataTypes,n)||V(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),z(e,n)}}function P(e,n){n.length>1&&!(2===n.length&&n.includes("null"))&&V(e,"use allowUnionTypes to allow union type keyword")}function F(e,n){let t=e.self.RULES.all;for(let D in t){let S=t[D];if("object"==typeof S&&(0,a.shouldUseRule)(e.schema,S)){let{type:t}=S.definition;t.length&&!t.some(e=>U(n,e))&&V(e,`missing type "${t.join(",")}" for keyword "${D}"`)}}}function U(e,n){return e.includes(n)||"number"===n&&e.includes("integer")}function B(e,n){return e.includes(n)||"integer"===n&&e.includes("number")}function z(e,n){let t=[];for(let D of e.dataTypes)B(n,D)?t.push(D):n.includes("integer")&&"number"===D&&t.push("integer");e.dataTypes=t}function V(e,n){let t=e.schemaEnv.baseId+e.errSchemaPath;n+=` at "${t}" (strictTypes)`,(0,c.checkStrictMode)(e,n,e.opts.strictTypes)}n.validateFunctionCode=function(e){w(e)&&(A(e),$(e))?m(e):f(e,()=>(0,D.topBoolOrEmptySchema)(e))};class H{constructor(e,n,t){if((0,i.validateKeywordUsage)(e,n,t),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=t,this.data=e.data,this.schema=e.schema[t],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,c.schemaRefOrVal)(e,this.schema,t,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,i.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw Error(`${t} 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,t){this.failResult((0,s.not)(e),n,t)}failResult(e,n,t){this.gen.if(e),t?t():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,s.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,s._)`${n} !== undefined && (${(0,s.or)(this.invalid$data(),e)})`)}error(e,n,t){if(n){this.setParams(n),this._error(e,t),this.setParams({});return}this._error(e,t)}_error(e,n){(e?u.reportExtraError:u.reportError)(this,this.def.error,n)}$dataError(){(0,u.reportError)(this,this.def.$dataError||u.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,u.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,t=s.nil){this.gen.block(()=>{this.check$data(e,t),n()})}check$data(e=s.nil,n=s.nil){if(!this.$data)return;let{gen:t,schemaCode:D,schemaType:S,def:a}=this;t.if((0,s.or)((0,s._)`${D} === undefined`,n)),e!==s.nil&&t.assign(e,!0),(S.length||a.validateSchema)&&(t.elseIf(this.invalid$data()),this.$dataError(),e!==s.nil&&t.assign(e,!1)),t.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:t,def:D,it:S}=this;return(0,s.or)(a(),o());function a(){if(t.length){if(!(n instanceof s.Name))throw Error("ajv implementation error");let e=Array.isArray(t)?t:[t];return(0,s._)`${(0,r.checkDataTypes)(e,n,S.opts.strictNumbers,r.DataType.Wrong)}`}return s.nil}function o(){if(D.validateSchema){let t=e.scopeValue("validate$data",{ref:D.validateSchema});return(0,s._)`!${t}(${n})`}return s.nil}}subschema(e,n){let t=(0,g.getSubschema)(this.it,e);(0,g.extendSubschemaData)(t,this.it,e),(0,g.extendSubschemaMode)(t,e);let D={...this.it,...t,items:void 0,props:void 0};return v(D,n),D}mergeEvaluated(e,n){let{it:t,gen:D}=this;t.opts.unevaluated&&(!0!==t.props&&void 0!==e.props&&(t.props=c.mergeEvaluated.props(D,e.props,t.props,n)),!0!==t.items&&void 0!==e.items&&(t.items=c.mergeEvaluated.items(D,e.items,t.items,n)))}mergeValidEvaluated(e,n){let{it:t,gen:D}=this;if(t.opts.unevaluated&&(!0!==t.props||!0!==t.items))return D.if(n,()=>this.mergeEvaluated(e,s.Name)),!0}}function W(e,n,t,D){let S=new H(e,t,n);"code"in t?t.code(S,D):S.$data&&t.validate?(0,i.funcKeywordCode)(S,t):"macro"in t?(0,i.macroKeywordCode)(S,t):(t.compile||t.validate)&&(0,i.funcKeywordCode)(S,t)}n.KeywordCxt=H;let q=/^\/(?:[^~]|~0|~1)*$/,G=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function K(e,{dataLevel:n,dataNames:t,dataPathArr:D}){let S,a;if(""===e)return l.default.rootData;if("/"===e[0]){if(!q.test(e))throw Error(`Invalid JSON-pointer: ${e}`);S=e,a=l.default.rootData}else{let r=G.exec(e);if(!r)throw Error(`Invalid JSON-pointer: ${e}`);let i=+r[1];if("#"===(S=r[2])){if(i>=n)throw Error(o("property/index",i));return D[n-i]}if(i>n)throw Error(o("data",i));if(a=t[n-i],!S)return a}let r=a;for(let e of S.split("/"))e&&(a=(0,s._)`${a}${(0,s.getProperty)((0,c.unescapeJsonPointer)(e))}`,r=(0,s._)`${r} && ${a}`);return r;function o(e,t){return`Cannot access ${e} ${t} levels up, current level is ${n}`}}n.getData=K},33673(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateKeywordUsage=n.validSchemaType=n.funcKeywordCode=n.macroKeywordCode=void 0;let D=t(99029),S=t(42023),a=t(15765),r=t(48708);function o(e){let{gen:n,data:t,it:S}=e;n.if(S.parentData,()=>n.assign(t,(0,D._)`${S.parentData}[${S.parentDataProperty}]`))}function i(e,n){let{gen:t}=e;t.if((0,D._)`Array.isArray(${n})`,()=>{t.assign(S.default.vErrors,(0,D._)`${S.default.vErrors} === null ? ${n} : ${S.default.vErrors}.concat(${n})`).assign(S.default.errors,(0,D._)`${S.default.vErrors}.length`),(0,r.extendErrors)(e)},()=>e.error())}function g({schemaEnv:e},n){if(n.async&&!e.$async)throw Error("async keyword in sync schema")}function s(e,n,t){if(void 0===t)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue("keyword","function"==typeof t?{ref:t}:{ref:t,code:(0,D.stringify)(t)})}n.macroKeywordCode=function(e,n){let{gen:t,keyword:S,schema:a,parentSchema:r,it:o}=e,i=n.macro.call(o.self,a,r,o),g=s(t,S,i);!1!==o.opts.validateSchema&&o.self.validateSchema(i,!0);let l=t.name("valid");e.subschema({schema:i,schemaPath:D.nil,errSchemaPath:`${o.errSchemaPath}/${S}`,topSchemaRef:g,compositeRule:!0},l),e.pass(l,()=>e.error(!0))},n.funcKeywordCode=function(e,n){var t;let{gen:r,keyword:l,schema:d,parentSchema:c,$data:u,it:f}=e;g(f,n);let h=s(r,l,!u&&n.compile?n.compile.call(f.self,d,c,f):n.validate),p=r.let("valid");function m(){if(!1===n.errors)v(),n.modifying&&o(e),$(()=>e.error());else{let t=n.async?y():b();n.modifying&&o(e),$(()=>i(e,t))}}function y(){let e=r.let("ruleErrs",null);return r.try(()=>v((0,D._)`await `),n=>r.assign(p,!1).if((0,D._)`${n} instanceof ${f.ValidationError}`,()=>r.assign(e,(0,D._)`${n}.errors`),()=>r.throw(n))),e}function b(){let e=(0,D._)`${h}.errors`;return r.assign(e,null),v(D.nil),e}function v(t=n.async?(0,D._)`await `:D.nil){let o=f.opts.passContext?S.default.this:S.default.self,i=!("compile"in n&&!u||!1===n.schema);r.assign(p,(0,D._)`${t}${(0,a.callValidateCode)(e,h,o,i)}`,n.modifying)}function $(e){var t;r.if((0,D.not)(null!=(t=n.valid)?t:p),e)}e.block$data(p,m),e.ok(null!=(t=n.valid)?t:p)},n.validSchemaType=function(e,n,t=!1){return!n.length||n.some(n=>"array"===n?Array.isArray(e):"object"===n?e&&"object"==typeof e&&!Array.isArray(e):typeof e==n||t&&void 0===e)},n.validateKeywordUsage=function({schema:e,opts:n,self:t,errSchemaPath:D},S,a){if(Array.isArray(S.keyword)?!S.keyword.includes(a):S.keyword!==a)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 ${a}: ${r.join(",")}`);if(S.validateSchema&&!S.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${D}": `+t.errorsText(S.validateSchema.errors);if("log"===n.validateSchema)t.logger.error(e);else throw Error(e)}}},24495(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.extendSubschemaMode=n.extendSubschemaData=n.getSubschema=void 0;let D=t(99029),S=t(94227);n.getSubschema=function(e,{keyword:n,schemaProp:t,schema:a,schemaPath:r,errSchemaPath:o,topSchemaRef:i}){if(void 0!==n&&void 0!==a)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){let a=e.schema[n];return void 0===t?{schema:a,schemaPath:(0,D._)`${e.schemaPath}${(0,D.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${n}`}:{schema:a[t],schemaPath:(0,D._)`${e.schemaPath}${(0,D.getProperty)(n)}${(0,D.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${n}/${(0,S.escapeFragment)(t)}`}}if(void 0!==a){if(void 0===r||void 0===o||void 0===i)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:r,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},n.extendSubschemaData=function(e,n,{dataProp:t,dataPropType:a,data:r,dataTypes:o,propertyName:i}){if(void 0!==r&&void 0!==t)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:g}=n;if(void 0!==t){let{errorPath:r,dataPathArr:o,opts:i}=n;s(g.let("data",(0,D._)`${n.data}${(0,D.getProperty)(t)}`,!0)),e.errorPath=(0,D.str)`${r}${(0,S.getErrorPath)(t,a,i.jsPropertySyntax)}`,e.parentDataProperty=(0,D._)`${t}`,e.dataPathArr=[...o,e.parentDataProperty]}function s(t){e.data=t,e.dataLevel=n.dataLevel+1,e.dataTypes=[],n.definedProperties=new Set,e.parentData=n.data,e.dataNames=[...n.dataNames,t]}void 0!==r&&(s(r instanceof D.Name?r:g.let("data",r,!0)),void 0!==i&&(e.propertyName=i)),o&&(e.dataTypes=o)},n.extendSubschemaMode=function(e,{jtdDiscriminator:n,jtdMetadata:t,compositeRule:D,createErrors:S,allErrors:a}){void 0!==D&&(e.compositeRule=D),void 0!==S&&(e.createErrors=S),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=n,e.jtdMetadata=t}},4042(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=void 0;var D=t(62586);Object.defineProperty(n,"KeywordCxt",{enumerable:!0,get:function(){return D.KeywordCxt}});var S=t(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 a=t(13558),r=t(34551),o=t(10396),i=t(73835),g=t(99029),s=t(66939),l=t(10208),d=t(94227),c=t(63837),u=t(55944),f=(e,n)=>new RegExp(e,n);f.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],p=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.'},b=200;function v(e){var n,t,D,S,a,r,o,i,g,s,l,d,c,h,p,m,y,v,$,w,_,A,M,x,L;let C=e.strict,k=null==(n=e.code)?void 0:n.optimize,E=!0===k||void 0===k?1:k||0,T=null!=(D=null==(t=e.code)?void 0:t.regExp)?D:f,O=null!=(S=e.uriResolver)?S:u.default;return{strictSchema:null==(r=null!=(a=e.strictSchema)?a:C)||r,strictNumbers:null==(i=null!=(o=e.strictNumbers)?o:C)||i,strictTypes:null!=(s=null!=(g=e.strictTypes)?g:C)?s:"log",strictTuples:null!=(d=null!=(l=e.strictTuples)?l:C)?d:"log",strictRequired:null!=(h=null!=(c=e.strictRequired)?c:C)&&h,code:e.code?{...e.code,optimize:E,regExp:T}:{optimize:E,regExp:T},loopRequired:null!=(p=e.loopRequired)?p:b,loopEnum:null!=(m=e.loopEnum)?m:b,meta:null==(y=e.meta)||y,messages:null==(v=e.messages)||v,inlineRefs:null==($=e.inlineRefs)||$,schemaId:null!=(w=e.schemaId)?w:"$id",addUsedSchema:null==(_=e.addUsedSchema)||_,validateSchema:null==(A=e.validateSchema)||A,validateFormats:null==(M=e.validateFormats)||M,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(L=e.int32range)||L,uriResolver:O}}class ${constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:n,lines:t}=this.opts.code;this.scope=new g.ValueScope({scope:{},prefixes:p,es5:n,lines:t}),this.logger=k(e.logger);const D=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,m,e,"NOT SUPPORTED"),w.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=L.call(this),e.formats&&M.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),A.call(this),e.validateFormats=D}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:t}=this.opts,D=c;"id"===t&&((D={...c}).id=D.$id,delete D.$id),n&&e&&this.addMetaSchema(D,D[t],!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 t;if("string"==typeof e){if(!(t=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else t=this.compile(e);let D=t(n);return"$async"in t||(this.errors=t.errors),D}compile(e,n){let t=this._addSchema(e,n);return t.validate||this._compileSchemaEnv(t)}compileAsync(e,n){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:t}=this.opts;return D.call(this,e,n);async function D(e,n){await S.call(this,e.$schema);let t=this._addSchema(e,n);return t.validate||a.call(this,t)}async function S(e){e&&!this.getSchema(e)&&await D.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(n){if(!(n instanceof r.default))throw n;return o.call(this,n),await i.call(this,n.missingSchema),a.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 i(e){let t=await g.call(this,e);this.refs[e]||await S.call(this,t.$schema),this.refs[e]||this.addSchema(t,e,n)}async function g(e){let n=this._loading[e];if(n)return n;try{return await (this._loading[e]=t(e))}finally{delete this._loading[e]}}}addSchema(e,n,t,D=this.opts.validateSchema){let S;if(Array.isArray(e)){for(let n of e)this.addSchema(n,void 0,t,D);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,s.normalizeId)(n||S),this._checkUnique(n),this.schemas[n]=this._addSchema(e,t,n,D,!0),this}addMetaSchema(e,n,t=this.opts.validateSchema){return this.addSchema(e,n,!0,t),this}validateSchema(e,n){let t;if("boolean"==typeof e)return!0;if(void 0!==(t=e.$schema)&&"string"!=typeof t)throw Error("$schema must be a string");if(!(t=t||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let D=this.validate(t,e);if(!D&&n){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return D}getSchema(e){let n;for(;"string"==typeof(n=_.call(this,e));)e=n;if(void 0===n){let{schemaId:t}=this.opts,D=new i.SchemaEnv({schema:{},schemaId:t});if(!(n=i.resolveSchema.call(this,D,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=_.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 t=e[this.opts.schemaId];return t&&(t=(0,s.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let t;if("string"==typeof e)t=e,"object"==typeof n&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=t);else if("object"==typeof e&&void 0===n){if(Array.isArray(t=(n=e).keyword)&&!t.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(T.call(this,t,n),!n)return(0,d.eachItem)(t,e=>O.call(this,e)),this;I.call(this,n);let D={...n,type:(0,l.getJSONTypes)(n.type),schemaType:(0,l.getJSONTypes)(n.schemaType)};return(0,d.eachItem)(t,0===D.type.length?e=>O.call(this,e,D):e=>D.type.forEach(n=>O.call(this,e,D,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 t of(delete n.keywords[e],delete n.all[e],n.rules)){let n=t.rules.findIndex(n=>n.keyword===e);n>=0&&t.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:t="data"}={}){return e&&0!==e.length?e.map(e=>`${t}${e.instancePath} ${e.message}`).reduce((e,t)=>e+n+t):"No errors"}$dataMetaSchema(e,n){let t=this.RULES.all;for(let D of(e=JSON.parse(JSON.stringify(e)),n)){let n=D.split("/").slice(1),S=e;for(let e of n)S=S[e];for(let e in t){let n=t[e];if("object"!=typeof n)continue;let{$data:D}=n.definition,a=S[e];D&&a&&(S[e]=j(a))}}return e}_removeAllSchemas(e,n){for(let t in e){let D=e[t];(!n||n.test(t))&&("string"==typeof D?delete e[t]:D&&!D.meta&&(this._cache.delete(D.schema),delete e[t]))}}_addSchema(e,n,t,D=this.opts.validateSchema,S=this.opts.addUsedSchema){let a,{schemaId:r}=this.opts;if("object"==typeof e)a=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;t=(0,s.normalizeId)(a||t);let g=s.getSchemaRefs.call(this,e,t);return o=new i.SchemaEnv({schema:e,schemaId:r,meta:n,baseId:t,localRefs:g}),this._cache.set(o.schema,o),S&&!t.startsWith("#")&&(t&&this._checkUnique(t),this.refs[t]=o),D&&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):i.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{i.compileSchema.call(this,e)}finally{this.opts=n}}}function w(e,n,t,D="error"){for(let S in e){let a=S;a in n&&this.logger[D](`${t}: option ${S}. ${e[a]}`)}}function _(e){return e=(0,s.normalizeId)(e),this.schemas[e]||this.refs[e]}function A(){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 M(){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 t=e[n];t.keyword||(t.keyword=n),this.addKeyword(t)}}function L(){let e={...this.opts};for(let n of h)delete e[n];return e}$.ValidationError=a.default,$.MissingRefError=r.default,n.default=$;let C={log(){},warn(){},error(){}};function k(e){if(!1===e)return C;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 E=/^[a-z_$][a-z0-9_$:-]*$/i;function T(e,n){let{RULES:t}=this;if((0,d.eachItem)(e,e=>{if(t.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!E.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,t){var D;let S=null==n?void 0:n.post;if(t&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,r=S?a.post:a.rules.find(({type:e})=>e===t);if(r||(r={type:t,rules:[]},a.rules.push(r)),a.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),a.all[e]=o,null==(D=n.implements)||D.forEach(e=>this.addKeyword(e))}function R(e,n,t){let D=e.rules.findIndex(e=>e.keyword===t);D>=0?e.rules.splice(D,0,n):(e.rules.push(n),this.logger.warn(`rule ${t} is not defined`))}function I(e){let{metaSchema:n}=e;void 0!==n&&(e.$data&&this.opts.$data&&(n=j(n)),e.validateSchema=this.compile(n,!0))}let N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(e){return{anyOf:[e,N]}}},76250(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(32017);D.code='require("ajv/dist/runtime/equal").default',n.default=D},53853(e,n){"use strict";function t(e){let n,t=e.length,D=0,S=0;for(;S<t;)D++,(n=e.charCodeAt(S++))>=55296&&n<=56319&&S<t&&(64512&(n=e.charCodeAt(S)))==56320&&S++;return D}Object.defineProperty(n,"__esModule",{value:!0}),n.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'},55944(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(48343);D.code='require("ajv/dist/runtime/uri").default',n.default=D},13558(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});class t extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}n.default=t},15457(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateAdditionalItems=void 0;let D=t(99029),S=t(94227),a={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,D.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,D._)`{limit: ${e}}`},code(e){let{parentSchema:n,it:t}=e,{items:D}=n;Array.isArray(D)?r(e,D):(0,S.checkStrictMode)(t,'"additionalItems" is ignored when "items" is not an array of schemas')}};function r(e,n){let{gen:t,schema:a,data:r,keyword:o,it:i}=e;i.items=!0;let g=t.const("len",(0,D._)`${r}.length`);if(!1===a)e.setParams({len:n.length}),e.pass((0,D._)`${g} <= ${n.length}`);else if("object"==typeof a&&!(0,S.alwaysValidSchema)(i,a)){let S=t.var("valid",(0,D._)`${g} <= ${n.length}`);t.if((0,D.not)(S),()=>s(S)),e.ok(S)}function s(a){t.forRange("i",n.length,g,n=>{e.subschema({keyword:o,dataProp:n,dataPropType:S.Type.Num},a),i.allErrors||t.if((0,D.not)(a),()=>t.break())})}}n.validateAdditionalItems=r,n.default=a},38660(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(15765),S=t(99029),a=t(42023),r=t(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:t,parentSchema:o,data:i,errsCount:g,it:s}=e;if(!g)throw Error("ajv implementation error");let{allErrors:l,opts:d}=s;if(s.props=!0,"all"!==d.removeAdditional&&(0,r.alwaysValidSchema)(s,t))return;let c=(0,D.allSchemaProperties)(o.properties),u=(0,D.allSchemaProperties)(o.patternProperties);function f(t){let a;if(c.length>8){let e=(0,r.schemaRefOrVal)(s,o.properties,"properties");a=(0,D.isOwnProperty)(n,e,t)}else a=c.length?(0,S.or)(...c.map(e=>(0,S._)`${t} === ${e}`)):S.nil;return u.length&&(a=(0,S.or)(a,...u.map(n=>(0,S._)`${(0,D.usePattern)(e,n)}.test(${t})`))),(0,S.not)(a)}function h(e){n.code((0,S._)`delete ${i}[${e}]`)}function p(D){if("all"===d.removeAdditional||d.removeAdditional&&!1===t)return void h(D);if(!1===t){e.setParams({additionalProperty:D}),e.error(),l||n.break();return}if("object"==typeof t&&!(0,r.alwaysValidSchema)(s,t)){let t=n.name("valid");"failing"===d.removeAdditional?(m(D,t,!1),n.if((0,S.not)(t),()=>{e.reset(),h(D)})):(m(D,t),l||n.if((0,S.not)(t),()=>n.break()))}}function m(n,t,D){let S={keyword:"additionalProperties",dataProp:n,dataPropType:r.Type.Str};!1===D&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,t)}(function e(){n.forIn("key",i,e=>{c.length||u.length?n.if(f(e),()=>p(e)):p(e)})})(),e.ok((0,S._)`${g} === ${a.default.errors}`)}}},15844(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(94227);n.default={keyword:"allOf",schemaType:"array",code(e){let{gen:n,schema:t,it:S}=e;if(!Array.isArray(t))throw Error("ajv implementation error");let a=n.name("valid");t.forEach((n,t)=>{if((0,D.alwaysValidSchema)(S,n))return;let r=e.subschema({keyword:"allOf",schemaProp:t},a);e.ok(a),e.mergeEvaluated(r)})}}},16505(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t(15765).validateUnion,error:{message:"must match a schema in anyOf"}}},12661(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});let D=t(99029),S=t(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,D.str)`must contain at least ${e} valid item(s)`:(0,D.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>void 0===n?(0,D._)`{minContains: ${e}}`:(0,D._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let n,t,{gen:a,schema:r,parentSchema:o,data:i,it:g}=e,{minContains:s,maxContains:l}=o;g.opts.next?(n=void 0===s?1:s,t=l):n=1;let d=a.const("len",(0,D._)`${i}.length`);if(e.setParams({min:n,max:t}),void 0===t&&0===n)return void(0,S.checkStrictMode)(g,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==t&&n>t){(0,S.checkStrictMode)(g,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,S.alwaysValidSchema)(g,r)){let S=(0,D._)`${d} >= ${n}`;void 0!==t&&(S=(0,D._)`${S} && ${d} <= ${t}`),e.pass(S);return}g.items=!0;let c=a.name("valid");function u(){let e=a.name("_valid"),n=a.let("count",0);f(e,()=>a.if(e,()=>h(n)))}function f(n,t){a.forRange("i",0,d,D=>{e.subschema({keyword:"contains",dataProp:D,dataPropType:S.Type.Num,compositeRule:!0},n),t()})}function h(e){a.code((0,D._)`${e}++`),void 0===t?a.if((0,D._)`${e} >= ${n}`,()=>a.assign(c,!0).break()):(a.if((0,D._)`${e} > ${t}`,()=>a.assign(c,!1).break()),1===n?a.assign(c,!0):a.if((0,D._)`${e} >= ${n}`,()=>a.assign(c,!0)))}void 0===t&&1===n?f(c,()=>a.if(c,()=>a.break())):0===n?(a.let(c,!0),void 0!==t&&a.if((0,D._)`${i}.length > 0`,u)):(a.let(c,!1),u()),e.result(c,()=>e.reset())}}},83025(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.validateSchemaDeps=n.validatePropertyDeps=n.error=void 0;let D=t(99029),S=t(94227),a=t(15765);n.error={message:({params:{property:e,depsCount:n,deps:t}})=>{let S=1===n?"property":"properties";return(0,D.str)`must have ${S} ${t} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:t,missingProperty:S}})=>(0,D._)`{property: ${e},
|