diff --git a/pr-preview/pr-701/index.js b/pr-preview/pr-701/index.js index da1db3fb..8ad4ac4c 100644 --- a/pr-preview/pr-701/index.js +++ b/pr-preview/pr-701/index.js @@ -1,3 +1,3 @@ /*! For license information please see index.js.LICENSE.txt */ -(()=>{var __webpack_modules__={92918:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseManager=void 0;const i=n(60544),r=n(22700);t.BaseManager=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new i.Signal(this),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._disposed.emit(void 0),i.Signal.clearData(this))}}},81611:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildManager=void 0;const i=n(18920),r=n(22700);t.BuildManager=class{constructor(e={}){var t;this._url="",this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();const{baseUrl:n,appUrl:s}=this.serverSettings;this._url=i.URLExt.join(n,s,"api/build")}get isAvailable(){return"true"===i.PageConfig.getOption("buildAvailable").toLowerCase()}get shouldCheck(){return"true"===i.PageConfig.getOption("buildCheck").toLowerCase()}getStatus(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{},t).then((e=>{if(200!==e.status)throw new r.ServerConnection.ResponseError(e);return e.json()})).then((e=>{if("string"!=typeof e.status)throw new Error("Invalid data");if("string"!=typeof e.message)throw new Error("Invalid data");return e}))}build(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"POST"},t).then((e=>{if(400===e.status)throw new r.ServerConnection.ResponseError(e,"Build aborted");if(200!==e.status){const t=`Build failed with ${e.status}.\n\n If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').\n\n If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new r.ServerConnection.ResponseError(e,t)}}))}cancel(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"DELETE"},t).then((e=>{if(204!==e.status)throw new r.ServerConnection.ResponseError(e)}))}}},42677:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigWithDefaults=t.ConfigSection=void 0;const i=n(18920),r=n(16914);(t.ConfigSection||(t.ConfigSection={})).create=function(e){const t=new s(e);return t.load().then((()=>t))};class s{constructor(e){var t;this._url="unknown";const n=this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();this._url=i.URLExt.join(n.baseUrl,"api/config",encodeURIComponent(e.name))}get data(){return this._data}async load(){const e=await r.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(200!==e.status)throw await r.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};const t={method:"PATCH",body:JSON.stringify(e)},n=await r.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(200!==n.status)throw await r.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}}t.ConfigWithDefaults=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=null!==(t=e.defaults)&&void 0!==t?t:{},this._className=null!==(n=e.className)&&void 0!==n?n:""}get(e){const t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){const n={};if(n[e]=t,this._className){const e={};return e[this._className]=n,this._section.update(e)}return this._section.update(n)}_classData(){const e=this._section.data;return this._className&&this._className in e?e[this._className]:e}}},57593:(e,t)=>{},93354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;const i=n(18920),r=n(59033),s=n(60544),o=n(22700),a="api/events";t.EventManager=class{constructor(e={}){var t;this._socket=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:o.ServerConnection.makeSettings(),this._poll=new r.Poll({factory:()=>this._subscribe()}),this._stream=new s.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();const e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),s.Signal.clearData(this),this._stream.stop()}async emit(e){const{serverSettings:t}=this,{baseUrl:n,token:r}=t,{makeRequest:s,ResponseError:l}=o.ServerConnection,u=i.URLExt.join(n,a)+(r?`?token=${r}`:""),d={body:JSON.stringify(e),method:"POST"},c=await s(u,d,t);if(204!==c.status)throw new l(c)}_subscribe(){return new Promise(((e,t)=>{if(this.isDisposed)return;const{token:n,WebSocket:r,wsUrl:s}=this.serverSettings,o=i.URLExt.join(s,a,"subscribe")+(n?`?token=${encodeURIComponent(n)}`:""),l=this._socket=new r(o),u=this._stream;l.onclose=()=>t(new Error("EventManager socket closed")),l.onmessage=e=>e.data&&u.emit(JSON.parse(e.data))}))}}},16914:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(92918),t),r(n(42677),t),r(n(57593),t),r(n(93354),t),r(n(10582),t),r(n(55312),t),r(n(88463),t),r(n(22700),t),r(n(67054),t),r(n(6052),t),r(n(98235),t),r(n(67523),t),r(n(10087),t),r(n(54933),t)},25045:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CommHandler=void 0;const o=n(34643),a=s(n(41632));class l extends o.DisposableDelegate{constructor(e,t,n,i){super(i),this._target="",this._id="",this._id=t,this._target=e,this._kernel=n}get commId(){return this._id}get targetName(){return this._target}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");const i=a.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,target_name:this._target,data:null!=e?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(i,!1,!0)}send(e,t,n=[],i=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");const r=a.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,i)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");const i=a.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(i,!1,!0),s=this._onClose;return s&&s(a.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n})),this.dispose(),r}}t.CommHandler=l},82094:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelConnection=void 0;const o=n(18920),a=n(65168),l=n(60544),u=n(16914),d=n(25045),c=s(n(41632)),h=n(79178),p=n(67411),g=s(n(95537)),f=n(55312),m=s(n(60925)),v="_RESTARTING_";class b{constructor(e){var t,n,i,r;this._createSocket=(e=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");const t=this.serverSettings,n=o.URLExt.join(t.wsUrl,m.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),i=n.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${i}`);let r=o.URLExt.join(n,"channels?session_id="+encodeURIComponent(this._clientId));const s=t.token;t.appendToken&&""!==s&&(r+=`&token=${encodeURIComponent(s)}`);const a=e?this._supportedProtocols:[];this._ws=new t.WebSocket(r,a),this._ws.binaryType="arraybuffer";let l=!1;const d=async e=>{var n,i;if(!this._isDisposed){this._reason="",this._model=void 0;try{const n=await m.getKernelModel(this._id,t);this._model=n,"dead"===(null==n?void 0:n.execution_state)?this._updateStatus("dead"):this._onWSClose(e)}catch(t){if(t instanceof u.ServerConnection.NetworkError||503===(null===(n=t.response)||void 0===n?void 0:n.status)||424===(null===(i=t.response)||void 0===i?void 0:i.status)){const t=1e3*_.getRandomIntInclusive(10,30);setTimeout(d,t,e)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},c=async e=>{l||(l=!0,await d(e))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=c,this._ws.onerror=c},this._onWSOpen=e=>{if(""!==this._ws.protocol&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=e=>{let t;try{t=(0,p.deserialize)(e.data,this._ws.protocol),g.validateMessage(t)}catch(e){throw e.message=`Kernel message validation error: ${e.message}`,e}this._kernelSession=t.header.session,this._msgChain=this._msgChain.then((()=>this._handleMessage(t))).catch((e=>{e.message.startsWith("Canceled future for ")&&console.error(e)})),this._anyMessage.emit({msg:t,direction:"recv"})},this._onWSClose=e=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(c.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new a.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new l.Signal(this),this._connectionStatusChanged=new l.Signal(this),this._disposed=new l.Signal(this),this._iopubMessage=new l.Signal(this),this._anyMessage=new l.Signal(this),this._pendingInput=new l.Signal(this),this._unhandledMessage=new l.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._name=e.model.name,this._id=e.model.id,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:u.ServerConnection.makeSettings(),this._clientId=null!==(n=e.clientId)&&void 0!==n?n:a.UUID.uuid4(),this._username=null!==(i=e.username)&&void 0!==i?i:"",this.handleComms=null===(r=e.handleComms)||void 0===r||r,this._createSocket()}get disposed(){return this._disposed}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise||(this._specPromise=f.KernelSpecAPI.getSpecs(this.serverSettings).then((e=>e.kernelspecs[this._name]))),this._specPromise}clone(e={}){return new b({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,...e})}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),l.Signal.clearData(this))}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,i=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});const r=new e((()=>{const e=t.header.msg_id;this._futures.delete(e);const n=this._msgIdToDisplayIds.get(e);n&&(n.forEach((t=>{const n=this._displayIdToParentIds.get(t);if(n){const i=n.indexOf(e);if(-1===i)return;1===n.length?this._displayIdToParentIds.delete(t):(n.splice(i,1),this._displayIdToParentIds.set(t,n))}})),this._msgIdToDisplayIds.delete(e))}),t,n,i,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if("dead"===this.status)throw new Error("Kernel is dead");if((""===this._kernelSession||this._kernelSession===v)&&c.isInfoRequestMsg(e)){if("connected"===this.connectionStatus)return void this._ws.send((0,p.serialize)(e,this._ws.protocol));throw new Error("Could not send message: status is not connected")}if(t&&this._pendingMessages.length>0)this._pendingMessages.push(e);else if("connected"===this.connectionStatus&&this._kernelSession!==v)this._ws.send((0,p.serialize)(e,this._ws.protocol));else{if(!t)throw new Error("Could not send message");this._pendingMessages.push(e)}}async interrupt(){if(this.hasPendingInput=!1,"dead"===this.status)throw new Error("Kernel is dead");return m.interruptKernel(this.id,this.serverSettings)}async restart(){if("dead"===this.status)throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=v,await m.restartKernel(this.id,this.serverSettings),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();const e=new a.PromiseDelegate,t=(n,i)=>{"connected"===i?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):"disconnected"===i&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){"dead"!==this.status&&await m.shutdownKernel(this.id,this.serverSettings),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){const e=c.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,content:{}});let t;try{t=await _.handleShellMessage(this,e)}catch(e){if(this.isDisposed)return;throw e}if(this._errorIfDisposed(),t)return void 0===t.content.status&&(t.content.status="ok"),"ok"!==t.content.status?(this._info.reject("Kernel info reply errored"),t):(this._info.resolve(t.content),this._kernelSession=t.header.session,t)}requestComplete(e){const t=c.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestInspect(e){const t=c.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestHistory(e){const t=c.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestExecute(e,t=!0,n){const i=c.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,content:{silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1,...e},metadata:n});return this.sendShellMessage(i,!0,t)}requestDebug(e,t=!0){const n=c.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){const t=c.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestCommInfo(e){const t=c.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}sendInputReply(e,t){const n=c.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=a.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");const n=new d.CommHandler(e,t,this,(()=>{this._unregisterComm(t)}));return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&(this.isDisposed||this._targetRegistry[e]!==t||delete this._targetRegistry[e])}registerMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.registerMessageHook(t)}removeMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,i;const r=t.parent_header.msg_id;let s=this._displayIdToParentIds.get(e);if(s){const e={header:a.JSONExt.deepCopy(t.header),parent_header:a.JSONExt.deepCopy(t.parent_header),metadata:a.JSONExt.deepCopy(t.metadata),content:a.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};e.header.msg_type="update_display_data",await Promise.all(s.map((async t=>{const n=this._futures&&this._futures.get(t);n&&await n.handleMsg(e)})))}if("update_display_data"===t.header.msg_type)return!0;s=null!==(n=this._displayIdToParentIds.get(e))&&void 0!==n?n:[],-1===s.indexOf(r)&&s.push(r),this._displayIdToParentIds.set(e,s);const o=null!==(i=this._msgIdToDisplayIds.get(r))&&void 0!==i?i:[];return-1===o.indexOf(r)&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){null!==this._ws&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status!==e&&"dead"!==this._status&&(this._status=e,_.logKernelStatus(this),this._statusChanged.emit(e),"dead"===e&&this.dispose())}_sendPending(){for(;"connected"===this.connectionStatus&&this._kernelSession!==v&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach((e=>{e.dispose()})),this._comms.forEach((e=>{e.dispose()})),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);const t=e.content,n=new d.CommHandler(t.target_name,t.comm_id,this,(()=>{this._unregisterComm(t.comm_id)}));this._comms.set(t.comm_id,n);try{const i=await _.loadObject(t.target_name,t.target_module,this._targetRegistry);await i(n,e)}catch(e){throw n.close(),console.error("Exception opening new comm"),e}}async _handleCommClose(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return void console.error("Comm not found for comm id "+t.comm_id);this._unregisterComm(n.commId);const i=n.onClose;i&&await i(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return;const i=n.onMsg;i&&await i(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,"connecting"!==e&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),"dead"!==this.status)if("connected"===e){let e=this._kernelSession===v,t=this.requestKernelInfo(),n=!1,i=()=>{n||(n=!0,e&&this._kernelSession===v&&(this._kernelSession=""),clearTimeout(r),this._pendingMessages.length>0&&this._sendPending())};t.then(i);let r=setTimeout(i,3e3)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let i=!1;if(e.parent_header&&"iopub"===e.channel&&(c.isDisplayDataMsg(e)||c.isUpdateDisplayDataMsg(e)||c.isExecuteResultMsg(e))){const n=(null!==(t=e.content.transient)&&void 0!==t?t:{}).display_id;n&&(i=await this._handleDisplayId(n,e),this._assertCurrentMessage(e))}if(!i&&e.parent_header){const t=e.parent_header,i=null===(n=this._futures)||void 0===n?void 0:n.get(t.msg_id);if(i)await i.handleMsg(e),this._assertCurrentMessage(e);else{const n=t.session===this.clientId;"iopub"!==e.channel&&n&&this._unhandledMessage.emit(e)}}if("iopub"===e.channel){switch(e.header.msg_type){case"status":{const t=e.content.execution_state;"restarting"===t&&Promise.resolve().then((async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()})),this._updateStatus(t);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e)}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt{if(t){if("undefined"==typeof requirejs)throw new Error("requirejs not found");requirejs([t],(n=>{void 0===n[e]?r(new Error(`Object '${e}' not found in module '${t}'`)):i(n[e])}),r)}else(null==n?void 0:n[e])?i(n[e]):r(new Error(`Object '${e}' not found in registry`))}))},e.getRandomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}}(_||(_={}))},79178:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelShellFutureHandler=t.KernelControlFutureHandler=t.KernelFutureHandler=void 0;const o=n(65168),a=n(34643),l=s(n(41632));class u extends a.DisposableDelegate{constructor(e,t,n,i,r){super(e),this._status=0,this._stdin=d.noOp,this._iopub=d.noOp,this._reply=d.noOp,this._done=new o.PromiseDelegate,this._hooks=new d.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(d.KernelFutureFlag.GotReply),this._disposeOnDone=i,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=d.noOp,this._iopub=d.noOp,this._reply=d.noOp,this._hooks=null,this._testFlag(d.KernelFutureFlag.IsDone)||(this._done.promise.catch((()=>{})),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e)}}async _handleReply(e){const t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(d.KernelFutureFlag.GotReply),this._testFlag(d.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;const t=this._stdin;t&&await t(e)}async _handleIOPub(e){const t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),l.isStatusMsg(e)&&"idle"===e.content.execution_state&&(this._setFlag(d.KernelFutureFlag.GotIdle),this._testFlag(d.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(d.KernelFutureFlag.IsDone)||(this._setFlag(d.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return 0!=(this._status&e)}_setFlag(e){this._status|=e}}var d;t.KernelFutureHandler=u,t.KernelControlFutureHandler=class extends u{},t.KernelShellFutureHandler=class extends u{},function(e){e.noOp=()=>{};const t="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate;let n;e.HookList=class{constructor(){this._hooks=[]}add(e){this.remove(e),this._hooks.push(e)}remove(e){const t=this._hooks.indexOf(e);t>=0&&(this._hooks[t]=null,this._scheduleCompact())}async process(e){await this._processing;const t=new o.PromiseDelegate;let n;this._processing=t.promise;for(let i=this._hooks.length-1;i>=0;i--){const r=this._hooks[i];if(null!==r){try{n=await r(e)}catch(e){n=!0,console.error(e)}if(!1===n)return t.resolve(void 0),!1}}return t.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,t((()=>{this._processing=this._processing.then((()=>{this._compactScheduled=!1,this._compact()}))})))}_compact(){let e=0;for(let t=0,n=this._hooks.length;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},72810:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KernelManager=void 0;const i=n(59033),r=n(60544),s=n(16914),o=n(92918),a=n(60925),l=n(82094);class u extends o.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;const{id:n}=e.model;let i=null===(t=e.handleComms)||void 0===t||t;if(void 0===e.handleComms)for(const e of this._kernelConnections)if(e.id===n&&e.handleComms){i=!1;break}const r=new l.KernelConnection({handleComms:i,...e,serverSettings:this.serverSettings});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch((()=>{})),r}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){const n=await(0,a.startNew)(e,this.serverSettings);return this.connectTo({...t,model:n})}async shutdown(e){await(0,a.shutdownKernel)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,a.shutdownKernel)(e,this.serverSettings)))),await this.refreshRunning()}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async requestRunning(){var e,t;let n;try{n=await(0,a.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{const t=this._models.get(e.id);return!!t&&t.connections===e.connections&&t.execution_state===e.execution_state&&t.last_activity===e.last_activity&&t.name===e.name&&t.reason===e.reason&&t.traceback===e.traceback}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._kernelConnections.forEach((e=>{this._models.has(e.id)||e.handleShutdown()})),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onStatusChanged(e,t){"dead"===t&&this.refreshRunning().catch((()=>{}))}}t.KernelManager=u,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e={},t={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(e){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then((()=>this._readyPromise))}async requestRunning(){return Promise.resolve()}}}(u=t.KernelManager||(t.KernelManager={}))},41632:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportedKernelWebSocketProtocols=t.isInputReplyMsg=t.isInputRequestMsg=t.isDebugReplyMsg=t.isDebugRequestMsg=t.isExecuteReplyMsg=t.isInfoRequestMsg=t.isCommMsgMsg=t.isCommCloseMsg=t.isCommOpenMsg=t.isDebugEventMsg=t.isClearOutputMsg=t.isStatusMsg=t.isErrorMsg=t.isExecuteResultMsg=t.isExecuteInputMsg=t.isUpdateDisplayDataMsg=t.isDisplayDataMsg=t.isStreamMsg=t.createMessage=void 0;const i=n(65168);t.createMessage=function(e){var t,n,r,s,o;return{buffers:null!==(t=e.buffers)&&void 0!==t?t:[],channel:e.channel,content:e.content,header:{date:(new Date).toISOString(),msg_id:null!==(n=e.msgId)&&void 0!==n?n:i.UUID.uuid4(),msg_type:e.msgType,session:e.session,username:null!==(r=e.username)&&void 0!==r?r:"",version:"5.2"},metadata:null!==(s=e.metadata)&&void 0!==s?s:{},parent_header:null!==(o=e.parentHeader)&&void 0!==o?o:{}}},t.isStreamMsg=function(e){return"stream"===e.header.msg_type},t.isDisplayDataMsg=function(e){return"display_data"===e.header.msg_type},t.isUpdateDisplayDataMsg=function(e){return"update_display_data"===e.header.msg_type},t.isExecuteInputMsg=function(e){return"execute_input"===e.header.msg_type},t.isExecuteResultMsg=function(e){return"execute_result"===e.header.msg_type},t.isErrorMsg=function(e){return"error"===e.header.msg_type},t.isStatusMsg=function(e){return"status"===e.header.msg_type},t.isClearOutputMsg=function(e){return"clear_output"===e.header.msg_type},t.isDebugEventMsg=function(e){return"debug_event"===e.header.msg_type},t.isCommOpenMsg=function(e){return"comm_open"===e.header.msg_type},t.isCommCloseMsg=function(e){return"comm_close"===e.header.msg_type},t.isCommMsgMsg=function(e){return"comm_msg"===e.header.msg_type},t.isInfoRequestMsg=function(e){return"kernel_info_request"===e.header.msg_type},t.isExecuteReplyMsg=function(e){return"execute_reply"===e.header.msg_type},t.isDebugRequestMsg=function(e){return"debug_request"===e.header.msg_type},t.isDebugReplyMsg=function(e){return"debug_reply"===e.header.msg_type},t.isInputRequestMsg=function(e){return"input_request"===e.header.msg_type},t.isInputReplyMsg=function(e){return"input_reply"===e.header.msg_type},(t.supportedKernelWebSocketProtocols||(t.supportedKernelWebSocketProtocols={})).v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"},60925:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getKernelModel=t.shutdownKernel=t.interruptKernel=t.restartKernel=t.startNew=t.listRunning=t.KERNEL_SERVICE_URL=void 0;const i=n(22700),r=n(18920),s=n(95537);t.KERNEL_SERVICE_URL="api/kernels",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.KERNEL_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();return(0,s.validateModels)(a),a},t.startNew=async function(e={},n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const u=await l.json();return(0,s.validateModel)(u),u},t.restartKernel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"restart"),a=await i.ServerConnection.makeRequest(o,{method:"POST"},n);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();(0,s.validateModel)(l)},t.interruptKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"interrupt"),o=await i.ServerConnection.makeRequest(s,{method:"POST"},n);if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.shutdownKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),o=await i.ServerConnection.makeRequest(s,{method:"DELETE"},n);if(404===o.status){const t=`The kernel "${e}" does not exist on the server`;console.warn(t)}else if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.getKernelModel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),a=await i.ServerConnection.makeRequest(o,{},n);if(404===a.status)return;if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.validateModel)(l),l}},67411:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=t.serialize=void 0;const o=s(n(41632));var a;t.serialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.serializeV1KernelWebsocketJupyterOrg(e):a.serializeDefault(e)},t.deserialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.deserializeV1KernelWebsocketJupyterOrg(e):a.deserializeDefault(e)},function(e){e.deserializeV1KernelWebsocketJupyterOrg=function(e){let t;const n=new DataView(e),i=Number(n.getBigUint64(0,!0));let r=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.validateModel=t.validateMessage=void 0;const i=n(68193),r=["username","version","session","msg_id","msg_type"],s={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function o(e){(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"id","string")}t.validateMessage=function(e){(0,i.validateProperty)(e,"metadata","object"),(0,i.validateProperty)(e,"content","object"),(0,i.validateProperty)(e,"channel","string"),function(e){for(let t=0;to(e)))}},55312:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecAPI=t.KernelSpec=void 0;const a=s(n(20523));t.KernelSpec=a;const l=s(n(47352));t.KernelSpecAPI=l,o(n(73973),t)},20523:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},73973:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecManager=void 0;const o=n(65168),a=n(59033),l=n(60544),u=s(n(47352)),d=n(92918);class c extends d.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._connectionFailure=new l.Signal(this),this._specs=null,this._specsChanged=new l.Signal(this),this._ready=Promise.all([this.requestSpecs()]).then((e=>{})).catch((e=>{})).then((()=>{this.isDisposed||(this._isReady=!0)})),this._pollSpecs=new a.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61e3,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelSpecManager#specs",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){const e=await u.getSpecs(this.serverSettings);this.isDisposed||o.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}}t.KernelSpecManager=c},47352:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSpecs=void 0;const i=n(22700),r=n(80007),s=n(18920);t.getSpecs=async function(e=i.ServerConnection.makeSettings()){const t=s.URLExt.join(e.baseUrl,"api/kernelspecs"),n=await i.ServerConnection.makeRequest(t,{},e);if(200!==n.status)throw await i.ServerConnection.ResponseError.create(n);const o=await n.json();return(0,r.validateSpecModels)(o)}},80007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSpecModels=t.validateSpecModel=void 0;const i=n(68193);function r(e){const t=e.spec;if(!t)throw new Error("Invalid kernel spec");(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"resources","object"),(0,i.validateProperty)(t,"language","string"),(0,i.validateProperty)(t,"display_name","string"),(0,i.validateProperty)(t,"argv","array");let n=null;t.hasOwnProperty("metadata")&&((0,i.validateProperty)(t,"metadata","object"),n=t.metadata);let r=null;return t.hasOwnProperty("env")&&((0,i.validateProperty)(t,"env","object"),r=t.env),{name:e.name,resources:e.resources,language:t.language,display_name:t.display_name,argv:t.argv,metadata:n,env:r}}t.validateSpecModel=r,t.validateSpecModels=function(e){if(!e.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let t=Object.keys(e.kernelspecs);const n=Object.create(null);let i=e.default;for(let i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceManager=void 0;const i=n(60544),r=n(81611),s=n(57593),o=n(93354),a=n(10582),l=n(55312),u=n(54933),d=n(22700),c=n(67054),h=n(6052),p=n(98235),g=n(67523),f=n(10087);t.ServiceManager=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new i.Signal(this),this._isReady=!1;const m=e.defaultDrive,v=null!==(t=e.serverSettings)&&void 0!==t?t:d.ServerConnection.makeSettings(),b={defaultDrive:m,serverSettings:v,standby:null!==(n=e.standby)&&void 0!==n?n:"when-hidden"};this.serverSettings=v,this.contents=e.contents||new s.ContentsManager(b),this.events=e.events||new o.EventManager(b),this.kernels=e.kernels||new a.KernelManager(b),this.sessions=e.sessions||new c.SessionManager({...b,kernelManager:this.kernels}),this.settings=e.settings||new h.SettingManager(b),this.terminals=e.terminals||new p.TerminalManager(b),this.builder=e.builder||new r.BuildManager(b),this.workspaces=e.workspaces||new f.WorkspaceManager(b),this.nbconvert=e.nbconvert||new u.NbConvertManager(b),this.kernelspecs=e.kernelspecs||new l.KernelSpecManager(b),this.user=e.user||new g.UserManager(b),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);const _=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&_.push(this.terminals.ready),this._readyPromise=Promise.all(_).then((()=>{this._isReady=!0}))}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,i.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}}},54933:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NbConvertManager=void 0;const i=n(18920),r=n(22700),s=n(65168);t.NbConvertManager=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new s.PromiseDelegate,this._exportFormats=null;const e=this.serverSettings.baseUrl,t=i.URLExt.join(e,"api/nbconvert"),{serverSettings:n}=this,o=await r.ServerConnection.makeRequest(t,{},n);if(200!==o.status)throw await r.ServerConnection.ResponseError.create(o);const a=await o.json(),l={};return Object.keys(a).forEach((function(e){const t=a[e].output_mimetype;l[e]={output_mimetype:t}})),this._exportFormats=l,this._requestingFormats.resolve(l),l}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}}},22700:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerConnection=void 0;const i=n(18920);let r;var s,o;r="undefined"==typeof window?n(32195):WebSocket,function(e){e.makeSettings=function(e){return o.makeSettings(e)},e.makeRequest=function(e,t,n){return o.handleRequest(e,t,n)};class t extends Error{static async create(e){try{const n=await e.json(),{message:i,traceback:r}=n;return r&&console.error(r),new t(e,null!=i?i:t._defaultMessage(e),null!=r?r:"")}catch(n){return console.debug(n),new t(e)}}constructor(e,n=t._defaultMessage(e),i=""){super(n),this.response=e,this.traceback=i}static _defaultMessage(e){return`Invalid response: ${e.status} ${e.statusText}`}}e.ResponseError=t;class n extends TypeError{constructor(e){super(e.message),this.stack=e.stack}}e.NetworkError=n}(s=t.ServerConnection||(t.ServerConnection={})),function(e){e.makeSettings=function(e={}){var t;const n=i.PageConfig.getBaseUrl(),s=i.PageConfig.getWsUrl(),o=i.URLExt.normalize(e.baseUrl)||n;let a=e.wsUrl;return a||o!==n||(a=s),a||0!==o.indexOf("http")||(a="ws"+o.slice(4)),a=null!=a?a:s,{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:r,token:i.PageConfig.getToken(),appUrl:i.PageConfig.getOption("appUrl"),appendToken:"undefined"==typeof window||"undefined"!=typeof process&&void 0!==(null===(t=null===process||void 0===process?void 0:process.env)||void 0===t?void 0:t.JEST_WORKER_ID)||i.URLExt.getHostName(n)!==i.URLExt.getHostName(a),...e,baseUrl:o,wsUrl:a}},e.handleRequest=function(e,t,n){var i;if(0!==e.indexOf(n.baseUrl))throw new Error("Can only be used for notebook server requests");"no-store"===(null!==(i=t.cache)&&void 0!==i?i:n.init.cache)&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());const r=new n.Request(e,{...n.init,...t});let o=!1;if(n.token&&(o=!0,r.headers.append("Authorization",`token ${n.token}`)),"undefined"!=typeof document&&(null===document||void 0===document?void 0:document.cookie)){const e=function(e){const t=document.cookie.match("\\b_xsrf=([^;]*)\\b");return null==t?void 0:t[1]}();void 0!==e&&(o=!0,r.headers.append("X-XSRFToken",e))}return!r.headers.has("Content-Type")&&o&&r.headers.set("Content-Type","application/json"),n.fetch.call(null,r).catch((e=>{throw new s.NetworkError(e)}))}}(o||(o={}))},75575:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionConnection=void 0;const i=n(60544),r=n(16914),s=n(28351),o=n(65168);t.SessionConnection=class{constructor(e){var t,n,s,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new i.Signal(this),this._kernelChanged=new i.Signal(this),this._statusChanged=new i.Signal(this),this._connectionStatusChanged=new i.Signal(this),this._pendingInput=new i.Signal(this),this._iopubMessage=new i.Signal(this),this._unhandledMessage=new i.Signal(this),this._anyMessage=new i.Signal(this),this._propertyChanged=new i.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=null!==(t=e.username)&&void 0!==t?t:"",this._clientId=null!==(n=e.clientId)&&void 0!==n?n:o.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=null!==(s=e.kernelConnectionOptions)&&void 0!==s?s:{},this.serverSettings=null!==(a=e.serverSettings)&&void 0!==a?a:r.ServerConnection.makeSettings(),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){const t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,null===this._kernel&&null!==e.kernel||null!==this._kernel&&null===e.kernel||null!==this._kernel&&null!==e.kernel&&this._kernel.id!==e.kernel.id){null!==this._kernel&&this._kernel.dispose();const t=this._kernel||null;this.setupKernel(e.kernel);const n=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:t,newValue:n})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();const e=this._kernel;this._kernel=null;const t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}i.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await(0,s.shutdownSession)(this.id,this.serverSettings),this.dispose()}setupKernel(e){if(null===e)return void(this._kernel=null);const t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){const t=await(0,s.updateSession)({...e,id:this._id},this.serverSettings);return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}}},67054:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionAPI=t.Session=void 0;const a=s(n(90658));t.Session=a;const l=s(n(28351));t.SessionAPI=l,o(n(6699),t)},6699:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const i=n(59033),r=n(60544),s=n(22700),o=n(92918),a=n(75575),l=n(28351);class u extends o.BaseManager{constructor(e){var t;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._connectToKernel=e=>this._kernelManager.connectTo(e),this._kernelManager=e.kernelManager,this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:SessionManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){const t=new a.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch((()=>{})),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){const n=await(0,l.startSession)(e,this.serverSettings);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await(0,l.shutdownSession)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,l.shutdownSession)(e,this.serverSettings)))),await this.refreshRunning()}async stopIfNeeded(e){try{const t=(await(0,l.listRunning)(this.serverSettings)).filter((t=>t.path===e));if(1===t.length){const e=t[0].id;await this.shutdown(e)}}catch(e){}}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async findByPath(e){for(const t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(const t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await(0,l.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{var t,n,i,r;const s=this._models.get(e.id);return!!s&&(null===(t=s.kernel)||void 0===t?void 0:t.id)===(null===(n=e.kernel)||void 0===n?void 0:n.id)&&(null===(i=s.kernel)||void 0===i?void 0:i.name)===(null===(r=e.kernel)||void 0===r?void 0:r.name)&&s.name===e.name&&s.path===e.path&&s.type===e.type}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._sessionConnections.forEach((e=>{this._models.has(e.id)?e.update(this._models.get(e.id)):e.dispose()})),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onChanged(){this.refreshRunning().catch((()=>{}))}}t.SessionManager=u,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e,t={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(e){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then((()=>this._readyPromise))}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}}(u=t.SessionManager||(t.SessionManager={}))},28351:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateSession=t.startSession=t.getSessionModel=t.shutdownSession=t.getSessionUrl=t.listRunning=t.SESSION_SERVICE_URL=void 0;const i=n(22700),r=n(18920),s=n(48775);function o(e,n){return r.URLExt.join(e,t.SESSION_SERVICE_URL,n)}t.SESSION_SERVICE_URL="api/sessions",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.SESSION_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();if(!Array.isArray(a))throw new Error("Invalid Session list");return a.forEach((e=>{(0,s.updateLegacySessionModel)(e),(0,s.validateModel)(e)})),a},t.getSessionUrl=o,t.shutdownSession=async function(e,t=i.ServerConnection.makeSettings()){var n;const r=o(t.baseUrl,e),s=await i.ServerConnection.makeRequest(r,{method:"DELETE"},t);if(404===s.status){const t=null!==(n=(await s.json()).message)&&void 0!==n?n:`The session "${e}"" does not exist on the server`;console.warn(t)}else{if(410===s.status)throw new i.ServerConnection.ResponseError(s,"The kernel was deleted but the session was not");if(204!==s.status)throw await i.ServerConnection.ResponseError.create(s)}},t.getSessionModel=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e),r=await i.ServerConnection.makeRequest(n,{},t);if(200!==r.status)throw await i.ServerConnection.ResponseError.create(r);const a=await r.json();return(0,s.updateLegacySessionModel)(a),(0,s.validateModel)(a),a},t.startSession=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.SESSION_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const u=await l.json();return(0,s.updateLegacySessionModel)(u),(0,s.validateModel)(u),u},t.updateSession=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e.id),r={method:"PATCH",body:JSON.stringify(e)},a=await i.ServerConnection.makeRequest(n,r,t);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.updateLegacySessionModel)(l),(0,s.validateModel)(l),l}},90658:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},48775:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.updateLegacySessionModel=t.validateModel=void 0;const i=n(95537),r=n(68193);function s(e){(0,r.validateProperty)(e,"id","string"),(0,r.validateProperty)(e,"type","string"),(0,r.validateProperty)(e,"name","string"),(0,r.validateProperty)(e,"path","string"),(0,r.validateProperty)(e,"kernel","object"),(0,i.validateModel)(e.kernel)}t.validateModel=s,t.updateLegacySessionModel=function(e){void 0===e.path&&void 0!==e.notebook&&(e.path=e.notebook.path,e.type="notebook",e.name="")},t.validateModels=function(e){if(!Array.isArray(e))throw new Error("Invalid session list");e.forEach((e=>s(e)))}},6052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingManager=void 0;const i=n(18920),r=n(34116),s=n(22700);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{},t);if(200!==d.status)throw await o.create(d);return d.json()}async list(e){var t,n,i,r;const{serverSettings:o}=this,{baseUrl:l,appUrl:u}=o,{makeRequest:d,ResponseError:c}=s.ServerConnection,h=l+u,p=a.url(h,"","ids"===e),g=await d(p,{},o);if(200!==g.status)throw new c(g);const f=await g.json(),m=null!==(n=null===(t=null==f?void 0:f.settings)||void 0===t?void 0:t.map((e=>e.id)))&&void 0!==n?n:[];let v=[];return e||(v=null!==(r=null===(i=null==f?void 0:f.settings)||void 0===i?void 0:i.map((e=>(e.data={composite:{},user:{}},e))))&&void 0!==r?r:[]),{ids:m,values:v}}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,u=i+r,d=a.url(u,e),c={body:JSON.stringify({raw:t}),method:"PUT"},h=await o(d,c,n);if(204!==h.status)throw new l(h)}}var a;t.SettingManager=o,function(e){e.url=function(e,t,n){const r=n?i.URLExt.objectToQueryString({ids_only:!0}):"";return`${i.URLExt.join(e,"api/settings",t)}${r}`}}(a||(a={}))},32195:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=WebSocket},98235:(e,t)=>{},67523:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserManager=void 0;const i=n(18920),r=n(65168),s=n(59033),o=n(60544),a=n(22700),l=n(92918),u="@jupyterlab/services:UserManager#user";class d extends l.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),this._ready=this.requestUser().then((()=>{this.isDisposed||(this._isReady=!0)})).catch((e=>new Promise((()=>{})))),this._pollSpecs=new s.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61e3,backoff:!0,max:3e5},name:u,standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;const{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=a.ServerConnection,s=i.URLExt.join(e,"api/me"),o=await t(s,{},this.serverSettings);if(200!==o.status)throw await n.create(o);const l={identity:this._identity,permissions:this._permissions},d=await o.json(),h=d.identity,{localStorage:p}=window,g=p.getItem(u);if(g&&(!h.initials||!h.color)){const e=JSON.parse(g);h.initials=h.initials||e.initials||h.name.substring(0,1),h.color=h.color||e.color||c.getRandomColor()}r.JSONExt.deepEqual(d,l)||(this._identity=h,this._permissions=d.permissions,p.setItem(u,JSON.stringify(h)),this._userChanged.emit(d))}}var c;t.UserManager=d,function(e){const t=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];e.getRandomColor=()=>t[Math.floor(Math.random()*t.length)]}(c||(c={}))},68193:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateProperty=void 0,t.validateProperty=function(e,t,n,i=[]){if(!e.hasOwnProperty(t))throw Error(`Missing property '${t}'`);const r=e[t];if(void 0!==n){let e=!0;switch(n){case"array":e=Array.isArray(r);break;case"object":e=void 0!==r;break;default:e=typeof r===n}if(!e)throw new Error(`Property '${t}' is not of type '${n}'`);if(i.length>0){let e=!0;switch(n){case"string":case"number":case"boolean":e=i.includes(r);break;default:e=i.findIndex((e=>e===r))>=0}if(!e)throw new Error(`Property '${t}' is not one of the valid values ${JSON.stringify(i)}`)}}}},10087:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceManager=void 0;const i=n(18920),r=n(34116),s=n(22700);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{},t);if(200!==d.status)throw await o.create(d);return d.json()}async list(){const{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:i,ResponseError:r}=s.ServerConnection,o=t+n,l=a.url(o,""),u=await i(l,{},e);if(200!==u.status)throw await r.create(u);return(await u.json()).workspaces}async remove(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{method:"DELETE"},t);if(204!==d.status)throw await o.create(d)}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,u=i+r,d=a.url(u,e),c={body:JSON.stringify(t),method:"PUT"},h=await o(d,c,n);if(204!==h.status)throw await l.create(h)}}var a;t.WorkspaceManager=o,function(e){e.url=function(e,t){return i.URLExt.join(e,"api/workspaces",t)}}(a||(a={}))},75619:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivityMonitor=void 0;const i=n(60544);t.ActivityMonitor=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new i.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,i.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout((()=>{this._activityStopped.emit({sender:this._sender,args:this._args})}),this._timeout)}}},18920:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(75619),t),r(n(58769),t),r(n(54612),t),r(n(49230),t),r(n(77034),t),r(n(902),t),r(n(6400),t),r(n(41718),t),r(n(78305),t)},58769:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},54612:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MarkdownCodeBlocks=void 0,function(e){e.CODE_BLOCK_MARKER="```";const t=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class n{constructor(e){this.startLine=e,this.code="",this.endLine=-1}}e.MarkdownCodeBlock=n,e.isMarkdown=function(e){return t.indexOf(e)>-1},e.findMarkdownCodeBlocks=function(t){if(!t||""===t)return[];const i=t.split("\n"),r=[];let s=null;for(let t=0;te===t||i&&e===i))},e.isDisabled=function(t){const n=t.indexOf(":");let i="";return-1!==n&&(i=t.slice(0,n)),e.disabled.some((e=>e===t||i&&e===i))}}(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig=exports.PageConfig||(exports.PageConfig={}))},77034:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathExt=void 0;const i=n(21023);!function(e){function t(e){return 0===e.indexOf("/")&&(e=e.slice(1)),e}e.join=function(...e){const n=i.posix.join(...e);return"."===n?"":t(n)},e.basename=function(e,t){return i.posix.basename(e,t)},e.dirname=function(e){const n=t(i.posix.dirname(e));return"."===n?"":n},e.extname=function(e){return i.posix.extname(e)},e.normalize=function(e){return""===e?"":t(i.posix.normalize(e))},e.resolve=function(...e){return t(i.posix.resolve(...e))},e.relative=function(e,n){return t(i.posix.relative(e,n))},e.normalizeExtension=function(e){return e.length>0&&0!==e.indexOf(".")&&(e=`.${e}`),e},e.removeSlash=t}(t.PathExt||(t.PathExt={}))},902:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signalToPromise=void 0;const i=n(65168);t.signalToPromise=function(e,t){const n=new i.PromiseDelegate;function r(){e.disconnect(s)}function s(e,t){r(),n.resolve([e,t])}return e.connect(s),(null!=t?t:0)>0&&setTimeout((()=>{r(),n.reject(`Signal not emitted within ${t} ms.`)}),t),n.promise}},6400:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Text=void 0,function(e){const t="𝐚".length>1;e.jsIndexToCharIndex=function(e,n){if(t)return e;let i=e;for(let t=0;t+1=55296&&e<=56319){const e=n.charCodeAt(t+1);e>=56320&&e<=57343&&(i--,t++)}}return i},e.charIndexToJsIndex=function(e,n){if(t)return e;let i=e;for(let e=0;e+1=55296&&t<=56319){const t=n.charCodeAt(e+1);t>=56320&&t<=57343&&(i++,e++)}}return i},e.camelCase=function(e,t=!1){return e.replace(/^(\w)|[\s-_:]+(\w)/g,(function(e,n,i){return i?i.toUpperCase():t?n.toUpperCase():n.toLowerCase()}))},e.titleCase=function(e){return(e||"").toLowerCase().split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}}(t.Text||(t.Text={}))},41718:(e,t)=>{},78305:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.URLExt=void 0;const r=n(21023),s=i(n(64846));!function(e){function t(e){if("undefined"!=typeof document&&document){const t=document.createElement("a");return t.href=e,t}return(0,s.default)(e)}function n(...e){let t=(0,s.default)(e[0],{});const n=""===t.protocol&&t.slashes;n&&(t=(0,s.default)(e[0],"https:"+e[0]));const i=`${n?"":t.protocol}${t.slashes?"//":""}${t.auth}${t.auth?"@":""}${t.host}`,o=r.posix.join(`${i&&"/"!==t.pathname[0]?"/":""}${t.pathname}`,...e.slice(1));return`${i}${"."===o?"":o}`}e.parse=t,e.getHostName=function(e){return(0,s.default)(e).hostname},e.normalize=function(e){return e&&t(e).toString()},e.join=n,e.encodeParts=function(e){return n(...e.split("/").map(encodeURIComponent))},e.objectToQueryString=function(e){const t=Object.keys(e).filter((e=>e.length>0));return t.length?"?"+t.map((t=>{const n=encodeURIComponent(String(e[t]));return t+(n?"="+n:"")})).join("&"):""},e.queryStringToObject=function(e){return e.replace(/^\?/,"").split("&").reduce(((e,t)=>{const[n,i]=t.split("=");return n.length>0&&(e[n]=decodeURIComponent(i||"")),e}),{})},e.isLocal=function(e){const{protocol:n}=t(e);return(!n||0!==e.toLowerCase().indexOf(n))&&0!==e.indexOf("/")}}(t.URLExt||(t.URLExt={}))},32845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataConnector=void 0,t.DataConnector=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}}},34116:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(32845),t),r(n(33288),t),r(n(34803),t),r(n(26165),t),r(n(59329),t)},33288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},34803:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestorablePool=void 0;const i=n(65168),r=n(12571),s=n(60544);var o;t.RestorablePool=class{constructor(e){this._added=new s.Signal(this),this._current=null,this._currentChanged=new s.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new i.PromiseDelegate,this._updated=new s.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&null!==e&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){const t="A disposed object cannot be added.";throw console.warn(t,e),new Error(t)}if(this._objects.has(e)){const t="This object already exists in the pool.";throw console.warn(t,e),new Error(t)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!o.injectedProperty.get(e)){if(this._restore){const{connector:i}=this._restore,r=this._restore.name(e);if(r){const s=`${this.namespace}:${r}`,a=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);o.nameProperty.set(e,s),await i.save(s,{data:a})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),s.Signal.clearData(this))}find(e){const t=this._objects.values();for(const n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){const t=[];return this.forEach((n=>{e(n)&&t.push(n)})),t}inject(e){return o.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;const{command:t,connector:n,registry:i,when:r}=e,s=this.namespace,o=r?[n.list(s)].concat(r):[n.list(s)];this._restore=e;const[a]=await Promise.all(o),l=await Promise.all(a.ids.map((async(e,r)=>{const s=a.values[r],o=s&&s.data;return void 0===o?n.remove(e):i.execute(t,o).catch((()=>n.remove(e)))})));return this._restored.resolve(),l}async save(e){var t,n;const i=o.injectedProperty.get(e);if(!this._restore||!this.has(e)||i)return;const{connector:r}=this._restore,s=this._restore.name(e),a=o.nameProperty.get(e),l=s?`${this.namespace}:${s}`:"";if(a&&a!==l&&await r.remove(a),o.nameProperty.set(e,l),l){const i=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);await r.save(l,{data:i})}a!==l&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),o.injectedProperty.get(e))return;if(!this._restore)return;const{connector:t}=this._restore,n=o.nameProperty.get(e);n&&t.remove(n)}},function(e){e.injectedProperty=new r.AttachedProperty({name:"injected",create:()=>!1}),e.nameProperty=new r.AttachedProperty({name:"name",create:()=>""})}(o||(o={}))},26165:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateDB=void 0;const i=n(60544);class r{constructor(e={}){this._changed=new i.Signal(this);const{connector:t,transform:n}=e;this._connector=t||new r.Connector,this._ready=n?n.then((e=>{const{contents:t,type:n}=e;switch(n){case"cancel":default:return;case"clear":return this._clear();case"merge":return this._merge(t||{});case"overwrite":return this._overwrite(t||{})}})):Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;const{ids:e,values:t}=await this._list();return t.reduce(((t,n,i)=>(t[e[i]]=n,t)),{})}async _clear(){await Promise.all((await this._list()).ids.map((e=>this._remove(e))))}async _fetch(e){const t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){const{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map((e=>JSON.parse(e).v))}}async _merge(e){await Promise.all(Object.keys(e).map((t=>e[t]&&this._save(t,e[t]))))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}}t.StateDB=r,function(e){e.Connector=class{constructor(){this._storage={}}async fetch(e){return this._storage[e]}async list(e=""){return Object.keys(this._storage).reduce(((t,n)=>(""!==e&&e!==n.split(":")[0]||(t.ids.push(n),t.values.push(this._storage[n])),t)),{ids:[],values:[]})}async remove(e){delete this._storage[e]}async save(e,t){this._storage[e]=t}}}(r=t.StateDB||(t.StateDB={}))},59329:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IStateDB=void 0;const i=n(65168);t.IStateDB=new i.Token("@jupyterlab/coreutils:IStateDB",'A service for the JupyterLab state database.\n Use this if you want to store data that will persist across page loads.\n See "state database" for more information.')},65168:function(e,t){!function(e){"use strict";e.JSONExt=void 0,function(e){function t(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e}function n(e){return Array.isArray(e)}function i(e,r){if(e===r)return!0;if(t(e)||t(r))return!1;let s=n(e),o=n(r);return s===o&&(s&&o?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0,r=e.length;n>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=(()=>{const e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:t})(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){const t=new Uint8Array(16),n=new Array(256);for(let e=0;e<16;++e)n[e]="0"+e.toString(16);for(let e=16;e<256;++e)n[e]=e.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=class{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(e){return-1!==this._types.indexOf(e)}getData(e){let t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0}setData(e,t){this.clearData(e),this._types.push(e),this._values.push(t)}clearData(e){let t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))}clear(){this._types.length=0,this._values.length=0}},e.PromiseDelegate=class{constructor(){this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){(0,this._resolve)(e)}reject(e){(0,this._reject)(e)}},e.Token=class{constructor(e,t){this.name=e,this.description=null!=t?t:"",this._tokenStructuralPropertyT=null}}}(t)},34643:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DisposableDelegate:()=>r,DisposableSet:()=>o,ObservableDisposableDelegate:()=>s,ObservableDisposableSet:()=>a});var i=n(60544);class r{constructor(e){this._fn=e}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let e=this._fn;this._fn=null,e()}}class s extends r{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}class o{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((e=>{e.dispose()})),this._items.clear())}contains(e){return this._items.has(e)}add(e){this._items.add(e)}remove(e){this._items.delete(e)}clear(){this._items.clear()}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(o||(o={}));class a extends o{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(a||(a={}))},59033:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Debouncer:()=>l,Poll:()=>o,RateLimiter:()=>a,Throttler:()=>u});var i,r=n(65168),s=n(60544);class o{constructor(e){var t;this._disposed=new s.Signal(this),this._lingered=0,this._tick=new r.PromiseDelegate,this._ticked=new s.Signal(this),this._factory=e.factory,this._linger=null!==(t=e.linger)&&void 0!==t?t:i.DEFAULT_LINGER,this._standby=e.standby||i.DEFAULT_STANDBY,this._state={...i.DEFAULT_STATE,timestamp:(new Date).getTime()};const n=e.frequency||{},o=Math.max(n.interval||0,n.max||0,i.DEFAULT_FREQUENCY.max);this.frequency={...i.DEFAULT_FREQUENCY,...n,max:o},this.name=e.name||i.DEFAULT_NAME,"auto"in e&&!e.auto||setTimeout((()=>this.start()))}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(e){if(this.isDisposed||r.JSONExt.deepEqual(e,this.frequency||{}))return;let{backoff:t,interval:n,max:i}=e;if(n=Math.round(n),i=Math.round(i),"number"==typeof t&&t<1)throw new Error("Poll backoff growth factor must be at least 1");if((n<0||n>i)&&n!==o.NEVER)throw new Error("Poll interval must be between 0 and max");if(i>o.MAX_INTERVAL&&i!==o.NEVER)throw new Error(`Max interval must be less than ${o.MAX_INTERVAL}`);this._frequency={backoff:t,interval:n,max:i}}get isDisposed(){return"disposed"===this.state.phase}get standby(){return this._standby}set standby(e){this.isDisposed||this.standby===e||(this._standby=e)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch((()=>{}))}dispose(){this.isDisposed||(this._state={...i.DISPOSED_STATE,timestamp:(new Date).getTime()},this._tick.promise.catch((e=>{})),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),s.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:e})=>"refreshed"===e,interval:o.IMMEDIATE,phase:"refreshed"})}async schedule(e={}){if(this.isDisposed)return;if(e.cancel&&e.cancel(this.state))return;const t=this._tick,n=new r.PromiseDelegate,i={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:(new Date).getTime(),...e};this._state=i,this._tick=n,clearTimeout(this._timeout),this._ticked.emit(this.state),t.resolve(this),await t.promise,i.interval!==o.NEVER?this._timeout=setTimeout((()=>{this.isDisposed||this.tick!==n.promise||this._execute()}),i.interval):this._timeout=void 0}start(){return this.schedule({cancel:({phase:e})=>"constructed"!==e&&"standby"!==e&&"stopped"!==e,interval:o.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:e})=>"stopped"===e,interval:o.NEVER,phase:"stopped"})}get hidden(){return i.hidden}_execute(){let e="function"==typeof this.standby?this.standby():this.standby;if("never"===e?e=!1:"when-hidden"===e&&(this.hidden?e=++this._lingered>this._linger:(this._lingered=0,e=!1)),e)return void this.schedule();const t=this.tick;this._factory(this.state).then((e=>{this.isDisposed||this.tick!==t||this.schedule({payload:e,phase:"rejected"===this.state.phase?"reconnected":"resolved"})})).catch((e=>{this.isDisposed||this.tick!==t||this.schedule({interval:i.sleep(this.frequency,this.state),payload:e,phase:"rejected"})}))}}!function(e){e.IMMEDIATE=0,e.MAX_INTERVAL=2147483647,e.NEVER=1/0}(o||(o={})),function(e){e.DEFAULT_BACKOFF=3,e.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:3e4},e.DEFAULT_LINGER=1,e.DEFAULT_NAME="unknown",e.DEFAULT_STANDBY="when-hidden",e.DEFAULT_STATE={interval:o.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},e.DISPOSED_STATE={interval:o.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()},e.sleep=function(t,n){const{backoff:i,interval:r,max:s}=t;if(r===o.NEVER)return r;const a=!0===i?e.DEFAULT_BACKOFF:!1===i?1:i,l=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}(r,n.interval*a);return Math.min(s,l)},e.hidden="undefined"!=typeof document&&(document.addEventListener("visibilitychange",(()=>{e.hidden="hidden"===document.visibilityState})),document.addEventListener("pagehide",(()=>{e.hidden="hidden"===document.visibilityState})),"hidden"===document.visibilityState)}(i||(i={}));class a{constructor(e,t=500){this.args=void 0,this.payload=null,this.limit=t,this.poll=new o({auto:!1,factory:async()=>{const{args:t}=this;return this.args=void 0,e(...t)},frequency:{backoff:!1,interval:o.NEVER,max:o.NEVER},standby:"never"}),this.payload=new r.PromiseDelegate,this.poll.ticked.connect(((e,t)=>{const{payload:n}=this;return"resolved"===t.phase?(this.payload=new r.PromiseDelegate,void n.resolve(t.payload)):"rejected"===t.phase||"stopped"===t.phase?(this.payload=new r.PromiseDelegate,n.promise.catch((e=>{})),void n.reject(t.payload)):void 0}),this)}get isDisposed(){return null===this.payload}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class l extends a{invoke(...e){return this.args=e,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class u extends a{constructor(e,t){super(e,"number"==typeof t?t:t&&t.limit),this._trailing=!1,"number"!=typeof t&&t&&"trailing"===t.edge&&(this._trailing=!0),this._interval=this._trailing?this.limit:o.IMMEDIATE}invoke(...e){const t="invoked"!==this.poll.state.phase;return(t||this._trailing)&&(this.args=e),t&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}},12571:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AttachedProperty:()=>i});class i{constructor(e){this._pid=r.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}get(e){let t,n=r.ensureMap(e);return t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e),t}set(e,t){let n,i=r.ensureMap(e);n=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(e);let s=this._coerceValue(e,t);this._maybeNotify(e,n,i[this._pid]=s)}coerce(e){let t,n=r.ensureMap(e);t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e);let i=this._coerceValue(e,t);this._maybeNotify(e,t,n[this._pid]=i)}_createValue(e){return(0,this._create)(e)}_coerceValue(e,t){let n=this._coerce;return n?n(e,t):t}_compareValue(e,t){let n=this._compare;return n?n(e,t):e===t}_maybeNotify(e,t,n){let i=this._changed;i&&!this._compareValue(t,n)&&i(e,t,n)}}var r;!function(e){e.clearData=function(e){r.ownerData.delete(e)}}(i||(i={})),function(e){e.ownerData=new WeakMap,e.nextPID=(()=>{let e=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${e++}`})(),e.ensureMap=function(t){let n=e.ownerData.get(t);return n||(n=Object.create(null),e.ownerData.set(t,n),n)}}(r||(r={}))},60544:(e,t,n)=>{"use strict";var i,r,s;n.r(t),n.d(t,{Signal:()=>l,Stream:()=>u}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var o,a=n(65168);class l{constructor(e){this.sender=e}connect(e,t){return o.connect(this,e,t)}disconnect(e,t){return o.disconnect(this,e,t)}emit(e){o.emit(this,e)}}!function(e){e.disconnectBetween=function(e,t){o.disconnectBetween(e,t)},e.disconnectSender=function(e){o.disconnectSender(e)},e.disconnectReceiver=function(e){o.disconnectReceiver(e)},e.disconnectAll=function(e){o.disconnectAll(e)},e.clearData=function(e){o.disconnectAll(e)},e.getExceptionHandler=function(){return o.exceptionHandler},e.setExceptionHandler=function(e){let t=o.exceptionHandler;return o.exceptionHandler=e,t}}(l||(l={}));class u extends l{constructor(){super(...arguments),this._pending=new a.PromiseDelegate}async*[Symbol.asyncIterator](){let e=this._pending;for(;;)try{const{args:t,next:n}=await e.promise;e=n,yield t}catch(e){return}}emit(e){const t=this._pending,n=this._pending=new a.PromiseDelegate;t.resolve({args:e,next:n}),super.emit(e)}stop(){this._pending.promise.catch((()=>{})),this._pending.reject("stop"),this._pending=new a.PromiseDelegate}}!function(e){function t(e){let t=r.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.thisArg||e.slot;e.signal=null,d(s.get(t))}d(t)}}function n(e){let t=s.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.signal.sender;e.signal=null,d(r.get(t))}d(t)}}e.exceptionHandler=e=>{console.error(e)},e.connect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(i||(i=[],r.set(e.sender,i)),l(i,e,t,n))return!1;let o=n||t,a=s.get(o);a||(a=[],s.set(o,a));let u={signal:e,slot:t,thisArg:n};return i.push(u),a.push(u),!0},e.disconnect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(!i||0===i.length)return!1;let o=l(i,e,t,n);if(!o)return!1;let a=n||t,u=s.get(a);return o.signal=null,d(i),d(u),!0},e.disconnectBetween=function(e,t){let n=r.get(e);if(!n||0===n.length)return;let i=s.get(t);if(i&&0!==i.length){for(const t of i)t.signal&&t.signal.sender===e&&(t.signal=null);d(n),d(i)}},e.disconnectSender=t,e.disconnectReceiver=n,e.disconnectAll=function(e){t(e),n(e)},e.emit=function(e,t){let n=r.get(e.sender);if(n&&0!==n.length)for(let i=0,r=n.length;i{"use strict";var i;function r(e){return"function"==typeof e.iter?e.iter():new l(e)}function s(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!1===t(n,i++))return}function o(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!t(n,i++))return!1;return!0}function a(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(t(n,i++))return!0;return!1}n.d(t,{G:()=>a,RO:()=>i,S6:()=>s,cS:()=>u,kh:()=>h,yW:()=>o}),function(e){function t(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)){for(var i=e[t],r=t+1;r0;){var l=a>>1,u=o+l;n(e[u],t)<0?(o=u+1,a-=l+1):a=l}return o},e.upperBound=function(e,t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=e.length;if(0===s)return 0;for(var o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;a>0;){var l=a>>1,u=o+l;n(e[u],t)>0?a=l:(o=u+1,a-=l+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(var i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);for(var a=[],l=0;l=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))){var o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0!==t){var a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)}}},e.fill=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0!==r){var s;n=n<0?Math.max(0,n+r):Math.min(n,r-1),s=(i=i<0?Math.max(0,i+r):Math.min(i,r-1))t;--r)e[r]=e[r-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i,r){void 0===i&&(i=-1),void 0===r&&(r=0);var s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n,r){var s;void 0===n&&(n=0),void 0===r&&(r=-1);var a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n,i){var s;void 0===n&&(n=-1),void 0===i&&(i=0);var a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={}));var l=function(){function e(e){this._index=0,this._source=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},e}();function u(){return new c}(function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}}})(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}}}(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}}}(),function(){function e(e){this._fn=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},e.prototype.next=function(){return this._fn.call(void 0)}}(),function(){function e(e){this._cloned=!1,this._source=e,this._active=void 0}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone());return t._active=this._active&&this._active.clone(),t._cloned=!0,this._cloned=!0,t},e.prototype.next=function(){if(void 0===this._active){var e=this._source.next();if(void 0===e)return;this._active=this._cloned?e.clone():e}var t=this._active.next();return void 0!==t?t:(this._active=void 0,this.next())}}();var d,c=function(){function e(){}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e},e.prototype.next=function(){},e}();function h(e){return"function"==typeof e.retro?e.retro():new g(e)}!function(){function e(e,t){this._source=e,this._index=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._index)},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return[this._index++,e]}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){for(var e,t=this._fn,n=this._source;void 0!==(e=n.next());)if(t(e,this._index++))return e}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return this._fn.call(void 0,e,this._index++)}}(),function(){function e(e,t,n){this._index=0,this._start=e,this._stop=t,this._step=n,this._length=d.rangeLength(e,t,n)}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._start,this._stop,this._step);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++}}(),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||e=this._source.length))return this._source[this._index--]},e}();!function(){function e(e,t){this._source=e,this._step=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._step)},e.prototype.next=function(){for(var e=this._source.next(),t=this._step-1;t>0;--t)this._source.next();return e}}(),function(e){function t(e,t,n){void 0===n&&(n=0);for(var i=new Array(t.length),r=0,s=n,o=t.length;rt?1:0}}(p||(p={})),function(){function e(e,t){this._source=e,this._count=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._count)},e.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(void 0!==e)return this._count--,e}}}(),function(){function e(e){this._source=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.map((function(e){return e.clone()})))},e.prototype.next=function(){for(var e=new Array(this._source.length),t=0,n=this._source.length;t>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=function(){var e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:r}(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){for(var t=new Uint8Array(16),n=new Array(256),i=0;i<16;++i)n[i]="0"+i.toString(16);for(i=16;i<256;++i)n[i]=i.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=t,e.PromiseDelegate=n,e.Token=i,Object.defineProperty(e,"__esModule",{value:!0})}(t)},85403:(e,t,n)=>{"use strict";var i,r,s,o,a;n.d(t,{t4:()=>s}),function(e){e.copyText=function(e){var t=document.body,n=function(i){i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(i||(i={})),function(e){e.boxSizing=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,u=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:u,horizontalSum:i+a+l+r,verticalSum:n+o+u+s}},e.sizeLimits=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return{minWidth:n,minHeight:i,maxWidth:r=Math.max(n,r),maxHeight:s=Math.max(i,s)}},e.hitTest=function(e,t,n){var i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height0;)if(h(n))t++;else if(h(i))d++;else if(h(r))d++;else if(h(o))c++;else if(h(a))d++;else if(h(s))c++;else if(!h(l))return 0;return(t=Math.min(t,255))<<16|(d=Math.min(d,255))<<8|Math.min(c,255)};var n=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,r=/^\[[^\]]+\]/,s=/^[^\s\+>~#\.\[:]+/,o=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,a=/^:[^\s\+>~#\.\[:]+/,l=/^[\s\+>~\*]+/,u=/:not\(([^\)]+)\)/g}(a||(a={}))},31790:(e,t,n)=>{"use strict";n.d(t,{pB:()=>l});var i,r=n(69060),s=function(){function e(e){this._root=new i.LeafNode,this.cmp=e}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){var e=i.firstLeaf(this._root);return e.size>0?e.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){var e=i.lastLeaf(this._root);return e.size>0?e.items[e.size-1]:void 0},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return i.iterItems(this._root)},e.prototype.retro=function(){return i.retroItems(this._root)},e.prototype.slice=function(e,t){return i.sliceItems(this._root,e,t)},e.prototype.retroSlice=function(e,t){return i.retroSliceItems(this._root,e,t)},e.prototype.at=function(e){return i.itemAt(this._root,e)},e.prototype.has=function(e,t){return i.hasItem(this._root,e,t)},e.prototype.indexOf=function(e,t){return i.indexOf(this._root,e,t)},e.prototype.get=function(e,t){return i.getItem(this._root,e,t)},e.prototype.assign=function(e){this.clear(),this.update(e)},e.prototype.insert=function(e){var t=i.insertItem(this._root,e,this.cmp);return this._root=i.maybeSplitRoot(this._root),t},e.prototype.update=function(e){var t=this;(0,r.S6)(e,(function(e){t.insert(e)}))},e.prototype.delete=function(e,t){var n=i.deleteItem(this._root,e,t);return this._root=i.maybeExtractRoot(this._root),n},e.prototype.remove=function(e){var t=i.removeItem(this._root,e);return this._root=i.maybeExtractRoot(this._root),t},e.prototype.clear=function(){i.clear(this._root),this._root=new i.LeafNode},e}();!function(e){e.from=function(t,n){var i=new e(n);return i.assign(t),i}}(s||(s={})),function(e){var t=function(){function e(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),e}();e.BranchNode=t;var n=function(){function e(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),e}();function i(e){for(;0===e.type;)e=e.children[0];return e}function s(e){for(;0===e.type;)e=e.children[e.children.length-1];return e}function o(e){0===e.type?((0,r.S6)(e.children,o),e.children.length=0,e.sizes.length=0,e.items.length=0):(e.items.length=0,e.next=null,e.prev=null)}e.LeafNode=n,e.firstLeaf=i,e.lastLeaf=s,e.iterItems=function(e){var t=i(e);return new u(t,0,-1)},e.retroItems=function(e){var t=s(e);return new d(t,t.size-1,-1)},e.sliceItems=function(e,t,n){t=void 0===t?0:t<0?Math.max(0,t+e.size):Math.min(t,e.size),n=void 0===n?e.size:n<0?Math.max(0,n+e.size):Math.min(n,e.size);var i=Math.max(0,n-t);if(0===i)return(0,r.cS)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new u(e,t,i)},e.retroSliceItems=function(e,t,n){t=void 0===t?e.size-1:t<0?Math.max(-1,t+e.size):Math.min(t,e.size-1),n=void 0===n?-1:n<0?Math.max(-1,n+e.size):Math.min(n,e.size-1);var i=Math.max(0,t-n);if(0===i)return(0,r.cS)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new d(e,t,i)},e.itemAt=function(e,t){if(t<0&&(t+=e.size),!(t<0||t>=e.size)){for(;0===e.type;){var n=c(e.sizes,t);n>0&&(t-=e.sizes[n-1]),e=e.children[n]}return e.items[t]}},e.hasItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}return p(e.items,t,n)>=0},e.indexOf=function(e,t,n){for(var i=0;0===e.type;){var r=h(e.items,t,n);r>0&&(i+=e.sizes[r-1]),e=e.children[r]}var s=p(e.items,t,n);return s>=0?i+s:-i+s},e.getItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}var r=p(e.items,t,n);return r>=0?e.items[r]:void 0},e.insertItem=function e(t,n,i){if(1===t.type){var s,o=p(t.items,n,i);return o>=0?(s=t.items[o],t.items[o]=n):(s=void 0,r.RO.insert(t.items,-o-1,n)),s}var l=h(t.items,n,i),u=t.children[l],d=u.size,c=e(u,n,i),m=u.size;if(t.items[l]=u.items[0],d===m)return c;if(u.width>a){var v=f(u);r.RO.insert(t.children,l+1,v),r.RO.insert(t.items,l+1,v.items[0])}return g(t,l),c},e.deleteItem=function e(t,n,i){if(1===t.type){var s=p(t.items,n,i);if(s<0)return;return r.RO.removeAt(t.items,s)}var o=h(t.items,n,i),a=t.children[o],u=a.size,d=e(a,n,i);return u===a.size||(t.items[o]=a.items[0],a.width=t.size)){if(1===t.type)return r.RO.removeAt(t.items,n);var i=c(t.sizes,n);i>0&&(n-=t.sizes[i]);var s=t.children[i],o=e(s,n);return t.items[i]=s.items[0],s.width1)return e;var t=e.children.pop();return o(e),t};var a=32,l=a>>1,u=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},e}(),d=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},e}();function c(e,t){for(var n=e.length,i=0;it)return i;return n-1}function h(e,t,n){for(var i=e.length,r=1;r0)return r-1;return i-1}function p(e,t,n){for(var i=e.length,r=0;r0)return-r-1}return-i-1}function g(e,t){for(var n=e.sizes,i=e.children,r=t>0?n[t-1]:0,s=i.length;tl;if(f&&m&&p){var v=h;return(b=c).items.push(v.items.shift()),e.items[t+1]=v.items[0],t}if(f&&m&&!p)return v=h,(b=c).items.unshift(v.items.pop()),e.items[t]=b.items[0],t-1;if(f&&!m&&p){var b=c;return(n=(v=h).items).unshift.apply(n,b.items),r.RO.removeAt(e.children,t),r.RO.removeAt(e.items,t+1),b.prev&&(b.prev.next=v),v.prev=b.prev,o(b),t}if(f&&!m&&!p)return b=c,(i=(v=h).items).push.apply(i,b.items),r.RO.removeAt(e.children,t),r.RO.removeAt(e.items,t),b.next&&(b.next.prev=v),v.next=b.next,o(b),t-1;if(!f&&m&&p)return v=h,(b=c).children.push(v.children.shift()),b.items.push(v.items.shift()),e.items[t+1]=v.items[0],g(b,b.width-1),g(v,0),t;if(!f&&m&&!p)return v=h,(b=c).children.unshift(v.children.pop()),b.items.unshift(v.items.pop()),e.items[t]=b.items[0],g(b,0),g(v,v.width-1),t-1;if(!f&&!m&&p)return b=c,(s=(v=h).children).unshift.apply(s,b.children),(a=v.items).unshift.apply(a,b.items),r.RO.removeAt(e.children,t),r.RO.removeAt(e.items,t+1),g(v,0),b.children.length=0,o(b),t;if(!f&&!m&&!p)return b=c,(u=(v=h).children).push.apply(u,b.children),(d=v.items).push.apply(d,b.items),r.RO.removeAt(e.children,t),r.RO.removeAt(e.items,t),g(v,0),b.children.length=0,o(b),t-1;throw"unreachable"}}(i||(i={}));var o,a=function(){function e(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return new e.ForwardValueIterator(this._first)},e.prototype.retro=function(){return new e.RetroValueIterator(this._last)},e.prototype.nodes=function(){return new e.ForwardNodeIterator(this._first)},e.prototype.retroNodes=function(){return new e.RetroNodeIterator(this._last)},e.prototype.assign=function(e){var t=this;this.clear(),(0,r.S6)(e,(function(e){t.addLast(e)}))},e.prototype.push=function(e){this.addLast(e)},e.prototype.pop=function(){return this.removeLast()},e.prototype.shift=function(e){this.addFirst(e)},e.prototype.unshift=function(){return this.removeFirst()},e.prototype.addFirst=function(e){var t=new o.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t},e.prototype.addLast=function(e){var t=new o.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t},e.prototype.insertBefore=function(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n},e.prototype.insertAfter=function(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n},e.prototype.removeFirst=function(){var e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeLast=function(){var e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeNode=function(e){if(!(e instanceof o.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");var t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--},e.prototype.clear=function(){for(var e=this._first;e;){var t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0},e}();!function(e){e.from=function(t){var n=new e;return n.assign(t),n};var t=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e.value}},e}();e.ForwardValueIterator=t;var n=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e.value}},e}();e.RetroValueIterator=n;var i=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e}},e}();e.ForwardNodeIterator=i;var r=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e}},e}();e.RetroNodeIterator=r}(a||(a={})),function(e){e.LinkedListNode=function(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}(o||(o={}));var l,u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},u(e,t)};!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e),Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.conflate=function(e){return!0}}(function(){function e(e){this.type=e}return Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.conflate=function(e){return!1},e}()),function(e){function t(e,t){var n=i.get(e);if(n&&0!==n.length){var s=(0,r.yW)((0,r.kh)(n),(function(n){return!n||function(e,t,n){var i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){o(e)}return i}(n,e,t)}));s&&h(e,t)}else h(e,t)}e.sendMessage=t,e.postMessage=function(e,t){t.isConflatable&&(0,r.G)(n,(function(n){return n.handler===e&&!!n.msg&&n.msg.type===t.type&&!!n.msg.isConflatable&&n.msg.conflate(t)}))||function(e,t){n.addLast({handler:e,msg:t}),0===l&&(l=d(p))}(e,t)},e.installMessageHook=function(e,t){var n=i.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):i.set(e,[t]))},e.removeMessageHook=function(e,t){var n=i.get(e);if(n){var r=n.indexOf(t);-1!==r&&(n[r]=null,g(n))}},e.clearData=function(e){var t=i.get(e);t&&t.length>0&&(r.RO.fill(t,null),g(t)),(0,r.S6)(n,(function(t){t.handler===e&&(t.handler=null,t.msg=null)}))},e.flush=function(){u||0===l||(c(l),u=!0,p(),u=!1)},e.getExceptionHandler=function(){return o},e.setExceptionHandler=function(e){var t=o;return o=e,t};var n=new a,i=new WeakMap,s=new Set,o=function(e){console.error(e)},l=0,u=!1,d="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate,c="function"==typeof cancelAnimationFrame?cancelAnimationFrame:clearImmediate;function h(e,t){try{e.processMessage(t)}catch(e){o(e)}}function p(){if(l=0,!n.isEmpty){var e={handler:null,msg:null};for(n.addLast(e);;){var i=n.removeFirst();if(i===e)return;i.handler&&i.msg&&t(i.handler,i.msg)}}}function g(e){0===s.size&&d(f),s.add(e)}function f(){s.forEach(m),s.clear()}function m(e){r.RO.removeAllWhere(e,v)}function v(e){return null===e}}(l||(l={}))},60785:(e,t,n)=>{"use strict";var i,r,s;function*o(){}function a(e,t){let n=0;for(const i of e)if(t(i,n++))return i}n.d(t,{Rh:()=>Se,s_:()=>le,LN:()=>K,nj:()=>me,$L:()=>V}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var l,u,d,c,h,p,g,f,m,v,b,_,A=n(68743);!function(e){e.copyText=function(e){const t=document.body,n=i=>{i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(l||(l={})),(b=u||(u={})).boxSizing=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,u=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:u,horizontalSum:i+a+l+r,verticalSum:n+o+u+s}},b.sizeLimits=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return r=Math.max(n,r),s=Math.max(i,s),{minWidth:n,minHeight:i,maxWidth:r,maxHeight:s}},b.hitTest=function(e,t,n){let i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height{let e=Element.prototype;return e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector||function(e){let t=this,n=t.ownerDocument?t.ownerDocument.querySelectorAll(e):[];return-1!==Array.prototype.indexOf.call(n,t)}})(),e.calculateSingle=function(e){let u=0,d=0,c=0;function h(t){let n=e.match(t);return null!==n&&(e=e.slice(n[0].length),!0)}for(e=(e=e.split(",",1)[0]).replace(l," $1 ");e.length>0;)if(h(t))u++;else if(h(n))d++;else if(h(i))d++;else if(h(s))c++;else if(h(o))d++;else if(h(r))c++;else if(!h(a))return 0;return u=Math.min(u,255),d=Math.min(d,255),c=Math.min(c,255),u<<16|d<<8|c};const t=/^#[^\s\+>~#\.\[:]+/,n=/^\.[^\s\+>~#\.\[:]+/,i=/^\[[^\]]+\]/,r=/^[^\s\+>~#\.\[:]+/,s=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,o=/^:[^\s\+>~#\.\[:]+/,a=/^[\s\+>~\*]+/,l=/:not\(([^\)]+)\)/g}(h||(h={}));class y{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let e=this._first;for(;e;)yield e.value,e=e.next}*retro(){let e=this._last;for(;e;)yield e.value,e=e.prev}*nodes(){let e=this._first;for(;e;)yield e,e=e.next}*retroNodes(){let e=this._last;for(;e;)yield e,e=e.prev}assign(e){this.clear();for(const t of e)this.addLast(t)}push(e){this.addLast(e)}pop(){return this.removeLast()}shift(e){this.addFirst(e)}unshift(){return this.removeFirst()}addFirst(e){let t=new p.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t}addLast(e){let t=new p.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t}insertBefore(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n}insertAfter(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n}removeFirst(){let e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeLast(){let e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeNode(e){if(!(e instanceof p.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");let t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--}clear(){let e=this._first;for(;e;){let t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0}}!function(e){e.from=function(t){let n=new e;return n.assign(t),n}}(y||(y={})),function(e){e.LinkedListNode=class{constructor(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}}(p||(p={}));class w{constructor(e){this.type=e}get isConflatable(){return!1}conflate(e){return!1}}class C extends w{get isConflatable(){return!0}conflate(e){return!0}}!function(e){let t=null;const n=(r=Promise.resolve(),e=>{let t=!1;return r.then((()=>!t&&e())),()=>{t=!0}});var r;function s(e,t){let n=a.get(e);if(!n||0===n.length)return void c(e,t);let i=function(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}(function*(e){if("function"==typeof e.retro)yield*e.retro();else for(let t=e.length-1;t>-1;t--)yield e[t]}(n),(n=>!n||function(e,t,n){let i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){u(e)}return i}(n,e,t)));i&&c(e,t)}e.sendMessage=s,e.postMessage=function(e,t){t.isConflatable&&function(n,i){for(const i of n)if((r=i).handler===e&&r.msg&&r.msg.type===t.type&&r.msg.isConflatable&&r.msg.conflate(t))return!0;var r;return!1}(o)||h(e,t)},e.installMessageHook=function(e,t){let n=a.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):a.set(e,[t]))},e.removeMessageHook=function(e,t){let n=a.get(e);if(!n)return;let i=n.indexOf(t);-1!==i&&(n[i]=null,g(n))},e.clearData=function(e){let t=a.get(e);t&&t.length>0&&(i.fill(t,null),g(t));for(const t of o)t.handler===e&&(t.handler=null,t.msg=null)},e.flush=function(){d||null===t||(t(),t=null,d=!0,p(),d=!1)},e.getExceptionHandler=function(){return u},e.setExceptionHandler=function(e){let t=u;return u=e,t};const o=new y,a=new WeakMap,l=new Set;let u=e=>{console.error(e)},d=!1;function c(e,t){try{e.processMessage(t)}catch(e){u(e)}}function h(e,i){o.addLast({handler:e,msg:i}),null===t&&(t=n(p))}function p(){if(t=null,o.isEmpty)return;let e={handler:null,msg:null};for(o.addLast(e);;){let t=o.removeFirst();if(t===e)return;t.handler&&t.msg&&s(t.handler,t.msg)}}function g(e){0===l.size&&n(f),l.add(e)}function f(){l.forEach(m),l.clear()}function m(e){i.removeAllWhere(e,v)}function v(e){return null===e}}(g||(g={}));class E{constructor(e){this._pid=f.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}get(e){let t,n=f.ensureMap(e);return t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e),t}set(e,t){let n,i=f.ensureMap(e);n=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(e);let r=this._coerceValue(e,t);this._maybeNotify(e,n,i[this._pid]=r)}coerce(e){let t,n=f.ensureMap(e);t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e);let i=this._coerceValue(e,t);this._maybeNotify(e,t,n[this._pid]=i)}_createValue(e){return(0,this._create)(e)}_coerceValue(e,t){let n=this._coerce;return n?n(e,t):t}_compareValue(e,t){let n=this._compare;return n?n(e,t):e===t}_maybeNotify(e,t,n){let i=this._changed;i&&!this._compareValue(t,n)&&i(e,t,n)}}!function(e){e.clearData=function(e){f.ownerData.delete(e)}}(E||(E={})),function(e){e.ownerData=new WeakMap,e.nextPID=(()=>{let e=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${e++}`})(),e.ensureMap=function(t){let n=e.ownerData.get(t);return n||(n=Object.create(null),e.ownerData.set(t,n),n)}}(f||(f={}));class x{constructor(e){this.sender=e}connect(e,t){return m.connect(this,e,t)}disconnect(e,t){return m.disconnect(this,e,t)}emit(e){m.emit(this,e)}}(_=x||(x={})).disconnectBetween=function(e,t){m.disconnectBetween(e,t)},_.disconnectSender=function(e){m.disconnectSender(e)},_.disconnectReceiver=function(e){m.disconnectReceiver(e)},_.disconnectAll=function(e){m.disconnectAll(e)},_.clearData=function(e){m.disconnectAll(e)},_.getExceptionHandler=function(){return m.exceptionHandler},_.setExceptionHandler=function(e){let t=m.exceptionHandler;return m.exceptionHandler=e,t};class D extends(null){constructor(){super(...arguments),this._pending=new PromiseDelegate}async*[Symbol.asyncIterator](){let e=this._pending;for(;;)try{const{args:t,next:n}=await e.promise;e=n,yield t}catch(e){return}}emit(e){const t=this._pending,n=this._pending=new PromiseDelegate;t.resolve({args:e,next:n}),super.emit(e)}stop(){this._pending.promise.catch((()=>{})),this._pending.reject("stop"),this._pending=new PromiseDelegate}}!function(e){function t(e){let t=r.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.thisArg||e.slot;e.signal=null,c(s.get(t))}c(t)}}function n(e){let t=s.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.signal.sender;e.signal=null,c(r.get(t))}c(t)}}e.exceptionHandler=e=>{console.error(e)},e.connect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(i||(i=[],r.set(e.sender,i)),u(i,e,t,n))return!1;let o=n||t,a=s.get(o);a||(a=[],s.set(o,a));let l={signal:e,slot:t,thisArg:n};return i.push(l),a.push(l),!0},e.disconnect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(!i||0===i.length)return!1;let o=u(i,e,t,n);if(!o)return!1;let a=n||t,l=s.get(a);return o.signal=null,c(i),c(l),!0},e.disconnectBetween=function(e,t){let n=r.get(e);if(!n||0===n.length)return;let i=s.get(t);if(i&&0!==i.length){for(const t of i)t.signal&&t.signal.sender===e&&(t.signal=null);c(n),c(i)}},e.disconnectSender=t,e.disconnectReceiver=n,e.disconnectAll=function(e){t(e),n(e)},e.emit=function(e,t){let n=r.get(e.sender);if(n&&0!==n.length)for(let i=0,r=n.length;ie.signal===t&&e.slot===n&&e.thisArg===i))}function d(t,n){let{signal:i,slot:r,thisArg:s}=t;try{r.call(s,i.sender,n)}catch(t){e.exceptionHandler(t)}}function c(e){0===o.size&&l(h),o.add(e)}function h(){o.forEach(p),o.clear()}function p(e){i.removeAllWhere(e,g)}function g(e){return null===e.signal}}(m||(m={}));var S,T,M=n(64604);class k{constructor(e){this.type="text",this.content=e}}class j{constructor(e,t,n,i){this.type="element",this.tag=e,this.attrs=t,this.children=n,this.renderer=i}}function B(e){let t,n={},i=[];for(let e=1,s=arguments.length;e=i;--s){const i=t[s],o=r?e.lastChild:e.childNodes[s];"text"===i.type||(i.renderer&&i.renderer.unrender?i.renderer.unrender(o,{attrs:i.attrs,children:i.children}):n(o,i.children,0,!1)),r&&e.removeChild(o)}}e.hostMap=new WeakMap,e.asContentArray=function(e){return e?e instanceof Array?e:[e]:[]},e.createDOMNode=t,e.updateContent=function e(r,o,a){if(o===a)return;let l=function(e,t){let n=e.firstChild,i=Object.create(null);for(let e of t)"element"===e.type&&e.attrs.key&&(i[e.attrs.key]={vNode:e,element:n}),n=n.nextSibling;return i}(r,o),u=o.slice(),d=r.firstChild,c=a.length;for(let n=0;n=u.length){t(a[n],r);continue}let o=u[n],c=a[n];if(o===c){d=d.nextSibling;continue}if("text"===o.type&&"text"===c.type){d.textContent!==c.content&&(d.textContent=c.content),d=d.nextSibling;continue}if("text"===o.type||"text"===c.type){i.insert(u,n,c),t(c,r,d);continue}if(!o.renderer!=!c.renderer){i.insert(u,n,c),t(c,r,d);continue}let h=c.attrs.key;if(h&&h in l){let e=l[h];e.vNode!==o&&(i.move(u,u.indexOf(e.vNode,n+1),n),r.insertBefore(e.element,d),o=e.vNode,d=e.element)}if(o===c){d=d.nextSibling;continue}let p=o.attrs.key;p&&p!==h?(i.insert(u,n,c),t(c,r,d)):o.tag===c.tag?(s(d,o.attrs,c.attrs),c.renderer?c.renderer.render(d,{attrs:c.attrs,children:c.children}):e(d,o.children,c.children),d=d.nextSibling):(i.insert(u,n,c),t(c,r,d))}n(r,u,c,!0)};const r={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function s(e,t,n){if(t===n)return;let i;for(i in t)i in r||i in n||("on"===i.substr(0,2)?e[i]=null:e.removeAttribute(i));for(i in n)i in r||t[i]===n[i]||("on"===i.substr(0,2)?e[i]=n[i]:e.setAttribute(i,n[i]));t.className!==n.className&&(void 0!==n.className?e.setAttribute("class",n.className):e.removeAttribute("class")),t.htmlFor!==n.htmlFor&&(void 0!==n.htmlFor?e.setAttribute("for",n.htmlFor):e.removeAttribute("for")),t.dataset!==n.dataset&&function(e,t,n){for(let i in t)i in n||e.removeAttribute(`data-${i}`);for(let i in n)t[i]!==n[i]&&e.setAttribute(`data-${i}`,n[i])}(e,t.dataset||{},n.dataset||{}),t.style!==n.style&&function(e,t,n){let i,r=e.style;for(i in t)i in n||(r[i]="");for(i in n)t[i]!==n[i]&&(r[i]=n[i])}(e,t.style||{},n.style||{})}}(T||(T={}));class O{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((e=>{e.dispose()})),this._items.clear())}contains(e){return this._items.has(e)}add(e){this._items.add(e)}remove(e){this._items.delete(e)}clear(){this._items.clear()}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(O||(O={}));class I extends O{constructor(){super(...arguments),this._disposed=new x(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),x.clearData(this))}}function R(){return N.keyboardLayout}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(I||(I={}));class P{constructor(e,t,n=[]){this.name=e,this._codes=t,this._keys=P.extractKeys(t),this._modifierKeys=P.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(e){return e in this._keys}isModifierKey(e){return e in this._modifierKeys}keyForKeydownEvent(e){return this._codes[e.keyCode]||""}}!function(e){e.extractKeys=function(e){let t=Object.create(null);for(let n in e)t[e[n]]=!0;return t},e.convertToKeySet=function(e){let t=Object(null);for(let n=0,i=e.length;n0&&(o+=n.stretch,a++)}if(t===s)return 0;if(t<=i){for(let t=0;t=r){for(let t=0;t0&&i>l;){let t=i,r=o;for(let s=0;s0&&i>l;){let t=i/u;for(let r=0;r0&&i>l;){let t=i,r=o;for(let s=0;s=n.maxSize?(i-=n.maxSize-n.size,o-=n.stretch,n.size=n.maxSize,n.done=!0,u--,a--):(i-=l,n.size+=l)}}for(;u>0&&i>l;){let t=i/u;for(let r=0;r=n.maxSize?(i-=n.maxSize-n.size,n.size=n.maxSize,n.done=!0,u--):(i-=t,n.size+=t))}}}return 0},e.adjust=function(e,t,n){0!==e.length&&0!==n&&(n>0?function(e,t,n){let i=0;for(let n=0;n<=t;++n){let t=e[n];i+=t.maxSize-t.size}let r=0;for(let n=t+1,i=e.length;n=0&&s>0;--n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t+1,i=e.length;n0;++n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,n):function(e,t,n){let i=0;for(let n=t+1,r=e.length;n0;++n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t;n>=0&&o>0;--n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,-n))}}(F||(F={}));class H{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new x(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,x.clearData(this))}}class V{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new x(this),this._hiddenMode=V.HiddenMode.Display,this.node=z.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(V.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&V.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),x.clearData(this),g.clearData(this),E.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(V.Flag.IsDisposed)}get isAttached(){return this.testFlag(V.Flag.IsAttached)}get isHidden(){return this.testFlag(V.Flag.IsHidden)}get isVisible(){return this.testFlag(V.Flag.IsVisible)}get title(){return z.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==V.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new V.ChildMessage("child-removed",this);g.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new V.ChildMessage("child-added",this);g.sendMessage(this._parent,e)}this.isDisposed||g.sendMessage(this,V.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(V.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){g.postMessage(this,V.Msg.UpdateRequest)}fit(){g.postMessage(this,V.Msg.FitRequest)}activate(){g.postMessage(this,V.Msg.ActivateRequest)}close(){g.sendMessage(this,V.Msg.CloseRequest)}show(){if(this.testFlag(V.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,V.Msg.BeforeShow),this.clearFlag(V.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,V.Msg.AfterShow),this.parent)){let e=new V.ChildMessage("child-shown",this);g.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(V.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,V.Msg.BeforeHide),this.setFlag(V.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,V.Msg.AfterHide),this.parent)){let e=new V.ChildMessage("child-hidden",this);g.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(V.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(V.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(V.Flag.IsVisible),this.setFlag(V.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(V.Flag.IsVisible),this.clearFlag(V.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&V.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case V.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case V.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case V.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case V.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case V.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case V.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,n,i;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(n=e.Flag||(e.Flag={}))[n.IsDisposed=1]="IsDisposed",n[n.IsAttached=2]="IsAttached",n[n.IsHidden=4]="IsHidden",n[n.IsVisible=8]="IsVisible",n[n.DisallowLayout=16]="DisallowLayout",(i=e.Msg||(e.Msg={})).BeforeShow=new w("before-show"),i.AfterShow=new w("after-show"),i.BeforeHide=new w("before-hide"),i.AfterHide=new w("after-hide"),i.BeforeAttach=new w("before-attach"),i.AfterAttach=new w("after-attach"),i.BeforeDetach=new w("before-detach"),i.AfterDetach=new w("after-detach"),i.ParentChanged=new w("parent-changed"),i.UpdateRequest=new C("update-request"),i.FitRequest=new C("fit-request"),i.ActivateRequest=new C("activate-request"),i.CloseRequest=new C("close-request"),e.ChildMessage=class extends w{constructor(e,t){super(e),this.child=t}};class r extends w{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,n,i=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!n.isConnected)throw new Error("Host is not attached.");g.sendMessage(t,e.Msg.BeforeAttach),n.insertBefore(t.node,i),g.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");g.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),g.sendMessage(t,e.Msg.AfterDetach)}}(V||(V={})),function(e){e.titleProperty=new E({name:"title",create:e=>new H({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(z||(z={}));class q{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,x.clearData(this),E.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)g.sendMessage(e,V.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)g.sendMessage(e,V.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)g.sendMessage(t,e)}onAfterAttach(e){for(const t of this)g.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)g.sendMessage(t,e)}onAfterDetach(e){for(const t of this)g.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return U.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){U.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return U.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){U.verticalAlignmentProperty.set(e,t)}}(q||(q={}));class G{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=u.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,n,i){let r=Math.max(this._minWidth,Math.min(n,this._maxWidth)),s=Math.max(this._minHeight,Math.min(i,this._maxHeight));if(r"center",changed:t}),e.verticalAlignmentProperty=new E({name:"verticalAlignment",create:()=>"top",changed:t})}(U||(U={}));class K extends q{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,t){t.parent=this.parent;let n=this._widgets.indexOf(t),r=Math.max(0,Math.min(e,this._widgets.length));if(-1===n)return i.insert(this._widgets,r,t),void(this.parent&&this.attachWidget(r,t));r===this._widgets.length&&r--,n!==r&&(i.move(this._widgets,n,r),this.parent&&this.moveWidget(n,r,t))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let t=i.removeAt(this._widgets,e);t&&this.parent&&this.detachWidget(e,t)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let n=this.parent.node.children[e];this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,n),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterAttach)}moveWidget(e,t,n){this.parent.isAttached&&g.sendMessage(n,V.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&g.sendMessage(n,V.Msg.AfterDetach);let i=this.parent.node.children[t];this.parent.isAttached&&g.sendMessage(n,V.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,i),this.parent.isAttached&&g.sendMessage(n,V.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}($||($={}));var Y,J,X,Z,Q,ee,te,ne,ie,re,se=$;class oe extends K{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=$.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=$.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return Y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let n=this._sizers.length,i=e.slice(0,n);for(;i.length0&&(e.sizeHint=e.size);F.adjust(this._sizers,e,n),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){let n=new G(t),r=Y.createHandle(this.renderer),s=Y.averageSize(this._sizers),o=Y.createSizer(s);i.insert(this._items,e,n),i.insert(this._sizers,e,o),i.insert(this._handles,e,r),this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.node.appendChild(r),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),i.move(this._handles,e,t),this.parent.fit()}detachWidget(e,t){let n=i.removeAt(this._items,e),r=i.removeAt(this._handles,e);i.removeAt(this._sizers,e),this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.node.removeChild(r),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,n,i,r,s,o){const a=this._items[e];if(a.isHidden)return;let l=this._handles[e].style;t?(n+=this.widgetOffset,a.update(n,i,o,r),n+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${this._spacing}px`,l.height=`${r}px`):(i+=this.widgetOffset,a.update(n,i,s,o),i+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${s}px`,l.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let n=0,i=this._items.length;n0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=oe.getStretch(t.widget),n?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,i+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,i=Math.max(i,t.minWidth)))}let s=this._box=u.boxSizing(this.parent.node);i+=s.horizontalSum,r+=s.verticalSum;let o=this.parent.node.style;o.minWidth=`${i}px`,o.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&g.sendMessage(this.parent.parent,V.Msg.FitRequest),this._dirty&&g.sendMessage(this.parent,V.Msg.UpdateRequest)}_update(e,t){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let e;if(e=d?Math.max(0,s-this._fixed):Math.max(0,o-this._fixed),this._hasNormedSizes){for(let t of this._sizers)t.sizeHint*=e;this._hasNormedSizes=!1}let t=F.calc(this._sizers,e);if(t>0)switch(this._alignment){case"start":break;case"center":a=0,l=t/2;break;case"end":a=0,l=t;break;case"justify":a=t/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof oe&&e.parent.fit()}}),e.createSizer=function(e){let t=new W;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let n=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===n?e.map((e=>1/t)):e.map((e=>e/n))}}(Y||(Y={}));class ae extends oe{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=se.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const n=this._titles[e],i=n.classList.contains("lm-mod-expanded"),r=J.createTitle(this.renderer,t.title,i);this._titles[e]=r,this.parent.node.replaceChild(r,n)}insertWidget(e,t){t.id||(t.id=`id-${A.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,t){const n=J.createTitle(this.renderer,t.title);i.insert(this._titles,e,n),this.parent.node.appendChild(n),t.node.setAttribute("role","region"),t.node.setAttribute("aria-labelledby",n.id),super.attachWidget(e,t)}moveWidget(e,t,n){i.move(this._titles,e,t),super.moveWidget(e,t,n)}detachWidget(e,t){const n=i.removeAt(this._titles,e);this.parent.node.removeChild(n),super.detachWidget(e,t)}updateItemPosition(e,t,n,i,r,s,o){const a=this._titles[e].style;a.top=`${i}px`,a.left=`${n}px`,a.height=`${this.widgetOffset}px`,a.width=t?`${r}px`:`${s}px`,super.updateItemPosition(e,t,n,i,r,s,o)}}!function(e){e.createTitle=function(e,t,n=!0){const i=e.createSectionTitle(t);return i.style.position="absolute",i.style.contain="strict",i.setAttribute("aria-label",`${t.label} Section`),i.setAttribute("aria-expanded",n?"true":"false"),i.setAttribute("aria-controls",t.owner.id),n&&i.classList.add("lm-mod-expanded"),i}}(J||(J={}));class le extends V{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=X.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new K}}(X||(X={}));class ue extends le{constructor(e={}){super({layout:Z.createLayout(e)}),this._handleMoved=new x(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let t,n=this.layout,r=i.findFirstIndex(n.handles,(t=>t.contains(e.target)));if(-1===r)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let s=n.handles[r],o=s.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-o.left:e.clientY-o.top;let a=window.getComputedStyle(s),l=M.Drag.overrideCursor(a.cursor);this._pressData={index:r,delta:t,override:l}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let n=this.layout,i=this.node.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-i.left-this._pressData.delta:e.clientY-i.top-this._pressData.delta,n.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return oe.getStretch(e)},e.setStretch=function(e,t){oe.setStretch(e,t)}}(ue||(ue={})),function(e){e.createLayout=function(e){return e.layout||new oe({renderer:e.renderer||ue.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(Z||(Z={}));class de extends ue{constructor(e={}){super({...e,layout:Q.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new x(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const t=i.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));t>=0&&(this.layout.updateTitle(t,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,n=t.widgets[e];if(!n)return;const i=n.isHidden,r=t.absoluteSizes(),s=(i?-1:1)*this.spacing,o=r.reduce(((e,t)=>e+t));let a=[...r];if(i){const t=this._widgetSizesCache.get(n);if(!t)return;a[e]+=t;const i=a.map((e=>e-t>0)).lastIndexOf(!0);-1===i?a.forEach(((n,i)=>{i!==e&&(a[i]-=r[i]/o*(t-s))})):a[i]-=t-s}else{const t=r[e];this._widgetSizesCache.set(n,t),a[e]=0;const i=a.map((e=>e>0)).lastIndexOf(!0);if(-1===i)return;a[i]=r[i]+t+s}return a.map((e=>e/(o+s)))}_evtClick(e){const t=e.target;if(t){const n=i.findFirstIndex(this.titles,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(n))}}_eventKeyDown(e){if(e.defaultPrevented)return;const t=e.target;let n=!1;if(t){const r=i.findFirstIndex(this.titles,(e=>e.contains(t)));if(r>=0){const i=e.keyCode.toString();if(e.key.match(/Space|Enter/)||i.match(/13|32/))t.click(),n=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||i.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||i.match(/38|40/)){const t=e.key.match(/ArrowLeft|ArrowUp/)||i.match(/37|38/)?-1:1,s=this.titles.length,o=(r+s+t)%s;this.titles[o].focus(),n=!0}else"End"===e.key||"35"===i?(this.titles[this.titles.length-1].focus(),n=!0):"Home"!==e.key&&"36"!==i||(this.titles[0].focus(),n=!0)}n&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],n=this.layout.widgets[e],i=this._computeWidgetSize(e);i&&this.setRelativeSizes(i,!1),n.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),n.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),n.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends ue.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const n in e.dataset)t.dataset[n]=e.dataset[n];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const n=t.appendChild(document.createElement("span"));return n.className="lm-AccordionPanel-titleLabel",n.textContent=e.label,n.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(de||(de={})),function(e){e.createLayout=function(e){return e.layout||new ae({renderer:e.renderer||de.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(Q||(Q={}));class ce extends K{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=se.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=se.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){i.insert(this._items,e,new G(t)),i.insert(this._sizers,e,new W),this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);i.removeAt(this._sizers,e),this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,n=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,d=i/2;break;case"end":l=0,d=i;break;case"justify":l=i/n,d=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new E({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(ee||(ee={}));class he extends le{constructor(e={}){super({layout:te.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return ce.getStretch(e)},e.setStretch=function(e,t){ce.setStretch(e,t)},e.getSizeBasis=function(e){return ce.getSizeBasis(e)},e.setSizeBasis=function(e,t){ce.setSizeBasis(e,t)}}(he||(he={})),function(e){e.createLayout=function(e){return e.layout||new ce(e)}}(te||(te={}));class pe extends V{constructor(e){super({node:ne.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(V.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||pe.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=ne.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>ne.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){i.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){this._results=null,""!==this.inputNode.value?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(this.isHidden)return;let t=this.inputNode.value,n=this.contentNode,r=this._results;if(r||(r=this._results=ne.search(this._items,t),this._activeIndex=t?i.findFirstIndex(r,ne.canActivate):-1),!t&&0===r.length)return void S.render(null,n);if(t&&0===r.length){let e=this.renderer.renderEmptyMessage({query:t});return void S.render(e,n)}let s=this.renderer,o=this._activeIndex,a=new Array(r.length);for(let e=0,t=r.length;e=r.length)n.scrollTop=0;else{let e=n.children[o];u.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let t=i.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==t&&(e.preventDefault(),e.stopPropagation(),this._execute(t))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,t=this._results.length,n=ee-t)),c=a.slice(0,d),h=a.slice(d);for(let e=0,t=h.length;en.command===e&&A.JSONExt.deepEqual(n.args,t)))||null}}}(ne||(ne={}));class ge extends V{constructor(e){super({node:ie.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new x(this),this._menuRequested=new x(this),this.addClass("lm-Menu"),this.setFlag(V.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||ge.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||ie.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,t=this._activeIndex,n=t{this.activeIndex=e}})}S.render(s,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let n=this._parentMenu;n&&(this._parentMenu=null,n._childIndex=-1,n._childMenu=null,n.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let n=R().keyForKeydownEvent(e);if(!n)return;let i=this._activeIndex+1,r=ie.findMnemonic(this._items,n,i);-1===r.index||r.multiple?-1!==r.index?this.activeIndex=r.index:-1!==r.auto&&(this.activeIndex=r.auto):(this.activeIndex=r.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>u.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(this.activeIndex=t,t=this.activeIndex,t===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:n}=e;u.hitTest(this._childMenu.node,t,n)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(ie.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let n=t.submenu;if(n===this._childMenu)return;ge.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,g.sendMessage(this,V.Msg.UpdateRequest);let i=this.contentNode.children[this._activeIndex];ie.openSubmenu(n,i),e&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),ie.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),ie.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){ie.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return B.li({className:t,dataset:n,tabindex:"0",onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return B.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return B.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return B.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return B.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let n=e.item.className;return n&&(t+=` ${n}`),t}createItemDataset(e){let t,{type:n,command:i,dataset:r}=e.item;return t="command"===n?{...r,type:n,command:i}:{...r,type:n},t}createIconClass(e){let t="lm-Menu-itemIcon",n=e.item.iconClass;return n?`${t} ${n}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:n}=e.item;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,B.span({className:"lm-Menu-itemMnemonic"},s),r]}formatShortcut(e){let t=e.item.keyBinding;return t?M.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(ge||(ge={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let t=null,n=0;function r(){return n>0?(n--,t):o()}function s(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function o(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){t=o(),n++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=s,e.createItem=function(e,t){return new a(e.commands,t)},e.hitTestMenus=function(e,t,n){for(let i=e;i;i=i.childMenu)if(u.hitTest(i.node,t,n))return!0;return!1},e.computeCollapsed=function(e){let t=new Array(e.length);i.fill(t,!1);let n=0,r=e.length;for(;n=0;--s){let n=e[s];if(n.isVisible){if("separator"!==n.type)break;t[s]=!0}}let o=!1;for(;++na+u&&(t=a+u-f),!s&&n+m>l+d&&(n>l+d?n=l+d-m:n-=m),p.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,n)}px`,p.opacity="1"},e.openSubmenu=function(t,n){const i=r();let s=i.pageXOffset,o=i.pageYOffset,a=i.clientWidth,l=i.clientHeight;g.sendMessage(t,V.Msg.UpdateRequest);let d=l,c=t.node,h=c.style;h.opacity="0",h.maxHeight=`${d}px`,V.attach(t,document.body);let{width:p,height:f}=c.getBoundingClientRect(),m=u.boxSizing(t.node),v=n.getBoundingClientRect(),b=v.right-e.SUBMENU_OVERLAP;b+p>s+a&&(b=v.left+e.SUBMENU_OVERLAP-p);let _=v.top-m.borderTop-m.paddingTop;_+f>o+l&&(_=v.bottom+m.borderBottom+m.paddingBottom-f),h.transform=`translate(${Math.max(0,b)}px, ${Math.max(0,_)}px`,h.opacity="1"},e.findMnemonic=function(e,t,n){let i=-1,r=-1,o=!1,a=t.toUpperCase();for(let t=0,l=e.length;t=0&&hn.command===e&&A.JSONExt.deepEqual(n.args,t)))||null}return null}}}(ie||(ie={})),function(e){function t(e,t){let n=e.rank,i=t.rank;return n!==i?n=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,n=this._titles[t]||null,i=e,r=this._titles[i]||null;this._currentIndex=i,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:n,currentIndex:i,currentTitle:r})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,t){this._releaseMouse();let n=ve.asTitle(t),r=this._titles.indexOf(n),s=Math.max(0,Math.min(e,this._titles.length));return-1===r?(i.insert(this._titles,s,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(s,n),n):(s===this._titles.length&&s--,r===s||(i.move(this._titles,r,s),this.update(),this._adjustCurrentForMove(r,s)),n)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let t=i.removeAt(this._titles,e);t&&(t.changed.disconnect(this._onTitleChanged,this),t===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,t))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let n=this._titles,i=this.renderer,r=this.currentTitle,s=new Array(n.length);const o=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=n.length;eu.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let r=this.titles[n],s=t[n].querySelector(".lm-TabBar-tabLabel");if(s&&s.contains(e.target)){let e=r.label||"",t=s.innerHTML;s.innerHTML="";let n=document.createElement("input");n.classList.add("lm-TabBar-tabInput"),n.value=e,s.appendChild(n);let i=()=>{n.removeEventListener("blur",i),s.innerHTML=t,this.node.addEventListener("keydown",this)};n.addEventListener("dblclick",(e=>e.stopPropagation())),n.addEventListener("blur",i),n.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==n.value&&(r.label=r.caption=n.value),i()):"Escape"===e.key&&i()})),this.node.removeEventListener("keydown",this),n.select(),n.focus(),s.children.length>0&&s.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var t,n,r;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const t=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(t))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const n=i.findFirstIndex(this.contentNode.children,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=n)}}else if(fe.includes(e.key)){const i=[...this.contentNode.children];if(this.addButtonEnabled&&i.push(this.addButtonNode),i.length<=1)return;e.preventDefault(),e.stopPropagation();let s,o=i.indexOf(document.activeElement);-1===o&&(o=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?s=null!==(t=i[o+1])&&void 0!==t?t:i[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?s=null!==(n=i[o-1])&&void 0!==n?n:i[i.length-1]:"Home"===e.key?s=i[0]:"End"===e.key&&(s=i[i.length-1]),s&&(null===(r=i[o])||void 0===r||r.setAttribute("tabindex","-1"),null==s||s.setAttribute("tabindex","0"),s.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let t=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,r=i.findFirstIndex(n,(t=>u.hitTest(t,e.clientX,e.clientY)));if(-1===r&&!t)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[r],index:r,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||t)return;let s=n[r].querySelector(this.renderer.closeIconSelector);s&&s.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===r?this.currentIndex=-1:this.currentIndex=r,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let n=this.contentNode.children;if(t.dragActive||ve.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=ve.snapTabLayout(n,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=M.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&ve.detachExceeded(t,e)){t.detachRequested=!0;let i=t.index,r=e.clientX,s=e.clientY,o=n[i],a=this._titles[i];if(this._tabDetachRequested.emit({index:i,title:a,tab:o,clientX:r,clientY:s,offset:t.tabPressOffset}),t.dragAborted)return}ve.layoutTabs(n,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const t=this._dragData;if(!t)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!t.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,r=i.findFirstIndex(n,(t=>u.hitTest(t,e.clientX,e.clientY)));if(r!==t.index)return;let s=this._titles[r];if(!s.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:r,title:s});let o=n[r].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:r,title:s}):void 0}if(0!==e.button)return;ve.finalizeTabPosition(t,this._orientation),t.tab.classList.remove("lm-mod-dragging");let n=ve.parseTransitionDuration(t.tab);setTimeout((()=>{if(t.dragAborted)return;this._dragData=null,ve.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),this.removeClass("lm-mod-dragging");let e=t.index,n=t.targetIndex;-1!==n&&e!==n&&(i.move(this._titles,e,n),this._adjustCurrentForMove(e,n),this._tabMoved.emit({fromIndex:e,toIndex:n,title:this._titles[n]}),g.sendMessage(this,V.Msg.UpdateRequest))}),n)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(ve.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let n=this.currentTitle,i=this._currentIndex,r=this.insertBehavior;if("select-tab"===r||"select-tab-if-needed"===r&&-1===i)return this._currentIndex=e,this._previousTitle=n,void this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:e,currentTitle:t});i>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let n=this._currentIndex,i=this.removeBehavior;if(n===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===i)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===i)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===i)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else n>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var ve,be,_e,Ae,ye,we,Ce,Ee;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,n=this.createTabKey(e),i=n,r=this.createTabStyle(e),s=this.createTabClass(e),o=this.createTabDataset(e),a=this.createTabARIA(e);return e.title.closable?B.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):B.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let n=this.createIconClass(e);return B.div({className:n},t.icon,t.iconLabel)}renderLabel(e){return B.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return B.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}(me||(me={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let n=document.createElement("div");return n.className="lm-TabBar-addButton lm-mod-hidden",n.setAttribute("tabindex","-1"),n.setAttribute("role","button"),e.appendChild(n),e},e.asTitle=function(e){return e instanceof H?e:new H(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let n=new Array(e.length);for(let i=0,r=e.length;i=e.DRAG_THRESHOLD||r>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,n){let i=t.contentRect;return n.clientX=i.right+e.DETACH_THRESHOLD||n.clientY=i.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,n,i){let r,s,o,a;"horizontal"===i?(r=t.pressX,s=n.clientX-t.contentRect.left,o=n.clientX,a=t.contentRect.width):(r=t.pressY,s=n.clientY-t.contentRect.top,o=n.clientY,a=t.contentRect.height);let l=t.index,u=s-t.tabPressPos,d=u+t.tabSize;for(let n=0,s=e.length;n>1);if(nt.index&&d>h)s=-t.tabSize-c.margin+"px",l=Math.max(l,n);else if(n===t.index){let e=o-r,n=a-(t.tabPos+t.tabSize);s=`${Math.max(-t.tabPos,Math.min(e,n))}px`}else s="";"horizontal"===i?e[n].style.left=s:e[n].style.top=s}t.targetIndex=l},e.finalizeTabPosition=function(e,t){let n,i;if(n="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)i=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];i=t.pos+t.size-e.tabSize-e.tabPos}else i=e.tabLayout[e.targetIndex].pos-e.tabPos;let r=n-(e.tabPos+e.tabSize),s=Math.max(-e.tabPos,Math.min(i,r));"horizontal"===t?e.tab.style.left=`${s}px`:e.tab.style.top=`${s}px`},e.resetTabPositions=function(e,t){for(const n of e)"horizontal"===t?n.style.left="":n.style.top=""}}(ve||(ve={}));class xe extends q{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=se.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:V.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=se.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():o()}widgets(){return this._root?this._root.iterUserWidgets():o()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():o()}tabBars(){return this._root?this._root.iterTabBars():o()}handles(){return this._root?this._root.iterHandles():o()}moveHandle(e,t,n){let i=e.classList.contains("lm-mod-hidden");if(!this._root||i)return;let r,s=this._root.findSplitNode(e);s&&(r="horizontal"===s.node.orientation?t-e.offsetLeft:n-e.offsetTop,0!==r&&(s.node.holdSizes(),F.adjust(s.node.sizers,s.index,r),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,n=new Set;t=e.main?be.normalizeAreaConfig(e.main,n):null;let i=this.widgets(),r=this.tabBars(),s=this.handles();this._root=null;for(const e of i)n.has(e)||(e.parent=null);for(const e of r)e.dispose();for(const e of s)e.parentNode&&e.parentNode.removeChild(e);for(const e of n)e.parent=this.parent;this._root=t?be.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(n.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let n=t.ref||null,i=t.mode||"tab-after",r=null;if(this._root&&n&&(r=this._root.findTabNode(n)),n&&!r)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,i){case"tab-after":this._insertTab(e,n,r,!0);break;case"tab-before":this._insertTab(e,n,r,!1);break;case"split-top":this._insertSplit(e,n,r,"vertical",!1);break;case"split-left":this._insertSplit(e,n,r,"horizontal",!1);break;case"split-right":this._insertSplit(e,n,r,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,n,r,"vertical",!0);break;case"merge-top":this._insertSplit(e,n,r,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,n,r,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,n,r,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,n,r,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=u.boxSizing(this.parent.node));let n=this.parent.node.getBoundingClientRect(),i=e-n.left-this._box.borderLeft,r=t-n.top-this._box.borderTop,s=this._root.hitTestTabNodes(i,r);if(!s)return null;let{tabBar:o,top:a,left:l,width:d,height:c}=s,h=this._box.borderLeft+this._box.borderRight,p=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:i,y:r,top:a,left:l,right:n.width-h-(l+d),bottom:n.height-p-(a+c),width:d,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new G(e)),this.parent.isAttached&&g.sendMessage(e,V.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&g.sendMessage(e,V.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&g.sendMessage(e,V.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&g.sendMessage(e,V.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let t=this._root.findTabNode(e);if(!t)return;if(be.removeAria(e),t.tabBar.titles.length>1)return t.tabBar.removeTab(e.title),void(this._hiddenMode===V.HiddenMode.Scale&&1==t.tabBar.titles.length&&(t.tabBar.titles[0].owner.hiddenMode=V.HiddenMode.Display));if(t.tabBar.dispose(),this._root===t)return void(this._root=null);this._root.holdAllSizes();let n=t.parent;t.parent=null;let r=i.removeFirstOf(n.children,t),s=i.removeAt(n.handles,r);if(i.removeAt(n.sizers,r),s.parentNode&&s.parentNode.removeChild(s),n.children.length>1)return void n.syncHandles();let o=n.parent;n.parent=null;let a=n.children[0],l=n.handles[0];if(n.children.length=0,n.handles.length=0,n.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===n)return a.parent=null,void(this._root=a);let u=o,d=u.children.indexOf(n);if(a instanceof be.TabLayoutNode)return a.parent=u,void(u.children[d]=a);let c=i.removeAt(u.handles,d);i.removeAt(u.children,d),i.removeAt(u.sizers,d),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,t=a.children.length;e=n.length)&&(i=0),{type:"tab-area",widgets:n,currentIndex:i}}(t,n):function(t,n){let i=t.orientation,r=[],s=[];for(let o=0,a=t.children.length;o{let l=r(i,n,s),u=t(e.sizes[a]),d=n.createHandle();o.children.push(l),o.handles.push(d),o.sizers.push(u),l.parent=o})),o.syncHandles(),o.normalizeSizes(),o}(s,o,a),l};class n{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new W,n=new W;t.stretch=0,n.stretch=1,this.tabBar=e,this.sizers=[t,n]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let n=0,i=0,r=t.get(this.tabBar),s=this.tabBar.currentTitle,o=s?t.get(s.owner):void 0,[a,l]=this.sizers;return r&&r.fit(),o&&o.fit(),r&&!r.isHidden?(n=Math.max(n,r.minWidth),i+=r.minHeight,a.minSize=r.minHeight,a.maxSize=r.maxHeight):(a.minSize=0,a.maxSize=0),o&&!o.isHidden?(n=Math.max(n,o.minWidth),i+=o.minHeight,l.minSize=o.minHeight,l.maxSize=1/0):(l.minSize=0,l.maxSize=1/0),{minWidth:n,minHeight:i,maxWidth:1/0,maxHeight:1/0}}update(e,t,n,i,r,s){this._top=t,this._left=e,this._width=n,this._height=i;let o=s.get(this.tabBar),a=this.tabBar.currentTitle,l=a?s.get(a.owner):void 0;if(F.calc(this.sizers,i),o&&!o.isHidden){let i=this.sizers[0].size;o.update(e,t,n,i),t+=i}if(l&&!l.isHidden){let i=this.sizers[1].size;l.update(e,t,n,i)}}}e.TabLayoutNode=n;class i{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,n=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),n=t.reduce(((e,t)=>e+t),0);if(0===n)for(let n=t.length-1;n>-1;n--)t[n]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=n;return t}fit(e,t){let n="horizontal"===this.orientation,i=Math.max(0,this.children.length-1)*e,r=n?i:0,s=n?0:i;for(let i=0,o=this.children.length;ithis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new xe({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new De.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(_e.createSingleDocumentConfig(this));break;default:throw"unreachable"}g.postMessage(this,_e.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let t=a(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!t)throw new Error("Widget is not contained in the dock panel.");t.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(d.IS_EDGE||d.IS_IE)&&g.flush(),g.postMessage(this,_e.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),g.postMessage(this,_e.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){_e.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){_e.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),g.postMessage(this,_e.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:n}=e,{zone:i,target:r}=_e.findDropTarget(this,t,n,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===i)return void(e.dropAction="none");let s=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof s)return void(e.dropAction="none");let o=s();if(!(o instanceof V))return void(e.dropAction="none");if(o.contains(this))return void(e.dropAction="none");let a=r?_e.getDropRef(r.tabBar):null;switch(i){case"root-all":this.addWidget(o);break;case"root-top":this.addWidget(o,{mode:"split-top"});break;case"root-left":this.addWidget(o,{mode:"split-left"});break;case"root-right":this.addWidget(o,{mode:"split-right"});break;case"root-bottom":this.addWidget(o,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(o,{mode:"tab-after",ref:a});break;case"widget-top":this.addWidget(o,{mode:"split-top",ref:a});break;case"widget-left":this.addWidget(o,{mode:"split-left",ref:a});break;case"widget-right":this.addWidget(o,{mode:"split-right",ref:a});break;case"widget-bottom":this.addWidget(o,{mode:"split-bottom",ref:a});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(o)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),g.postMessage(this,_e.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let t=this.layout,n=e.target,i=a(t.handles(),(e=>e.contains(n)));if(!i)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let r=i.getBoundingClientRect(),s=e.clientX-r.left,o=e.clientY-r.top,l=window.getComputedStyle(i),u=M.Drag.overrideCursor(l.cursor,this._document);this._pressData={handle:i,deltaX:s,deltaY:o,override:u}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),n=e.clientX-t.left-this._pressData.deltaX,i=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,n,i)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),g.postMessage(this,_e.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let n,i,r,s,{zone:o,target:a}=_e.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let l=u.boxSizing(this.node),d=this.node.getBoundingClientRect();switch(o){case"root-all":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"root-top":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=d.height*_e.GOLDEN_RATIO;break;case"root-left":n=l.paddingTop,i=l.paddingLeft,r=d.width*_e.GOLDEN_RATIO,s=l.paddingBottom;break;case"root-right":n=l.paddingTop,i=d.width*_e.GOLDEN_RATIO,r=l.paddingRight,s=l.paddingBottom;break;case"root-bottom":n=d.height*_e.GOLDEN_RATIO,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"widget-all":n=a.top,i=a.left,r=a.right,s=a.bottom;break;case"widget-top":n=a.top,i=a.left,r=a.right,s=a.bottom+a.height/2;break;case"widget-left":n=a.top,i=a.left,r=a.right+a.width/2,s=a.bottom;break;case"widget-right":n=a.top,i=a.left+a.width/2,r=a.right,s=a.bottom;break;case"widget-bottom":n=a.top+a.height/2,i=a.left,r=a.right,s=a.bottom;break;case"widget-tab":{const e=a.tabBar.node.getBoundingClientRect().height;n=a.top,i=a.left,r=a.right,s=a.bottom+a.height-e;break}default:throw"unreachable"}return this.overlay.show({top:n,left:i,right:r,bottom:s}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return _e.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){g.postMessage(this,_e.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:n,currentTitle:i}=t;n&&n.owner.hide(),i&&i.owner.show(),(d.IS_EDGE||d.IS_IE)&&g.flush(),g.postMessage(this,_e.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:n,tab:i,clientX:r,clientY:s,offset:o}=t,a=new A.MimeData;a.setData("application/vnd.lumino.widget-factory",(()=>n.owner));let l=i.cloneNode(!0);o&&(l.style.top=`-${o.y}px`,l.style.left=`-${o.x}px`),this._drag=new M.Drag({document:this._document,mimeData:a,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),i.classList.add("lm-mod-hidden"),this._drag.start(r,s).then((()=>{this._drag=null,i.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new me({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(De||(De={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new C("layout-modified"),e.isGeneratedTabBarProperty=new E({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),n=e.selectedWidgets().next().value,i=n?t.indexOf(n):-1;return{main:{type:"tab-area",widgets:t,currentIndex:i}}},e.findDropTarget=function(e,t,n,i){if(!u.hitTest(e.node,t,n))return{zone:"invalid",target:null};let r=e.layout;if(r.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let r=e.node.getBoundingClientRect(),s=t-r.left+1,o=n-r.top+1,a=r.right-t,l=r.bottom-n;switch(Math.min(o,a,l,s)){case o:if(oh&&l>h&&a>p&&d>p)return{zone:"widget-all",target:s};switch(o/=h,a/=p,l/=h,d/=p,Math.min(o,a,l,d)){case o:c="widget-left";break;case a:c="widget-top";break;case l:c="widget-right";break;case d:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:s}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(_e||(_e={}));class Se{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new x(this),this._currentChanged=new x(this)}dispose(){if(!(this._counter<0)){this._counter=-1,x.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),n=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,n),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),i.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let t=function(e,t){let n;for(const i of e)void 0!==n?t(i,n)>0&&(n=i):n=i;return n}(this._widgets.filter((e=>-1!==this._numbers.get(e))),((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(t,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let n=this._currentWidget;this._currentWidget=e;let i=this._activeWidget;this._activeWidget=t,n!==e&&this._currentChanged.emit({oldValue:n,newValue:e}),i!==t&&this._activeChanged.emit({oldValue:i,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let t=this._nodes.get(e.currentTarget),n=e.relatedTarget;n&&(t.node.contains(n)||a(this._widgets,(e=>e.node.contains(n))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}}class Te extends q{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new W],this._columnSizers=[new W],this._box=null,void 0!==e.rowCount&&Ae.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&Ae.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=Ae.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=Ae.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(Ae.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(Ae.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=Ae.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=Ae.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let n=this._rowSizers[e];n&&(t=Ae.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let n=this._columnSizers[e];n&&(t=Ae.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===i.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new G(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let t=i.findFirstIndex(this._items,(t=>t.widget===e));if(-1===t)return;let n=i.removeAt(this._items,t);this.parent&&this.detachWidget(e),n.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&g.sendMessage(e,V.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&g.sendMessage(e,V.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&g.sendMessage(e,V.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&g.sendMessage(e,V.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,n=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof Te&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.rowSpan-r.rowSpan},e.columnSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.columnSpan-r.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,n,i){if(n=i)return;let s=(i-r)/(n-t+1);for(let i=t;i<=n;++i)e[i].minSize+=s}}(Ae||(Ae={}));class Me extends V{constructor(e={}){super({node:ye.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(V.Flag.DisallowLayout),this.renderer=e.renderer||Me.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,t,n=!0){this._closeChildMenu();let r=this._menus.indexOf(t),s=Math.max(0,Math.min(e,this._menus.length));if(-1===r)return i.insert(this._menus,s,t),t.addClass("lm-MenuBar-menu"),t.aboutToClose.connect(this._onMenuAboutToClose,this),t.menuRequested.connect(this._onMenuMenuRequested,this),t.title.changed.connect(this._onTitleChanged,this),void(n&&this.update());s===this._menus.length&&s--,r!==s&&(i.move(this._menus,r,s),n&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,t=!0){this._closeChildMenu();let n=i.removeAt(this._menus,e);n&&(n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),t&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let n=this._menus,i=this.renderer,r=this._activeIndex,s=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:n.length,a=0,l=!1;o=null!==this._overflowMenu?o-1:o;let u=new Array(o);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),a+=this._menuItemSizes[e],n[e].title.label===this._overflowMenuOptions.title&&(l=!0,o--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new ge({commands:new M.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=n.length-2;e>=o;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}u[o]=i.renderItem({title:this._overflowMenu.title,active:o===r&&0!==n[o].items.length,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,r=this._overflowMenu.items.length;for(let l=0;lthis._menuItemSizes[r]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(o,t,!1),u[o]=i.renderItem({title:t.title,active:!1,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),u.pop(),this._overflowMenu=null,this._overflowIndex=-1)}S.render(u,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,n=0,i=-1,r=e.length;if(0==this._menuItemSizes.length)for(let s=0;st&&-1===i&&(i=s)}else for(let e=0;et){i=e;break}this._overflowIndex=i}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,n=this._tabFocusIndex+e,i=this._menus.length;for(let t=0;tu.hitTest(t,e.clientX,e.clientY)));if(-1!==t){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=t;else{e.preventDefault();const n=this._positionForMenu(t);ge.saveWindowData(),this.activeIndex=t,this._openChildMenu(n)}}else this._closeChildMenu()}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>u.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(-1===t&&this._childMenu)return;const n=t>=0&&this._childMenu?this._positionForMenu(t):null;ge.saveWindowData(),this.activeIndex=t,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:n,bottom:i}=t.getBoundingClientRect();return{top:i,left:n}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let n=this._childMenu;if(n===t)return;this._childMenu=t,n?n.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,g.sendMessage(this,V.Msg.UpdateRequest);let{left:i,top:r}=e;void 0!==i&&void 0!==r||({left:i,top:r}=this._positionForMenu(this._activeIndex)),n||this.addClass("lm-mod-active"),t.items.length>0&&t.open(i,r,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let n=this._activeIndex,i=this._menus.length;switch(t){case"next":this.activeIndex=n===i-1?0:n+1;break;case"previous":this.activeIndex=0===n?i-1:n-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return B.li({className:t,dataset:n,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return B.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return B.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}formatLabel(e){let{label:t,mnemonic:n}=e.title;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,B.span({className:"lm-MenuBar-itemMnemonic"},s),r]}}e.Renderer=t,e.defaultRenderer=new t}(Me||(Me={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,n){let i=-1,r=-1,s=!1,o=t.toUpperCase();for(let t=0,a=e.length;t=0&&d1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,t){this._hiddenMode===V.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=V.HiddenMode.Scale),t.hiddenMode=V.HiddenMode.Scale):t.hiddenMode=V.HiddenMode.Display,i.insert(this._items,e,new G(t)),this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);this.parent.isAttached&&g.sendMessage(t,V.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,V.Msg.AfterDetach),n.widget.node.style.zIndex="",this._hiddenMode===V.HiddenMode.Scale&&(t.hiddenMode=V.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=V.HiddenMode.Display)),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let n=0,i=this._items.length;n>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=(()=>{const e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:t})(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){const t=new Uint8Array(16),n=new Array(256);for(let e=0;e<16;++e)n[e]="0"+e.toString(16);for(let e=16;e<256;++e)n[e]=e.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=class{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(e){return-1!==this._types.indexOf(e)}getData(e){let t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0}setData(e,t){this.clearData(e),this._types.push(e),this._values.push(t)}clearData(e){let t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))}clear(){this._types.length=0,this._values.length=0}},e.PromiseDelegate=class{constructor(){this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){(0,this._resolve)(e)}reject(e){(0,this._reject)(e)}},e.Token=class{constructor(e,t){this.name=e,this.description=null!=t?t:"",this._tokenStructuralPropertyT=null}}}(t)},7298:(e,t,n)=>{var i,r,s;s="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g,i=[n(70405),n(38291),t],r=function(e,t,n){s.Backbone=function(e,t,n,i){var r=e.Backbone,s=Array.prototype.slice;t.VERSION="1.4.0",t.$=i,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o,a=t.Events={},l=/\s+/,u=function(e,t,i,r,s){var o,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=n.keys(i);athis.length&&(r=this.length),r<0&&(r+=this.length+1);var s,o,a=[],l=[],u=[],d=[],c={},h=t.add,p=t.merge,g=t.remove,f=!1,m=this.comparator&&null==r&&!1!==t.sort,v=n.isString(this.comparator)?this.comparator:null;for(o=0;o7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(U,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),F.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),n.some(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!F.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");var n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+e;e=e.replace($,"");var r=this.decodeFragment(e);if(this.fragment!==r){if(this.fragment=r,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;t.replace||(s.document.open(),s.document.close()),this._updateHash(s.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),t.history=new F;v.extend=b.extend=I.extend=S.extend=F.extend=function(e,t){var i,r=this;return i=e&&n.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,t),i.prototype=n.create(r.prototype,e),i.prototype.constructor=i,i.__super__=r.prototype,i};var W=function(){throw new Error('A "url" property or function must be specified')},H=function(e,t){var n=t.error;t.error=function(i){n&&n.call(t.context,e,i,t),e.trigger("error",e,i,t)}};return t}(s,n,e,t)}.apply(t,i),void 0===r||(e.exports=r)},95766:(e,t)=>{"use strict";t.b$=function(e){var t,n,s=function(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}(e),o=s[0],a=s[1],l=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),u=0,d=a>0?o-4:o;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.JQ=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,u=i-r;au?u:a+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},51590:(e,t,n)=>{!function(e){"use strict";function t(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,(function(n,i){n.state.autoRefresh&&(t(0,n.state.autoRefresh),n.state.autoRefresh=null),i&&0==n.display.wrapper.offsetHeight&&function(n,i){function r(){n.display.wrapper.offsetHeight?(t(0,i),n.display.lastWrapHeight!=n.display.wrapper.clientHeight&&n.refresh()):i.timeout=setTimeout(r,i.delay)}i.timeout=setTimeout(r,i.delay),i.hurry=function(){clearTimeout(i.timeout),i.timeout=setTimeout(r,50)},e.on(window,"mouseup",i.hurry),e.on(window,"keyup",i.hurry)}(n,n.state.autoRefresh={delay:i.delay||250})}))}(n(23326))},22130:(e,t,n)=>{!function(e){"use strict";var t="CodeMirror-hint",n="CodeMirror-hint-active";function i(e,t){if(this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}}e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var i={hint:t};if(n)for(var r in n)i[r]=n[r];return e.showHint(i)},e.defineExtension("showHint",(function(t){t=function(e,t,n){var i=e.options.hintOptions,r={};for(var s in d)r[s]=d[s];if(i)for(var s in i)void 0!==i[s]&&(r[s]=i[s]);if(n)for(var s in n)void 0!==n[s]&&(r[s]=n[s]);return r.hint.resolve&&(r.hint=r.hint.resolve(e,t)),r}(this,this.getCursor("start"),t);var n=this.listSelections();if(!(n.length>1)){if(this.somethingSelected()){if(!t.hint.supportsSelection)return;for(var r=0;rc.clientHeight+1;if(setTimeout((function(){k=l.getScrollInfo()})),j.bottom-M>0){var O=j.bottom-j.top;if(_.top-(_.bottom-j.top)-O>0)c.style.top=(y=_.top-O-E)+"px",w=!1;else if(O>M){c.style.height=M-5+"px",c.style.top=(y=_.bottom-j.top-E)+"px";var I=l.getCursor();r.from.ch!=I.ch&&(_=l.cursorCoords(I),c.style.left=(A=_.left-C)+"px",j=c.getBoundingClientRect())}}var R,P=j.right-T;if(B&&(P+=l.display.nativeBarWidth),P>0&&(j.right-j.left>T&&(c.style.width=T-5+"px",P-=j.right-j.left-T),c.style.left=(A=_.left-P-C)+"px"),B)for(var L=c.firstChild;L;L=L.nextSibling)L.style.paddingRight=l.display.nativeBarWidth+"px";l.addKeyMap(this.keyMap=function(e,t){var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(1-t.menuSize(),!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var i=e.options.customKeys,r=i?{}:n;function s(e,i){var s;s="string"!=typeof i?function(e){return i(e,t)}:n.hasOwnProperty(i)?n[i]:i,r[e]=s}if(i)for(var o in i)i.hasOwnProperty(o)&&s(o,i[o]);var a=e.options.extraKeys;if(a)for(var o in a)a.hasOwnProperty(o)&&s(o,a[o]);return r}(i,{moveFocus:function(e,t){s.changeActive(s.selectedHint+e,t)},setFocus:function(e){s.changeActive(e)},menuSize:function(){return s.screenAmount()},length:p.length,close:function(){i.close()},pick:function(){s.pick()},data:r})),i.options.closeOnUnfocus&&(l.on("blur",this.onBlur=function(){R=setTimeout((function(){i.close()}),100)}),l.on("focus",this.onFocus=function(){clearTimeout(R)})),l.on("scroll",this.onScroll=function(){var e=l.getScrollInfo(),t=l.getWrapperElement().getBoundingClientRect();k||(k=l.getScrollInfo());var n=y+k.top-e.top,r=n-(d.pageYOffset||(u.documentElement||u.body).scrollTop);if(w||(r+=c.offsetHeight),r<=t.top||r>=t.bottom)return i.close();c.style.top=n+"px",c.style.left=A+k.left-e.left+"px"}),e.on(c,"dblclick",(function(e){var t=a(c,e.target||e.srcElement);t&&null!=t.hintId&&(s.changeActive(t.hintId),s.pick())})),e.on(c,"click",(function(e){var t=a(c,e.target||e.srcElement);t&&null!=t.hintId&&(s.changeActive(t.hintId),i.options.completeOnSingleClick&&s.pick())})),e.on(c,"mousedown",(function(){setTimeout((function(){l.focus()}),20)}));var N=this.getSelectedHintRange();return 0===N.from&&0===N.to||this.scrollToActive(),e.signal(r,"select",p[this.selectedHint],c.childNodes[this.selectedHint]),!0}function u(e,t,n,i){if(e.async)e(t,i,n);else{var r=e(t,n);r&&r.then?r.then(i):i(r)}}i.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&e.signal(this.data,"close"),this.widget&&this.widget.close(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var i=t.list[n],r=this;this.cm.operation((function(){i.hint?i.hint(r.cm,t,i):r.cm.replaceRange(o(i),i.from||t.from,i.to||t.to,"complete"),e.signal(t,"pick",i),r.cm.scrollIntoView()})),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(s(this.debounce),this.debounce=0);var e=this.startPos;this.data&&(e=this.data.from);var t=this.cm.getCursor(),n=this.cm.getLine(t.line);if(t.line!=this.startPos.line||n.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?t=i?this.data.list.length-1:0:t<0&&(t=i?0:this.data.list.length-1),this.selectedHint!=t){var r=this.hints.childNodes[this.selectedHint];r&&(r.className=r.className.replace(" "+n,"")),(r=this.hints.childNodes[this.selectedHint=t]).className+=" "+n,this.scrollToActive(),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from],n=this.hints.childNodes[e.to],i=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}},e.registerHelper("hint","auto",{resolve:function(t,n){var i,r=t.getHelpers(n,"hint");if(r.length){var s=function(e,t,n){var i=function(e,t){if(!e.somethingSelected())return t;for(var n=[],i=0;i0?t(e):r(s+1)}))}(0)};return s.async=!0,s.supportsSelection=!0,s}return(i=t.getHelper(t.getCursor(),"hintWords"))?function(t){return e.hint.fromList(t,{words:i})}:e.hint.anyword?function(t,n){return e.hint.anyword(t,n)}:function(){}}}),e.registerHelper("hint","fromList",(function(t,n){var i,r=t.getCursor(),s=t.getTokenAt(r),o=e.Pos(r.line,s.start),a=r;s.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};e.defineOption("hintOptions",null)}(n(23326))},23326:function(e){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),s=/Edge\/(\d+)/.exec(e),o=i||r||s,a=o&&(i?document.documentMode||6:+(s||r)[1]),l=!s&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),d=!s&&/Chrome\//.test(e),c=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),g=/PhantomJS/.test(e),f=h&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),m=/Android/.test(e),v=f||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=f||/Mac/.test(t),_=/\bCrOS\b/.test(e),A=/win/i.test(t),y=c&&e.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1])),y&&y>=15&&(c=!1,l=!0);var w=b&&(u||c&&(null==y||y<12.11)),C=n||o&&a>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x,D=function(e,t){var n=e.className,i=E(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function S(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return S(e).appendChild(t)}function M(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var s=0;s=t)return o+(t-s);o+=a-s,o+=n-o%n,s=a+1}}f?R=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:o&&(R=function(e){try{e.select()}catch(e){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};function z(e,t){for(var n=0;n=t)return i+Math.min(o,t-r);if(r+=s-i,i=s+1,(r+=n-r%n)>=t)return i}}var G=[""];function K(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function J(e,t){for(var n=[],i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ie.test(e)}function se(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var r=(t+n)/2,s=i<0?Math.ceil(r):Math.floor(r);if(s==t)return e(s)?t:n;e(s)?n=s:t=s+i}}var ae=null;function le(e,t,n){var i;ae=null;for(var r=0;rt)return r;s.to==t&&(s.from!=s.to&&"before"==n?i=r:ae=r),s.from==t&&(s.from!=s.to&&"before"!=n?i=r:ae=r)}return null!=i?i:ae}var ue=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,r=/[LRr]/,s=/[Lb1n]/,o=/[1n]/;function a(e,t,n){this.level=e,this.from=t,this.to=n}return function(l,u){var d,c="ltr"==u?"L":"R";if(0==l.length||"ltr"==u&&!n.test(l))return!1;for(var h=l.length,p=[],g=0;g-1&&(i[t]=r.slice(0,s).concat(r.slice(s+1)))}}}function fe(e,t){var n=pe(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function _e(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){ge(this,e,t)}}function Ae(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ye(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){Ae(e),ye(e)}function Ee(e){return e.target||e.srcElement}function xe(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var De,Se,Te=function(){if(o&&a<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();function Me(e){if(null==De){var t=M("span","​");T(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(De=t.offsetWidth<=1&&t.offsetHeight>2&&!(o&&a<8))}var n=De?M("span","​"):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function ke(e){if(null!=Se)return Se;var t=T(e,document.createTextNode("AخA")),n=x(t,0,1).getBoundingClientRect(),i=x(t,1,2).getBoundingClientRect();return S(e),!(!n||n.left==n.right)&&(Se=i.right-n.right<3)}var je,Be=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf("\n",t);-1==r&&(r=e.length);var s=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),o=s.indexOf("\r");-1!=o?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Oe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ie="oncopy"in(je=M("div"))||(je.setAttribute("oncopy","return;"),"function"==typeof je.oncopy),Re=null;var Pe={},Le={};function Ne(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pe[e]=t}function Fe(e){if("string"==typeof e&&Le.hasOwnProperty(e))e=Le[e];else if(e&&"string"==typeof e.name&&Le.hasOwnProperty(e.name)){var t=Le[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Fe(t);var n=Pe[t.name];if(!n)return ze(e,"text/plain");var i=n(e,t);if(Ue.hasOwnProperty(t.name)){var r=Ue[t.name];for(var s in r)r.hasOwnProperty(s)&&(i.hasOwnProperty(s)&&(i["_"+s]=i[s]),i[s]=r[s])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)i[o]=t.modeProps[o];return i}var Ue={};function $e(e,t){L(t,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function We(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function He(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ve(e,t,n){return!e.startState||e.startState(t,n)}var qe=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],s=r.chunkSize();if(t=e.first&&tn?tt(n,Ge(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?tt(e.line,t):n<0?tt(e.line,0):e}(t,Ge(e,t.line).text.length)}function ut(e,t){for(var n=[],i=0;i=this.string.length},qe.prototype.sol=function(){return this.pos==this.lineStart},qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},qe.prototype.next=function(){if(this.post},qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},qe.prototype.skipToEnd=function(){this.pos=this.string.length},qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},qe.prototype.backUp=function(e){this.pos-=e},qe.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var dt=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,n,i){var r=[e.state.modeGen],s={};yt(e,t.text,e.doc.mode,n,(function(e,t){return r.push(e,t)}),s,i);for(var o=n.state,a=function(i){n.baseTokens=r;var a=e.state.overlays[i],l=1,u=0;n.state=!0,yt(e,t.text,a.mode,n,(function(e,t){for(var n=l;ue&&r.splice(l,1,e,r[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(a.opaque)r.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;ne.options.maxHighlightLength&&We(e.doc.mode,i.state),s=ht(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function gt(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new ct(i,!0,t);var s=function(e,t,n){for(var i,r,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=s.first)return s.first;var l=Ge(s,a-1),u=l.stateAfter;if(u&&(!n||a+(u instanceof dt?u.lookAhead:0)<=s.modeFrontier))return a;var d=N(l.text,null,e.options.tabSize);(null==r||i>d)&&(r=a-1,i=d)}return r}(e,t,n),o=s>i.first&&Ge(i,s-1).stateAfter,a=o?ct.fromSaved(i,o,s):new ct(i,Ve(i.mode),s);return i.iter(s,t,(function(n){ft(e,n.text,a);var i=a.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&it.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,n){return t instanceof dt?new ct(e,We(e.mode,t.state),n,t.lookAhead):new ct(e,We(e.mode,t),n)},ct.prototype.save=function(e){var t=!1!==e?We(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new dt(t,this.maxLookAhead):t};var bt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function _t(e,t,n,i){var r,s,o=e.doc,a=o.mode,l=Ge(o,(t=lt(o,t)).line),u=gt(e,t.line,n),d=new qe(l.text,e.options.tabSize,u);for(i&&(s=[]);(i||d.pose.options.maxHighlightLength?(a=!1,o&&ft(e,t,i,c.pos),c.pos=t.length,l=null):l=At(vt(n,c,i.state,h),s),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!a||d!=l){for(;u=t:s.to>t);(i||(i=[])).push(new Et(o,s.from,a?null:s.to))}}return i}(n,r,o),l=function(e,t,n){var i;if(e)for(var r=0;r=t:s.to>t)||s.from==t&&"bookmark"==o.type&&(!n||s.marker.insertLeft)){var a=null==s.from||(o.inclusiveLeft?s.from<=t:s.from0&&a)for(var _=0;_t)&&(!n||Ot(n,s.marker)<0)&&(n=s.marker)}return n}function Nt(e,t,n,i,r){var s=Ge(e,t),o=Ct&&s.markedSpans;if(o)for(var a=0;a=0&&c<=0||d<=0&&c>=0)&&(d<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(u.to,n)>=0:nt(u.to,n)>0)||d>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(u.from,i)<=0:nt(u.from,i)<0)))return!0}}}function Ft(e){for(var t;t=Rt(e);)e=t.find(-1,!0).line;return e}function zt(e,t){var n=Ge(e,t),i=Ft(n);return n==i?t:Xe(i)}function Ut(e,t){if(t>e.lastLine())return t;var n,i=Ge(e,t);if(!$t(e,i))return t;for(;n=Pt(i);)i=n.find(1,!0).line;return Xe(i)+1}function $t(e,t){var n=Ct&&t.markedSpans;if(n)for(var i=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Gt=function(e,t,n){this.text=e,kt(this,t),this.height=n?n(this):1};function Kt(e){e.parent=null,Mt(e)}Gt.prototype.lineNo=function(){return Xe(this)},_e(Gt);var Yt={},Jt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Jt:Yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var n=k("span",null,null,l?"padding-right: .1px":null),i={pre:k("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var s=r?t.rest[r-1]:t.line,o=void 0;i.pos=0,i.addToken=en,ke(e.display.measure)&&(o=de(s,e.doc.direction))&&(i.addToken=tn(i.addToken,o)),i.map=[],rn(s,i,pt(e,s,t!=e.display.externalMeasured&&Xe(s))),s.styleClasses&&(s.styleClasses.bgClass&&(i.bgClass=I(s.styleClasses.bgClass,i.bgClass||"")),s.styleClasses.textClass&&(i.textClass=I(s.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Me(e.display.measure))),0==r?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=I(i.pre.className,i.textClass||"")),i}function Qt(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function en(e,t,n,i,r,s,l){if(t){var u,d=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;ru&&c.from<=u);h++);if(c.to>=d)return e(n,i,r,s,o,a,l);e(n,i.slice(0,c.to-u),r,s,null,a,l),s=null,i=i.slice(c.to-u),u=c.to}}}function nn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function rn(e,t,n){var i=e.markedSpans,r=e.text,s=0;if(i)for(var o,a,l,u,d,c,h,p=r.length,g=0,f=1,m="",v=0;;){if(v==g){l=u=d=a="",h=null,c=null,v=1/0;for(var b=[],_=void 0,A=0;Ag||w.collapsed&&y.to==g&&y.from==g)){if(null!=y.to&&y.to!=g&&v>y.to&&(v=y.to,u=""),w.className&&(l+=" "+w.className),w.css&&(a=(a?a+";":"")+w.css),w.startStyle&&y.from==g&&(d+=" "+w.startStyle),w.endStyle&&y.to==v&&(_||(_=[])).push(w.endStyle,y.to),w.title&&((h||(h={})).title=w.title),w.attributes)for(var C in w.attributes)(h||(h={}))[C]=w.attributes[C];w.collapsed&&(!c||Ot(c.marker,w)<0)&&(c=y)}else y.from>g&&v>y.from&&(v=y.from)}if(_)for(var E=0;E<_.length;E+=2)_[E+1]==v&&(u+=" "+_[E]);if(!c||c.from==g)for(var x=0;x=p)break;for(var D=Math.min(p,v);;){if(m){var S=g+m.length;if(!c){var T=S>D?m.slice(0,D-g):m;t.addToken(t,T,o?o+l:l,d,g+T.length==v?u:"",a,h)}if(S>=D){m=m.slice(D-g),g=D;break}g=S,d=""}m=r.slice(s,s=n[f++]),o=Xt(n[f++],t.cm.options)}}else for(var M=1;Mn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function jn(e,t,n,i){return In(e,On(e,t),n,i)}function Bn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&s.push((l.bottom+u.top)/2-n.top)}}s.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(s=function(e,t,n,i){var r,s=Ln(t.map,n,i),l=s.node,u=s.start,d=s.end,c=s.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;u&&re(t.line.text.charAt(s.coverStart+u));)--u;for(;s.coverStart+d1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}(e.display.measure,r))}else{var p;u>0&&(c=i="right"),r=e.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==i?p.length-1:0]:l.getBoundingClientRect()}if(o&&a<9&&!u&&(!r||!r.left&&!r.right)){var g=l.parentNode.getClientRects()[0];r=g?{left:g.left,right:g.left+si(e.display),top:g.top,bottom:g.bottom}:Pn}for(var f=r.top-t.rect.top,m=r.bottom-t.rect.top,v=(f+m)/2,b=t.view.measure.heights,_=0;_t)&&(r=(s=l-a)-1,t>=l&&(o="right")),null!=r){if(i=e[u+2],a==l&&n==(i.insertLeft?"left":"right")&&(o=n),"left"==n&&0==r)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[2+(u-=3)],o="left";if("right"==n&&r==l-a)for(;u=0&&(n=e[r]).left==n.right;r--);return n}function Fn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=i.text.length?(l=i.text.length,u="before"):l<=0&&(l=0,u="after"),!a)return o("before"==u?l-1:l,"before"==u);function d(e,t,n){return o(n?e-1:e,1==a[t].level!=n)}var c=le(a,l,u),h=ae,p=d(l,c,"before"==u);return null!=h&&(p.other=d(l,h,"before"!=u)),p}function Yn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=si(e.display)*t.ch);var i=Ge(e.doc,t.line),r=Ht(i)+En(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Jn(e,t,n,i,r){var s=tt(e,t,n);return s.xRel=r,i&&(s.outside=i),s}function Xn(e,t,n){var i=e.doc;if((n+=e.display.viewOffset)<0)return Jn(i.first,0,null,-1,-1);var r=Ze(i,n),s=i.first+i.size-1;if(r>s)return Jn(i.first+i.size-1,Ge(i,s).text.length,null,1,1);t<0&&(t=0);for(var o=Ge(i,r);;){var a=ti(e,o,r,t,n),l=Lt(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var u=l.find(1);if(u.line==r)return u;o=Ge(i,r=u.line)}}function Zn(e,t,n,i){i-=Hn(t);var r=t.text.length,s=oe((function(t){return In(e,n,t-1).bottom<=i}),r,0);return{begin:s,end:r=oe((function(t){return In(e,n,t).top>i}),s,r)}}function Qn(e,t,n,i){return n||(n=On(e,t)),Zn(e,t,n,Vn(e,t,In(e,n,i),"line").top)}function ei(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function ti(e,t,n,i,r){r-=Ht(t);var s=On(e,t),o=Hn(t),a=0,l=t.text.length,u=!0,d=de(t,e.doc.direction);if(d){var c=(e.options.lineWrapping?ii:ni)(e,t,n,s,d,i,r);a=(u=1!=c.level)?c.from:c.to-1,l=u?c.to:c.from-1}var h,p,g=null,f=null,m=oe((function(t){var n=In(e,s,t);return n.top+=o,n.bottom+=o,!!ei(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(g=t,f=n),!0)}),a,l),v=!1;if(f){var b=i-f.left=A.bottom?1:0}return Jn(n,m=se(t.text,m,1),p,v,i-h)}function ni(e,t,n,i,r,s,o){var a=oe((function(a){var l=r[a],u=1!=l.level;return ei(Kn(e,tt(n,u?l.to:l.from,u?"before":"after"),"line",t,i),s,o,!0)}),0,r.length-1),l=r[a];if(a>0){var u=1!=l.level,d=Kn(e,tt(n,u?l.from:l.to,u?"after":"before"),"line",t,i);ei(d,s,o,!0)&&d.top>o&&(l=r[a-1])}return l}function ii(e,t,n,i,r,s,o){var a=Zn(e,t,i,o),l=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,c=null,h=0;h=u||p.to<=l)){var g=In(e,i,1!=p.level?Math.min(u,p.to)-1:Math.max(l,p.from)).right,f=gf)&&(d=p,c=f)}}return d||(d=r[r.length-1]),d.fromu&&(d={from:d.from,to:u,level:d.level}),d}function ri(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Rn){Rn=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(M("br"));Rn.appendChild(document.createTextNode("x"))}T(e.measure,Rn);var n=Rn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),S(e.measure),n||1}function si(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),n=M("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function oi(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o){var a=e.display.gutterSpecs[o].className;n[a]=s.offsetLeft+s.clientLeft+r,i[a]=s.clientWidth}return{fixedPos:ai(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ai(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function li(e){var t=ri(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/si(e.display)-3);return function(r){if($t(e.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o0&&(l=Ge(e.doc,u.line).text).length==u.ch){var d=N(l,l.length,e.options.tabSize)-l.length;u=tt(u.line,Math.max(0,Math.round((s-Dn(e.display).left)/si(e.display))-d))}return u}function ci(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,i=0;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Ct&&zt(e.doc,t)r.viewFrom?gi(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)gi(e);else if(t<=r.viewFrom){var s=fi(e,n,n+i,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=i):gi(e)}else if(n>=r.viewTo){var o=fi(e,t,t,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):gi(e)}else{var a=fi(e,t,t,-1),l=fi(e,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(on(e,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):gi(e)}var u=r.externalMeasured;u&&(n=r.lineN&&t=i.viewTo)){var s=i.view[ci(e,t)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==z(o,n)&&o.push(n)}}}function gi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function fi(e,t,n,i){var r,s=ci(e,t),o=e.display.view;if(!Ct||n==e.doc.first+e.doc.size)return{index:s,lineN:n};for(var a=e.display.viewFrom,l=0;l0){if(s==o.length-1)return null;r=a+o[s].size-t,s++}else r=a-t;t+=r,n+=r}for(;zt(e.doc,n)!=n;){if(s==(i<0?0:o.length-1))return null;n+=i*o[s-(i<0?1:0)].size,s+=i}return{index:s,lineN:n}}function mi(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||a.to().linet||t==n&&o.to==t)&&(i(Math.max(o.from,t),Math.min(o.to,n),1==o.level?"rtl":"ltr",s),r=!0)}r||i(t,n,"ltr")}(f,n||0,null==i?h:i,(function(e,t,r,c){var m="ltr"==r,v=p(e,m?"left":"right"),b=p(t-1,m?"right":"left"),_=null==n&&0==e,A=null==i&&t==h,y=0==c,w=!f||c==f.length-1;if(b.top-v.top<=3){var C=(u?A:_)&&w,E=(u?_:A)&&y?a:(m?v:b).left,x=C?l:(m?b:v).right;d(E,v.top,x-E,v.bottom)}else{var D,S,T,M;m?(D=u&&_&&y?a:v.left,S=u?l:g(e,r,"before"),T=u?a:g(t,r,"after"),M=u&&A&&w?l:b.right):(D=u?g(e,r,"before"):a,S=!u&&_&&y?l:v.right,T=!u&&A&&w?a:b.left,M=u?g(t,r,"after"):l),d(D,v.top,S-D,v.bottom),v.bottom0?t.blinker=setInterval((function(){e.hasFocus()||Di(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ci(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||xi(e))}function Ei(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Di(e))}),100)}function xi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(fe(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),wi(e))}function Di(e,t){e.state.delayingBlurEvent||(e.state.focused&&(fe(e,"blur",e,t),e.state.focused=!1,D(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Si(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i.005||h<-.005)&&(Je(r.line,l),Ti(r.line),r.rest))for(var p=0;pe.display.sizerWidth){var g=Math.ceil(u/si(e.display));g>e.display.maxLineLength&&(e.display.maxLineLength=g,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function Ti(e){if(e.widgets)for(var t=0;t=o&&(s=Ze(t,Ht(Ge(t,l))-e.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function ki(e,t){var n=e.display,i=ri(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,s=Mn(e),o={};t.bottom-t.top>s&&(t.bottom=t.top+s);var a=e.doc.height+xn(n),l=t.topa-i;if(t.topr+s){var d=Math.min(t.top,(u?a:t.bottom)-s);d!=r&&(o.scrollTop=d)}var c=e.options.fixedGutter?0:n.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-c,p=Tn(e)-n.gutters.offsetWidth,g=t.right-t.left>p;return g&&(t.right=t.left+p),t.left<10?o.scrollLeft=0:t.leftp+h-3&&(o.scrollLeft=t.right+(g?0:10)-p),o}function ji(e,t){null!=t&&(Ii(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Bi(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Oi(e,t,n){null==t&&null==n||Ii(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ii(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Ri(e,Yn(e,t.from),Yn(e,t.to),t.margin))}function Ri(e,t,n,i){var r=ki(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});Oi(e,r.scrollLeft,r.scrollTop)}function Pi(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||ur(e,{top:t}),Li(e,t,!0),n&&ur(e),rr(e,100))}function Li(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ni(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,hr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Fi(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+xn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zi=function(e,t,n){this.cm=n;var i=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),he(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),he(r,"scroll",(function(){r.clientWidth&&t(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,o&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},zi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zi.prototype.zeroWidthHack=function(){var e=b&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new F,this.disableVert=new F},zi.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function i(){var r=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,i)}))},zi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ui=function(){};function $i(e,t){t||(t=Fi(e));var n=e.display.barWidth,i=e.display.barHeight;Wi(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Si(e),Wi(e,Fi(e)),n=e.display.barWidth,i=e.display.barHeight}function Wi(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ui.prototype.update=function(){return{bottom:0,right:0}},Ui.prototype.setScrollLeft=function(){},Ui.prototype.setScrollTop=function(){},Ui.prototype.clear=function(){};var Hi={native:zi,null:Ui};function Vi(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Hi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Ni(e,t):Pi(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var qi=0;function Gi(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++qi,markArrays:null},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Ki(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new or(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ji(e){e.updatedDisplay=e.mustUpdate&&ar(e.cm,e.update)}function Xi(e){var t=e.cm,n=t.display;e.updatedDisplay&&Si(t),e.barMeasure=Fi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=jn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Sn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Tn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Zi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!g){var s=M("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-En(e.display))+"px;\n height: "+(t.bottom-t.top+Sn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(r),e.display.lineSpace.removeChild(s)}}}(t,function(e,t,n,i){var r;null==i&&(i=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?tt(t.line,t.ch+1,"before"):t,t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var s=0;s<5;s++){var o=!1,a=Kn(e,t),l=n&&n!=t?Kn(e,n):a,u=ki(e,r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),d=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=u.scrollTop&&(Pi(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(o=!0)),null!=u.scrollLeft&&(Ni(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return r}(t,lt(i,e.scrollToPos.from),lt(i,e.scrollToPos.to),e.scrollToPos.margin));var r=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(r)for(var o=0;o=e.display.viewTo)){var n=+new Date+e.options.workTime,i=gt(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(s){if(i.line>=e.display.viewFrom){var o=s.styles,a=s.text.length>e.options.maxHighlightLength?We(t.mode,i.state):null,l=ht(e,s,i,!0);a&&(i.state=a),s.styles=l.styles;var u=s.styleClasses,d=l.classes;d?s.styleClasses=d:u&&(s.styleClasses=null);for(var c=!o||o.length!=s.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),h=0;!c&&hn)return rr(e,e.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&er(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mi(e))return!1;pr(e)&&(gi(e),t.dims=oi(e));var r=i.first+i.size,s=Math.max(t.visible.from-e.options.viewportMargin,i.first),o=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFromo&&n.viewTo-o<20&&(o=Math.min(r,n.viewTo)),Ct&&(s=zt(e.doc,s),o=Ut(e.doc,o));var a=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;(function(e,t,n){var i=e.display;0==i.view.length||t>=i.viewTo||n<=i.viewFrom?(i.view=on(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=on(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,ci(e,n)))),i.viewTo=n})(e,s,o),n.viewOffset=Ht(Ge(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=mi(e);if(!a&&0==u&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var d=function(e){if(e.hasFocus())return null;var t=B();if(!t||!j(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&j(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(e);return u>4&&(n.lineDiv.style.display="none"),function(e,t,n){var i=e.display,r=e.options.lineNumbers,s=i.lineDiv,o=s.firstChild;function a(t){var n=t.nextSibling;return l&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=i.view,d=i.viewFrom,c=0;c-1&&(p=!1),cn(e,h,d,n)),p&&(S(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(et(e.options,d)))),o=h.node.nextSibling}else{var g=bn(e,h,d,n);s.insertBefore(g,o)}d+=h.size}for(;o;)o=a(o)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=B()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&j(document.body,e.anchorNode)&&j(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(d),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,rr(e,400)),n.updateLineNumbers=null,!0}function lr(e,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Tn(e))i&&(t.visible=Mi(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+xn(e.display)-Mn(e),n.top)}),t.visible=Mi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ar(e,t))break;Si(e);var r=Fi(e);vi(e),$i(e,r),cr(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ur(e,t){var n=new or(e,t);if(ar(e,n)){Si(e),lr(e,n);var i=Fi(e);vi(e),$i(e,i),cr(e,i),n.finish()}}function dr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",un(e,"gutterChanged",e)}function cr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sn(e)+"px"}function hr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=ai(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,s=i+"px",o=0;oa.clientWidth,d=a.scrollHeight>a.clientHeight;if(r&&u||s&&d){if(s&&b&&l)e:for(var h=t.target,p=o.view;h!=a;h=h.parentNode)for(var g=0;g=0&&nt(e,i.to())<=0)return n}return-1};var Er=function(e,t){this.anchor=e,this.head=t};function xr(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort((function(e,t){return nt(e.from(),t.from())})),n=z(t,r);for(var s=1;s0:l>=0){var u=ot(a.from(),o.from()),d=st(a.to(),o.to()),c=a.empty()?o.from()==o.head:a.from()==a.head;s<=n&&--n,t.splice(--s,2,new Er(c?d:u,c?u:d))}}return new Cr(t,n)}function Dr(e,t){return new Cr([new Er(e,t||e)],0)}function Sr(e){return e.text?tt(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Tr(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return Sr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Sr(t).ch-t.to.ch),tt(n,i)}function Mr(e,t){for(var n=[],i=0;i1&&e.remove(a.line+1,g-1),e.insert(a.line+1,v)}un(e,"change",e,t)}function Rr(e,t,n){!function e(i,r,s){if(i.linked)for(var o=0;oa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(s=function(e,t){return t?(zr(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(r,r.lastOp==i)))o=Y(s.changes),0==nt(t.from,t.to)&&0==nt(t.from,o.to)?o.to=Sr(t):s.changes.push(Fr(e,t));else{var l=Y(r.done);for(l&&l.ranges||Wr(e.sel,r.done),s={changes:[Fr(e,t)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,o||fe(e,"historyAdded")}function $r(e,t,n,i){var r=e.history,s=i&&i.origin;n==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||function(e,t,n,i){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,s,Y(r.done),t))?r.done[r.done.length-1]=t:Wr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=n,i&&!1!==i.clearRedo&&zr(r.undone)}function Wr(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Hr(e,t,n,i){var r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),(function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=n.markedSpans),++s}))}function Vr(e){if(!e)return null;for(var t,n=0;n-1&&(Y(a)[c]=u[c],delete u[c])}}}return i}function Kr(e,t,n,i){if(i){var r=e.anchor;if(n){var s=nt(t,r)<0;s!=nt(n,r)<0?(r=t,t=n):s!=nt(t,n)<0&&(t=n)}return new Er(r,t)}return new Er(n||t,t)}function Yr(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),es(e,new Cr([Kr(e.sel.primary(),t,n,r)],0),i)}function Jr(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),s=0;s=t.ch:a.to>t.ch))){if(r&&(fe(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(n){var c=l.find(i<0?1:-1),h=void 0;if((i<0?d:u)&&(c=as(e,c,-i,c&&c.line==t.line?s:null)),c&&c.line==t.line&&(h=nt(c,n))&&(i<0?h<0:h>0))return ss(e,c,t,i,r)}var p=l.find(i<0?-1:1);return(i<0?u:d)&&(p=as(e,p,i,p.line==t.line?s:null)),p?ss(e,p,t,i,r):null}}return t}function os(e,t,n,i,r){var s=i||1;return ss(e,t,n,s,r)||!r&&ss(e,t,n,s,!0)||ss(e,t,n,-s,r)||!r&&ss(e,t,n,-s,!0)||(e.cantEdit=!0,tt(e.first,0))}function as(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?lt(e,tt(t.line-1)):null:n>0&&t.ch==(i||Ge(e,t.line)).text.length?t.line0)){var d=[l,1],c=nt(u.from,a.from),h=nt(u.to,a.to);(c<0||!o.inclusiveLeft&&!c)&&d.push({from:u.from,to:a.from}),(h>0||!o.inclusiveRight&&!h)&&d.push({from:a.to,to:u.to}),r.splice.apply(r,d),l+=d.length-3}}return r}(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)cs(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else cs(e,t)}}function cs(e,t){if(1!=t.text.length||""!=t.text[0]||0!=nt(t.from,t.to)){var n=Mr(e,t);Ur(e,t,n,e.cm?e.cm.curOp.id:NaN),gs(e,t,n,St(e,t));var i=[];Rr(e,(function(e,n){n||-1!=z(i,e.history)||(bs(e.history,t),i.push(e.history)),gs(e,t,null,St(e,t))}))}}function hs(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,s=e.history,o=e.sel,a="undo"==t?s.done:s.undone,l="undo"==t?s.undone:s.done,u=0;u=0;--p){var g=h(p);if(g)return g.v}}}}function ps(e,t){if(0!=t&&(e.first+=t,e.sel=new Cr(J(e.sel.ranges,(function(e){return new Er(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){hi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())){if(t.from.lines&&(t={from:t.from,to:tt(s,Ge(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ke(e,t.from,t.to),n||(n=Mr(e,t)),e.cm?function(e,t,n){var i=e.doc,r=e.display,s=t.from,o=t.to,a=!1,l=s.line;e.options.lineWrapping||(l=Xe(Ft(Ge(i,s.line))),i.iter(l,o.line+1,(function(e){if(e==r.maxLine)return a=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&ve(e),Ir(i,t,n,li(e)),e.options.lineWrapping||(i.iter(l,s.line+t.text.length,(function(e){var t=Vt(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;i--){var r=Ge(e,i).stateAfter;if(r&&(!(r instanceof dt)||i+r.lookAhead1||!(this.children[0]instanceof As))){var a=[];this.collapse(a),this.children=[new As(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=r.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;i0||0==o&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=k("span",[s.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(Nt(e,t.line,t,n,s)||t.line!=n.line&&Nt(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}s.addToHistory&&Ur(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,l=t.line,u=e.cm;if(e.iter(l,n.line+1,(function(i){u&&s.collapsed&&!u.options.lineWrapping&&Ft(i)==u.display.maxLine&&(a=!0),s.collapsed&&l!=t.line&&Je(i,0),function(e,t,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));i&&i.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],i&&i.add(e.markedSpans)),t.marker.attachLine(e)}(i,new Et(s,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l})),s.collapsed&&e.iter(t.line,n.line+1,(function(t){$t(e,t)&&Je(t,0)})),s.clearOnEnter&&he(s,"beforeCursorEnter",(function(){return s.clear()})),s.readOnly&&(wt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Es,s.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),s.collapsed)hi(u,t.line,n.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var d=t.line;d<=n.line;d++)pi(u,d,"text");s.atomic&&is(u.doc),un(u,"markerAdded",u,s)}return s}xs.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gi(e),be(this,"clear")){var n=this.find();n&&un(this,"clear",n.from,n.to)}for(var i=null,r=null,s=0;se.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=d,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&hi(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&is(e.doc)),e&&un(e,"markerCleared",e,this,i,r),t&&Ki(e),this.parent&&this.parent.clear()}},xs.prototype.find=function(e,t){var n,i;null==e&&"bookmark"==this.type&&(e=1);for(var r=0;r=0;l--)ds(this,i[l]);a?Qr(this,a):this.cm&&Bi(this.cm)})),undo:ir((function(){hs(this,"undo")})),redo:ir((function(){hs(this,"redo")})),undoSelection:ir((function(){hs(this,"undo",!0)})),redoSelection:ir((function(){hs(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,(function(s){var o=s.markedSpans;if(o)for(var a=0;a=l.to||null==l.from&&r!=e.line||null!=l.from&&r==t.line&&l.from>=t.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r})),i},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var i=0;ie)return t=e,!0;e-=s,++n})),lt(this,tt(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var c=e.dataTransfer.getData("Text");if(c){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),ts(t.doc,Dr(n,n)),h)for(var p=0;p=0;t--)fs(e.doc,"",i[t].from,i[t].to,"+delete");Bi(e)}))}function Zs(e,t,n){var i=se(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Qs(e,t,n){var i=Zs(e,t.ch,n);return null==i?null:new tt(t.line,i,n<0?"after":"before")}function eo(e,t,n,i,r){if(e){"rtl"==t.doc.direction&&(r=-r);var s=de(n,t.doc.direction);if(s){var o,a=r<0?Y(s):s[0],l=r<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var u=On(t,n);o=r<0?n.text.length-1:0;var d=In(t,u,o).top;o=oe((function(e){return In(t,u,e).top==d}),r<0==(1==a.level)?a.from:a.to-1,o),"before"==l&&(o=Zs(n,o,1))}else o=r<0?a.to:a.from;return new tt(i,o,l)}}return new tt(i,r<0?n.text.length:0,r<0?"before":"after")}Ws.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ws.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ws.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ws.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ws.default=b?Ws.macDefault:Ws.pcDefault;var to={selectAll:ls,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),W)},killLine:function(e){return Xs(e,(function(t){if(t.empty()){var n=Ge(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)r=new tt(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),tt(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var o=Ge(e.doc,r.line-1).text;o&&(r=new tt(r.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),tt(r.line-1,o.length-1),r,"+transpose"))}n.push(new Er(r,r))}e.setSelections(n)}))},newlineAndIndent:function(e){return er(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i-1&&(nt((r=u.ranges[r]).from(),t)<0||t.xRel>0)&&(nt(r.to(),t)>0||t.xRel<0)?function(e,t,n,i){var r=e.display,s=!1,u=tr(e,(function(t){l&&(r.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ei(e)),ge(r.wrapper.ownerDocument,"mouseup",u),ge(r.wrapper.ownerDocument,"mousemove",d),ge(r.scroller,"dragstart",c),ge(r.scroller,"drop",u),s||(Ae(t),i.addNew||Yr(e.doc,n,null,null,i.extend),l&&!h||o&&9==a?setTimeout((function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()}),20):r.input.focus())})),d=function(e){s=s||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},c=function(){return s=!0};l&&(r.scroller.draggable=!0),e.state.draggingText=u,u.copy=!i.moveOnDrag,he(r.wrapper.ownerDocument,"mouseup",u),he(r.wrapper.ownerDocument,"mousemove",d),he(r.scroller,"dragstart",c),he(r.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return r.input.focus()}),20),r.scroller.dragDrop&&r.scroller.dragDrop()}(e,i,t,s):function(e,t,n,i){o&&Ei(e);var r=e.display,s=e.doc;Ae(t);var a,l,u=s.sel,d=u.ranges;if(i.addNew&&!i.extend?(l=s.sel.contains(n),a=l>-1?d[l]:new Er(n,n)):(a=s.sel.primary(),l=s.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Er(n,n)),n=di(e,t,!0,!0),l=-1;else{var c=bo(e,n,i.unit);a=i.extend?Kr(a,c.anchor,c.head,i.extend):c}i.addNew?-1==l?(l=d.length,es(s,xr(e,d.concat([a]),l),{scroll:!1,origin:"*mouse"})):d.length>1&&d[l].empty()&&"char"==i.unit&&!i.extend?(es(s,xr(e,d.slice(0,l).concat(d.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=s.sel):Xr(s,l,a,H):(l=0,es(s,new Cr([a],0),H),u=s.sel);var h=n;function p(t){if(0!=nt(h,t))if(h=t,"rectangle"==i.unit){for(var r=[],o=e.options.tabSize,d=N(Ge(s,n.line).text,n.ch,o),c=N(Ge(s,t.line).text,t.ch,o),p=Math.min(d,c),g=Math.max(d,c),f=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));f<=m;f++){var v=Ge(s,f).text,b=q(v,p,o);p==g?r.push(new Er(tt(f,b),tt(f,b))):v.length>b&&r.push(new Er(tt(f,b),tt(f,q(v,g,o))))}r.length||r.push(new Er(n,n)),es(s,xr(e,u.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var _,A=a,y=bo(e,t,i.unit),w=A.anchor;nt(y.anchor,w)>0?(_=y.head,w=ot(A.from(),y.anchor)):(_=y.anchor,w=st(A.to(),y.head));var C=u.ranges.slice(0);C[l]=function(e,t){var n=t.anchor,i=t.head,r=Ge(e.doc,n.line);if(0==nt(n,i)&&n.sticky==i.sticky)return t;var s=de(r);if(!s)return t;var o=le(s,n.ch,n.sticky),a=s[o];if(a.from!=n.ch&&a.to!=n.ch)return t;var l,u=o+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==s.length)return t;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var d=le(s,i.ch,i.sticky),c=d-o||(i.ch-n.ch)*(1==a.level?-1:1);l=d==u-1||d==u?c<0:c>0}var h=s[u+(l?-1:0)],p=l==(1==h.level),g=p?h.from:h.to,f=p?"after":"before";return n.ch==g&&n.sticky==f?t:new Er(new tt(n.line,g,f),i)}(e,new Er(lt(s,w),_)),es(s,xr(e,C,l),H)}}var g=r.wrapper.getBoundingClientRect(),f=0;function m(t){var n=++f,o=di(e,t,!0,"rectangle"==i.unit);if(o)if(0!=nt(o,h)){e.curOp.focus=B(),p(o);var a=Mi(r,s);(o.line>=a.to||o.lineg.bottom?20:0;l&&setTimeout(tr(e,(function(){f==n&&(r.scroller.scrollTop+=l,m(t))})),50)}}function v(t){e.state.selectingText=!1,f=1/0,t&&(Ae(t),r.input.focus()),ge(r.wrapper.ownerDocument,"mousemove",b),ge(r.wrapper.ownerDocument,"mouseup",_),s.history.lastSelOrigin=null}var b=tr(e,(function(e){0!==e.buttons&&xe(e)?m(e):v(e)})),_=tr(e,v);e.state.selectingText=_,he(r.wrapper.ownerDocument,"mousemove",b),he(r.wrapper.ownerDocument,"mouseup",_)}(e,i,t,s)}(t,i,s,e):Ee(e)==n.scroller&&Ae(e):2==r?(i&&Yr(t.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==r&&(C?t.display.input.onContextMenu(e):Ei(t)))}}function bo(e,t,n){if("char"==n)return new Er(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Er(tt(t.line,0),lt(e.doc,tt(t.line+1,0)));var i=n(e,t);return new Er(i.from,i.to)}function _o(e,t,n,i){var r,s;if(t.touches)r=t.touches[0].clientX,s=t.touches[0].clientY;else try{r=t.clientX,s=t.clientY}catch(e){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&Ae(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!be(e,n))return we(t);s-=a.top-o.viewOffset;for(var l=0;l=r)return fe(e,n,e,Ze(e.doc,s),e.display.gutterSpecs[l].className,t),we(t)}}function Ao(e,t){return _o(e,t,"gutterClick",!0)}function yo(e,t){Cn(e.display,t)||function(e,t){return!!be(e,"gutterContextMenu")&&_o(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function wo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Un(e)}mo.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button};var Co={toString:function(){return"CodeMirror.Init"}},Eo={},xo={};function Do(e,t,n){if(!t!=!(n&&n!=Co)){var i=e.display.dragFunctions,r=t?he:ge;r(e.display.scroller,"dragstart",i.start),r(e.display.scroller,"dragenter",i.enter),r(e.display.scroller,"dragover",i.over),r(e.display.scroller,"dragleave",i.leave),r(e.display.scroller,"drop",i.drop)}}function So(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(D(e.display.wrapper,"CodeMirror-wrap"),qt(e)),ui(e),hi(e),Un(e),setTimeout((function(){return $i(e)}),100)}function To(e,t){var n=this;if(!(this instanceof To))return new To(e,t);this.options=t=t?L(t):{},L(Eo,t,!1);var i=t.value;"string"==typeof i?i=new js(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new To.inputStyles[t.inputStyle](this),s=this.display=new vr(e,i,r,t);for(var u in s.wrapper.CodeMirror=this,wo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Vi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new F,keySeq:null,specialChars:null},t.autofocus&&!v&&s.input.focus(),o&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",tr(e,vo)),he(t.scroller,"dblclick",o&&a<11?tr(e,(function(t){if(!me(e,t)){var n=di(e,t);if(n&&!Ao(e,t)&&!Cn(e.display,t)){Ae(t);var i=e.findWordAt(n);Yr(e.doc,i.anchor,i.head)}}})):function(t){return me(e,t)||Ae(t)}),he(t.scroller,"contextmenu",(function(t){return yo(e,t)})),he(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||yo(e,n)}));var n,i={end:0};function r(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(i=t.activeTouch).end=+new Date)}function s(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>400}he(t.scroller,"touchstart",(function(r){if(!me(e,r)&&!s(r)&&!Ao(e,r)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-i.end<=300?i:null},1==r.touches.length&&(t.activeTouch.left=r.touches[0].pageX,t.activeTouch.top=r.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(n){var i=t.activeTouch;if(i&&!Cn(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var s,o=e.coordsChar(t.activeTouch,"page");s=!i.prev||l(i,i.prev)?new Er(o,o):!i.prev.prev||l(i,i.prev.prev)?e.findWordAt(o):new Er(tt(o.line,0),lt(e.doc,tt(o.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),Ae(n)}r()})),he(t.scroller,"touchcancel",r),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Pi(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),fe(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return wr(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return wr(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||Ce(t)},over:function(t){me(e,t)||(function(e,t){var n=di(e,t);if(n){var i=document.createDocumentFragment();_i(e,n,i),e.display.dragCursor||(e.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,i)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(o&&(!e.state.draggingText||+new Date-Bs<100))Ce(t);else if(!me(e,t)&&!Cn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=M("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),c&&n.parentNode.removeChild(n)}}(e,t)},drop:tr(e,Os),leave:function(t){me(e,t)||Is(e)}};var u=t.input.getField();he(u,"keyup",(function(t){return ho.call(e,t)})),he(u,"keydown",tr(e,co)),he(u,"keypress",tr(e,po)),he(u,"focus",(function(t){return xi(e,t)})),he(u,"blur",(function(t){return Di(e,t)}))}(this),Ls(),Gi(this),this.curOp.forceUpdate=!0,Pr(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&xi(n)}),20):Di(this),xo)xo.hasOwnProperty(u)&&xo[u](this,t[u],Co);pr(this),t.finishInit&&t.finishInit(this);for(var d=0;d150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>s.first?N(Ge(s,t-1).text,null,o):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(u/o);p;--p)h+=o,c+="\t";if(ho,l=Be(t),u=null;if(a&&i.ranges.length>1)if(jo&&jo.text.join("\n")==t){if(i.ranges.length%jo.text.length==0){u=[];for(var d=0;d=0;h--){var p=i.ranges[h],g=p.from(),f=p.to();p.empty()&&(n&&n>0?g=tt(g.line,g.ch-n):e.state.overwrite&&!a?f=tt(f.line,Math.min(Ge(s,f.line).text.length,f.ch+Y(l).length)):a&&jo&&jo.lineWise&&jo.text.join("\n")==l.join("\n")&&(g=f=tt(g.line,0)));var m={from:g,to:f,text:u?u[h%u.length]:l,origin:r||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};ds(e.doc,m),un(e,"inputRead",e,m)}t&&!a&&Ro(e,t),Bi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Io(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||er(t,(function(){return Oo(t,n,0,null,"paste")})),!0}function Ro(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var s=e.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a-1){o=ko(e,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(Ge(e.doc,r.head.line).text.slice(0,r.head.ch))&&(o=ko(e,r.head.line,"smart"));o&&un(e,"electricInput",e,r.head.line)}}}function Po(e){for(var t=[],n=[],i=0;i0?0:-1));if(isNaN(d))o=null;else{var c=n>0?d>=55296&&d<56320:d>=56320&&d<57343;o=new tt(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(c?2:1))),-n)}}else o=r?function(e,t,n,i){var r=de(t,e.doc.direction);if(!r)return Qs(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var s=le(r,n.ch,n.sticky),o=r[s];if("ltr"==e.doc.direction&&o.level%2==0&&(i>0?o.to>n.ch:o.from=o.from&&h>=d.begin)){var p=c?"before":"after";return new tt(n.line,h,p)}}var g=function(e,t,i){for(var s=function(e,t){return t?new tt(n.line,l(e,1),"before"):new tt(n.line,e,"after")};e>=0&&e0==(1!=o.level),u=a?i.begin:l(i.end,-1);if(o.from<=u&&u0?d.end:l(d.begin,-1);return null==m||i>0&&m==t.text.length||!(f=g(i>0?0:r.length-1,i,u(m)))?null:f}(e.cm,a,t,n):Qs(a,t,n);if(null==o){if(s||((u=t.line+l)=e.first+e.size||(t=new tt(u,t.ch,t.sticky),!(a=Ge(e,u)))))return!1;t=eo(r,e.cm,a,t.line,l)}else t=o;return!0}if("char"==i||"codepoint"==i)u();else if("column"==i)u(!0);else if("word"==i||"group"==i)for(var d=null,c="group"==i,h=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(n<0)||u(!p);p=!1){var g=a.text.charAt(t.ch)||"\n",f=te(g,h)?"w":c&&"\n"==g?"n":!c||/\s/.test(g)?null:"p";if(!c||p||f||(f="s"),d&&d!=f){n<0&&(n=1,u(),t.sticky="after");break}if(f&&(d=f),n>0&&!u(!p))break}var m=os(e,t,s,o,!0);return it(s,m)&&(m.hitSide=!0),m}function zo(e,t,n,i){var r,s,o=e.doc,a=t.left;if("page"==i){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*ri(e.display),3);r=(n>0?t.bottom:t.top)+n*u}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(;(s=Xn(e,a,r)).outside;){if(n<0?r<=0:r>=o.height){s.hitSide=!0;break}r+=5*n}return s}var Uo=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new F,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function $o(e,t){var n=Bn(e,t.line);if(!n||n.hidden)return null;var i=Ge(e.doc,t.line),r=kn(n,i,t.line),s=de(i,e.doc.direction),o="left";s&&(o=le(s,t.ch)%2?"right":"left");var a=Ln(r.map,t.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function Wo(e,t){return t&&(e.bad=!0),e}function Ho(e,t,n){var i;if(t==e.display.lineDiv){if(!(i=e.display.lineDiv.childNodes[n]))return Wo(e.clipPos(tt(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r=t.display.viewTo||s.line=t.display.viewFrom&&$o(t,r)||{node:l[0].measure.map[2],offset:0},d=s.linei.firstLine()&&(o=tt(o.line-1,Ge(i.doc,o.line-1).length)),a.ch==Ge(i.doc,a.line).text.length&&a.liner.viewTo-1)return!1;o.line==r.viewFrom||0==(e=ci(i,o.line))?(t=Xe(r.view[0].line),n=r.view[0].node):(t=Xe(r.view[e].line),n=r.view[e-1].node.nextSibling);var l,u,d=ci(i,a.line);if(d==r.view.length-1?(l=r.viewTo-1,u=r.lineDiv.lastChild):(l=Xe(r.view[d+1].line)-1,u=r.view[d+1].node.previousSibling),!n)return!1;for(var c=i.doc.splitLines(function(e,t,n,i,r){var s="",o=!1,a=e.doc.lineSeparator(),l=!1;function u(){o&&(s+=a,l&&(s+=a),o=l=!1)}function d(e){e&&(u(),s+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void d(n);var s,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(tt(i,0),tt(r+1,0),(m=+h,function(e){return e.id==m}));return void(p.length&&(s=p[0].find(0))&&d(Ke(e.doc,s.from,s.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&u();for(var f=0;f1&&h.length>1;)if(Y(c)==Y(h))c.pop(),h.pop(),l--;else{if(c[0]!=h[0])break;c.shift(),h.shift(),t++}for(var p=0,g=0,f=c[0],m=h[0],v=Math.min(f.length,m.length);po.ch&&b.charCodeAt(b.length-g-1)==_.charCodeAt(_.length-g-1);)p--,g++;c[c.length-1]=b.slice(0,b.length-g).replace(/^\u200b+/,""),c[0]=c[0].slice(p).replace(/\u200b+$/,"");var y=tt(t,p),w=tt(l,h.length?Y(h).length-g:0);return c.length>1||c[0]||nt(y,w)?(fs(i.doc,c,y,w,"+input"),!0):void 0},Uo.prototype.ensurePolled=function(){this.forceCompositionEnd()},Uo.prototype.reset=function(){this.forceCompositionEnd()},Uo.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Uo.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Uo.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||er(this.cm,(function(){return hi(e.cm)}))},Uo.prototype.setUneditable=function(e){e.contentEditable="false"},Uo.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tr(this.cm,Oo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Uo.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Uo.prototype.onContextMenu=function(){},Uo.prototype.resetPosition=function(){},Uo.prototype.needsContentAttribute=!0;var qo=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new F,this.hasSelection=!1,this.composing=null};qo.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;function s(e){if(!me(i,e)){if(i.somethingSelected())Bo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Po(i);Bo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,W):(n.prevInput="",r.value=t.text.join("\n"),R(r))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),f&&(r.style.width="0px"),he(r,"input",(function(){o&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),he(r,"paste",(function(e){me(i,e)||Io(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),he(r,"cut",s),he(r,"copy",s),he(e.scroller,"paste",(function(t){if(!Cn(e,t)&&!me(i,t)){if(!r.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var s=new Event("paste");s.clipboardData=t.clipboardData,r.dispatchEvent(s)}})),he(e.lineSpace,"selectstart",(function(t){Cn(e,t)||Ae(t)})),he(r,"compositionstart",(function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}})),he(r,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},qo.prototype.createField=function(e){this.wrapper=No(),this.textarea=this.wrapper.firstChild},qo.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qo.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=bi(e);if(e.options.moveInputWithCursor){var r=Kn(e,n.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+o.top-s.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+o.left-s.left))}return i},qo.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qo.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&R(this.textarea),o&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",o&&a>=9&&(this.hasSelection=null))}},qo.prototype.getField=function(){return this.textarea},qo.prototype.supportsTouch=function(){return!1},qo.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},qo.prototype.blur=function(){this.textarea.blur()},qo.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qo.prototype.receivedFocus=function(){this.slowPoll()},qo.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},qo.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},qo.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Oe(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(o&&a>=9&&this.hasSelection===r||b&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=r.charCodeAt(0);if(8203!=s||i||(i="​"),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(i.length,r.length);l1e3||r.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},qo.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qo.prototype.onKeyPress=function(){o&&a>=9&&(this.hasSelection=null),this.fastPoll()},qo.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=di(n,e),u=i.scroller.scrollTop;if(s&&!c){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(s)&&tr(n,es)(n.doc,Dr(s),W);var d,h=r.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(d=window.scrollY),i.input.focus(),l&&window.scrollTo(null,d),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=v,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),o&&a>=9&&m(),C){Ce(e);var f=function(){ge(window,"mouseup",f),setTimeout(v,20)};he(window,"mouseup",f)}else setTimeout(v,50)}function m(){if(null!=r.selectionStart){var e=n.somethingSelected(),s="​"+(e?r.value:"");r.value="⇚",r.value=s,t.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=s.length,i.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,r.style.cssText=h,o&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=r.selectionStart)){(!o||o&&a<9)&&m();var e=0,s=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==t.prevInput?tr(n,ls)(n):e++<10?i.detectingSelectAll=setTimeout(s,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(s,200)}}},qo.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},qo.prototype.setUneditable=function(){},qo.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,i,r,s){e.defaults[n]=i,r&&(t[n]=s?function(e,t,n){n!=Co&&r(e,t,n)}:r)}e.defineOption=n,e.Init=Co,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,jr(e)}),!0),n("indentUnit",2,jr,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Br(e),Un(e),hi(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter((function(e){for(var r=0;;){var s=e.text.indexOf(t,r);if(-1==s)break;r=s+t.length,n.push(tt(i,s))}i++}));for(var r=n.length-1;r>=0;r--)fs(e.doc,t,n[r],tt(n[r].line,n[r].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Co&&e.refresh()})),n("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!A),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){wo(e),mr(e)}),!0),n("keyMap","default",(function(e,t,n){var i=Js(t),r=n!=Co&&Js(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,So,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=gr(t,e.options.lineNumbers),mr(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ai(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return $i(e)}),!0),n("scrollbarStyle","native",(function(e){Vi(e),$i(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=gr(e.options.gutters,t),mr(e)}),!0),n("firstLineNumber",1,mr,!0),n("lineNumberFormatter",(function(e){return e}),mr,!0),n("showCursorWhenSelecting",!1,vi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Di(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Do),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vi,!0),n("singleCursorHeightPerLine",!0,vi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Br,!0),n("addModeClass",!1,Br,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Br,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(To),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var i=this.options,r=i[e];i[e]==n&&"mode"!=e||(i[e]=n,t.hasOwnProperty(e)&&tr(this,t[e])(this,n,r),fe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Js(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(ko(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex&&Bi(this));else{var s=r.from(),o=r.to(),a=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;l0&&Xr(this.doc,i,new Er(s,u[i].to()),W)}}})),getTokenAt:function(e,t){return _t(this,e,t)},getLineTokens:function(e,t){return _t(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=pt(this,Ge(this.doc,e.line)),i=0,r=(n.length-1)/2,s=e.ch;if(0==s)t=n[2];else for(;;){var o=i+r>>1;if((o?n[2*o-1]:0)>=s)r=o;else{if(!(n[2*o+1]s&&(e=s,r=!0),i=Ge(this.doc,e)}else i=e;return Vn(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-Ht(i):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return si(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var s,o,a,l=this.display,u=(e=Kn(this,lt(this.doc,e))).bottom,d=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==i)u=e.top;else if("above"==i||"near"==i){var c=Math.max(l.wrapper.clientHeight,this.doc.height),h=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(u=e.bottom),d+t.offsetWidth>h&&(d=h-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==r?(d=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?d=0:"middle"==r&&(d=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=d+"px"),n&&(s=this,o={left:d,top:u,right:d+t.offsetWidth,bottom:u+t.offsetHeight},null!=(a=ki(s,o)).scrollTop&&Pi(s,a.scrollTop),null!=a.scrollLeft&&Ni(s,a.scrollLeft))},triggerOnKeyDown:nr(co),triggerOnKeyPress:nr(po),triggerOnKeyUp:ho,triggerOnMouseDown:nr(vo),execCommand:function(e){if(to.hasOwnProperty(e))return to[e].call(null,this)},triggerElectric:nr((function(e){Ro(this,e)})),findPosH:function(e,t,n,i){var r=1;t<0&&(r=-1,t=-t);for(var s=lt(this.doc,e),o=0;o0&&o(t.charAt(n-1));)--n;for(;i.5||this.options.lineWrapping)&&ui(this),fe(this,"refresh",this)})),swapDoc:nr((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Pr(this,e),Un(this),this.display.input.reset(),Oi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,un(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},_e(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,s){e.registerHelper(t,i,s),n[t]._global.push({pred:r,val:s})}}(To);var Go="iter insert remove copy getEditor constructor".split(" ");for(var Ko in js.prototype)js.prototype.hasOwnProperty(Ko)&&z(Go,Ko)<0&&(To.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(js.prototype[Ko]));return _e(js),To.inputStyles={textarea:qo,contenteditable:Uo},To.defineMode=function(e){To.defaults.mode||"null"==e||(To.defaults.mode=e),Ne.apply(this,arguments)},To.defineMIME=function(e,t){Le[e]=t},To.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),To.defineMIME("text/plain","null"),To.defineExtension=function(e,t){To.prototype[e]=t},To.defineDocExtension=function(e,t){js.prototype[e]=t},To.fromTextArea=function(e,t){if((t=t?L(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=B();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function i(){e.value=a.getValue()}var r;if(e.form&&(he(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var s=e.form;r=s.submit;try{var o=s.submit=function(){i(),s.submit=r,s.submit(),s.submit=o}}catch(e){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,i(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(ge(e.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=r))}},e.style.display="none";var a=To((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a},function(e){e.off=ge,e.on=he,e.wheelEventPixels=yr,e.Doc=js,e.splitLines=Be,e.countColumn=N,e.findColumn=q,e.isWordChar=ee,e.Pass=$,e.signal=fe,e.Line=Gt,e.changeEnd=Sr,e.scrollbarModel=Hi,e.Pos=tt,e.cmpPos=nt,e.modes=Pe,e.mimeModes=Le,e.resolveMode=Fe,e.getMode=ze,e.modeExtensions=Ue,e.extendMode=$e,e.copyState=We,e.startState=Ve,e.innerMode=He,e.commands=to,e.keyMap=Ws,e.keyName=Ys,e.isModifierKey=Gs,e.lookupKey=qs,e.normalizeKeyMap=Vs,e.StringStream=qe,e.SharedTextMarker=Ss,e.TextMarker=xs,e.LineWidget=ws,e.e_preventDefault=Ae,e.e_stopPropagation=ye,e.e_stop=Ce,e.addClass=O,e.contains=j,e.rmClass=D,e.keyNames=Fs}(To),To.version="5.61.1",To}()},56141:(e,t,n)=>{!function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],r=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function s(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",i.concat(r)),e.defineMode("python",(function(o,a){for(var l="error",u=a.delimiters||a.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,d=[a.singleOperators,a.doubleOperators,a.doubleDelimiters,a.tripleDelimiters,a.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],c=0;ci?w(t):r0&&C(e,t)&&(o+=" "+l),o}return y(e,t)}function y(e,t,i){if(e.eatSpace())return null;if(!i&&e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^[\d_]+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var s=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(s=!0),e.match(/^0b[01_]+/i)&&(s=!0),e.match(/^0o[0-7_]+/i)&&(s=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),s=!0),e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}if(e.match(v))return-1!==e.current().toLowerCase().indexOf("f")?(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(e){return function(t,n){var i=y(t,n,!0);return"punctuation"==i&&("{"==t.current()?n.tokenize=r(e+1):"}"==t.current()&&(n.tokenize=e>1?r(e-1):s)),i}}function s(s,o){for(;!s.eol();)if(s.eatWhile(/[^'"\{\}\\]/),s.eat("\\")){if(s.next(),n&&s.eol())return i}else{if(s.match(e))return o.tokenize=t,i;if(s.match("{{"))return i;if(s.match("{",!1))return o.tokenize=r(0),s.current()?i:o.tokenize(s,o);if(s.match("}}"))return i;if(s.match("}"))return l;s.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;o.tokenize=t}return i}return s.isString=!0,s}(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(r,s){for(;!r.eol();)if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),n&&r.eol())return i}else{if(r.match(e))return s.tokenize=t,i;r.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;s.tokenize=t}return i}return r.isString=!0,r}(e.current(),t.tokenize),t.tokenize(e,t));for(var o=0;o1&&s(t).offset>n;){if("py"!=s(t).type)return!0;t.scopes.pop()}return s(t).offset!=n}function E(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(m,!1)?"meta":f?"operator":l;if(/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"==i&&!t.lambda&&"py"==s(t).type&&e.match(/^\s*(?:#|$)/,!1)&&w(t),1==i.length&&!/string|comment/.test(n)){var r="[({".indexOf(i);if(-1!=r&&function(e,t,n){var i=e.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+h,type:n,align:i})}(e,t,"])}".slice(r,r+1)),-1!=(r="])}".indexOf(i))){if(s(t).type!=i)return l;t.indent=t.scopes.pop().offset-h}}return t.dedent>0&&e.eol()&&"py"==s(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}return{startState:function(e){return{tokenize:A,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var i=E(e,t);return i&&"comment"!=i&&(t.lastToken="keyword"==i||"punctuation"==i?e.current():i),"punctuation"==i&&(i=null),e.eol()&&t.lambda&&(t.lambda=!1),n?i+" "+l:i},indent:function(t,n){if(t.tokenize!=A)return t.tokenize.isString?e.Pass:0;var i=s(t),r=i.type==n.charAt(0);return null!=i.align?i.align-(r?1:0):i.offset-(r?h:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}})),e.defineMIME("text/x-python","python");var o;e.defineMIME("text/x-cython",{name:"python",extra_keywords:(o="by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE",o.split(" "))})}(n(23326))},39714:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var u=Array.isArray(n);return u===Array.isArray(e)?u?l.arrayMerge(e,n,l):function(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach((function(t){r[t]=i(e[t],n)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&n.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return a;var n=t.customMerge(e);return"function"==typeof n?n:a}(s,n)(e[s],t[s],n):r[s]=i(t[s],n))})),r}(e,n,l):i(n,l)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return a(e,n,t)}),{})};var l=a;e.exports=l},16594:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attributeNames=t.elementNames=void 0,t.elementNames=new Map([["altglyph","altGlyph"],["altglyphdef","altGlyphDef"],["altglyphitem","altGlyphItem"],["animatecolor","animateColor"],["animatemotion","animateMotion"],["animatetransform","animateTransform"],["clippath","clipPath"],["feblend","feBlend"],["fecolormatrix","feColorMatrix"],["fecomponenttransfer","feComponentTransfer"],["fecomposite","feComposite"],["feconvolvematrix","feConvolveMatrix"],["fediffuselighting","feDiffuseLighting"],["fedisplacementmap","feDisplacementMap"],["fedistantlight","feDistantLight"],["fedropshadow","feDropShadow"],["feflood","feFlood"],["fefunca","feFuncA"],["fefuncb","feFuncB"],["fefuncg","feFuncG"],["fefuncr","feFuncR"],["fegaussianblur","feGaussianBlur"],["feimage","feImage"],["femerge","feMerge"],["femergenode","feMergeNode"],["femorphology","feMorphology"],["feoffset","feOffset"],["fepointlight","fePointLight"],["fespecularlighting","feSpecularLighting"],["fespotlight","feSpotLight"],["fetile","feTile"],["feturbulence","feTurbulence"],["foreignobject","foreignObject"],["glyphref","glyphRef"],["lineargradient","linearGradient"],["radialgradient","radialGradient"],["textpath","textPath"]]),t.attributeNames=new Map([["definitionurl","definitionURL"],["attributename","attributeName"],["attributetype","attributeType"],["basefrequency","baseFrequency"],["baseprofile","baseProfile"],["calcmode","calcMode"],["clippathunits","clipPathUnits"],["diffuseconstant","diffuseConstant"],["edgemode","edgeMode"],["filterunits","filterUnits"],["glyphref","glyphRef"],["gradienttransform","gradientTransform"],["gradientunits","gradientUnits"],["kernelmatrix","kernelMatrix"],["kernelunitlength","kernelUnitLength"],["keypoints","keyPoints"],["keysplines","keySplines"],["keytimes","keyTimes"],["lengthadjust","lengthAdjust"],["limitingconeangle","limitingConeAngle"],["markerheight","markerHeight"],["markerunits","markerUnits"],["markerwidth","markerWidth"],["maskcontentunits","maskContentUnits"],["maskunits","maskUnits"],["numoctaves","numOctaves"],["pathlength","pathLength"],["patterncontentunits","patternContentUnits"],["patterntransform","patternTransform"],["patternunits","patternUnits"],["pointsatx","pointsAtX"],["pointsaty","pointsAtY"],["pointsatz","pointsAtZ"],["preservealpha","preserveAlpha"],["preserveaspectratio","preserveAspectRatio"],["primitiveunits","primitiveUnits"],["refx","refX"],["refy","refY"],["repeatcount","repeatCount"],["repeatdur","repeatDur"],["requiredextensions","requiredExtensions"],["requiredfeatures","requiredFeatures"],["specularconstant","specularConstant"],["specularexponent","specularExponent"],["spreadmethod","spreadMethod"],["startoffset","startOffset"],["stddeviation","stdDeviation"],["stitchtiles","stitchTiles"],["surfacescale","surfaceScale"],["systemlanguage","systemLanguage"],["tablevalues","tableValues"],["targetx","targetX"],["targety","targetY"],["textlength","textLength"],["viewbox","viewBox"],["viewtarget","viewTarget"],["xchannelselector","xChannelSelector"],["ychannelselector","yChannelSelector"],["zoomandpan","zoomAndPan"]])},50606:function(e,t,n){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n";case a.Comment:return"\x3c!--"+e.data+"--\x3e";case a.CDATA:return function(e){return""}(e);case a.Script:case a.Style:case a.Tag:return function(e,t){var n;"foreign"===t.xmlMode&&(e.name=null!==(n=u.elementNames.get(e.name))&&void 0!==n?n:e.name,e.parent&&g.has(e.parent.name)&&(t=i(i({},t),{xmlMode:!1}))),!t.xmlMode&&f.has(e.name)&&(t=i(i({},t),{xmlMode:"foreign"}));var r="<"+e.name,s=function(e,t){if(e)return Object.keys(e).map((function(n){var i,r,s=null!==(i=e[n])&&void 0!==i?i:"";return"foreign"===t.xmlMode&&(n=null!==(r=u.attributeNames.get(n))&&void 0!==r?r:n),t.emptyAttrs||t.xmlMode||""!==s?n+'="'+(!1!==t.decodeEntities?l.encodeXML(s):s.replace(/"/g,"""))+'"':n})).join(" ")}(e.attribs,t);return s&&(r+=" "+s),0===e.children.length&&(t.xmlMode?!1!==t.selfClosingTags:t.selfClosingTags&&c.has(e.name))?(t.xmlMode||(r+=" "),r+="/>"):(r+=">",e.children.length>0&&(r+=h(e.children,t)),!t.xmlMode&&c.has(e.name)||(r+="")),r}(e,t);case a.Text:return function(e,t){var n=e.data||"";return!1===t.decodeEntities||!t.xmlMode&&e.parent&&d.has(e.parent.name)||(n=l.encodeXML(n)),n}(e,t)}}t.default=h;var g=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),f=new Set(["svg","math"])},34821:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(n=t.ElementType||(t.ElementType={})),t.isTag=function(e){return e.type===n.Tag||e.type===n.Script||e.type===n.Style},t.Root=n.Root,t.Text=n.Text,t.Directive=n.Directive,t.Comment=n.Comment,t.Script=n.Script,t.Style=n.Style,t.Tag=n.Tag,t.CDATA=n.CDATA,t.Doctype=n.Doctype},79959:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var s=n(34821),o=n(75538);r(n(75538),t);var a=/\s+/g,l={normalizeWhitespace:!1,withStartIndices:!1,withEndIndices:!1,xmlMode:!1},u=function(){function e(e,t,n){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=l),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:l,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?s.ElementType.Tag:void 0,i=new o.Element(e,t,void 0,n);this.addNode(i),this.tagStack.push(i)},e.prototype.ontext=function(e){var t=this.options.normalizeWhitespace,n=this.lastNode;if(n&&n.type===s.ElementType.Text)t?n.data=(n.data+e).replace(a," "):n.data+=e,this.options.withEndIndices&&(n.endIndex=this.parser.endIndex);else{t&&(e=e.replace(a," "));var i=new o.Text(e);this.addNode(i),this.lastNode=i}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===s.ElementType.Comment)this.lastNode.data+=e;else{var t=new o.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new o.Text(""),t=new o.NodeWithChildren(s.ElementType.CDATA,[e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new o.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();t.DomHandler=u,t.default=u},75538:function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(l);t.NodeWithChildren=p;var g=function(e){function t(t){return e.call(this,o.ElementType.Root,t)||this}return r(t,e),t}(p);t.Document=g;var f=function(e){function t(t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r="script"===t?o.ElementType.Script:"style"===t?o.ElementType.Style:o.ElementType.Tag);var s=e.call(this,r,i)||this;return s.name=t,s.attribs=n,s}return r(t,e),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,i;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(i=e["x-attribsPrefix"])||void 0===i?void 0:i[t]}}))},enumerable:!1,configurable:!0}),t}(p);function m(e){return(0,o.isTag)(e)}function v(e){return e.type===o.ElementType.CDATA}function b(e){return e.type===o.ElementType.Text}function _(e){return e.type===o.ElementType.Comment}function A(e){return e.type===o.ElementType.Directive}function y(e){return e.type===o.ElementType.Root}function w(e,t){var n;if(void 0===t&&(t=!1),b(e))n=new d(e.data);else if(_(e))n=new c(e.data);else if(m(e)){var i=t?C(e.children):[],r=new f(e.name,s({},e.attribs),i);i.forEach((function(e){return e.parent=r})),null!=e.namespace&&(r.namespace=e.namespace),e["x-attribsNamespace"]&&(r["x-attribsNamespace"]=s({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(r["x-attribsPrefix"]=s({},e["x-attribsPrefix"])),n=r}else if(v(e)){i=t?C(e.children):[];var a=new p(o.ElementType.CDATA,i);i.forEach((function(e){return e.parent=a})),n=a}else if(y(e)){i=t?C(e.children):[];var l=new g(i);i.forEach((function(e){return e.parent=l})),e["x-mode"]&&(l["x-mode"]=e["x-mode"]),n=l}else{if(!A(e))throw new Error("Not implemented yet: ".concat(e.type));var u=new h(e.name,e.data);null!=e["x-name"]&&(u["x-name"]=e["x-name"],u["x-publicId"]=e["x-publicId"],u["x-systemId"]=e["x-systemId"]),n=u}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function C(e){for(var t=e.map((function(e){return w(e,!0)})),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFeed=void 0;var i=n(87559),r=n(65310);t.getFeed=function(e){var t=l(c,e);return t?"feed"===t.name?function(e){var t,n=e.children,i={type:"atom",items:(0,r.getElementsByTagName)("entry",n).map((function(e){var t,n=e.children,i={media:a(n)};d(i,"id","id",n),d(i,"title","title",n);var r=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;r&&(i.link=r);var s=u("summary",n)||u("content",n);s&&(i.description=s);var o=u("updated",n);return o&&(i.pubDate=new Date(o)),i}))};d(i,"id","id",n),d(i,"title","title",n);var s=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;s&&(i.link=s),d(i,"description","subtitle",n);var o=u("updated",n);return o&&(i.updated=new Date(o)),d(i,"author","email",n,!0),i}(t):function(e){var t,n,i=null!==(n=null===(t=l("channel",e.children))||void 0===t?void 0:t.children)&&void 0!==n?n:[],s={type:e.name.substr(0,3),id:"",items:(0,r.getElementsByTagName)("item",e.children).map((function(e){var t=e.children,n={media:a(t)};d(n,"id","guid",t),d(n,"title","title",t),d(n,"link","link",t),d(n,"description","description",t);var i=u("pubDate",t);return i&&(n.pubDate=new Date(i)),n}))};d(s,"title","title",i),d(s,"link","link",i),d(s,"description","description",i);var o=u("lastBuildDate",i);return o&&(s.updated=new Date(o)),d(s,"author","managingEditor",i,!0),s}(t):null};var s=["url","type","lang"],o=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function a(e){return(0,r.getElementsByTagName)("media:content",e).map((function(e){for(var t=e.attribs,n={medium:t.medium,isDefault:!!t.isDefault},i=0,r=s;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueSort=t.compareDocumentPosition=t.removeSubsets=void 0;var i=n(79959);function r(e,t){var n=[],r=[];if(e===t)return 0;for(var s=(0,i.hasChildren)(e)?e:e.parent;s;)n.unshift(s),s=s.parent;for(s=(0,i.hasChildren)(t)?t:t.parent;s;)r.unshift(s),s=s.parent;for(var o=Math.min(n.length,r.length),a=0;au.indexOf(c)?l===t?20:4:l===e?10:2}t.removeSubsets=function(e){for(var t=e.length;--t>=0;){var n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(var i=n.parent;i;i=i.parent)if(e.includes(i)){e.splice(t,1);break}}return e},t.compareDocumentPosition=r,t.uniqueSort=function(e){return(e=e.filter((function(e,t,n){return!n.includes(e,t+1)}))).sort((function(e,t){var n=r(e,t);return 2&n?-1:4&n?1:0})),e}},64622:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.hasChildren=t.isDocument=t.isComment=t.isText=t.isCDATA=t.isTag=void 0,r(n(87559),t),r(n(16304),t),r(n(57427),t),r(n(17853),t),r(n(65310),t),r(n(42880),t),r(n(57065),t);var s=n(79959);Object.defineProperty(t,"isTag",{enumerable:!0,get:function(){return s.isTag}}),Object.defineProperty(t,"isCDATA",{enumerable:!0,get:function(){return s.isCDATA}}),Object.defineProperty(t,"isText",{enumerable:!0,get:function(){return s.isText}}),Object.defineProperty(t,"isComment",{enumerable:!0,get:function(){return s.isComment}}),Object.defineProperty(t,"isDocument",{enumerable:!0,get:function(){return s.isDocument}}),Object.defineProperty(t,"hasChildren",{enumerable:!0,get:function(){return s.hasChildren}})},65310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getElementsByTagType=t.getElementsByTagName=t.getElementById=t.getElements=t.testElement=void 0;var i=n(79959),r=n(17853),s={tag_name:function(e){return"function"==typeof e?function(t){return(0,i.isTag)(t)&&e(t.name)}:"*"===e?i.isTag:function(t){return(0,i.isTag)(t)&&t.name===e}},tag_type:function(e){return"function"==typeof e?function(t){return e(t.type)}:function(t){return t.type===e}},tag_contains:function(e){return"function"==typeof e?function(t){return(0,i.isText)(t)&&e(t.data)}:function(t){return(0,i.isText)(t)&&t.data===e}}};function o(e,t){return"function"==typeof t?function(n){return(0,i.isTag)(n)&&t(n.attribs[e])}:function(n){return(0,i.isTag)(n)&&n.attribs[e]===t}}function a(e,t){return function(n){return e(n)||t(n)}}function l(e){var t=Object.keys(e).map((function(t){var n=e[t];return Object.prototype.hasOwnProperty.call(s,t)?s[t](n):o(t,n)}));return 0===t.length?null:t.reduce(a)}t.testElement=function(e,t){var n=l(e);return!n||n(t)},t.getElements=function(e,t,n,i){void 0===i&&(i=1/0);var s=l(e);return s?(0,r.filter)(s,t,n,i):[]},t.getElementById=function(e,t,n){return void 0===n&&(n=!0),Array.isArray(t)||(t=[t]),(0,r.findOne)(o("id",e),t,n)},t.getElementsByTagName=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_name(e),t,n,i)},t.getElementsByTagType=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_type(e),t,n,i)}},57427:(e,t)=>{"use strict";function n(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children;t.splice(t.lastIndexOf(e),1)}}Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.prependChild=t.append=t.appendChild=t.replaceElement=t.removeElement=void 0,t.removeElement=n,t.replaceElement=function(e,t){var n=t.prev=e.prev;n&&(n.next=t);var i=t.next=e.next;i&&(i.prev=t);var r=t.parent=e.parent;if(r){var s=r.children;s[s.lastIndexOf(e)]=t}},t.appendChild=function(e,t){if(n(t),t.next=null,t.parent=e,e.children.push(t)>1){var i=e.children[e.children.length-2];i.next=t,t.prev=i}else t.prev=null},t.append=function(e,t){n(t);var i=e.parent,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=i,r){if(r.prev=t,i){var s=i.children;s.splice(s.lastIndexOf(r),0,t)}}else i&&i.children.push(t)},t.prependChild=function(e,t){if(n(t),t.parent=e,t.prev=null,1!==e.children.unshift(t)){var i=e.children[1];i.prev=t,t.next=i}else t.next=null},t.prepend=function(e,t){n(t);var i=e.parent;if(i){var r=i.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=i,t.prev=e.prev,t.next=e,e.prev=t}},17853:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=t.existsOne=t.findOne=t.findOneChild=t.find=t.filter=void 0;var i=n(79959);function r(e,t,n,s){for(var o=[],a=0,l=t;a0){var d=r(e,u.children,n,s);if(o.push.apply(o,d),(s-=d.length)<=0)break}}return o}t.filter=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),Array.isArray(t)||(t=[t]),r(e,t,n,i)},t.find=r,t.findOneChild=function(e,t){return t.find(e)},t.findOne=function e(t,n,r){void 0===r&&(r=!0);for(var s=null,o=0;o0&&(s=e(t,a.children)))}return s},t.existsOne=function e(t,n){return n.some((function(n){return(0,i.isTag)(n)&&(t(n)||n.children.length>0&&e(t,n.children))}))},t.findAll=function(e,t){for(var n,r,s=[],o=t.filter(i.isTag);r=o.shift();){var a=null===(n=r.children)||void 0===n?void 0:n.filter(i.isTag);a&&a.length>0&&o.unshift.apply(o,a),e(r)&&s.push(r)}return s}},87559:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.innerText=t.textContent=t.getText=t.getInnerHTML=t.getOuterHTML=void 0;var r=n(79959),s=i(n(50606)),o=n(34821);function a(e,t){return(0,s.default)(e,t)}t.getOuterHTML=a,t.getInnerHTML=function(e,t){return(0,r.hasChildren)(e)?e.children.map((function(e){return a(e,t)})).join(""):""},t.getText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.isTag)(t)?"br"===t.name?"\n":e(t.children):(0,r.isCDATA)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.textContent=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&!(0,r.isComment)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.innerText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&(t.type===o.ElementType.Tag||(0,r.isCDATA)(t))?e(t.children):(0,r.isText)(t)?t.data:""}},16304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prevElementSibling=t.nextElementSibling=t.getName=t.hasAttrib=t.getAttributeValue=t.getSiblings=t.getParent=t.getChildren=void 0;var i=n(79959),r=[];function s(e){var t;return null!==(t=e.children)&&void 0!==t?t:r}function o(e){return e.parent||null}t.getChildren=s,t.getParent=o,t.getSiblings=function(e){var t=o(e);if(null!=t)return s(t);for(var n=[e],i=e.prev,r=e.next;null!=i;)n.unshift(i),i=i.prev;for(;null!=r;)n.push(r),r=r.next;return n},t.getAttributeValue=function(e,t){var n;return null===(n=e.attribs)||void 0===n?void 0:n[t]},t.hasAttrib=function(e,t){return null!=e.attribs&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&null!=e.attribs[t]},t.getName=function(e){return e.name},t.nextElementSibling=function(e){for(var t=e.next;null!==t&&!(0,i.isTag)(t);)t=t.next;return t},t.prevElementSibling=function(e){for(var t=e.prev;null!==t&&!(0,i.isTag)(t);)t=t.prev;return t}},73094:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHTML=t.decodeHTMLStrict=t.decodeXML=void 0;var r=i(n(72059)),s=i(n(62184)),o=i(n(81542)),a=i(n(70105)),l=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;function u(e){var t=c(e);return function(e){return String(e).replace(l,t)}}t.decodeXML=u(o.default),t.decodeHTMLStrict=u(r.default);var d=function(e,t){return e65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+String.fromCharCode(e)};t.default=function(e){return e>=55296&&e<=57343||e>1114111?"�":(e in r.default&&(e=r.default[e]),s(e))}},41029:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=void 0;var r=d(i(n(81542)).default),s=c(r);t.encodeXML=m(r);var o,a,l=d(i(n(72059)).default),u=c(l);function d(e){return Object.keys(e).sort().reduce((function(t,n){return t[e[n]]="&"+n+";",t}),{})}function c(e){for(var t=[],n=[],i=0,r=Object.keys(e);i1?p(e):e.charCodeAt(0)).toString(16).toUpperCase()+";"}var f=new RegExp(s.source+"|"+h.source,"g");function m(e){return function(t){return t.replace(f,(function(t){return e[t]||g(t)}))}}t.escape=function(e){return e.replace(f,g)},t.escapeUTF8=function(e){return e.replace(s,g)}},75924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var i=n(73094),r=n(41029);t.decode=function(e,t){return(!t||t<=0?i.decodeXML:i.decodeHTML)(e)},t.decodeStrict=function(e,t){return(!t||t<=0?i.decodeXML:i.decodeHTMLStrict)(e)},t.encode=function(e,t){return(!t||t<=0?r.encodeXML:r.encodeHTML)(e)};var s=n(41029);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return s.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return s.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return s.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return s.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return s.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return s.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return s.encodeHTML}});var o=n(73094);Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return o.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return o.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return o.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return o.decodeXML}})},84163:function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&s(t,e,n);return o(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseFeed=t.FeedHandler=void 0;var u,d,c=l(n(79959)),h=a(n(64622)),p=n(75233);!function(e){e[e.image=0]="image",e[e.audio=1]="audio",e[e.video=2]="video",e[e.document=3]="document",e[e.executable=4]="executable"}(u||(u={})),function(e){e[e.sample=0]="sample",e[e.full=1]="full",e[e.nonstop=2]="nonstop"}(d||(d={}));var g=function(e){function t(t,n){return"object"==typeof t&&(n=t=void 0),e.call(this,t,n)||this}return r(t,e),t.prototype.onend=function(){var e,t,n=v(y,this.dom);if(n){var i={};if("feed"===n.name){var r=n.children;i.type="atom",A(i,"id","id",r),A(i,"title","title",r);var s=_("href",v("link",r));s&&(i.link=s),A(i,"description","subtitle",r),(o=b("updated",r))&&(i.updated=new Date(o)),A(i,"author","email",r,!0),i.items=m("entry",r).map((function(e){var t={},n=e.children;A(t,"id","id",n),A(t,"title","title",n);var i=_("href",v("link",n));i&&(t.link=i);var r=b("summary",n)||b("content",n);r&&(t.description=r);var s=b("updated",n);return s&&(t.pubDate=new Date(s)),t.media=f(n),t}))}else{var o;r=null!==(t=null===(e=v("channel",n.children))||void 0===e?void 0:e.children)&&void 0!==t?t:[],i.type=n.name.substr(0,3),i.id="",A(i,"title","title",r),A(i,"link","link",r),A(i,"description","description",r),(o=b("lastBuildDate",r))&&(i.updated=new Date(o)),A(i,"author","managingEditor",r,!0),i.items=m("item",n.children).map((function(e){var t={},n=e.children;A(t,"id","guid",n),A(t,"title","title",n),A(t,"link","link",n),A(t,"description","description",n);var i=b("pubDate",n);return i&&(t.pubDate=new Date(i)),t.media=f(n),t}))}this.feed=i,this.handleCallback(null)}else this.handleCallback(new Error("couldn't find root of feed"))},t}(c.default);function f(e){return m("media:content",e).map((function(e){var t={medium:e.attribs.medium,isDefault:!!e.attribs.isDefault};return e.attribs.url&&(t.url=e.attribs.url),e.attribs.fileSize&&(t.fileSize=parseInt(e.attribs.fileSize,10)),e.attribs.type&&(t.type=e.attribs.type),e.attribs.expression&&(t.expression=e.attribs.expression),e.attribs.bitrate&&(t.bitrate=parseInt(e.attribs.bitrate,10)),e.attribs.framerate&&(t.framerate=parseInt(e.attribs.framerate,10)),e.attribs.samplingrate&&(t.samplingrate=parseInt(e.attribs.samplingrate,10)),e.attribs.channels&&(t.channels=parseInt(e.attribs.channels,10)),e.attribs.duration&&(t.duration=parseInt(e.attribs.duration,10)),e.attribs.height&&(t.height=parseInt(e.attribs.height,10)),e.attribs.width&&(t.width=parseInt(e.attribs.width,10)),e.attribs.lang&&(t.lang=e.attribs.lang),t}))}function m(e,t){return h.getElementsByTagName(e,t,!0)}function v(e,t){return h.getElementsByTagName(e,t,!0,1)[0]}function b(e,t,n){return void 0===n&&(n=!1),h.getText(h.getElementsByTagName(e,t,n,1)).trim()}function _(e,t){return t?t.attribs[e]:null}function A(e,t,n,i,r){void 0===r&&(r=!1);var s=b(n,i,r);s&&(e[t]=s)}function y(e){return"rss"===e||"feed"===e||"rdf:RDF"===e}t.FeedHandler=g,t.parseFeed=function(e,t){void 0===t&&(t={xmlMode:!0});var n=new g(t);return new p.Parser(n,t).end(e),n.feed}},75233:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=void 0;var r=i(n(59636)),s=new Set(["input","option","optgroup","select","button","datalist","textarea"]),o=new Set(["p"]),a={tr:new Set(["tr","th","td"]),th:new Set(["th"]),td:new Set(["thead","th","td"]),body:new Set(["head","link","script"]),li:new Set(["li"]),p:o,h1:o,h2:o,h3:o,h4:o,h5:o,h6:o,select:s,input:s,output:s,button:s,datalist:s,textarea:s,option:new Set(["option"]),optgroup:new Set(["optgroup","option"]),dd:new Set(["dt","dd"]),dt:new Set(["dt","dd"]),address:o,article:o,aside:o,blockquote:o,details:o,div:o,dl:o,fieldset:o,figcaption:o,figure:o,footer:o,form:o,header:o,hr:o,main:o,nav:o,ol:o,pre:o,section:o,table:o,ul:o,rt:new Set(["rt","rp"]),rp:new Set(["rt","rp"]),tbody:new Set(["thead","tbody"]),tfoot:new Set(["thead","tbody"])},l=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),u=new Set(["math","svg"]),d=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),c=/\s|\//,h=function(){function e(e,t){var n,i,s,o,a;void 0===t&&(t={}),this.startIndex=0,this.endIndex=null,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.foreignContext=[],this.options=t,this.cbs=null!=e?e:{},this.lowerCaseTagNames=null!==(n=t.lowerCaseTags)&&void 0!==n?n:!t.xmlMode,this.lowerCaseAttributeNames=null!==(i=t.lowerCaseAttributeNames)&&void 0!==i?i:!t.xmlMode,this.tokenizer=new(null!==(s=t.Tokenizer)&&void 0!==s?s:r.default)(this.options,this),null===(a=(o=this.cbs).onparserinit)||void 0===a||a.call(o,this)}return e.prototype.updatePosition=function(e){null===this.endIndex?this.tokenizer.sectionStart<=e?this.startIndex=0:this.startIndex=this.tokenizer.sectionStart-e:this.startIndex=this.endIndex+1,this.endIndex=this.tokenizer.getAbsoluteIndex()},e.prototype.ontext=function(e){var t,n;this.updatePosition(1),this.endIndex--,null===(n=(t=this.cbs).ontext)||void 0===n||n.call(t,e)},e.prototype.onopentagname=function(e){var t,n;if(this.lowerCaseTagNames&&(e=e.toLowerCase()),this.tagname=e,!this.options.xmlMode&&Object.prototype.hasOwnProperty.call(a,e))for(var i=void 0;this.stack.length>0&&a[e].has(i=this.stack[this.stack.length-1]);)this.onclosetag(i);!this.options.xmlMode&&l.has(e)||(this.stack.push(e),u.has(e)?this.foreignContext.push(!0):d.has(e)&&this.foreignContext.push(!1)),null===(n=(t=this.cbs).onopentagname)||void 0===n||n.call(t,e),this.cbs.onopentag&&(this.attribs={})},e.prototype.onopentagend=function(){var e,t;this.updatePosition(1),this.attribs&&(null===(t=(e=this.cbs).onopentag)||void 0===t||t.call(e,this.tagname,this.attribs),this.attribs=null),!this.options.xmlMode&&this.cbs.onclosetag&&l.has(this.tagname)&&this.cbs.onclosetag(this.tagname),this.tagname=""},e.prototype.onclosetag=function(e){if(this.updatePosition(1),this.lowerCaseTagNames&&(e=e.toLowerCase()),(u.has(e)||d.has(e))&&this.foreignContext.pop(),!this.stack.length||!this.options.xmlMode&&l.has(e))this.options.xmlMode||"br"!==e&&"p"!==e||(this.onopentagname(e),this.closeCurrentTag());else{var t=this.stack.lastIndexOf(e);if(-1!==t)if(this.cbs.onclosetag)for(t=this.stack.length-t;t--;)this.cbs.onclosetag(this.stack.pop());else this.stack.length=t;else"p"!==e||this.options.xmlMode||(this.onopentagname(e),this.closeCurrentTag())}},e.prototype.onselfclosingtag=function(){this.options.xmlMode||this.options.recognizeSelfClosing||this.foreignContext[this.foreignContext.length-1]?this.closeCurrentTag():this.onopentagend()},e.prototype.closeCurrentTag=function(){var e,t,n=this.tagname;this.onopentagend(),this.stack[this.stack.length-1]===n&&(null===(t=(e=this.cbs).onclosetag)||void 0===t||t.call(e,n),this.stack.pop())},e.prototype.onattribname=function(e){this.lowerCaseAttributeNames&&(e=e.toLowerCase()),this.attribname=e},e.prototype.onattribdata=function(e){this.attribvalue+=e},e.prototype.onattribend=function(e){var t,n;null===(n=(t=this.cbs).onattribute)||void 0===n||n.call(t,this.attribname,this.attribvalue,e),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribname="",this.attribvalue=""},e.prototype.getInstructionName=function(e){var t=e.search(c),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n},e.prototype.ondeclaration=function(e){if(this.cbs.onprocessinginstruction){var t=this.getInstructionName(e);this.cbs.onprocessinginstruction("!"+t,"!"+e)}},e.prototype.onprocessinginstruction=function(e){if(this.cbs.onprocessinginstruction){var t=this.getInstructionName(e);this.cbs.onprocessinginstruction("?"+t,"?"+e)}},e.prototype.oncomment=function(e){var t,n,i,r;this.updatePosition(4),null===(n=(t=this.cbs).oncomment)||void 0===n||n.call(t,e),null===(r=(i=this.cbs).oncommentend)||void 0===r||r.call(i)},e.prototype.oncdata=function(e){var t,n,i,r,s,o;this.updatePosition(1),this.options.xmlMode||this.options.recognizeCDATA?(null===(n=(t=this.cbs).oncdatastart)||void 0===n||n.call(t),null===(r=(i=this.cbs).ontext)||void 0===r||r.call(i,e),null===(o=(s=this.cbs).oncdataend)||void 0===o||o.call(s)):this.oncomment("[CDATA["+e+"]]")},e.prototype.onerror=function(e){var t,n;null===(n=(t=this.cbs).onerror)||void 0===n||n.call(t,e)},e.prototype.onend=function(){var e,t;if(this.cbs.onclosetag)for(var n=this.stack.length;n>0;this.cbs.onclosetag(this.stack[--n]));null===(t=(e=this.cbs).onend)||void 0===t||t.call(e)},e.prototype.reset=function(){var e,t,n,i;null===(t=(e=this.cbs).onreset)||void 0===t||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack=[],null===(i=(n=this.cbs).onparserinit)||void 0===i||i.call(n,this)},e.prototype.parseComplete=function(e){this.reset(),this.end(e)},e.prototype.write=function(e){this.tokenizer.write(e)},e.prototype.end=function(e){this.tokenizer.end(e)},e.prototype.pause=function(){this.tokenizer.pause()},e.prototype.resume=function(){this.tokenizer.resume()},e.prototype.parseChunk=function(e){this.write(e)},e.prototype.done=function(e){this.end(e)},e}();t.Parser=h},59636:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(70105)),s=i(n(72059)),o=i(n(62184)),a=i(n(81542));function l(e){return" "===e||"\n"===e||"\t"===e||"\f"===e||"\r"===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function d(e,t,n){var i=e.toLowerCase();return e===i?function(e,r){r===i?e._state=t:(e._state=n,e._index--)}:function(r,s){s===i||s===e?r._state=t:(r._state=n,r._index--)}}function c(e,t){var n=e.toLowerCase();return function(i,r){r===n||r===e?i._state=t:(i._state=3,i._index--)}}var h=d("C",24,16),p=d("D",25,16),g=d("A",26,16),f=d("T",27,16),m=d("A",28,16),v=c("R",35),b=c("I",36),_=c("P",37),A=c("T",38),y=d("R",40,1),w=d("I",41,1),C=d("P",42,1),E=d("T",43,1),x=c("Y",45),D=c("L",46),S=c("E",47),T=d("Y",49,1),M=d("L",50,1),k=d("E",51,1),j=c("I",54),B=c("T",55),O=c("L",56),I=c("E",57),R=d("I",58,1),P=d("T",59,1),L=d("L",60,1),N=d("E",61,1),F=d("#",63,64),z=d("X",66,65),U=function(){function e(e,t){var n;this._state=1,this.buffer="",this.sectionStart=0,this._index=0,this.bufferOffset=0,this.baseState=1,this.special=1,this.running=!0,this.ended=!1,this.cbs=t,this.xmlMode=!!(null==e?void 0:e.xmlMode),this.decodeEntities=null===(n=null==e?void 0:e.decodeEntities)||void 0===n||n}return e.prototype.reset=function(){this._state=1,this.buffer="",this.sectionStart=0,this._index=0,this.bufferOffset=0,this.baseState=1,this.special=1,this.running=!0,this.ended=!1},e.prototype.write=function(e){this.ended&&this.cbs.onerror(Error(".write() after done!")),this.buffer+=e,this.parse()},e.prototype.end=function(e){this.ended&&this.cbs.onerror(Error(".end() after done!")),e&&this.write(e),this.ended=!0,this.running&&this.finish()},e.prototype.pause=function(){this.running=!1},e.prototype.resume=function(){this.running=!0,this._indexthis.sectionStart&&this.cbs.ontext(this.getSection()),this._state=2,this.sectionStart=this._index):!this.decodeEntities||"&"!==e||1!==this.special&&4!==this.special||(this._index>this.sectionStart&&this.cbs.ontext(this.getSection()),this.baseState=1,this._state=62,this.sectionStart=this._index)},e.prototype.isTagStartChar=function(e){return u(e)||this.xmlMode&&!l(e)&&"/"!==e&&">"!==e},e.prototype.stateBeforeTagName=function(e){"/"===e?this._state=5:"<"===e?(this.cbs.ontext(this.getSection()),this.sectionStart=this._index):">"===e||1!==this.special||l(e)?this._state=1:"!"===e?(this._state=15,this.sectionStart=this._index+1):"?"===e?(this._state=17,this.sectionStart=this._index+1):this.isTagStartChar(e)?(this._state=this.xmlMode||"s"!==e&&"S"!==e?this.xmlMode||"t"!==e&&"T"!==e?3:52:32,this.sectionStart=this._index):this._state=1},e.prototype.stateInTagName=function(e){("/"===e||">"===e||l(e))&&(this.emitToken("onopentagname"),this._state=8,this._index--)},e.prototype.stateBeforeClosingTagName=function(e){l(e)||(">"===e?this._state=1:1!==this.special?4===this.special||"s"!==e&&"S"!==e?4!==this.special||"t"!==e&&"T"!==e?(this._state=1,this._index--):this._state=53:this._state=33:this.isTagStartChar(e)?(this._state=6,this.sectionStart=this._index):(this._state=20,this.sectionStart=this._index))},e.prototype.stateInClosingTagName=function(e){(">"===e||l(e))&&(this.emitToken("onclosetag"),this._state=7,this._index--)},e.prototype.stateAfterClosingTagName=function(e){">"===e&&(this._state=1,this.sectionStart=this._index+1)},e.prototype.stateBeforeAttributeName=function(e){">"===e?(this.cbs.onopentagend(),this._state=1,this.sectionStart=this._index+1):"/"===e?this._state=4:l(e)||(this._state=9,this.sectionStart=this._index)},e.prototype.stateInSelfClosingTag=function(e){">"===e?(this.cbs.onselfclosingtag(),this._state=1,this.sectionStart=this._index+1,this.special=1):l(e)||(this._state=8,this._index--)},e.prototype.stateInAttributeName=function(e){("="===e||"/"===e||">"===e||l(e))&&(this.cbs.onattribname(this.getSection()),this.sectionStart=-1,this._state=10,this._index--)},e.prototype.stateAfterAttributeName=function(e){"="===e?this._state=11:"/"===e||">"===e?(this.cbs.onattribend(void 0),this._state=8,this._index--):l(e)||(this.cbs.onattribend(void 0),this._state=9,this.sectionStart=this._index)},e.prototype.stateBeforeAttributeValue=function(e){'"'===e?(this._state=12,this.sectionStart=this._index+1):"'"===e?(this._state=13,this.sectionStart=this._index+1):l(e)||(this._state=14,this.sectionStart=this._index,this._index--)},e.prototype.handleInAttributeValue=function(e,t){e===t?(this.emitToken("onattribdata"),this.cbs.onattribend(t),this._state=8):this.decodeEntities&&"&"===e&&(this.emitToken("onattribdata"),this.baseState=this._state,this._state=62,this.sectionStart=this._index)},e.prototype.stateInAttributeValueDoubleQuotes=function(e){this.handleInAttributeValue(e,'"')},e.prototype.stateInAttributeValueSingleQuotes=function(e){this.handleInAttributeValue(e,"'")},e.prototype.stateInAttributeValueNoQuotes=function(e){l(e)||">"===e?(this.emitToken("onattribdata"),this.cbs.onattribend(null),this._state=8,this._index--):this.decodeEntities&&"&"===e&&(this.emitToken("onattribdata"),this.baseState=this._state,this._state=62,this.sectionStart=this._index)},e.prototype.stateBeforeDeclaration=function(e){this._state="["===e?23:"-"===e?18:16},e.prototype.stateInDeclaration=function(e){">"===e&&(this.cbs.ondeclaration(this.getSection()),this._state=1,this.sectionStart=this._index+1)},e.prototype.stateInProcessingInstruction=function(e){">"===e&&(this.cbs.onprocessinginstruction(this.getSection()),this._state=1,this.sectionStart=this._index+1)},e.prototype.stateBeforeComment=function(e){"-"===e?(this._state=19,this.sectionStart=this._index+1):this._state=16},e.prototype.stateInComment=function(e){"-"===e&&(this._state=21)},e.prototype.stateInSpecialComment=function(e){">"===e&&(this.cbs.oncomment(this.buffer.substring(this.sectionStart,this._index)),this._state=1,this.sectionStart=this._index+1)},e.prototype.stateAfterComment1=function(e){this._state="-"===e?22:19},e.prototype.stateAfterComment2=function(e){">"===e?(this.cbs.oncomment(this.buffer.substring(this.sectionStart,this._index-2)),this._state=1,this.sectionStart=this._index+1):"-"!==e&&(this._state=19)},e.prototype.stateBeforeCdata6=function(e){"["===e?(this._state=29,this.sectionStart=this._index+1):(this._state=16,this._index--)},e.prototype.stateInCdata=function(e){"]"===e&&(this._state=30)},e.prototype.stateAfterCdata1=function(e){this._state="]"===e?31:29},e.prototype.stateAfterCdata2=function(e){">"===e?(this.cbs.oncdata(this.buffer.substring(this.sectionStart,this._index-2)),this._state=1,this.sectionStart=this._index+1):"]"!==e&&(this._state=29)},e.prototype.stateBeforeSpecialS=function(e){"c"===e||"C"===e?this._state=34:"t"===e||"T"===e?this._state=44:(this._state=3,this._index--)},e.prototype.stateBeforeSpecialSEnd=function(e){2!==this.special||"c"!==e&&"C"!==e?3!==this.special||"t"!==e&&"T"!==e?this._state=1:this._state=48:this._state=39},e.prototype.stateBeforeSpecialLast=function(e,t){("/"===e||">"===e||l(e))&&(this.special=t),this._state=3,this._index--},e.prototype.stateAfterSpecialLast=function(e,t){">"===e||l(e)?(this.special=1,this._state=6,this.sectionStart=this._index-t,this._index--):this._state=1},e.prototype.parseFixedEntity=function(e){if(void 0===e&&(e=this.xmlMode?a.default:s.default),this.sectionStart+1=2;){var n=this.buffer.substr(e,t);if(Object.prototype.hasOwnProperty.call(o.default,n))return this.emitPartial(o.default[n]),void(this.sectionStart+=t+1);t--}},e.prototype.stateInNamedEntity=function(e){";"===e?(this.parseFixedEntity(),1===this.baseState&&this.sectionStart+1"9")&&!u(e)&&(this.xmlMode||this.sectionStart+1===this._index||(1!==this.baseState?"="!==e&&this.parseFixedEntity(o.default):this.parseLegacyEntity()),this._state=this.baseState,this._index--)},e.prototype.decodeNumericEntity=function(e,t,n){var i=this.sectionStart+e;if(i!==this._index){var s=this.buffer.substring(i,this._index),o=parseInt(s,t);this.emitPartial(r.default(o)),this.sectionStart=n?this._index+1:this._index}this._state=this.baseState},e.prototype.stateInNumericEntity=function(e){";"===e?this.decodeNumericEntity(2,10,!0):(e<"0"||e>"9")&&(this.xmlMode?this._state=this.baseState:this.decodeNumericEntity(2,10,!1),this._index--)},e.prototype.stateInHexEntity=function(e){";"===e?this.decodeNumericEntity(3,16,!0):(e<"a"||e>"f")&&(e<"A"||e>"F")&&(e<"0"||e>"9")&&(this.xmlMode?this._state=this.baseState:this.decodeNumericEntity(3,16,!1),this._index--)},e.prototype.cleanup=function(){this.sectionStart<0?(this.buffer="",this.bufferOffset+=this._index,this._index=0):this.running&&(1===this._state?(this.sectionStart!==this._index&&this.cbs.ontext(this.buffer.substr(this.sectionStart)),this.buffer="",this.bufferOffset+=this._index,this._index=0):this.sectionStart===this._index?(this.buffer="",this.bufferOffset+=this._index,this._index=0):(this.buffer=this.buffer.substr(this.sectionStart),this._index-=this.sectionStart,this.bufferOffset+=this.sectionStart),this.sectionStart=0)},e.prototype.parse=function(){for(;this._index0&&t-1 in e)}E.fn=E.prototype={jquery:C,constructor:E,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=E.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return E.each(this,e)},map:function(e){return this.pushStack(E.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(E.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(E.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+L+")"+L+"*"),V=new RegExp(L+"|>"),q=new RegExp(z),G=new RegExp("^"+N+"$"),K={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N+"|[*])"),ATTR:new RegExp("^"+F),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+L+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ie=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},se=function(){h()},oe=Ae((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{O.apply(k=I.call(y.childNodes),y.childNodes),k[y.childNodes.length].nodeType}catch(e){O={apply:k.length?function(e,t){B.apply(e,I.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function ae(e,t,i,r){var s,a,u,d,c,g,v,b=t&&t.ownerDocument,y=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==y&&9!==y&&11!==y)return i;if(!r&&(h(t),t=t||p,f)){if(11!==y&&(c=Q.exec(e)))if(s=c[1]){if(9===y){if(!(u=t.getElementById(s)))return i;if(u.id===s)return i.push(u),i}else if(b&&(u=b.getElementById(s))&&_(t,u)&&u.id===s)return i.push(u),i}else{if(c[2])return O.apply(i,t.getElementsByTagName(e)),i;if((s=c[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(i,t.getElementsByClassName(s)),i}if(n.qsa&&!S[e+" "]&&(!m||!m.test(e))&&(1!==y||"object"!==t.nodeName.toLowerCase())){if(v=e,b=t,1===y&&(V.test(e)||H.test(e))){for((b=ee.test(e)&&ve(t.parentNode)||t)===t&&n.scope||((d=t.getAttribute("id"))?d=d.replace(ie,re):t.setAttribute("id",d=A)),a=(g=o(e)).length;a--;)g[a]=(d?"#"+d:":scope")+" "+_e(g[a]);v=g.join(",")}try{return O.apply(i,b.querySelectorAll(v)),i}catch(t){S(e,!0)}finally{d===A&&t.removeAttribute("id")}}}return l(e.replace($,"$1"),t,i,r)}function le(){var e=[];return function t(n,r){return e.push(n+" ")>i.cacheLength&&delete t[e.shift()],t[n+" "]=r}}function ue(e){return e[A]=!0,e}function de(e){var t=p.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ce(e,t){for(var n=e.split("|"),r=n.length;r--;)i.attrHandle[n[r]]=t}function he(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ge(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function fe(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&oe(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function me(e){return ue((function(t){return t=+t,ue((function(n,i){for(var r,s=e([],n.length,t),o=s.length;o--;)n[r=s[o]]&&(n[r]=!(i[r]=n[r]))}))}))}function ve(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},s=ae.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},h=ae.setDocument=function(e){var t,r,o=e?e.ownerDocument||e:y;return o!=p&&9===o.nodeType&&o.documentElement?(g=(p=o).documentElement,f=!s(p),y!=p&&(r=p.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",se,!1):r.attachEvent&&r.attachEvent("onunload",se)),n.scope=de((function(e){return g.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.cssHas=de((function(){try{return p.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}})),n.attributes=de((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=de((function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Z.test(p.getElementsByClassName),n.getById=de((function(e){return g.appendChild(e).id=A,!p.getElementsByName||!p.getElementsByName(A).length})),n.getById?(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&f){var n=t.getElementById(e);return n?[n]:[]}}):(i.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},i.find.ID=function(e,t){if(void 0!==t.getElementById&&f){var n,i,r,s=t.getElementById(e);if(s){if((n=s.getAttributeNode("id"))&&n.value===e)return[s];for(r=t.getElementsByName(e),i=0;s=r[i++];)if((n=s.getAttributeNode("id"))&&n.value===e)return[s]}return[]}}),i.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,s=t.getElementsByTagName(e);if("*"===e){for(;n=s[r++];)1===n.nodeType&&i.push(n);return i}return s},i.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&f)return t.getElementsByClassName(e)},v=[],m=[],(n.qsa=Z.test(p.querySelectorAll))&&(de((function(e){var t;g.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+L+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+L+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+A+"-]").length||m.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||m.push("\\["+L+"*name"+L+"*="+L+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+A+"+*").length||m.push(".#.+[+~]"),e.querySelectorAll("\\\f"),m.push("[\\r\\n\\f]")})),de((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+L+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),g.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")}))),(n.matchesSelector=Z.test(b=g.matches||g.webkitMatchesSelector||g.mozMatchesSelector||g.oMatchesSelector||g.msMatchesSelector))&&de((function(e){n.disconnectedMatch=b.call(e,"*"),b.call(e,"[s!='']:x"),v.push("!=",z)})),n.cssHas||m.push(":has"),m=m.length&&new RegExp(m.join("|")),v=v.length&&new RegExp(v.join("|")),t=Z.test(g.compareDocumentPosition),_=t||Z.test(g.contains)?function(e,t){var n=9===e.nodeType&&e.documentElement||e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},T=t?function(e,t){if(e===t)return c=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===i?e==p||e.ownerDocument==y&&_(y,e)?-1:t==p||t.ownerDocument==y&&_(y,t)?1:d?R(d,e)-R(d,t):0:4&i?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,i=0,r=e.parentNode,s=t.parentNode,o=[e],a=[t];if(!r||!s)return e==p?-1:t==p?1:r?-1:s?1:d?R(d,e)-R(d,t):0;if(r===s)return he(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;o[i]===a[i];)i++;return i?he(o[i],a[i]):o[i]==y?-1:a[i]==y?1:0},p):p},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if(h(e),n.matchesSelector&&f&&!S[t+" "]&&(!v||!v.test(t))&&(!m||!m.test(t)))try{var i=b.call(e,t);if(i||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){S(t,!0)}return ae(t,p,null,[e]).length>0},ae.contains=function(e,t){return(e.ownerDocument||e)!=p&&h(e),_(e,t)},ae.attr=function(e,t){(e.ownerDocument||e)!=p&&h(e);var r=i.attrHandle[t.toLowerCase()],s=r&&M.call(i.attrHandle,t.toLowerCase())?r(e,t,!f):void 0;return void 0!==s?s:n.attributes||!f?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ae.escape=function(e){return(e+"").replace(ie,re)},ae.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ae.uniqueSort=function(e){var t,i=[],r=0,s=0;if(c=!n.detectDuplicates,d=!n.sortStable&&e.slice(0),e.sort(T),c){for(;t=e[s++];)t===e[s]&&(r=i.push(s));for(;r--;)e.splice(i[r],1)}return d=null,e},r=ae.getText=function(e){var t,n="",i=0,s=e.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=r(e)}else if(3===s||4===s)return e.nodeValue}else for(;t=e[i++];)n+=r(t);return n},i=ae.selectors={cacheLength:50,createPseudo:ue,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&q.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+L+")"+e+"("+L+"|$)"))&&E(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var r=ae.attr(i,e);return null==r?"!="===t:!t||(r+="","="===t?r===n:"!="===t?r!==n:"^="===t?n&&0===r.indexOf(n):"*="===t?n&&r.indexOf(n)>-1:"$="===t?n&&r.slice(-n.length)===n:"~="===t?(" "+r.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,i,r){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var u,d,c,h,p,g,f=s!==o?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),b=!l&&!a,_=!1;if(m){if(s){for(;f;){for(h=t;h=h[f];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;g=f="only"===e&&!g&&"nextSibling"}return!0}if(g=[o?m.firstChild:m.lastChild],o&&b){for(_=(p=(u=(d=(c=(h=m)[A]||(h[A]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]||[])[0]===w&&u[1])&&u[2],h=p&&m.childNodes[p];h=++p&&h&&h[f]||(_=p=0)||g.pop();)if(1===h.nodeType&&++_&&h===t){d[e]=[w,p,_];break}}else if(b&&(_=p=(u=(d=(c=(h=t)[A]||(h[A]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]||[])[0]===w&&u[1]),!1===_)for(;(h=++p&&h&&h[f]||(_=p=0)||g.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++_||(b&&((d=(c=h[A]||(h[A]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]=[w,_]),h!==t)););return(_-=r)===i||_%i==0&&_/i>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ae.error("unsupported pseudo: "+e);return r[A]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,n){for(var i,s=r(e,t),o=s.length;o--;)e[i=R(e,s[o])]=!(n[i]=s[o])})):function(e){return r(e,0,n)}):r}},pseudos:{not:ue((function(e){var t=[],n=[],i=a(e.replace($,"$1"));return i[A]?ue((function(e,t,n,r){for(var s,o=i(e,null,r,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))})):function(e,r,s){return t[0]=e,i(t,null,s,n),t[0]=null,!n.pop()}})),has:ue((function(e){return function(t){return ae(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,ne),function(t){return(t.textContent||r(t)).indexOf(e)>-1}})),lang:ue((function(e){return G.test(e||"")||ae.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=f?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===g},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:fe(!1),disabled:fe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return X.test(e.nodeName)},input:function(e){return J.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:me((function(){return[0]})),last:me((function(e,t){return[t-1]})),eq:me((function(e,t,n){return[n<0?n+t:n]})),even:me((function(e,t){for(var n=0;nt?t:n;--i>=0;)e.push(i);return e})),gt:me((function(e,t,n){for(var i=n<0?n+t:n;++i1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function we(e,t,n,i,r){for(var s,o=[],a=0,l=e.length,u=null!=t;a-1&&(s[u]=!(o[u]=c))}}else v=we(v===o?v.splice(g,v.length):v),r?r(null,o,v,l):O.apply(o,v)}))}function Ee(e){for(var t,n,r,s=e.length,o=i.relative[e[0].type],a=o||i.relative[" "],l=o?1:0,d=Ae((function(e){return e===t}),a,!0),c=Ae((function(e){return R(t,e)>-1}),a,!0),h=[function(e,n,i){var r=!o&&(i||n!==u)||((t=n).nodeType?d(e,n,i):c(e,n,i));return t=null,r}];l1&&ye(h),l>1&&_e(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace($,"$1"),n,l0,r=e.length>0,s=function(s,o,a,l,d){var c,g,m,v=0,b="0",_=s&&[],A=[],y=u,C=s||r&&i.find.TAG("*",d),E=w+=null==y?1:Math.random()||.1,x=C.length;for(d&&(u=o==p||o||d);b!==x&&null!=(c=C[b]);b++){if(r&&c){for(g=0,o||c.ownerDocument==p||(h(c),a=!f);m=e[g++];)if(m(c,o||p,a)){l.push(c);break}d&&(w=E)}n&&((c=!m&&c)&&v--,s&&_.push(c))}if(v+=b,n&&b!==v){for(g=0;m=t[g++];)m(_,A,o,a);if(s){if(v>0)for(;b--;)_[b]||A[b]||(A[b]=j.call(l));A=we(A)}O.apply(l,A),d&&!s&&A.length>0&&v+t.length>1&&ae.uniqueSort(l)}return d&&(w=E,u=y),_};return n?ue(s):s}(s,r)),a.selector=e}return a},l=ae.select=function(e,t,n,r){var s,l,u,d,c,h="function"==typeof e&&e,p=!r&&o(e=h.selector||e);if(n=n||[],1===p.length){if((l=p[0]=p[0].slice(0)).length>2&&"ID"===(u=l[0]).type&&9===t.nodeType&&f&&i.relative[l[1].type]){if(!(t=(i.find.ID(u.matches[0].replace(te,ne),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(s=K.needsContext.test(e)?0:l.length;s--&&(u=l[s],!i.relative[d=u.type]);)if((c=i.find[d])&&(r=c(u.matches[0].replace(te,ne),ee.test(l[0].type)&&ve(t.parentNode)||t))){if(l.splice(s,1),!(e=r.length&&_e(l)))return O.apply(n,r),n;break}}return(h||a(e,p))(r,t,!f,n,!t||ee.test(e)&&ve(t.parentNode)||t),n},n.sortStable=A.split("").sort(T).join("")===A,n.detectDuplicates=!!c,h(),n.sortDetached=de((function(e){return 1&e.compareDocumentPosition(p.createElement("fieldset"))})),de((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||ce("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),n.attributes&&de((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||ce("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),de((function(e){return null==e.getAttribute("disabled")}))||ce(P,(function(e,t,n){var i;if(!n)return!0===e[t]?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null})),ae}(i);E.find=D,E.expr=D.selectors,E.expr[":"]=E.expr.pseudos,E.uniqueSort=E.unique=D.uniqueSort,E.text=D.getText,E.isXMLDoc=D.isXML,E.contains=D.contains,E.escapeSelector=D.escape;var S=function(e,t,n){for(var i=[],r=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&E(e).is(n))break;i.push(e)}return i},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},M=E.expr.match.needsContext;function k(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var j=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function B(e,t,n){return v(t)?E.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?E.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?E.grep(e,(function(e){return d.call(t,e)>-1!==n})):E.filter(t,e,n)}E.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?E.find.matchesSelector(i,e)?[i]:[]:E.find.matches(e,E.grep(t,(function(e){return 1===e.nodeType})))},E.fn.extend({find:function(e){var t,n,i=this.length,r=this;if("string"!=typeof e)return this.pushStack(E(e).filter((function(){for(t=0;t1?E.uniqueSort(n):n},filter:function(e){return this.pushStack(B(this,e||[],!1))},not:function(e){return this.pushStack(B(this,e||[],!0))},is:function(e){return!!B(this,"string"==typeof e&&M.test(e)?E(e):e||[],!1).length}});var O,I=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(E.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||O,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:I.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:_,!0)),j.test(i[1])&&E.isPlainObject(t))for(i in t)v(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(r=_.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(E):E.makeArray(e,this)}).prototype=E.fn,O=E(_);var R=/^(?:parents|prev(?:Until|All))/,P={children:!0,contents:!0,next:!0,prev:!0};function L(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}E.fn.extend({has:function(e){var t=E(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&E.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?E.uniqueSort(s):s)},index:function(e){return e?"string"==typeof e?d.call(E(e),this[0]):d.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(E.uniqueSort(E.merge(this.get(),E(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),E.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return S(e,"parentNode")},parentsUntil:function(e,t,n){return S(e,"parentNode",n)},next:function(e){return L(e,"nextSibling")},prev:function(e){return L(e,"previousSibling")},nextAll:function(e){return S(e,"nextSibling")},prevAll:function(e){return S(e,"previousSibling")},nextUntil:function(e,t,n){return S(e,"nextSibling",n)},prevUntil:function(e,t,n){return S(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(k(e,"template")&&(e=e.content||e),E.merge([],e.childNodes))}},(function(e,t){E.fn[e]=function(n,i){var r=E.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=E.filter(i,r)),this.length>1&&(P[e]||E.uniqueSort(r),R.test(e)&&r.reverse()),this.pushStack(r)}}));var N=/[^\x20\t\r\n\f]+/g;function F(e){return e}function z(e){throw e}function U(e,t,n,i){var r;try{e&&v(r=e.promise)?r.call(e).done(t).fail(n):e&&v(r=e.then)?r.call(e,t,n):t.apply(void 0,[e].slice(i))}catch(e){n.apply(void 0,[e])}}E.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return E.each(e.match(N)||[],(function(e,n){t[n]=!0})),t}(e):E.extend({},e);var t,n,i,r,s=[],o=[],a=-1,l=function(){for(r=r||e.once,i=t=!0;o.length;a=-1)for(n=o.shift();++a-1;)s.splice(n,1),n<=a&&a--})),this},has:function(e){return e?E.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return r=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return r=o=[],n||t||(s=n=""),this},locked:function(){return!!r},fireWith:function(e,n){return r||(n=[e,(n=n||[]).slice?n.slice():n],o.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},E.extend({Deferred:function(e){var t=[["notify","progress",E.Callbacks("memory"),E.Callbacks("memory"),2],["resolve","done",E.Callbacks("once memory"),E.Callbacks("once memory"),0,"resolved"],["reject","fail",E.Callbacks("once memory"),E.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return s.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return E.Deferred((function(n){E.each(t,(function(t,i){var r=v(e[i[4]])&&e[i[4]];s[i[1]]((function(){var e=r&&r.apply(this,arguments);e&&v(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[e]:arguments)}))})),e=null})).promise()},then:function(e,n,r){var s=0;function o(e,t,n,r){return function(){var a=this,l=arguments,u=function(){var i,u;if(!(e=s&&(n!==z&&(a=void 0,l=[i]),t.rejectWith(a,l))}};e?d():(E.Deferred.getStackHook&&(d.stackTrace=E.Deferred.getStackHook()),i.setTimeout(d))}}return E.Deferred((function(i){t[0][3].add(o(0,i,v(r)?r:F,i.notifyWith)),t[1][3].add(o(0,i,v(e)?e:F)),t[2][3].add(o(0,i,v(n)?n:z))})).promise()},promise:function(e){return null!=e?E.extend(e,r):r}},s={};return E.each(t,(function(e,i){var o=i[2],a=i[5];r[i[1]]=o.add,a&&o.add((function(){n=a}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(i[3].fire),s[i[0]]=function(){return s[i[0]+"With"](this===s?void 0:this,arguments),this},s[i[0]+"With"]=o.fireWith})),r.promise(s),e&&e.call(s,s),s},when:function(e){var t=arguments.length,n=t,i=Array(n),r=a.call(arguments),s=E.Deferred(),o=function(e){return function(n){i[e]=this,r[e]=arguments.length>1?a.call(arguments):n,--t||s.resolveWith(i,r)}};if(t<=1&&(U(e,s.done(o(n)).resolve,s.reject,!t),"pending"===s.state()||v(r[n]&&r[n].then)))return s.then();for(;n--;)U(r[n],o(n),s.reject);return s.promise()}});var $=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;E.Deferred.exceptionHook=function(e,t){i.console&&i.console.warn&&e&&$.test(e.name)&&i.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},E.readyException=function(e){i.setTimeout((function(){throw e}))};var W=E.Deferred();function H(){_.removeEventListener("DOMContentLoaded",H),i.removeEventListener("load",H),E.ready()}E.fn.ready=function(e){return W.then(e).catch((function(e){E.readyException(e)})),this},E.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--E.readyWait:E.isReady)||(E.isReady=!0,!0!==e&&--E.readyWait>0||W.resolveWith(_,[E]))}}),E.ready.then=W.then,"complete"===_.readyState||"loading"!==_.readyState&&!_.documentElement.doScroll?i.setTimeout(E.ready):(_.addEventListener("DOMContentLoaded",H),i.addEventListener("load",H));var V=function(e,t,n,i,r,s,o){var a=0,l=e.length,u=null==n;if("object"===w(n))for(a in r=!0,n)V(e,t,a,n[a],!0,s,o);else if(void 0!==i&&(r=!0,v(i)||(o=!0),u&&(o?(t.call(e,i),t=null):(u=t,t=function(e,t,n){return u.call(E(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each((function(){Q.remove(this,e)}))}}),E.extend({queue:function(e,t,n){var i;if(e)return t=(t||"fx")+"queue",i=Z.get(e,t),n&&(!i||Array.isArray(n)?i=Z.access(e,t,E.makeArray(n)):i.push(n)),i||[]},dequeue:function(e,t){t=t||"fx";var n=E.queue(e,t),i=n.length,r=n.shift(),s=E._queueHooks(e,t);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete s.stop,r.call(e,(function(){E.dequeue(e,t)}),s)),!i&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Z.get(e,n)||Z.access(e,n,{empty:E.Callbacks("once memory").add((function(){Z.remove(e,[t+"queue",n])}))})}}),E.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,be=/^$|^module$|\/(?:java|ecma)script/i;ge=_.createDocumentFragment().appendChild(_.createElement("div")),(fe=_.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ge.appendChild(fe),m.checkClone=ge.cloneNode(!0).cloneNode(!0).lastChild.checked,ge.innerHTML="",m.noCloneChecked=!!ge.cloneNode(!0).lastChild.defaultValue,ge.innerHTML="",m.option=!!ge.lastChild;var _e={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Ae(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&k(e,t)?E.merge([e],n):n}function ye(e,t){for(var n=0,i=e.length;n",""]);var we=/<|&#?\w+;/;function Ce(e,t,n,i,r){for(var s,o,a,l,u,d,c=t.createDocumentFragment(),h=[],p=0,g=e.length;p-1)r&&r.push(s);else if(u=ae(s),o=Ae(c.appendChild(s),"script"),u&&ye(o),n)for(d=0;s=o[d++];)be.test(s.type||"")&&n.push(s);return c}var Ee=/^([^.]*)(?:\.(.+)|)/;function xe(){return!0}function De(){return!1}function Se(e,t){return e===function(){try{return _.activeElement}catch(e){}}()==("focus"===t)}function Te(e,t,n,i,r,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)Te(e,a,n,i,t[a],s);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=De;else if(!r)return e;return 1===s&&(o=r,r=function(e){return E().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=E.guid++)),e.each((function(){E.event.add(this,t,r,i,n)}))}function Me(e,t,n){n?(Z.set(e,t,!1),E.event.add(e,t,{namespace:!1,handler:function(e){var i,r,s=Z.get(this,t);if(1&e.isTrigger&&this[t]){if(s.length)(E.event.special[t]||{}).delegateType&&e.stopPropagation();else if(s=a.call(arguments),Z.set(this,t,s),i=n(this,t),this[t](),s!==(r=Z.get(this,t))||i?Z.set(this,t,!1):r={},s!==r)return e.stopImmediatePropagation(),e.preventDefault(),r&&r.value}else s.length&&(Z.set(this,t,{value:E.event.trigger(E.extend(s[0],E.Event.prototype),s.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Z.get(e,t)&&E.event.add(e,t,xe)}E.event={global:{},add:function(e,t,n,i,r){var s,o,a,l,u,d,c,h,p,g,f,m=Z.get(e);if(J(e))for(n.handler&&(n=(s=n).handler,r=s.selector),r&&E.find.matchesSelector(oe,r),n.guid||(n.guid=E.guid++),(l=m.events)||(l=m.events=Object.create(null)),(o=m.handle)||(o=m.handle=function(t){return void 0!==E&&E.event.triggered!==t.type?E.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(N)||[""]).length;u--;)p=f=(a=Ee.exec(t[u])||[])[1],g=(a[2]||"").split(".").sort(),p&&(c=E.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,c=E.event.special[p]||{},d=E.extend({type:p,origType:f,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&E.expr.match.needsContext.test(r),namespace:g.join(".")},s),(h=l[p])||((h=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(e,i,g,o)||e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,d):h.push(d),E.event.global[p]=!0)},remove:function(e,t,n,i,r){var s,o,a,l,u,d,c,h,p,g,f,m=Z.hasData(e)&&Z.get(e);if(m&&(l=m.events)){for(u=(t=(t||"").match(N)||[""]).length;u--;)if(p=f=(a=Ee.exec(t[u])||[])[1],g=(a[2]||"").split(".").sort(),p){for(c=E.event.special[p]||{},h=l[p=(i?c.delegateType:c.bindType)||p]||[],a=a[2]&&new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;s--;)d=h[s],!r&&f!==d.origType||n&&n.guid!==d.guid||a&&!a.test(d.namespace)||i&&i!==d.selector&&("**"!==i||!d.selector)||(h.splice(s,1),d.selector&&h.delegateCount--,c.remove&&c.remove.call(e,d));o&&!h.length&&(c.teardown&&!1!==c.teardown.call(e,g,m.handle)||E.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)E.event.remove(e,p+t[u],n,i,!0);E.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,s,o,a=new Array(arguments.length),l=E.event.fix(e),u=(Z.get(this,"events")||Object.create(null))[l.type]||[],d=E.event.special[l.type]||{};for(a[0]=l,t=1;t=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(s=[],o={},n=0;n-1:E.find(r,this,null,[u]).length),o[r]&&s.push(i);s.length&&a.push({elem:u,handlers:s})}return u=this,l\s*$/g;function Oe(e,t){return k(e,"table")&&k(11!==t.nodeType?t:t.firstChild,"tr")&&E(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,i,r,s,o,a;if(1===t.nodeType){if(Z.hasData(e)&&(a=Z.get(e).events))for(r in Z.remove(t,"handle events"),a)for(n=0,i=a[r].length;n1&&"string"==typeof g&&!m.checkClone&&je.test(g))return e.each((function(r){var s=e.eq(r);f&&(t[0]=g.call(this,r,s.html())),Ne(s,t,n,i)}));if(h&&(s=(r=Ce(t,e[0].ownerDocument,!1,e,i)).firstChild,1===r.childNodes.length&&(r=s),s||i)){for(a=(o=E.map(Ae(r,"script"),Ie)).length;c0&&ye(o,!l&&Ae(e,"script")),a},cleanData:function(e){for(var t,n,i,r=E.event.special,s=0;void 0!==(n=e[s]);s++)if(J(n)){if(t=n[Z.expando]){if(t.events)for(i in t.events)r[i]?E.event.remove(n,i):E.removeEvent(n,i,t.handle);n[Z.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),E.fn.extend({detach:function(e){return Fe(this,e,!0)},remove:function(e){return Fe(this,e)},text:function(e){return V(this,(function(e){return void 0===e?E.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Ne(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Oe(this,e).appendChild(e)}))},prepend:function(){return Ne(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Oe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Ne(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Ne(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(E.cleanData(Ae(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return E.clone(this,e,t)}))},html:function(e){return V(this,(function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!_e[(ve.exec(e)||["",""])[1].toLowerCase()]){e=E.htmlPrefilter(e);try{for(;n=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-s-l-a-.5))||0),l}function rt(e,t,n){var i=$e(e),r=(!m.boxSizingReliable()||n)&&"border-box"===E.css(e,"boxSizing",!1,i),s=r,o=Ge(e,t,i),a="offset"+t[0].toUpperCase()+t.slice(1);if(ze.test(o)){if(!n)return o;o="auto"}return(!m.boxSizingReliable()&&r||!m.reliableTrDimensions()&&k(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===E.css(e,"display",!1,i))&&e.getClientRects().length&&(r="border-box"===E.css(e,"boxSizing",!1,i),(s=a in e)&&(o=e[a])),(o=parseFloat(o)||0)+it(e,t,n||(r?"border":"content"),s,i,o)+"px"}function st(e,t,n,i,r){return new st.prototype.init(e,t,n,i,r)}E.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,o,a=Y(t),l=Ue.test(t),u=e.style;if(l||(t=Ze(a)),o=E.cssHooks[t]||E.cssHooks[a],void 0===n)return o&&"get"in o&&void 0!==(r=o.get(e,!1,i))?r:u[t];"string"==(s=typeof n)&&(r=re.exec(n))&&r[1]&&(n=de(e,t,r),s="number"),null!=n&&n==n&&("number"!==s||l||(n+=r&&r[3]||(E.cssNumber[a]?"":"px")),m.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),o&&"set"in o&&void 0===(n=o.set(e,n,i))||(l?u.setProperty(t,n):u[t]=n))}},css:function(e,t,n,i){var r,s,o,a=Y(t);return Ue.test(t)||(t=Ze(a)),(o=E.cssHooks[t]||E.cssHooks[a])&&"get"in o&&(r=o.get(e,!0,n)),void 0===r&&(r=Ge(e,t,i)),"normal"===r&&t in tt&&(r=tt[t]),""===n||n?(s=parseFloat(r),!0===n||isFinite(s)?s||0:r):r}}),E.each(["height","width"],(function(e,t){E.cssHooks[t]={get:function(e,n,i){if(n)return!Qe.test(E.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?rt(e,t,i):We(e,et,(function(){return rt(e,t,i)}))},set:function(e,n,i){var r,s=$e(e),o=!m.scrollboxSize()&&"absolute"===s.position,a=(o||i)&&"border-box"===E.css(e,"boxSizing",!1,s),l=i?it(e,t,i,a,s):0;return a&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(s[t])-it(e,t,"border",!1,s)-.5)),l&&(r=re.exec(n))&&"px"!==(r[3]||"px")&&(e.style[t]=n,n=E.css(e,t)),nt(0,n,l)}}})),E.cssHooks.marginLeft=Ke(m.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),E.each({margin:"",padding:"",border:"Width"},(function(e,t){E.cssHooks[e+t]={expand:function(n){for(var i=0,r={},s="string"==typeof n?n.split(" "):[n];i<4;i++)r[e+se[i]+t]=s[i]||s[i-2]||s[0];return r}},"margin"!==e&&(E.cssHooks[e+t].set=nt)})),E.fn.extend({css:function(e,t){return V(this,(function(e,t,n){var i,r,s={},o=0;if(Array.isArray(t)){for(i=$e(e),r=t.length;o1)}}),E.Tween=st,st.prototype={constructor:st,init:function(e,t,n,i,r,s){this.elem=e,this.prop=n,this.easing=r||E.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=s||(E.cssNumber[n]?"":"px")},cur:function(){var e=st.propHooks[this.prop];return e&&e.get?e.get(this):st.propHooks._default.get(this)},run:function(e){var t,n=st.propHooks[this.prop];return this.options.duration?this.pos=t=E.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):st.propHooks._default.set(this),this}},st.prototype.init.prototype=st.prototype,st.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=E.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){E.fx.step[e.prop]?E.fx.step[e.prop](e):1!==e.elem.nodeType||!E.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:E.style(e.elem,e.prop,e.now+e.unit)}}},st.propHooks.scrollTop=st.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},E.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},E.fx=st.prototype.init,E.fx.step={};var ot,at,lt=/^(?:toggle|show|hide)$/,ut=/queueHooks$/;function dt(){at&&(!1===_.hidden&&i.requestAnimationFrame?i.requestAnimationFrame(dt):i.setTimeout(dt,E.fx.interval),E.fx.tick())}function ct(){return i.setTimeout((function(){ot=void 0})),ot=Date.now()}function ht(e,t){var n,i=0,r={height:e};for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=se[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function pt(e,t,n){for(var i,r=(gt.tweeners[t]||[]).concat(gt.tweeners["*"]),s=0,o=r.length;s1)},removeAttr:function(e){return this.each((function(){E.removeAttr(this,e)}))}}),E.extend({attr:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===e.getAttribute?E.prop(e,t,n):(1===s&&E.isXMLDoc(e)||(r=E.attrHooks[t.toLowerCase()]||(E.expr.match.bool.test(t)?ft:void 0)),void 0!==n?null===n?void E.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=E.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!m.radioValue&&"radio"===t&&k(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i=0,r=t&&t.match(N);if(r&&1===e.nodeType)for(;n=r[i++];)e.removeAttribute(n)}}),ft={set:function(e,t,n){return!1===t?E.removeAttr(e,n):e.setAttribute(n,n),n}},E.each(E.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=mt[t]||E.find.attr;mt[t]=function(e,t,i){var r,s,o=t.toLowerCase();return i||(s=mt[o],mt[o]=r,r=null!=n(e,t,i)?o:null,mt[o]=s),r}}));var vt=/^(?:input|select|textarea|button)$/i,bt=/^(?:a|area)$/i;function _t(e){return(e.match(N)||[]).join(" ")}function At(e){return e.getAttribute&&e.getAttribute("class")||""}function yt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(N)||[]}E.fn.extend({prop:function(e,t){return V(this,E.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[E.propFix[e]||e]}))}}),E.extend({prop:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&E.isXMLDoc(e)||(t=E.propFix[t]||t,r=E.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=E.find.attr(e,"tabindex");return t?parseInt(t,10):vt.test(e.nodeName)||bt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(E.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),E.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){E.propFix[this.toLowerCase()]=this})),E.fn.extend({addClass:function(e){var t,n,i,r,s,o;return v(e)?this.each((function(t){E(this).addClass(e.call(this,t,At(this)))})):(t=yt(e)).length?this.each((function(){if(i=At(this),n=1===this.nodeType&&" "+_t(i)+" "){for(s=0;s-1;)n=n.replace(" "+r+" "," ");o=_t(n),i!==o&&this.setAttribute("class",o)}})):this:this.attr("class","")},toggleClass:function(e,t){var n,i,r,s,o=typeof e,a="string"===o||Array.isArray(e);return v(e)?this.each((function(n){E(this).toggleClass(e.call(this,n,At(this),t),t)})):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(n=yt(e),this.each((function(){if(a)for(s=E(this),r=0;r-1)return!0;return!1}});var wt=/\r/g;E.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=v(e),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?e.call(this,n,E(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=E.map(r,(function(e){return null==e?"":e+""}))),(t=E.valHooks[this.type]||E.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))}))):r?(t=E.valHooks[r.type]||E.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(wt,""):null==n?"":n:void 0}}),E.extend({valHooks:{option:{get:function(e){var t=E.find.attr(e,"value");return null!=t?t:_t(E.text(e))}},select:{get:function(e){var t,n,i,r=e.options,s=e.selectedIndex,o="select-one"===e.type,a=o?null:[],l=o?s+1:r.length;for(i=s<0?l:o?s:0;i-1)&&(n=!0);return n||(e.selectedIndex=-1),s}}}}),E.each(["radio","checkbox"],(function(){E.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=E.inArray(E(e).val(),t)>-1}},m.checkOn||(E.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),m.focusin="onfocusin"in i;var Ct=/^(?:focusinfocus|focusoutblur)$/,Et=function(e){e.stopPropagation()};E.extend(E.event,{trigger:function(e,t,n,r){var s,o,a,l,u,d,c,h,g=[n||_],f=p.call(e,"type")?e.type:e,m=p.call(e,"namespace")?e.namespace.split("."):[];if(o=h=a=n=n||_,3!==n.nodeType&&8!==n.nodeType&&!Ct.test(f+E.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),u=f.indexOf(":")<0&&"on"+f,(e=e[E.expando]?e:new E.Event(f,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:E.makeArray(t,[e]),c=E.event.special[f]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!b(n)){for(l=c.delegateType||f,Ct.test(l+f)||(o=o.parentNode);o;o=o.parentNode)g.push(o),a=o;a===(n.ownerDocument||_)&&g.push(a.defaultView||a.parentWindow||i)}for(s=0;(o=g[s++])&&!e.isPropagationStopped();)h=o,e.type=s>1?l:c.bindType||f,(d=(Z.get(o,"events")||Object.create(null))[e.type]&&Z.get(o,"handle"))&&d.apply(o,t),(d=u&&o[u])&&d.apply&&J(o)&&(e.result=d.apply(o,t),!1===e.result&&e.preventDefault());return e.type=f,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(g.pop(),t)||!J(n)||u&&v(n[f])&&!b(n)&&((a=n[u])&&(n[u]=null),E.event.triggered=f,e.isPropagationStopped()&&h.addEventListener(f,Et),n[f](),e.isPropagationStopped()&&h.removeEventListener(f,Et),E.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var i=E.extend(new E.Event,n,{type:e,isSimulated:!0});E.event.trigger(i,null,t)}}),E.fn.extend({trigger:function(e,t){return this.each((function(){E.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return E.event.trigger(e,t,n,!0)}}),m.focusin||E.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){E.event.simulate(t,e.target,E.event.fix(e))};E.event.special[t]={setup:function(){var i=this.ownerDocument||this.document||this,r=Z.access(i,t);r||i.addEventListener(e,n,!0),Z.access(i,t,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this.document||this,r=Z.access(i,t)-1;r?Z.access(i,t,r):(i.removeEventListener(e,n,!0),Z.remove(i,t))}}}));var xt=i.location,Dt={guid:Date.now()},St=/\?/;E.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new i.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||E.error("Invalid XML: "+(n?E.map(n.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var Tt=/\[\]$/,Mt=/\r?\n/g,kt=/^(?:submit|button|image|reset|file)$/i,jt=/^(?:input|select|textarea|keygen)/i;function Bt(e,t,n,i){var r;if(Array.isArray(t))E.each(t,(function(t,r){n||Tt.test(e)?i(e,r):Bt(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)}));else if(n||"object"!==w(t))i(e,t);else for(r in t)Bt(e+"["+r+"]",t[r],n,i)}E.param=function(e,t){var n,i=[],r=function(e,t){var n=v(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!E.isPlainObject(e))E.each(e,(function(){r(this.name,this.value)}));else for(n in e)Bt(n,e[n],t,r);return i.join("&")},E.fn.extend({serialize:function(){return E.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=E.prop(this,"elements");return e?E.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!E(this).is(":disabled")&&jt.test(this.nodeName)&&!kt.test(e)&&(this.checked||!me.test(e))})).map((function(e,t){var n=E(this).val();return null==n?null:Array.isArray(n)?E.map(n,(function(e){return{name:t.name,value:e.replace(Mt,"\r\n")}})):{name:t.name,value:n.replace(Mt,"\r\n")}})).get()}});var Ot=/%20/g,It=/#.*$/,Rt=/([?&])_=[^&]*/,Pt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Lt=/^(?:GET|HEAD)$/,Nt=/^\/\//,Ft={},zt={},Ut="*/".concat("*"),$t=_.createElement("a");function Wt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,s=t.toLowerCase().match(N)||[];if(v(n))for(;i=s[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function Ht(e,t,n,i){var r={},s=e===zt;function o(a){var l;return r[a]=!0,E.each(e[a]||[],(function(e,a){var u=a(t,n,i);return"string"!=typeof u||s||r[u]?s?!(l=u):void 0:(t.dataTypes.unshift(u),o(u),!1)})),l}return o(t.dataTypes[0])||!r["*"]&&o("*")}function Vt(e,t){var n,i,r=E.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&E.extend(!0,e,i),e}$t.href=xt.href,E.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:xt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(xt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ut,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":E.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Vt(Vt(e,E.ajaxSettings),t):Vt(E.ajaxSettings,e)},ajaxPrefilter:Wt(Ft),ajaxTransport:Wt(zt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r,s,o,a,l,u,d,c,h,p=E.ajaxSetup({},t),g=p.context||p,f=p.context&&(g.nodeType||g.jquery)?E(g):E.event,m=E.Deferred(),v=E.Callbacks("once memory"),b=p.statusCode||{},A={},y={},w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(u){if(!o)for(o={};t=Pt.exec(s);)o[t[1].toLowerCase()+" "]=(o[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=o[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?s:null},setRequestHeader:function(e,t){return null==u&&(e=y[e.toLowerCase()]=y[e.toLowerCase()]||e,A[e]=t),this},overrideMimeType:function(e){return null==u&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)C.always(e[C.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||w;return n&&n.abort(t),x(0,t),this}};if(m.promise(C),p.url=((e||p.url||xt.href)+"").replace(Nt,xt.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(N)||[""],null==p.crossDomain){l=_.createElement("a");try{l.href=p.url,l.href=l.href,p.crossDomain=$t.protocol+"//"+$t.host!=l.protocol+"//"+l.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=E.param(p.data,p.traditional)),Ht(Ft,p,t,C),u)return C;for(c in(d=E.event&&p.global)&&0==E.active++&&E.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Lt.test(p.type),r=p.url.replace(It,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Ot,"+")):(h=p.url.slice(r.length),p.data&&(p.processData||"string"==typeof p.data)&&(r+=(St.test(r)?"&":"?")+p.data,delete p.data),!1===p.cache&&(r=r.replace(Rt,"$1"),h=(St.test(r)?"&":"?")+"_="+Dt.guid+++h),p.url=r+h),p.ifModified&&(E.lastModified[r]&&C.setRequestHeader("If-Modified-Since",E.lastModified[r]),E.etag[r]&&C.setRequestHeader("If-None-Match",E.etag[r])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Ut+"; q=0.01":""):p.accepts["*"]),p.headers)C.setRequestHeader(c,p.headers[c]);if(p.beforeSend&&(!1===p.beforeSend.call(g,C,p)||u))return C.abort();if(w="abort",v.add(p.complete),C.done(p.success),C.fail(p.error),n=Ht(zt,p,t,C)){if(C.readyState=1,d&&f.trigger("ajaxSend",[C,p]),u)return C;p.async&&p.timeout>0&&(a=i.setTimeout((function(){C.abort("timeout")}),p.timeout));try{u=!1,n.send(A,x)}catch(e){if(u)throw e;x(-1,e)}}else x(-1,"No Transport");function x(e,t,o,l){var c,h,_,A,y,w=t;u||(u=!0,a&&i.clearTimeout(a),n=void 0,s=l||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,o&&(A=function(e,t,n){for(var i,r,s,o,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){l.unshift(r);break}if(l[0]in n)s=l[0];else{for(r in n){if(!l[0]||e.converters[r+" "+l[0]]){s=r;break}o||(o=r)}s=s||o}if(s)return s!==l[0]&&l.unshift(s),n[s]}(p,C,o)),!c&&E.inArray("script",p.dataTypes)>-1&&E.inArray("json",p.dataTypes)<0&&(p.converters["text script"]=function(){}),A=function(e,t,n,i){var r,s,o,a,l,u={},d=e.dataTypes.slice();if(d[1])for(o in e.converters)u[o.toLowerCase()]=e.converters[o];for(s=d.shift();s;)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=s,s=d.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(o=u[l+" "+s]||u["* "+s]))for(r in u)if((a=r.split(" "))[1]===s&&(o=u[l+" "+a[0]]||u["* "+a[0]])){!0===o?o=u[r]:!0!==u[r]&&(s=a[0],d.unshift(a[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+s}}}return{state:"success",data:t}}(p,A,C,c),c?(p.ifModified&&((y=C.getResponseHeader("Last-Modified"))&&(E.lastModified[r]=y),(y=C.getResponseHeader("etag"))&&(E.etag[r]=y)),204===e||"HEAD"===p.type?w="nocontent":304===e?w="notmodified":(w=A.state,h=A.data,c=!(_=A.error))):(_=w,!e&&w||(w="error",e<0&&(e=0))),C.status=e,C.statusText=(t||w)+"",c?m.resolveWith(g,[h,w,C]):m.rejectWith(g,[C,w,_]),C.statusCode(b),b=void 0,d&&f.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?h:_]),v.fireWith(g,[C,w]),d&&(f.trigger("ajaxComplete",[C,p]),--E.active||E.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return E.get(e,t,n,"json")},getScript:function(e,t){return E.get(e,void 0,t,"script")}}),E.each(["get","post"],(function(e,t){E[t]=function(e,n,i,r){return v(n)&&(r=r||i,i=n,n=void 0),E.ajax(E.extend({url:e,type:t,dataType:r,data:n,success:i},E.isPlainObject(e)&&e))}})),E.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),E._evalUrl=function(e,t,n){return E.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){E.globalEval(e,t,n)}})},E.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=E(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return v(e)?this.each((function(t){E(this).wrapInner(e.call(this,t))})):this.each((function(){var t=E(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=v(e);return this.each((function(n){E(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){E(this).replaceWith(this.childNodes)})),this}}),E.expr.pseudos.hidden=function(e){return!E.expr.pseudos.visible(e)},E.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},E.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(e){}};var qt={0:200,1223:204},Gt=E.ajaxSettings.xhr();m.cors=!!Gt&&"withCredentials"in Gt,m.ajax=Gt=!!Gt,E.ajaxTransport((function(e){var t,n;if(m.cors||Gt&&!e.crossDomain)return{send:function(r,s){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(qt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),n=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&i.setTimeout((function(){t&&n()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),E.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),E.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return E.globalEval(e),e}}}),E.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),E.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(i,r){t=E("