@wecode-team/we0-cms 1.0.18 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/page.d.ts +9 -0
- package/dist/components/pages/welcome.d.ts +2 -0
- package/dist/index.css +2 -2
- package/dist/index.esm.js +9 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom"),r=require("react-dom/client"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom"),r=require("react-dom/client"),i=require("dayjs");function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var s=o(e),a=o(n);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){c(o,r,i,s,a,"next",e)}function a(e){c(o,r,i,s,a,"throw",e)}s(void 0)})}}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=v(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function d(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof a?r:a,c=Object.create(l.prototype);return p(c,"_invoke",function(n,r,i){var o,a,l,c=0,h=i||[],u=!1,d={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,a=0,l=e,d.n=n,s}};function f(n,r){for(a=n,l=r,t=0;!u&&c&&!i&&t<h.length;t++){var i,o=h[t],f=d.p,p=o[2];n>3?(i=p===r)&&(l=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(a=0,d.v=r,d.n=o[1]):f<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,a=0))}if(i||n>1)return s;throw u=!0,r}return function(i,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),a=h,l=p;(t=a<2?e:l)||!u;){o||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(c=2,o){if(a||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=e}else if((t=(u=d.n<0)?l:n.call(r,d))!==s)break}catch(t){o=e,a=1,l=t}finally{c=1}}return{value:t,done:u}}}(n,i,o),!0),c}var s={};function a(){}function l(){}function c(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),u=c.prototype=a.prototype=Object.create(h);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,p(e,i,"GeneratorFunction")),e.prototype=Object.create(u),e}return l.prototype=c,p(u,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,i,"GeneratorFunction"),p(u),p(u,i,"Generator"),p(u,r,function(){return this}),p(u,"toString",function(){return"[object Generator]"}),(f=function(){return{w:o,m:d}})()}function p(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}
|
|
4
4
|
/**
|
|
5
5
|
* @license lucide-react v0.344.0 - ISC
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the ISC license.
|
|
8
8
|
* See the LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
var L={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},I=["color","size","strokeWidth","absoluteStrokeWidth","className","children"],F=function(t,n){var r=e.forwardRef(function(r,a){var o,i=r.color,s=void 0===i?"currentColor":i,l=r.size,c=void 0===l?24:l,u=r.strokeWidth,d=void 0===u?2:u,f=r.absoluteStrokeWidth,m=r.className,p=void 0===m?"":m,h=r.children,v=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(r,I);return e.createElement("svg",S(S({ref:a},L),{},{width:c,height:c,stroke:s,strokeWidth:f?24*Number(d)/Number(c):d,className:["lucide","lucide-".concat((o=t,o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim())),p].join(" ")},v),[].concat(_(n.map(function(t){var n=R(t,2),r=n[0],a=n[1];return e.createElement(r,a)})),_(Array.isArray(h)?h:[h])))});return r.displayName="".concat(t),r},z=F("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),B=F("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),q=F("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),U=F("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),H=F("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),W=F("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),V=F("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),$=F("Crown",[["path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14",key:"zkxr6b"}]]),K=F("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),Y=F("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),J=F("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),G=F("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),X=F("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),Z=F("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Q=F("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),ee=F("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),te=F("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),ne=F("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),re=F("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ae=F("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),oe=F("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ie=F("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]),se=F("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),le=F("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),ce=F("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),ue=F("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),de=F("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fe=function(){return fe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},fe.apply(this,arguments)};function me(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function pe(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=pe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function he(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=pe(e))&&(r&&(r+=" "),r+=t);return r}"function"==typeof SuppressedError&&SuppressedError;const ve=e=>{const t=we(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),ge(n,t)||ye(e)},getConflictingClassGroupIds:(e,t)=>{const a=n[e]||[];return t&&r[e]?[...a,...r[e]]:a}}},ge=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?ge(e.slice(1),r):void 0;if(a)return a;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},be=/^\[(.+)\]$/,ye=e=>{if(be.test(e)){const t=be.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},we=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return ke(Object.entries(e.classGroups),n).forEach(([e,n])=>{xe(n,r,e,t)}),r},xe=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:Ee(t,e)).classGroupId=n)}if("function"==typeof e)return Ne(e)?void xe(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,a])=>{xe(a,Ee(t,e),n,r)})})},Ee=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Ne=e=>e.isThemeGetter,ke=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,Se=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(a(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):a(e,t)}}},Oe=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,a=t[0],o=t.length,i=e=>{const n=[];let i,s=0,l=0;for(let c=0;c<e.length;c++){let u=e[c];if(0===s){if(u===a&&(r||e.slice(c,c+o)===t)){n.push(e.slice(l,c)),l=c+o;continue}if("/"===u){i=c;continue}}"["===u?s++:"]"===u&&s--}const c=0===n.length?e:e.substring(l),u=c.startsWith("!");return{modifiers:n,hasImportantModifier:u,baseClassName:u?c.substring(1):c,maybePostfixModifierPosition:i&&i>l?i-l:void 0}};return n?e=>n({className:e,parseClassName:i}):i},Ce=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},je=/\s+/;function Re(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=_e(e))&&(r&&(r+=" "),r+=t);return r}const _e=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=_e(e[r]))&&(n&&(n+=" "),n+=t);return n};function Te(e,...t){let n,r,a,o=function(s){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:Se(e.cacheSize),parseClassName:Oe(e),...ve(e)}))(l),r=n.cache.get,a=n.cache.set,o=i,i(s)};function i(e){const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,o=[],i=e.trim().split(je);let s="";for(let e=i.length-1;e>=0;e-=1){const t=i[e],{modifiers:l,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(t);let f=Boolean(d),m=r(f?u.substring(0,d):u);if(!m){if(!f){s=t+(s.length>0?" "+s:s);continue}if(m=r(u),!m){s=t+(s.length>0?" "+s:s);continue}f=!1}const p=Ce(l).join(":"),h=c?p+"!":p,v=h+m;if(o.includes(v))continue;o.push(v);const g=a(m,f);for(let e=0;e<g.length;++e){const t=g[e];o.push(h+t)}s=t+(s.length>0?" "+s:s)}return s})(e,n);return a(e,o),o}return function(){return o(Re.apply(null,arguments))}}const Pe=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Ae=/^\[(?:([a-z-]+):)?(.+)\]$/i,De=/^\d+\/\d+$/,Me=new Set(["px","full","screen"]),Le=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ze=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Be=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qe=e=>He(e)||Me.has(e)||De.test(e),Ue=e=>nt(e,"length",rt),He=e=>Boolean(e)&&!Number.isNaN(Number(e)),We=e=>nt(e,"number",He),Ve=e=>Boolean(e)&&Number.isInteger(Number(e)),$e=e=>e.endsWith("%")&&He(e.slice(0,-1)),Ke=e=>Ae.test(e),Ye=e=>Le.test(e),Je=new Set(["length","size","percentage"]),Ge=e=>nt(e,Je,at),Xe=e=>nt(e,"position",at),Ze=new Set(["image","url"]),Qe=e=>nt(e,Ze,it),et=e=>nt(e,"",ot),tt=()=>!0,nt=(e,t,n)=>{const r=Ae.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},rt=e=>Ie.test(e)&&!Fe.test(e),at=()=>!1,ot=e=>ze.test(e),it=e=>Be.test(e),st=Te(()=>{const e=Pe("colors"),t=Pe("spacing"),n=Pe("blur"),r=Pe("brightness"),a=Pe("borderColor"),o=Pe("borderRadius"),i=Pe("borderSpacing"),s=Pe("borderWidth"),l=Pe("contrast"),c=Pe("grayscale"),u=Pe("hueRotate"),d=Pe("invert"),f=Pe("gap"),m=Pe("gradientColorStops"),p=Pe("gradientColorStopPositions"),h=Pe("inset"),v=Pe("margin"),g=Pe("opacity"),b=Pe("padding"),y=Pe("saturate"),w=Pe("scale"),x=Pe("sepia"),E=Pe("skew"),N=Pe("space"),k=Pe("translate"),S=()=>["auto",Ke,t],O=()=>[Ke,t],C=()=>["",qe,Ue],j=()=>["auto",He,Ke],R=()=>["","0",Ke],_=()=>[He,Ke];return{cacheSize:500,separator:":",theme:{colors:[tt],spacing:[qe,Ue],blur:["none","",Ye,Ke],brightness:_(),borderColor:[e],borderRadius:["none","","full",Ye,Ke],borderSpacing:O(),borderWidth:C(),contrast:_(),grayscale:R(),hueRotate:_(),invert:R(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[$e,Ue],inset:S(),margin:S(),opacity:_(),padding:O(),saturate:_(),scale:_(),sepia:R(),skew:_(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Ke]}],container:["container"],columns:[{columns:[Ye]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Ke]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ve,Ke]}],basis:[{basis:S()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ke]}],grow:[{grow:R()}],shrink:[{shrink:R()}],order:[{order:["first","last","none",Ve,Ke]}],"grid-cols":[{"grid-cols":[tt]}],"col-start-end":[{col:["auto",{span:["full",Ve,Ke]},Ke]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[tt]}],"row-start-end":[{row:["auto",{span:[Ve,Ke]},Ke]}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ke]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ke,t]}],"min-w":[{"min-w":[Ke,t,"min","max","fit"]}],"max-w":[{"max-w":[Ke,t,"none","full","min","max","fit","prose",{screen:[Ye]},Ye]}],h:[{h:[Ke,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ke,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ye,Ue]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",We]}],"font-family":[{font:[tt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ke]}],"line-clamp":[{"line-clamp":["none",He,We]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qe,Ke]}],"list-image":[{"list-image":["none",Ke]}],"list-style-type":[{list:["none","disc","decimal",Ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qe,Ue]}],"underline-offset":[{"underline-offset":["auto",qe,Ke]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Xe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ge]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Qe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[qe,Ke]}],"outline-w":[{outline:[qe,Ue]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:C()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[qe,Ue]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ye,et]}],"shadow-color":[{shadow:[tt]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ye,Ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ke]}],duration:[{duration:_()}],ease:[{ease:["linear","in","out","in-out",Ke]}],delay:[{delay:_()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Ve,Ke]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ke]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ke]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ke]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[qe,Ue,We]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function lt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return st(he(t))}function ct(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("animate-pulse rounded-md bg-muted",t)},n))}function ut(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dt(...e){return t=>{let n=!1;const r=e.map(e=>{const r=ut(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():ut(e[t],null)}}}}function ft(...e){return c.useCallback(dt(...e),e)}var mt=Symbol.for("react.lazy"),pt=c[" use ".trim().toString()];function ht(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===mt&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function vt(e){const n=bt(e),r=c.forwardRef((e,r)=>{let{children:a,...o}=e;ht(a)&&"function"==typeof pt&&(a=pt(a._payload));const i=c.Children.toArray(a),s=i.find(wt);if(s){const e=s.props.children,a=i.map(t=>t===s?c.Children.count(e)>1?c.Children.only(null):c.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:c.isValidElement(e)?c.cloneElement(e,void 0,a):null})}return t.jsx(n,{...o,ref:r,children:a})});return r.displayName=`${e}.Slot`,r}var gt=vt("Slot");function bt(e){const t=c.forwardRef((e,t)=>{let{children:n,...r}=e;if(ht(n)&&"function"==typeof pt&&(n=pt(n._payload)),c.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),a=function(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==c.Fragment&&(a.ref=t?dt(t,e):e),c.cloneElement(n,a)}return c.Children.count(n)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yt=Symbol("radix.slottable");function wt(e){return c.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===yt}const xt=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Et=he,Nt=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return Et(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;const i=xt(t)||xt(r);return a[e][i]}),s=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...s}[t]):{...o,...s}[t]===n})?[...e,n,r]:e},[]);return Et(e,i,l,null==n?void 0:n.class,null==n?void 0:n.className)};var kt=Nt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),St=c.forwardRef(function(e,t){var n=e.className,r=e.variant,a=e.size,o=e.asChild,i=void 0!==o&&o,s=me(e,["className","variant","size","asChild"]),l=i?gt:"button";return c.createElement(l,Object.assign({className:lt(kt({variant:r,size:a,className:n})),ref:t},s))});St.displayName="Button";var Ot=c.forwardRef(function(e,t){var n=e.className,r=e.type,a=me(e,["className","type"]);return c.createElement("input",Object.assign({type:r,className:lt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:t},a))});Ot.displayName="Input";var Ct=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=vt(`Primitive.${n}`),a=c.forwardRef((e,a)=>{const{asChild:o,...i}=e,s=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...i,ref:a})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{}),jt="horizontal",Rt=["horizontal","vertical"],_t=c.forwardRef((e,n)=>{const{decorative:r,orientation:a=jt,...o}=e,i=function(e){return Rt.includes(e)}(a)?a:jt,s=r?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t.jsx(Ct.div,{"data-orientation":i,...s,...o,ref:n})});_t.displayName="Separator";var Tt=_t;function Pt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function At(e,n=[]){let r=[];const a=()=>{const t=r.map(e=>c.createContext(e));return function(n){const r=n?.[e]||t;return c.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return a.scopeName=e,[function(n,a){const o=c.createContext(a),i=r.length;r=[...r,a];const s=n=>{const{scope:r,children:a,...s}=n,l=r?.[e]?.[i]||o,u=c.useMemo(()=>s,Object.values(s));return t.jsx(l.Provider,{value:u,children:a})};return s.displayName=n+"Provider",[s,function(t,r){const s=r?.[e]?.[i]||o,l=c.useContext(s);if(l)return l;if(void 0!==a)return a;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},Dt(a,...n)]}function Dt(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}c.forwardRef(function(e,t){var n=e.className,r=e.orientation,a=void 0===r?"horizontal":r,o=e.decorative,i=void 0===o||o,s=me(e,["className","orientation","decorative"]);return c.createElement(Tt,Object.assign({ref:t,decorative:i,orientation:a,className:lt("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",n)},s))}).displayName=Tt.displayName;var Mt=globalThis?.document?c.useLayoutEffect:()=>{},Lt=c[" useId ".trim().toString()]||(()=>{}),It=0;function Ft(e){const[t,n]=c.useState(Lt());return Mt(()=>{e||n(e=>e??String(It++))},[e]),e||(t?`radix-${t}`:"")}var zt=c[" useInsertionEffect ".trim().toString()]||Mt;function Bt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,o,i]=function({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),a=c.useRef(n),o=c.useRef(t);return zt(()=>{o.current=t},[t]),c.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}({defaultProp:t,onChange:n}),s=void 0!==e,l=s?e:a;{const t=c.useRef(void 0!==e);c.useEffect(()=>{const e=t.current;if(e!==s){}t.current=s},[s,r])}const u=c.useCallback(t=>{if(s){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&i.current?.(n)}else o(t)},[s,e,o,i]);return[l,u]}function qt(e){const n=Ut(e),r=c.forwardRef((e,r)=>{const{children:a,...o}=e,i=c.Children.toArray(a),s=i.find(Wt);if(s){const e=s.props.children,a=i.map(t=>t===s?c.Children.count(e)>1?c.Children.only(null):c.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:c.isValidElement(e)?c.cloneElement(e,void 0,a):null})}return t.jsx(n,{...o,ref:r,children:a})});return r.displayName=`${e}.Slot`,r}function Ut(e){const t=c.forwardRef((e,t)=>{const{children:n,...r}=e;if(c.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),a=function(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...o}:"className"===r&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==c.Fragment&&(a.ref=t?dt(t,e):e),c.cloneElement(n,a)}return c.Children.count(n)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ht=Symbol("radix.slottable");function Wt(e){return c.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ht}var Vt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=qt(`Primitive.${n}`),a=c.forwardRef((e,a)=>{const{asChild:o,...i}=e,s=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...i,ref:a})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{});function $t(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...e)=>t.current?.(...e),[])}var Kt,Yt="dismissableLayer.update",Jt="dismissableLayer.pointerDownOutside",Gt="dismissableLayer.focusOutside",Xt=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zt=c.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...u}=e,d=c.useContext(Xt),[f,m]=c.useState(null),p=f?.ownerDocument??globalThis?.document,[,h]=c.useState({}),v=ft(n,e=>m(e)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),w=f?g.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,N=function(e,t=globalThis?.document){const n=$t(e),r=c.useRef(!1),a=c.useRef(()=>{});return c.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){en(Jt,n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=r,t.addEventListener("click",a.current,{once:!0})):r()}else t.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));E&&!n&&(o?.(e),s?.(e),e.defaultPrevented||l?.())},p),k=function(e,t=globalThis?.document){const n=$t(e),r=c.useRef(!1);return c.useEffect(()=>{const e=e=>{if(e.target&&!r.current){en(Gt,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(i?.(e),s?.(e),e.defaultPrevented||l?.())},p);return function(e,t=globalThis?.document){const n=$t(e);c.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{w===d.layers.size-1&&(a?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},p),c.useEffect(()=>{if(f)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Kt=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Qt(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Kt)}},[f,p,r,d]),c.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Qt())},[f,d]),c.useEffect(()=>{const e=()=>h({});return document.addEventListener(Yt,e),()=>document.removeEventListener(Yt,e)},[]),t.jsx(Vt.div,{...u,ref:v,style:{pointerEvents:x?E?"auto":"none":void 0,...e.style},onFocusCapture:Pt(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Pt(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Pt(e.onPointerDownCapture,N.onPointerDownCapture)})});Zt.displayName="DismissableLayer";function Qt(){const e=new CustomEvent(Yt);document.dispatchEvent(e)}function en(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?function(e,t){e&&u.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}c.forwardRef((e,n)=>{const r=c.useContext(Xt),a=c.useRef(null),o=ft(n,a);return c.useEffect(()=>{const e=a.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),t.jsx(Vt.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var tn="focusScope.autoFocusOnMount",nn="focusScope.autoFocusOnUnmount",rn={bubbles:!1,cancelable:!0},an=c.forwardRef((e,n)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,u]=c.useState(null),d=$t(o),f=$t(i),m=c.useRef(null),p=ft(n,e=>u(e)),h=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(a){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?m.current=t:cn(m.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||cn(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&cn(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[a,l,h.paused]),c.useEffect(()=>{if(l){un.add(h);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(tn,rn);l.addEventListener(tn,d),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(cn(r,{select:t}),document.activeElement!==n)return}((e=on(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&cn(l))}return()=>{l.removeEventListener(tn,d),setTimeout(()=>{const e=new CustomEvent(nn,rn);l.addEventListener(nn,f),l.dispatchEvent(e),e.defaultPrevented||cn(t??document.body,{select:!0}),l.removeEventListener(nn,f),un.remove(h)},0)}}var e},[l,d,f,h]);const v=c.useCallback(e=>{if(!r&&!a)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[a,o]=function(e){const t=on(e),n=sn(t,e),r=sn(t.reverse(),e);return[n,r]}(t);a&&o?e.shiftKey||n!==o?e.shiftKey&&n===a&&(e.preventDefault(),r&&cn(o,{select:!0})):(e.preventDefault(),r&&cn(a,{select:!0})):n===t&&e.preventDefault()}},[r,a,h.paused]);return t.jsx(Vt.div,{tabIndex:-1,...s,ref:p,onKeyDown:v})});function on(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function sn(e,t){for(const n of e)if(!ln(n,{upTo:t}))return n}function ln(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function cn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}an.displayName="FocusScope";var un=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=dn(e,t),e.unshift(t)},remove(t){e=dn(e,t),e[0]?.resume()}}}();function dn(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var fn=c.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=c.useState(!1);Mt(()=>s(!0),[]);const l=a||i&&globalThis?.document?.body;return l?n.createPortal(t.jsx(Vt.div,{...o,ref:r}),l):null});fn.displayName="Portal";var mn=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=c.useState(),r=c.useRef(null),a=c.useRef(e),o=c.useRef("none"),i=e?"mounted":"unmounted",[s,l]=function(e,t){return c.useReducer((e,n)=>t[e][n]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const e=pn(r.current);o.current="mounted"===s?e:"none"},[s]),Mt(()=>{const t=r.current,n=a.current;if(n!==e){const r=o.current,i=pn(t);if(e)l("MOUNT");else if("none"===i||"none"===t?.display)l("UNMOUNT");else{l(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}a.current=e}},[e,l]),Mt(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=o=>{const i=pn(r.current).includes(CSS.escape(o.animationName));if(o.target===t&&i&&(l("ANIMATION_END"),!a.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(o.current=pn(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:c.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),a="function"==typeof n?n({present:r.isPresent}):c.Children.only(n),o=ft(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a));return"function"==typeof n||r.isPresent?c.cloneElement(a,{ref:o}):null};function pn(e){return e?.animationName||"none"}mn.displayName="Presence";var hn=0;function vn(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gn()),document.body.insertAdjacentElement("beforeend",e[1]??gn()),hn++,()=>{1===hn&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hn--}},[])}function gn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var bn="right-scroll-bar-position",yn="width-before-scroll-bar";function wn(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var xn="undefined"!=typeof window?c.useLayoutEffect:c.useEffect,En=new WeakMap;function Nn(t,n){var r,a,o,i=(r=n||null,a=function(e){return t.forEach(function(t){return wn(t,e)})},(o=e.useState(function(){return{value:r,callback:a,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=a,o.facade);return xn(function(){var e=En.get(i);if(e){var n=new Set(e),r=new Set(t),a=i.current;n.forEach(function(e){r.has(e)||wn(e,null)}),r.forEach(function(e){n.has(e)||wn(e,a)})}En.set(i,t)},[t]),i}function kn(e){return e}var Sn=function(e){var t=e.sideCar,n=me(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,fe({},n))};Sn.isSideCarExport=!0;var On=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=kn);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var a=t(e,r);return n.push(a),function(){n=n.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var a=n;n=[],a.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=fe({async:!0,ssr:!1},e),t}(),Cn=function(){},jn=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Cn,onWheelCapture:Cn,onTouchMoveCapture:Cn}),a=r[0],o=r[1],i=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,h=e.noIsolation,v=e.inert,g=e.allowPinchZoom,b=e.as,y=void 0===b?"div":b,w=e.gapMode,x=me(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,N=Nn([n,t]),k=fe(fe({},x),a);return c.createElement(c.Fragment,null,d&&c.createElement(E,{sideCar:On,removeScrollBar:u,shards:f,noRelative:p,noIsolation:h,inert:v,setCallbacks:o,allowPinchZoom:!!g,lockRef:n,gapMode:w}),i?c.cloneElement(c.Children.only(s),fe(fe({},k),{ref:N})):c.createElement(y,fe({},k,{className:l,ref:N}),s))});jn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},jn.classNames={fullWidth:yn,zeroRight:bn};function Rn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var _n=function(){var e=0,t=null;return{add:function(n){var r,a;0==e&&(t=Rn())&&(a=n,(r=t).styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Tn=function(){var e,t=(e=_n(),function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},Pn={left:0,top:0,right:0,gap:0},An=function(e){return parseInt(e||"",10)||0},Dn=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Pn;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[An(n),An(r),An(a)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Mn=Tn(),Ln="data-scroll-locked",In=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(Ln,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(bn," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(yn," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(bn," .").concat(bn," {\n right: 0 ").concat(r,";\n }\n \n .").concat(yn," .").concat(yn," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Ln,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Fn=function(){var e=parseInt(document.body.getAttribute(Ln)||"0",10);return isFinite(e)?e:0},zn=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;c.useEffect(function(){return document.body.setAttribute(Ln,(Fn()+1).toString()),function(){var e=Fn()-1;e<=0?document.body.removeAttribute(Ln):document.body.setAttribute(Ln,e.toString())}},[]);var o=c.useMemo(function(){return Dn(a)},[a]);return c.createElement(Mn,{styles:In(o,!t,a,n?"":"!important")})},Bn=!1;if("undefined"!=typeof window)try{var qn=Object.defineProperty({},"passive",{get:function(){return Bn=!0,!0}});window.addEventListener("test",qn,qn),window.removeEventListener("test",qn,qn)}catch(e){Bn=!1}var Un=!!Bn&&{passive:!1},Hn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Wn=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Vn(e,r)){var a=$n(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Vn=function(e,t){return"v"===e?function(e){return Hn(e,"overflowY")}(t):function(e){return Hn(e,"overflowX")}(t)},$n=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Kn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yn=function(e){return[e.deltaX,e.deltaY]},Jn=function(e){return e&&"current"in e?e.current:e},Gn=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Xn=0,Zn=[];function Qn(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var er,tr=(er=function(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),a=c.useState(Xn++)[0],o=c.useState(Tn)[0],i=c.useRef(e);c.useEffect(function(){i.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Jn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=c.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=Kn(e),s=n.current,l="deltaX"in e?e.deltaX:s[0]-o[0],c="deltaY"in e?e.deltaY:s[1]-o[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=window.getSelection(),m=f&&f.anchorNode;if(m&&(m===u||m.contains(u)))return!1;var p=Wn(d,u);if(!p)return!0;if(p?a=d:(a="v"===d?"h":"v",p=Wn(d,u)),!p)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=a),!a)return!0;var h=r.current||a;return function(e,t,n,r,a){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,f=0;do{if(!s)break;var m=$n(e,s),p=m[0],h=m[1]-m[2]-o*p;(p||h)&&Vn(e,s)&&(d+=h,f+=p);var v=s.parentNode;s=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(a&&Math.abs(d)<1||!a&&i>d)||!u&&(a&&Math.abs(f)<1||!a&&-i>f))&&(c=!0),c}(h,t,e,"h"===h?l:c,!0)},[]),l=c.useCallback(function(e){var n=e;if(Zn.length&&Zn[Zn.length-1]===o){var r="deltaY"in n?Yn(n):Kn(n),a=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,a=r,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)n.cancelable&&n.preventDefault();else if(!a){var l=(i.current.shards||[]).map(Jn).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?s(n,l[0]):!i.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,a){var o={name:e,delta:n,target:r,should:a,shadowParent:Qn(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),d=c.useCallback(function(e){n.current=Kn(e),r.current=void 0},[]),f=c.useCallback(function(t){u(t.type,Yn(t),t.target,s(t,e.lockRef.current))},[]),m=c.useCallback(function(t){u(t.type,Kn(t),t.target,s(t,e.lockRef.current))},[]);c.useEffect(function(){return Zn.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Un),document.addEventListener("touchmove",l,Un),document.addEventListener("touchstart",d,Un),function(){Zn=Zn.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,Un),document.removeEventListener("touchmove",l,Un),document.removeEventListener("touchstart",d,Un)}},[]);var p=e.removeScrollBar,h=e.inert;return c.createElement(c.Fragment,null,h?c.createElement(o,{styles:Gn(a)}):null,p?c.createElement(zn,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},On.useMedium(er),Sn),nr=c.forwardRef(function(e,t){return c.createElement(jn,fe({},e,{ref:t,sideCar:tr}))});nr.classNames=jn.classNames;var rr=nr,ar=new WeakMap,or=new WeakMap,ir={},sr=0,lr=function(e){return e&&(e.host||lr(e.parentNode))},cr=function(e,t,n,r){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=lr(t);return n&&e.contains(n)?n:null}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);ir[n]||(ir[n]=new WeakMap);var o=ir[n],i=[],s=new Set,l=new Set(a),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,l=(ar.get(e)||0)+1,c=(o.get(e)||0)+1;ar.set(e,l),o.set(e,c),i.push(e),1===l&&a&&or.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(e){}})};return u(t),s.clear(),sr++,function(){i.forEach(function(e){var t=ar.get(e)-1,a=o.get(e)-1;ar.set(e,t),o.set(e,a),t||(or.has(e)||e.removeAttribute(r),or.delete(e)),a||e.removeAttribute(n)}),--sr||(ar=new WeakMap,ar=new WeakMap,or=new WeakMap,ir={})}},ur=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),cr(r,a,n,"aria-hidden")):function(){return null}},dr="Dialog",[fr,mr]=At(dr),[pr,hr]=fr(dr),vr=e=>{const{__scopeDialog:n,children:r,open:a,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,l=c.useRef(null),u=c.useRef(null),[d,f]=Bt({prop:a,defaultProp:o??!1,onChange:i,caller:dr});return t.jsx(pr,{scope:n,triggerRef:l,contentRef:u,contentId:Ft(),titleId:Ft(),descriptionId:Ft(),open:d,onOpenChange:f,onOpenToggle:c.useCallback(()=>f(e=>!e),[f]),modal:s,children:r})};vr.displayName=dr;var gr="DialogTrigger",br=c.forwardRef((e,n)=>{const{__scopeDialog:r,...a}=e,o=hr(gr,r),i=ft(n,o.triggerRef);return t.jsx(Vt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fr(o.open),...a,ref:i,onClick:Pt(e.onClick,o.onOpenToggle)})});br.displayName=gr;var yr="DialogPortal",[wr,xr]=fr(yr,{forceMount:void 0}),Er=e=>{const{__scopeDialog:n,forceMount:r,children:a,container:o}=e,i=hr(yr,n);return t.jsx(wr,{scope:n,forceMount:r,children:c.Children.map(a,e=>t.jsx(mn,{present:r||i.open,children:t.jsx(fn,{asChild:!0,container:o,children:e})}))})};Er.displayName=yr;var Nr="DialogOverlay",kr=c.forwardRef((e,n)=>{const r=xr(Nr,e.__scopeDialog),{forceMount:a=r.forceMount,...o}=e,i=hr(Nr,e.__scopeDialog);return i.modal?t.jsx(mn,{present:a||i.open,children:t.jsx(Or,{...o,ref:n})}):null});kr.displayName=Nr;var Sr=qt("DialogOverlay.RemoveScroll"),Or=c.forwardRef((e,n)=>{const{__scopeDialog:r,...a}=e,o=hr(Nr,r);return t.jsx(rr,{as:Sr,allowPinchZoom:!0,shards:[o.contentRef],children:t.jsx(Vt.div,{"data-state":Fr(o.open),...a,ref:n,style:{pointerEvents:"auto",...a.style}})})}),Cr="DialogContent",jr=c.forwardRef((e,n)=>{const r=xr(Cr,e.__scopeDialog),{forceMount:a=r.forceMount,...o}=e,i=hr(Cr,e.__scopeDialog);return t.jsx(mn,{present:a||i.open,children:i.modal?t.jsx(Rr,{...o,ref:n}):t.jsx(_r,{...o,ref:n})})});jr.displayName=Cr;var Rr=c.forwardRef((e,n)=>{const r=hr(Cr,e.__scopeDialog),a=c.useRef(null),o=ft(n,r.contentRef,a);return c.useEffect(()=>{const e=a.current;if(e)return ur(e)},[]),t.jsx(Tr,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pt(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Pt(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Pt(e.onFocusOutside,e=>e.preventDefault())})}),_r=c.forwardRef((e,n)=>{const r=hr(Cr,e.__scopeDialog),a=c.useRef(!1),o=c.useRef(!1);return t.jsx(Tr,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(a.current||r.triggerRef.current?.focus(),t.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(a.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const n=t.target,i=r.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),Tr=c.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,l=hr(Cr,r),u=c.useRef(null),d=ft(n,u);return vn(),t.jsxs(t.Fragment,{children:[t.jsx(an,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t.jsx(Zt,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Fr(l.open),...s,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(Ur,{titleId:l.titleId}),t.jsx(Hr,{contentRef:u,descriptionId:l.descriptionId})]})]})}),Pr="DialogTitle",Ar=c.forwardRef((e,n)=>{const{__scopeDialog:r,...a}=e,o=hr(Pr,r);return t.jsx(Vt.h2,{id:o.titleId,...a,ref:n})});Ar.displayName=Pr;var Dr="DialogDescription",Mr=c.forwardRef((e,n)=>{const{__scopeDialog:r,...a}=e,o=hr(Dr,r);return t.jsx(Vt.p,{id:o.descriptionId,...a,ref:n})});Mr.displayName=Dr;var Lr="DialogClose",Ir=c.forwardRef((e,n)=>{const{__scopeDialog:r,...a}=e,o=hr(Lr,r);return t.jsx(Vt.button,{type:"button",...a,ref:n,onClick:Pt(e.onClick,()=>o.onOpenChange(!1))})});function Fr(e){return e?"open":"closed"}Ir.displayName=Lr;var zr="DialogTitleWarning",[Br,qr]=function(e,n){const r=c.createContext(n),a=e=>{const{children:n,...a}=e,o=c.useMemo(()=>a,Object.values(a));return t.jsx(r.Provider,{value:o,children:n})};return a.displayName=e+"Provider",[a,function(t){const a=c.useContext(r);if(a)return a;if(void 0!==n)return n;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(zr,{contentName:Cr,titleName:Pr,docsSlug:"dialog"}),Ur=({titleId:e})=>{const t=qr(zr),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return c.useEffect(()=>{if(e){document.getElementById(e)}},[n,e]),null},Hr=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qr("DialogDescriptionWarning").contentName}}.`;return c.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)}},[n,e,t]),null},Wr=vr,Vr=br,$r=Er,Kr=kr,Yr=jr,Jr=Ar,Gr=Mr,Xr=Ir,Zr=Wr,Qr=$r,ea=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Kr,Object.assign({className:lt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)},r,{ref:t}))});ea.displayName=Kr.displayName;var ta=Nt("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),na=c.forwardRef(function(e,t){var n=e.side,r=void 0===n?"right":n,a=e.className,o=e.children,i=me(e,["side","className","children"]);return c.createElement(Qr,null,c.createElement(ea,null),c.createElement(Yr,Object.assign({ref:t,className:lt(ta({side:r}),a)},i),o,c.createElement(Xr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"},c.createElement(de,{className:"h-4 w-4"}),c.createElement("span",{className:"sr-only"},"Close"))))});na.displayName=Yr.displayName;var ra=function(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex flex-col space-y-2 text-center sm:text-left",t)},n))};ra.displayName="SheetHeader";var aa=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Jr,Object.assign({ref:t,className:lt("text-lg font-semibold text-foreground",n)},r))});aa.displayName=Jr.displayName;var oa=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Gr,Object.assign({ref:t,className:lt("text-sm text-muted-foreground",n)},r))});oa.displayName=Gr.displayName;const ia=["top","right","bottom","left"],sa=Math.min,la=Math.max,ca=Math.round,ua=Math.floor,da=e=>({x:e,y:e}),fa={left:"right",right:"left",bottom:"top",top:"bottom"},ma={start:"end",end:"start"};function pa(e,t,n){return la(e,sa(t,n))}function ha(e,t){return"function"==typeof e?e(t):e}function va(e){return e.split("-")[0]}function ga(e){return e.split("-")[1]}function ba(e){return"x"===e?"y":"x"}function ya(e){return"y"===e?"height":"width"}const wa=new Set(["top","bottom"]);function xa(e){return wa.has(va(e))?"y":"x"}function Ea(e){return ba(xa(e))}function Na(e){return e.replace(/start|end/g,e=>ma[e])}const ka=["left","right"],Sa=["right","left"],Oa=["top","bottom"],Ca=["bottom","top"];function ja(e,t,n,r){const a=ga(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Sa:ka:t?ka:Sa;case"left":case"right":return t?Oa:Ca;default:return[]}}(va(e),"start"===n,r);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Na)))),o}function Ra(e){return e.replace(/left|right|bottom|top/g,e=>fa[e])}function _a(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ta(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function Pa(e,t,n){let{reference:r,floating:a}=e;const o=xa(t),i=Ea(t),s=ya(i),l=va(t),c="y"===o,u=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,f=r[s]/2-a[s]/2;let m;switch(l){case"top":m={x:u,y:r.y-a.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-a.width,y:d};break;default:m={x:r.x,y:r.y}}switch(ga(t)){case"start":m[i]-=f*(n&&c?-1:1);break;case"end":m[i]+=f*(n&&c?-1:1)}return m}async function Aa(e,t){var n;void 0===t&&(t={});const{x:r,y:a,platform:o,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=ha(t,e),p=_a(m),h=s[f?"floating"===d?"reference":"floating":d],v=Ta(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(h)))||n?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),g="floating"===d?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},w=Ta(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:b,strategy:l}):g);return{top:(v.top-w.top+p.top)/y.y,bottom:(w.bottom-v.bottom+p.bottom)/y.y,left:(v.left-w.left+p.left)/y.x,right:(w.right-v.right+p.right)/y.x}}function Da(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ma(e){return ia.some(t=>e[t]>=0)}const La=new Set(["left","top"]);function Ia(){return"undefined"!=typeof window}function Fa(e){return qa(e)?(e.nodeName||"").toLowerCase():"#document"}function za(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ba(e){var t;return null==(t=(qa(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function qa(e){return!!Ia()&&(e instanceof Node||e instanceof za(e).Node)}function Ua(e){return!!Ia()&&(e instanceof Element||e instanceof za(e).Element)}function Ha(e){return!!Ia()&&(e instanceof HTMLElement||e instanceof za(e).HTMLElement)}function Wa(e){return!(!Ia()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof za(e).ShadowRoot)}const Va=new Set(["inline","contents"]);function $a(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=ao(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Va.has(a)}const Ka=new Set(["table","td","th"]);function Ya(e){return Ka.has(Fa(e))}const Ja=[":popover-open",":modal"];function Ga(e){return Ja.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Xa=["transform","translate","scale","rotate","perspective"],Za=["transform","translate","scale","rotate","perspective","filter"],Qa=["paint","layout","strict","content"];function eo(e){const t=to(),n=Ua(e)?ao(e):e;return Xa.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Za.some(e=>(n.willChange||"").includes(e))||Qa.some(e=>(n.contain||"").includes(e))}function to(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const no=new Set(["html","body","#document"]);function ro(e){return no.has(Fa(e))}function ao(e){return za(e).getComputedStyle(e)}function oo(e){return Ua(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function io(e){if("html"===Fa(e))return e;const t=e.assignedSlot||e.parentNode||Wa(e)&&e.host||Ba(e);return Wa(t)?t.host:t}function so(e){const t=io(e);return ro(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ha(t)&&$a(t)?t:so(t)}function lo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const a=so(e),o=a===(null==(r=e.ownerDocument)?void 0:r.body),i=za(a);if(o){const e=co(i);return t.concat(i,i.visualViewport||[],$a(a)?a:[],e&&n?lo(e):[])}return t.concat(a,lo(a,[],n))}function co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uo(e){const t=ao(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ha(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,s=ca(n)!==o||ca(r)!==i;return s&&(n=o,r=i),{width:n,height:r,$:s}}function fo(e){return Ua(e)?e:e.contextElement}function mo(e){const t=fo(e);if(!Ha(t))return da(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=uo(t);let i=(o?ca(n.width):n.width)/r,s=(o?ca(n.height):n.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const po=da(0);function ho(e){const t=za(e);return to()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:po}function vo(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const a=e.getBoundingClientRect(),o=fo(e);let i=da(1);t&&(r?Ua(r)&&(i=mo(r)):i=mo(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==za(e))&&t}(o,n,r)?ho(o):da(0);let l=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,u=a.width/i.x,d=a.height/i.y;if(o){const e=za(o),t=r&&Ua(r)?za(r):r;let n=e,a=co(n);for(;a&&r&&t!==n;){const e=mo(a),t=a.getBoundingClientRect(),r=ao(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=i,n=za(a),a=co(n)}}return Ta({width:u,height:d,x:l,y:c})}function go(e,t){const n=oo(e).scrollLeft;return t?t.left+n:vo(Ba(e)).left+n}function bo(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-go(e,n),y:n.top+t.scrollTop}}const yo=new Set(["absolute","fixed"]);function wo(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=za(e),r=Ba(e),a=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,s=0,l=0;if(a){o=a.width,i=a.height;const e=to();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const c=go(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(r.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else c<=25&&(o+=c);return{width:o,height:i,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ba(e),n=oo(e),r=e.ownerDocument.body,a=la(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=la(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+go(e);const s=-n.scrollTop;return"rtl"===ao(r).direction&&(i+=la(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Ba(e));else if(Ua(t))r=function(e,t){const n=vo(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Ha(e)?mo(e):da(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:r*o.y}}(t,n);else{const n=ho(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ta(r)}function xo(e,t){const n=io(e);return!(n===t||!Ua(n)||ro(n))&&("fixed"===ao(n).position||xo(n,t))}function Eo(e,t,n){const r=Ha(t),a=Ba(t),o="fixed"===n,i=vo(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=da(0);function c(){l.x=go(a)}if(r||!r&&!o)if(("body"!==Fa(t)||$a(a))&&(s=oo(t)),r){const e=vo(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();o&&!r&&a&&c();const u=!a||r||o?da(0):bo(a,s);return{x:i.left+s.scrollLeft-l.x-u.x,y:i.top+s.scrollTop-l.y-u.y,width:i.width,height:i.height}}function No(e){return"static"===ao(e).position}function ko(e,t){if(!Ha(e)||"fixed"===ao(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ba(e)===n&&(n=n.ownerDocument.body),n}function So(e,t){const n=za(e);if(Ga(e))return n;if(!Ha(e)){let t=io(e);for(;t&&!ro(t);){if(Ua(t)&&!No(t))return t;t=io(t)}return n}let r=ko(e,t);for(;r&&Ya(r)&&No(r);)r=ko(r,t);return r&&ro(r)&&No(r)&&!eo(r)?n:r||function(e){let t=io(e);for(;Ha(t)&&!ro(t);){if(eo(t))return t;if(Ga(t))return null;t=io(t)}return null}(e)||n}const Oo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o="fixed"===a,i=Ba(r),s=!!t&&Ga(t.floating);if(r===i||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=da(1);const u=da(0),d=Ha(r);if((d||!d&&!o)&&(("body"!==Fa(r)||$a(i))&&(l=oo(r)),Ha(r))){const e=vo(r);c=mo(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||d||o?da(0):bo(i,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:Ba,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const o=[..."clippingAncestors"===n?Ga(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=lo(e,[],!1).filter(e=>Ua(e)&&"body"!==Fa(e)),a=null;const o="fixed"===ao(e).position;let i=o?io(e):e;for(;Ua(i)&&!ro(i);){const t=ao(i),n=eo(i);n||"fixed"!==t.position||(a=null),(o?!n&&!a:!n&&"static"===t.position&&a&&yo.has(a.position)||$a(i)&&!n&&xo(e,i))?r=r.filter(e=>e!==i):a=t,i=io(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=o[0],s=o.reduce((e,n)=>{const r=wo(t,n,a);return e.top=la(r.top,e.top),e.right=sa(r.right,e.right),e.bottom=sa(r.bottom,e.bottom),e.left=la(r.left,e.left),e},wo(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:So,getElementRects:async function(e){const t=this.getOffsetParent||So,n=this.getDimensions,r=await n(e.floating);return{reference:Eo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=uo(e);return{width:t,height:n}},getScale:mo,isElement:Ua,isRTL:function(e){return"rtl"===ao(e).direction}};function Co(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jo(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=fo(e),u=a||o?[...c?lo(c):[],...lo(t)]:[];u.forEach(e=>{a&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,r=null;const a=Ba(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=c;if(s||t(),!f||!m)return;const p={rootMargin:-ua(d)+"px "+-ua(a.clientWidth-(u+f))+"px "+-ua(a.clientHeight-(d+m))+"px "+-ua(u)+"px",threshold:la(0,sa(1,l))||1};let h=!0;function v(t){const r=t[0].intersectionRatio;if(r!==l){if(!h)return i();r?i(!1,r):n=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==r||Co(c,e.getBoundingClientRect())||i(),h=!1}try{r=new IntersectionObserver(v,{...p,root:a.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),o}(c,n):null;let f,m=-1,p=null;i&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let h=l?vo(e):null;return l&&function t(){const r=vo(e);h&&!Co(h,r)&&n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{a&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const Ro=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:i,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:a}=e,o=await(null==r.isRTL?void 0:r.isRTL(a.floating)),i=va(n),s=ga(n),l="y"===xa(n),c=La.has(i)?-1:1,u=o&&l?-1:1,d=ha(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}(t,e);return i===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},_o=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ha(e,t),c={x:n,y:r},u=await Aa(t,l),d=xa(va(a)),f=ba(d);let m=c[f],p=c[d];if(o){const e="y"===f?"bottom":"right";m=pa(m+u["y"===f?"top":"left"],m,m-u[e])}if(i){const e="y"===d?"bottom":"right";p=pa(p+u["y"===d?"top":"left"],p,p-u[e])}const h=s.fn({...t,[f]:m,[d]:p});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:o,[d]:i}}}}}},To=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...v}=ha(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const g=va(a),b=xa(s),y=va(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(y||!h?[Ra(s)]:function(e){const t=Ra(e);return[Na(e),t,Na(t)]}(s)),E="none"!==p;!f&&E&&x.push(...ja(s,h,p,w));const N=[s,...x],k=await Aa(t,v),S=[];let O=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&S.push(k[g]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=ga(e),a=Ea(e),o=ya(a);let i="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Ra(i)),[i,Ra(i)]}(a,i,w);S.push(k[e[0]],k[e[1]])}if(O=[...O,{placement:a,overflows:S}],!S.every(e=>e<=0)){var C,j;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=N[e];if(t){if(!("alignment"===d&&b!==xa(t))||O.every(e=>xa(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:O},reset:{placement:t}}}let n=null==(j=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(m){case"bestFit":{var R;const e=null==(R=O.filter(e=>{if(E){const t=xa(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(a!==n)return{reset:{placement:n}}}return{}}}},Po=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:l=()=>{},...c}=ha(e,t),u=await Aa(t,c),d=va(a),f=ga(a),m="y"===xa(a),{width:p,height:h}=o.floating;let v,g;"top"===d||"bottom"===d?(v=d,g=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,v="end"===f?"top":"bottom");const b=h-u.top-u.bottom,y=p-u.left-u.right,w=sa(h-u[v],b),x=sa(p-u[g],y),E=!t.middlewareData.shift;let N=w,k=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(k=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(N=b),E&&!f){const e=la(u.left,0),t=la(u.right,0),n=la(u.top,0),r=la(u.bottom,0);m?k=p-2*(0!==e||0!==t?e+t:la(u.left,u.right)):N=h-2*(0!==n||0!==r?n+r:la(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:N});const S=await i.getDimensions(s.floating);return p!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},Ao=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=ha(e,t);switch(r){case"referenceHidden":{const e=Da(await Aa(t,{...a,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ma(e)}}}case"escaped":{const e=Da(await Aa(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ma(e)}}}default:return{}}}}},Do=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=ha(e,t)||{};if(null==c)return{};const d=_a(u),f={x:n,y:r},m=Ea(a),p=ya(m),h=await i.getDimensions(c),v="y"===m,g=v?"top":"left",b=v?"bottom":"right",y=v?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[m]-f[m]-o.floating[p],x=f[m]-o.reference[m],E=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c));let N=E?E[y]:0;N&&await(null==i.isElement?void 0:i.isElement(E))||(N=s.floating[y]||o.floating[p]);const k=w/2-x/2,S=N/2-h[p]/2-1,O=sa(d[g],S),C=sa(d[b],S),j=O,R=N-h[p]-C,_=N/2-h[p]/2+k,T=pa(j,_,R),P=!l.arrow&&null!=ga(a)&&_!==T&&o.reference[p]/2-(_<j?O:C)-h[p]/2<0,A=P?_<j?_-j:_-R:0;return{[m]:f[m]+A,data:{[m]:T,centerOffset:_-T-A,...P&&{alignmentOffset:A}},reset:P}}}),Mo=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=ha(e,t),u={x:n,y:r},d=xa(a),f=ba(d);let m=u[f],p=u[d];const h=ha(s,t),v="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+v.mainAxis,n=o.reference[f]+o.reference[e]-v.mainAxis;m<t?m=t:m>n&&(m=n)}if(c){var g,b;const e="y"===f?"width":"height",t=La.has(va(a)),n=o.reference[d]-o.floating[e]+(t&&(null==(g=i.offset)?void 0:g[d])||0)+(t?0:v.crossAxis),r=o.reference[d]+o.reference[e]+(t?0:(null==(b=i.offset)?void 0:b[d])||0)-(t?v.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[f]:m,[d]:p}}}},Lo=(e,t,n)=>{const r=new Map,a={platform:Oo,...n},o={...a.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,s=o.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=Pa(c,r,l),f=r,m={},p=0;for(let n=0;n<s.length;n++){const{name:o,fn:h}=s[n],{x:v,y:g,data:b,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:a,middlewareData:m,rects:c,platform:i,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=g?g:d,m={...m,[o]:{...m[o],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:u,y:d}=Pa(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:a,middlewareData:m}})(e,t,{...a,platform:o})};var Io="undefined"!=typeof document?e.useLayoutEffect:function(){};function Fo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Fo(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!==r--;){const n=a[r];if(("_owner"!==n||!e.$$typeof)&&!Fo(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function zo(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bo(e,t){const n=zo(e);return Math.round(t*n)/n}function qo(e){const t=c.useRef(e);return Io(()=>{t.current=e}),t}const Uo=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(a=n,{}.hasOwnProperty.call(a,"current"))?null!=n.current?Do({element:n.current,padding:r}).fn(t):{}:n?Do({element:n,padding:r}).fn(t):{};var a}}),Ho=(e,t)=>({...Ro(e),options:[e,t]}),Wo=(e,t)=>({..._o(e),options:[e,t]}),Vo=(e,t)=>({...Mo(e),options:[e,t]}),$o=(e,t)=>({...To(e),options:[e,t]}),Ko=(e,t)=>({...Po(e),options:[e,t]}),Yo=(e,t)=>({...Ao(e),options:[e,t]}),Jo=(e,t)=>({...Uo(e),options:[e,t]});var Go=c.forwardRef((e,n)=>{const{children:r,width:a=10,height:o=5,...i}=e;return t.jsx(Vt.svg,{...i,ref:n,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Go.displayName="Arrow";var Xo=Go;function Zo(e){const[t,n]=c.useState(void 0);return Mt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let a,o;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;n({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var Qo="Popper",[ei,ti]=At(Qo),[ni,ri]=ei(Qo),ai=e=>{const{__scopePopper:n,children:r}=e,[a,o]=c.useState(null);return t.jsx(ni,{scope:n,anchor:a,onAnchorChange:o,children:r})};ai.displayName=Qo;var oi="PopperAnchor",ii=c.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:a,...o}=e,i=ri(oi,r),s=c.useRef(null),l=ft(n,s),u=c.useRef(null);return c.useEffect(()=>{const e=u.current;u.current=a?.current||s.current,e!==u.current&&i.onAnchorChange(u.current)}),a?null:t.jsx(Vt.div,{...o,ref:l})});ii.displayName=oi;var si="PopperContent",[li,ci]=ei(si),ui=c.forwardRef((e,n)=>{const{__scopePopper:r,side:a="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:g,...b}=e,y=ri(si,r),[w,x]=c.useState(null),E=ft(n,e=>x(e)),[N,k]=c.useState(null),S=Zo(N),O=S?.width??0,C=S?.height??0,j=a+("center"!==i?"-"+i:""),R="number"==typeof m?m:{top:0,right:0,bottom:0,left:0,...m},_=Array.isArray(f)?f:[f],T=_.length>0,P={padding:R,boundary:_.filter(pi),altBoundary:T},{refs:A,floatingStyles:D,placement:M,isPositioned:L,middlewareData:I}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:l,open:d}=e,[f,m]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=c.useState(r);Fo(p,r)||h(r);const[v,g]=c.useState(null),[b,y]=c.useState(null),w=c.useCallback(e=>{e!==k.current&&(k.current=e,g(e))},[]),x=c.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),E=o||v,N=i||b,k=c.useRef(null),S=c.useRef(null),O=c.useRef(f),C=null!=l,j=qo(l),R=qo(a),_=qo(d),T=c.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:t,strategy:n,middleware:p};R.current&&(e.platform=R.current),Lo(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==_.current};P.current&&!Fo(O.current,t)&&(O.current=t,u.flushSync(()=>{m(t)}))})},[p,t,n,R,_]);Io(()=>{!1===d&&O.current.isPositioned&&(O.current.isPositioned=!1,m(e=>({...e,isPositioned:!1})))},[d]);const P=c.useRef(!1);Io(()=>(P.current=!0,()=>{P.current=!1}),[]),Io(()=>{if(E&&(k.current=E),N&&(S.current=N),E&&N){if(j.current)return j.current(E,N,T);T()}},[E,N,T,j,C]);const A=c.useMemo(()=>({reference:k,floating:S,setReference:w,setFloating:x}),[w,x]),D=c.useMemo(()=>({reference:E,floating:N}),[E,N]),M=c.useMemo(()=>{const e={position:n,left:0,top:0};if(!D.floating)return e;const t=Bo(D.floating,f.x),r=Bo(D.floating,f.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...zo(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,s,D.floating,f.x,f.y]);return c.useMemo(()=>({...f,update:T,refs:A,elements:D,floatingStyles:M}),[f,T,A,D,M])}({strategy:"fixed",placement:j,whileElementsMounted:(...e)=>jo(...e,{animationFrame:"always"===v}),elements:{reference:y.anchor},middleware:[Ho({mainAxis:o+C,alignmentAxis:s}),d&&Wo({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Vo():void 0,...P}),d&&$o({...P}),Ko({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${n}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),N&&Jo({element:N,padding:l}),hi({arrowWidth:O,arrowHeight:C}),h&&Yo({strategy:"referenceHidden",...P})]}),[F,z]=vi(M),B=$t(g);Mt(()=>{L&&B?.()},[L,B]);const q=I.arrow?.x,U=I.arrow?.y,H=0!==I.arrow?.centerOffset,[W,V]=c.useState();return Mt(()=>{w&&V(window.getComputedStyle(w).zIndex)},[w]),t.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:L?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(li,{scope:r,placedSide:F,onArrowChange:k,arrowX:q,arrowY:U,shouldHideArrow:H,children:t.jsx(Vt.div,{"data-side":F,"data-align":z,...b,ref:E,style:{...b.style,animation:L?void 0:"none"}})})})});ui.displayName=si;var di="PopperArrow",fi={top:"bottom",right:"left",bottom:"top",left:"right"},mi=c.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,o=ci(di,r),i=fi[o.placedSide];return t.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t.jsx(Xo,{...a,ref:n,style:{...a.style,display:"block"}})})});function pi(e){return null!==e}mi.displayName=di;var hi=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[l,c]=vi(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let m="",p="";return"bottom"===l?(m=o?u:`${d}px`,p=-s+"px"):"top"===l?(m=o?u:`${d}px`,p=`${r.floating.height+s}px`):"right"===l?(m=-s+"px",p=o?u:`${f}px`):"left"===l&&(m=`${r.floating.width+s}px`,p=o?u:`${f}px`),{data:{x:m,y:p}}}});function vi(e){const[t,n="center"]=e.split("-");return[t,n]}var gi=ai,bi=ii,yi=ui,wi=mi,xi=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ei=c.forwardRef((e,n)=>t.jsx(Vt.span,{...e,ref:n,style:{...xi,...e.style}}));Ei.displayName="VisuallyHidden";var Ni=Ei,[ki,Si]=At("Tooltip",[ti]),Oi=ti(),Ci="TooltipProvider",ji=700,Ri="tooltip.open",[_i,Ti]=ki(Ci),Pi=e=>{const{__scopeTooltip:n,delayDuration:r=ji,skipDelayDuration:a=300,disableHoverableContent:o=!1,children:i}=e,s=c.useRef(!0),l=c.useRef(!1),u=c.useRef(0);return c.useEffect(()=>{const e=u.current;return()=>window.clearTimeout(e)},[]),t.jsx(_i,{scope:n,isOpenDelayedRef:s,delayDuration:r,onOpen:c.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:c.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:l,onPointerInTransitChange:c.useCallback(e=>{l.current=e},[]),disableHoverableContent:o,children:i})};Pi.displayName=Ci;var Ai="Tooltip",[Di,Mi]=ki(Ai),Li=e=>{const{__scopeTooltip:n,children:r,open:a,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=e,u=Ti(Ai,e.__scopeTooltip),d=Oi(n),[f,m]=c.useState(null),p=Ft(),h=c.useRef(0),v=s??u.disableHoverableContent,g=l??u.delayDuration,b=c.useRef(!1),[y,w]=Bt({prop:a,defaultProp:o??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(Ri))):u.onClose(),i?.(e)},caller:Ai}),x=c.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),E=c.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b.current=!1,w(!0)},[w]),N=c.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),k=c.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{b.current=!0,w(!0),h.current=0},g)},[g,w]);return c.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),t.jsx(gi,{...d,children:t.jsx(Di,{scope:n,contentId:p,open:y,stateAttribute:x,trigger:f,onTriggerChange:m,onTriggerEnter:c.useCallback(()=>{u.isOpenDelayedRef.current?k():E()},[u.isOpenDelayedRef,k,E]),onTriggerLeave:c.useCallback(()=>{v?N():(window.clearTimeout(h.current),h.current=0)},[N,v]),onOpen:E,onClose:N,disableHoverableContent:v,children:r})})};Li.displayName=Ai;var Ii="TooltipTrigger",Fi=c.forwardRef((e,n)=>{const{__scopeTooltip:r,...a}=e,o=Mi(Ii,r),i=Ti(Ii,r),s=Oi(r),l=ft(n,c.useRef(null),o.onTriggerChange),u=c.useRef(!1),d=c.useRef(!1),f=c.useCallback(()=>u.current=!1,[]);return c.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),t.jsx(bi,{asChild:!0,...s,children:t.jsx(Vt.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...a,ref:l,onPointerMove:Pt(e.onPointerMove,e=>{"touch"!==e.pointerType&&(d.current||i.isPointerInTransitRef.current||(o.onTriggerEnter(),d.current=!0))}),onPointerLeave:Pt(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Pt(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Pt(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Pt(e.onBlur,o.onClose),onClick:Pt(e.onClick,o.onClose)})})});Fi.displayName=Ii;var[zi,Bi]=ki("TooltipPortal",{forceMount:void 0}),qi="TooltipContent",Ui=c.forwardRef((e,n)=>{const r=Bi(qi,e.__scopeTooltip),{forceMount:a=r.forceMount,side:o="top",...i}=e,s=Mi(qi,e.__scopeTooltip);return t.jsx(mn,{present:a||s.open,children:s.disableHoverableContent?t.jsx(Ki,{side:o,...i,ref:n}):t.jsx(Hi,{side:o,...i,ref:n})})}),Hi=c.forwardRef((e,n)=>{const r=Mi(qi,e.__scopeTooltip),a=Ti(qi,e.__scopeTooltip),o=c.useRef(null),i=ft(n,o),[s,l]=c.useState(null),{trigger:u,onClose:d}=r,f=o.current,{onPointerInTransitChange:m}=a,p=c.useCallback(()=>{l(null),m(!1)},[m]),h=c.useCallback((e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},a=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(r,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(r,n.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const r=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const r=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x)))break;n.pop()}n.push(r)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...a,...function(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}(t.getBoundingClientRect())]);l(o),m(!0)},[m]);return c.useEffect(()=>()=>p(),[p]),c.useEffect(()=>{if(u&&f){const e=e=>h(e,f),t=e=>h(e,u);return u.addEventListener("pointerleave",e),f.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),f.removeEventListener("pointerleave",t)}}},[u,f,h,p]),c.useEffect(()=>{if(s){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||f?.contains(t),a=!function(e,t){const{x:n,y:r}=e;let a=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){const i=t[e],s=t[o],l=i.x,c=i.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(a=!a)}return a}(n,s);r?p():a&&(p(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[u,f,s,d,p]),t.jsx(Ki,{...e,ref:i})}),[Wi,Vi]=ki(Ai,{isInside:!1}),$i=function(e){const n=({children:e})=>t.jsx(t.Fragment,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=Ht,n}("TooltipContent"),Ki=c.forwardRef((e,n)=>{const{__scopeTooltip:r,children:a,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...l}=e,u=Mi(qi,r),d=Oi(r),{onClose:f}=u;return c.useEffect(()=>(document.addEventListener(Ri,f),()=>document.removeEventListener(Ri,f)),[f]),c.useEffect(()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&f()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[u.trigger,f]),t.jsx(Zt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:t.jsxs(yi,{"data-state":u.stateAttribute,...d,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx($i,{children:a}),t.jsx(Wi,{scope:r,isInside:!0,children:t.jsx(Ni,{id:u.contentId,role:"tooltip",children:o||a})})]})})});Ui.displayName=qi;var Yi="TooltipArrow";c.forwardRef((e,n)=>{const{__scopeTooltip:r,...a}=e,o=Oi(r);return Vi(Yi,r).isInside?null:t.jsx(wi,{...o,...a,ref:n})}).displayName=Yi;var Ji=Ui,Gi=Pi,Xi=Li,Zi=Fi,Qi=c.forwardRef(function(e,t){var n=e.className,r=e.sideOffset,a=void 0===r?4:r,o=me(e,["className","sideOffset"]);return c.createElement(Ji,Object.assign({ref:t,sideOffset:a,className:lt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",n)},o))});Qi.displayName=Ji.displayName;var es=c.createContext(null);function ts(){var e=c.useContext(es);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function ns(e){var t=e.defaultOpen,n=void 0===t||t,r=e.open,a=e.onOpenChange,o=e.className,i=e.style,s=e.children,l=me(e,["defaultOpen","open","onOpenChange","className","style","children"]),u=function(){var e=R(c.useState(void 0),2),t=e[0],n=e[1];return c.useEffect(function(){var e=window.matchMedia("(max-width: ".concat(767,"px)")),t=function(){n(window.innerWidth<768)};return e.addEventListener("change",t),n(window.innerWidth<768),function(){return e.removeEventListener("change",t)}},[]),!!t}(),d=R(c.useState(!1),2),f=d[0],m=d[1],p=R(c.useState(n),2),h=p[0],v=p[1],g=null!=r?r:h,b=c.useCallback(function(e){var t="function"==typeof e?e(g):e;a?a(t):v(t),document.cookie="".concat("sidebar_state","=").concat(t,"; path=/; max-age=").concat(604800)},[a,g]),y=c.useCallback(function(){return u?m(function(e){return!e}):b(function(e){return!e})},[u,b,m]);c.useEffect(function(){var e=function(e){"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[y]);var w=g?"expanded":"collapsed",x=c.useMemo(function(){return{state:w,open:g,setOpen:b,isMobile:u,openMobile:f,setOpenMobile:m,toggleSidebar:y}},[w,g,b,u,f,m,y]);return c.createElement(es.Provider,{value:x},c.createElement(Gi,{delayDuration:0},c.createElement("div",Object.assign({style:Object.assign({"--sidebar-width":"16rem","--sidebar-width-icon":"3rem"},i),className:lt("group/sidebar-wrapper flex min-h-svh w-full",o)},l),s)))}function rs(e){var t=e.side,n=void 0===t?"left":t,r=e.variant,a=void 0===r?"sidebar":r,o=e.collapsible,i=void 0===o?"offcanvas":o,s=e.className,l=e.children,u=me(e,["side","variant","collapsible","className","children"]),d=ts(),f=d.isMobile,m=d.state,p=d.openMobile,h=d.setOpenMobile;return"none"===i?c.createElement("div",Object.assign({className:lt("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",s)},u),l):f?c.createElement(Zr,Object.assign({open:p,onOpenChange:h},u),c.createElement(na,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:n},c.createElement(ra,{className:"sr-only"},c.createElement(aa,null,"Sidebar"),c.createElement(oa,null,"Displays the mobile sidebar.")),c.createElement("div",{className:"flex h-full w-full flex-col"},l))):c.createElement("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":"collapsed"===m?i:"","data-variant":a,"data-side":n},c.createElement("div",{className:lt("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),c.createElement("div",Object.assign({className:lt("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===n?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",s)},u),c.createElement("div",{className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"},l)))}function as(e){var t=e.className,n=e.onClick,r=me(e,["className","onClick"]),a=ts().toggleSidebar;return c.createElement(St,Object.assign({variant:"ghost",size:"icon",className:lt("h-7 w-7",t),onClick:function(e){null==n||n(e),a()}},r),c.createElement(ne,null),c.createElement("span",{className:"sr-only"},"Toggle Sidebar"))}function os(e){var t=e.className,n=me(e,["className"]);return c.createElement("main",Object.assign({className:lt("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t)},n))}function is(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex flex-col gap-2 p-2",t)},n))}function ss(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex flex-col gap-2 p-2",t)},n))}function ls(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t)},n))}function cs(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("relative flex w-full min-w-0 flex-col p-2",t)},n))}function us(e){var t=e.className,n=e.asChild,r=void 0!==n&&n,a=me(e,["className","asChild"]),o=r?gt:"div";return c.createElement(o,Object.assign({className:lt("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t)},a))}function ds(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("w-full text-sm",t)},n))}function fs(e){var t=e.className,n=me(e,["className"]);return c.createElement("ul",Object.assign({className:lt("flex w-full min-w-0 flex-col gap-1",t)},n))}function ms(e){var t=e.className,n=me(e,["className"]);return c.createElement("li",Object.assign({className:lt("group/menu-item relative",t)},n))}var ps=Nt("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function hs(e){var t=e.asChild,n=void 0!==t&&t,r=e.isActive,a=void 0!==r&&r,o=e.variant,i=void 0===o?"default":o,s=e.size,l=void 0===s?"default":s,u=e.tooltip,d=e.className,f=me(e,["asChild","isActive","variant","size","tooltip","className"]),m=n?gt:"button",p=ts(),h=p.isMobile,v=p.state,g=c.createElement(m,Object.assign({"data-size":l,"data-active":a,className:lt(ps({variant:i,size:l}),d)},f));return u?("string"==typeof u&&(u={children:u}),c.createElement(Xi,null,c.createElement(Zi,{asChild:!0},g),c.createElement(Qi,Object.assign({side:"right",align:"center",hidden:"collapsed"!==v||h},u)))):g}var vs=c.forwardRef((e,n)=>t.jsx(Ct.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));vs.displayName="Label";var gs=vs,bs=Nt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ys=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(gs,Object.assign({ref:t,className:lt(bs(),n)},r))});ys.displayName=gs.displayName;var ws=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("rounded-lg border bg-card text-card-foreground shadow-sm",n)},r))});ws.displayName="Card";var xs=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("flex flex-col space-y-1.5 p-6",n)},r))});xs.displayName="CardHeader";var Es=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("text-2xl font-semibold leading-none tracking-tight",n)},r))});Es.displayName="CardTitle";var Ns=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("text-sm text-muted-foreground",n)},r))});Ns.displayName="CardDescription";var ks=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("p-6 pt-0",n)},r))});ks.displayName="CardContent",c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",Object.assign({ref:t,className:lt("flex items-center p-6 pt-0",n)},r))}).displayName="CardFooter";var Ss={items:[],config:Object.assign({},{top:24,duration:3,maxCount:5})},Os=new Set;function Cs(){Os.forEach(function(e){return e(Ss.items.slice())})}function js(t){switch(t){case"success":return e.createElement(B,null);case"error":return e.createElement(ue,null);case"warning":return e.createElement(z,null);case"loading":return e.createElement(Z,{className:"animate-spin"});default:return e.createElement(X,null)}}function Rs(e){var t,n,r;As();var a=Date.now(),o=null!==(t=e.key)&&void 0!==t?t:"msg_".concat(a,"_").concat(Math.random().toString(36).slice(2)),i=Ss.items.findIndex(function(e){return e.key===o}),s={key:o,content:e.content,duration:null!==(n=e.duration)&&void 0!==n?n:Ss.config.duration,type:e.type,onClose:e.onClose,icon:null!==(r=e.icon)&&void 0!==r?r:js(e.type),className:e.className,createdAt:a};return i>=0?Ss.items[i]=Object.assign({},Ss.items[i],s):(Ss.items.length>=Ss.config.maxCount&&Ss.items.shift(),Ss.items.push(s)),Cs(),s.duration>0&&"loading"!==s.type&&window.setTimeout(function(){_s(o)},1e3*s.duration),{close:function(){return _s(o)}}}function _s(e){var t;if(void 0===e)return Ss.items.forEach(function(e){var t;return null===(t=e.onClose)||void 0===t?void 0:t.call(e)}),Ss.items=[],void Cs();var n=Ss.items.findIndex(function(t){return t.key===e});if(n>=0){var r=R(Ss.items.splice(n,1),1)[0];null===(t=null==r?void 0:r.onClose)||void 0===t||t.call(r),Cs()}}var Ts=null,Ps=null;function As(){"undefined"!=typeof window&&(Ps||((Ps=document.createElement("div")).setAttribute("data-custom-message-holder",""),document.body.appendChild(Ps)),Ts||(Ts=r.createRoot(Ps)).render(e.createElement(Ds,null)))}function Ds(){var t=function(){var t=R(e.useState(Ss.items),2),n=t[0],r=t[1];return e.useEffect(function(){var e=r;return Os.add(e),function(){Os.delete(e)}},[]),n}(),n=Ss.config.top;return e.createElement("div",{className:"fixed left-1/2 -translate-x-1/2 z-[1000] w-80 pointer-events-none",style:{top:n}},e.createElement("div",{className:"mx-auto flex w-full max-w-xl flex-col items-center gap-2 px-4"},t.map(function(t){var n,r,a=function(e){switch(e){case"success":return{container:"border-green-200 bg-green-50/90 text-green-800 border-l-4 border-l-green-500",icon:"text-green-500",text:"text-green-800"};case"error":return{container:"border-red-200 bg-red-50/90 text-red-800 border-l-4 border-l-red-500",icon:"text-red-500",text:"text-red-800"};case"warning":return{container:"border-yellow-200 bg-yellow-50/90 text-yellow-800 border-l-4 border-l-yellow-500",icon:"text-yellow-500",text:"text-yellow-800"};default:return{container:"border-blue-200 bg-blue-50/90 text-blue-800 border-l-4 border-l-blue-500",icon:"text-blue-500",text:"text-blue-800"}}}(t.type);return e.createElement("div",{key:t.key,className:"pointer-events-auto flex w-full items-center gap-2 rounded-md border px-3 py-2 backdrop-blur ".concat(a.container," ").concat(null!==(n=t.className)&&void 0!==n?n:"")},e.createElement("span",{className:"text-[18px] leading-none ".concat(a.icon)},null!==(r=t.icon)&&void 0!==r?r:js(t.type)),e.createElement("div",{className:"min-w-0 flex-1 text-[14px] leading-normal ".concat(a.text)},"string"==typeof t.content?e.createElement("span",{className:"break-words align-middle"},t.content):t.content))})))}function Ms(t,n,r,a){if(e.isValidElement(n)||"string"==typeof n||"number"==typeof n)return{type:t,content:n,duration:r,onClose:a};var o=n;return Object.assign({},o,{type:t})}var Ls,Is,Fs=(Is={open:function(e){var t;return Rs(Object.assign({},e,{type:null!==(t=e.type)&&void 0!==t?t:"info"}))},info:function(e,t,n){return Rs(Ms("info",e,t,n))},success:function(e,t,n){return Rs(Ms("success",e,t,n))},error:function(e,t,n){return Rs(Ms("error",e,t,n))},warning:function(e,t,n){return Rs(Ms("warning",e,t,n))},loading:function(e,t,n){return Rs(Ms("loading",e,null!=t?t:0,n))},destroy:function(e){return _s(e)},config:function(e){return t=e,Ss.config=Object.assign({},Ss.config,t),void Cs();var t},useMessage:function(){var t=e.useMemo(function(){return"undefined"!=typeof window&&As(),e.createElement(e.Fragment,null)},[]);return[Ls.current,t]}},(Ls={}).current=Is,Is);function zs(e,t){return function(){return e.apply(t,arguments)}}var Bs,qs=Object.prototype.toString,Us=Object.getPrototypeOf,Hs=Symbol.iterator,Ws=Symbol.toStringTag,Vs=(Bs=Object.create(null),function(e){var t=qs.call(e);return Bs[t]||(Bs[t]=t.slice(8,-1).toLowerCase())}),$s=function(e){return e=e.toLowerCase(),function(t){return Vs(t)===e}},Ks=function(e){return function(t){return P(t)===e}},Ys=Array.isArray,Js=Ks("undefined");function Gs(e){return null!==e&&!Js(e)&&null!==e.constructor&&!Js(e.constructor)&&Qs(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Xs=$s("ArrayBuffer");var Zs=Ks("string"),Qs=Ks("function"),el=Ks("number"),tl=function(e){return null!==e&&"object"===P(e)},nl=function(e){if("object"!==Vs(e))return!1;var t=Us(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ws in e||Hs in e)},rl=$s("Date"),al=$s("File"),ol=$s("Blob"),il=$s("FileList"),sl=$s("URLSearchParams"),ll=R(["ReadableStream","Request","Response","Headers"].map($s),4),cl=ll[0],ul=ll[1],dl=ll[2],fl=ll[3];function ml(e,t){var n,r,a=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,o=void 0!==a&&a;if(null!=e)if("object"!==P(e)&&(e=[e]),Ys(e))for(n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else{if(Gs(e))return;var i,s=o?Object.getOwnPropertyNames(e):Object.keys(e),l=s.length;for(n=0;n<l;n++)i=s[n],t.call(null,e[i],i,e)}}function pl(e,t){if(Gs(e))return null;t=t.toLowerCase();for(var n,r=Object.keys(e),a=r.length;a-- >0;)if(t===(n=r[a]).toLowerCase())return n;return null}var hl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,vl=function(e){return!Js(e)&&e!==hl};var gl,bl=(gl="undefined"!=typeof Uint8Array&&Us(Uint8Array),function(e){return gl&&e instanceof gl}),yl=$s("HTMLFormElement"),wl=function(){var e=Object.prototype.hasOwnProperty;return function(t,n){return e.call(t,n)}}(),xl=$s("RegExp"),El=function(e,t){var n=Object.getOwnPropertyDescriptors(e),r={};ml(n,function(n,a){var o;!1!==(o=t(n,a,e))&&(r[a]=o||n)}),Object.defineProperties(e,r)};var Nl,kl,Sl,Ol,Cl=$s("AsyncFunction"),jl=(Nl="function"==typeof setImmediate,kl=Qs(hl.postMessage),Nl?setImmediate:kl?(Sl="axios@".concat(Math.random()),Ol=[],hl.addEventListener("message",function(e){var t=e.source,n=e.data;t===hl&&n===Sl&&Ol.length&&Ol.shift()()},!1),function(e){Ol.push(e),hl.postMessage(Sl,"*")}):function(e){return setTimeout(e)}),Rl="undefined"!=typeof queueMicrotask?queueMicrotask.bind(hl):"undefined"!=typeof process&&process.nextTick||jl,_l={isArray:Ys,isArrayBuffer:Xs,isBuffer:Gs,isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||Qs(e.append)&&("formdata"===(t=Vs(e))||"object"===t&&Qs(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xs(e.buffer)},isString:Zs,isNumber:el,isBoolean:function(e){return!0===e||!1===e},isObject:tl,isPlainObject:nl,isEmptyObject:function(e){if(!tl(e)||Gs(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:cl,isRequest:ul,isResponse:dl,isHeaders:fl,isUndefined:Js,isDate:rl,isFile:al,isBlob:ol,isRegExp:xl,isFunction:Qs,isStream:function(e){return tl(e)&&Qs(e.pipe)},isURLSearchParams:sl,isTypedArray:bl,isFileList:il,forEach:ml,merge:function e(){for(var t=vl(this)&&this||{},n=t.caseless,r=t.skipUndefined,a={},o=function(t,o){var i=n&&pl(a,o)||o;nl(a[i])&&nl(t)?a[i]=e(a[i],t):nl(t)?a[i]=e({},t):Ys(t)?a[i]=t.slice():r&&Js(t)||(a[i]=t)},i=0,s=arguments.length;i<s;i++)arguments[i]&&ml(arguments[i],o);return a},extend:function(e,t,n){return ml(t,function(t,r){n&&Qs(t)?e[r]=zs(t,n):e[r]=t},{allOwnKeys:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var a,o,i,s={};if(t=t||{},null==e)return t;do{for(o=(a=Object.getOwnPropertyNames(e)).length;o-- >0;)i=a[o],r&&!r(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==n&&Us(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Vs,kindOfTest:$s,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(Ys(e))return e;var t=e.length;if(!el(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},forEachEntry:function(e,t){for(var n,r=(e&&e[Hs]).call(e);(n=r.next())&&!n.done;){var a=n.value;t.call(e,a[0],a[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:yl,hasOwnProperty:wl,hasOwnProp:wl,reduceDescriptors:El,freezeMethods:function(e){El(e,function(t,n){if(Qs(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;var r=e[n];Qs(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:function(e,t){var n={},r=function(e){e.forEach(function(e){n[e]=!0})};return Ys(e)?r(e):r(String(e).split(t)),n},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:pl,global:hl,isContextDefined:vl,isSpecCompliantForm:function(e){return!!(e&&Qs(e.append)&&"FormData"===e[Ws]&&e[Hs])},toJSONObject:function(e){var t=new Array(10),n=function(e,r){if(tl(e)){if(t.indexOf(e)>=0)return;if(Gs(e))return e;if(!("toJSON"in e)){t[r]=e;var a=Ys(e)?[]:{};return ml(e,function(e,t){var o=n(e,r+1);!Js(o)&&(a[t]=o)}),t[r]=void 0,a}}return e};return n(e,0)},isAsyncFn:Cl,isThenable:function(e){return e&&(tl(e)||Qs(e))&&Qs(e.then)&&Qs(e.catch)},setImmediate:jl,asap:Rl,isIterable:function(e){return null!=e&&Qs(e[Hs])}};function Tl(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}_l.inherits(Tl,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_l.toJSONObject(this.config),code:this.code,status:this.status}}});var Pl=Tl.prototype,Al={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(e){Al[e]={value:e}}),Object.defineProperties(Tl,Al),Object.defineProperty(Pl,"isAxiosError",{value:!0}),Tl.from=function(e,t,n,r,a,o){var i=Object.create(Pl);_l.toFlatObject(e,i,function(e){return e!==Error.prototype},function(e){return"isAxiosError"!==e});var s=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Tl.call(i,s,l,n,r,a),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function Dl(e){return _l.isPlainObject(e)||_l.isArray(e)}function Ml(e){return _l.endsWith(e,"[]")?e.slice(0,-2):e}function Ll(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ml(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}var Il=_l.toFlatObject(_l,{},null,function(e){return/^is[A-Z]/.test(e)});function Fl(e,t,n){if(!_l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var r=(n=_l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!_l.isUndefined(t[e])})).metaTokens,a=n.visitor||c,o=n.dots,i=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_l.isSpecCompliantForm(t);if(!_l.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(_l.isDate(e))return e.toISOString();if(_l.isBoolean(e))return e.toString();if(!s&&_l.isBlob(e))throw new Tl("Blob is not supported. Use a Buffer instead.");return _l.isArrayBuffer(e)||_l.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,a){var s=e;if(e&&!a&&"object"===P(e))if(_l.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(_l.isArray(e)&&function(e){return _l.isArray(e)&&!e.some(Dl)}(e)||(_l.isFileList(e)||_l.endsWith(n,"[]"))&&(s=_l.toArray(e)))return n=Ml(n),s.forEach(function(e,r){!_l.isUndefined(e)&&null!==e&&t.append(!0===i?Ll([n],r,o):null===i?n:n+"[]",l(e))}),!1;return!!Dl(e)||(t.append(Ll(a,n,o),l(e)),!1)}var u=[],d=Object.assign(Il,{defaultVisitor:c,convertValue:l,isVisitable:Dl});if(!_l.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!_l.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),_l.forEach(n,function(n,o){!0===(!(_l.isUndefined(n)||null===n)&&a.call(t,n,_l.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function zl(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Bl(e,t){this._pairs=[],e&&Fl(e,this,t)}var ql=Bl.prototype;function Ul(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hl(e,t,n){if(!t)return e;var r=n&&n.encode||Ul;_l.isFunction(n)&&(n={serialize:n});var a,o=n&&n.serialize;if(a=o?o(t,n):_l.isURLSearchParams(t)?t.toString():new Bl(t,n).toString(r)){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}ql.append=function(e,t){this._pairs.push([e,t])},ql.toString=function(e){var t=e?function(t){return e.call(this,t,zl)}:zl;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Wl=function(){return x(function e(){y(this,e),this.handlers=[]},[{key:"use",value:function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){_l.forEach(this.handlers,function(t){null!==t&&e(t)})}}])}(),Vl=Wl,$l={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Kl={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Bl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Yl="undefined"!=typeof window&&"undefined"!=typeof document,Jl="object"===("undefined"==typeof navigator?"undefined":P(navigator))&&navigator||void 0,Gl=Yl&&(!Jl||["ReactNative","NativeScript","NS"].indexOf(Jl.product)<0),Xl="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Zl=Yl&&window.location.href||"http://localhost",Ql=S(S({},Object.freeze({__proto__:null,hasBrowserEnv:Yl,hasStandardBrowserEnv:Gl,hasStandardBrowserWebWorkerEnv:Xl,navigator:Jl,origin:Zl})),Kl);function ec(e){function t(e,n,r,a){var o=e[a++];if("__proto__"===o)return!0;var i=Number.isFinite(+o),s=a>=e.length;return o=!o&&_l.isArray(r)?r.length:o,s?(_l.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i):(r[o]&&_l.isObject(r[o])||(r[o]=[]),t(e,n,r[o],a)&&_l.isArray(r[o])&&(r[o]=function(e){var t,n,r={},a=Object.keys(e),o=a.length;for(t=0;t<o;t++)r[n=a[t]]=e[n];return r}(r[o])),!i)}if(_l.isFormData(e)&&_l.isFunction(e.entries)){var n={};return _l.forEachEntry(e,function(e,r){t(function(e){return _l.matchAll(/\w+|\[(\w*)]/g,e).map(function(e){return"[]"===e[0]?"":e[1]||e[0]})}(e),r,n,0)}),n}return null}var tc={transitional:$l,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){var n,r=t.getContentType()||"",a=r.indexOf("application/json")>-1,o=_l.isObject(e);if(o&&_l.isHTMLForm(e)&&(e=new FormData(e)),_l.isFormData(e))return a?JSON.stringify(ec(e)):e;if(_l.isArrayBuffer(e)||_l.isBuffer(e)||_l.isStream(e)||_l.isFile(e)||_l.isBlob(e)||_l.isReadableStream(e))return e;if(_l.isArrayBufferView(e))return e.buffer;if(_l.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Fl(e,new Ql.classes.URLSearchParams,S({visitor:function(e,t,n,r){return Ql.isNode&&_l.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=_l.isFileList(e))||r.indexOf("multipart/form-data")>-1){var i=this.env&&this.env.FormData;return Fl(n?{"files[]":e}:e,i&&new i,this.formSerializer)}}return o||a?(t.setContentType("application/json",!1),function(e,t,n){if(_l.isString(e))try{return(t||JSON.parse)(e),_l.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||tc.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(_l.isResponse(e)||_l.isReadableStream(e))return e;if(e&&_l.isString(e)&&(n&&!this.responseType||r)){var a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(a){if("SyntaxError"===e.name)throw Tl.from(e,Tl.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ql.classes.FormData,Blob:Ql.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_l.forEach(["delete","get","head","post","put","patch"],function(e){tc.headers[e]={}});var nc=tc,rc=_l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ac=Symbol("internals");function oc(e){return e&&String(e).trim().toLowerCase()}function ic(e){return!1===e||null==e?e:_l.isArray(e)?e.map(ic):String(e)}function sc(e,t,n,r,a){return _l.isFunction(r)?r.call(this,t,n):(a&&(t=n),_l.isString(t)?_l.isString(r)?-1!==t.indexOf(r):_l.isRegExp(r)?r.test(t):void 0:void 0)}var lc=function(){return x(function e(t){y(this,e),t&&this.set(t)},[{key:"set",value:function(e,t,n){var r=this;function a(e,t,n){var a=oc(t);if(!a)throw new Error("header name must be a non-empty string");var o=_l.findKey(r,a);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=ic(e))}var o=function(e,t){return _l.forEach(e,function(e,n){return a(e,n,t)})};if(_l.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(_l.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o(function(e){var t,n,r,a={};return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),t=e.substring(0,r).trim().toLowerCase(),n=e.substring(r+1).trim(),!t||a[t]&&rc[t]||("set-cookie"===t?a[t]?a[t].push(n):a[t]=[n]:a[t]=a[t]?a[t]+", "+n:n)}),a}(e),t);else if(_l.isObject(e)&&_l.isIterable(e)){var i,s,l,c={},u=E(e);try{for(u.s();!(l=u.n()).done;){var d=l.value;if(!_l.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[s=d[0]]=(i=c[s])?_l.isArray(i)?[].concat(_(i),[d[1]]):[i,d[1]]:d[1]}}catch(e){u.e(e)}finally{u.f()}o(c,t)}else null!=e&&a(t,e,n);return this}},{key:"get",value:function(e,t){if(e=oc(e)){var n=_l.findKey(this,e);if(n){var r=this[n];if(!t)return r;if(!0===t)return function(e){for(var t,n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=r.exec(e);)n[t[1]]=t[2];return n}(r);if(_l.isFunction(t))return t.call(this,r,n);if(_l.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=oc(e)){var n=_l.findKey(this,e);return!(!n||void 0===this[n]||t&&!sc(0,this[n],n,t))}return!1}},{key:"delete",value:function(e,t){var n=this,r=!1;function a(e){if(e=oc(e)){var a=_l.findKey(n,e);!a||t&&!sc(0,n[a],a,t)||(delete n[a],r=!0)}}return _l.isArray(e)?e.forEach(a):a(e),r}},{key:"clear",value:function(e){for(var t=Object.keys(this),n=t.length,r=!1;n--;){var a=t[n];e&&!sc(0,this[a],a,e,!0)||(delete this[a],r=!0)}return r}},{key:"normalize",value:function(e){var t=this,n={};return _l.forEach(this,function(r,a){var o=_l.findKey(n,a);if(o)return t[o]=ic(r),void delete t[a];var i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})}(a):String(a).trim();i!==a&&delete t[a],t[i]=ic(r),n[i]=!0}),this}},{key:"concat",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=this.constructor).concat.apply(e,[this].concat(n))}},{key:"toJSON",value:function(e){var t=Object.create(null);return _l.forEach(this,function(n,r){null!=n&&!1!==n&&(t[r]=e&&_l.isArray(n)?n.join(", "):n)}),t}},{key:Symbol.iterator,value:function(){return Object.entries(this.toJSON())[Symbol.iterator]()}},{key:"toString",value:function(){return Object.entries(this.toJSON()).map(function(e){var t=R(e,2);return t[0]+": "+t[1]}).join("\n")}},{key:"getSetCookie",value:function(){return this.get("set-cookie")||[]}},{key:Symbol.toStringTag,get:function(){return"AxiosHeaders"}}],[{key:"from",value:function(e){return e instanceof this?e:new this(e)}},{key:"concat",value:function(e){for(var t=new this(e),n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.forEach(function(e){return t.set(e)}),t}},{key:"accessor",value:function(e){var t=(this[ac]=this[ac]={accessors:{}}).accessors,n=this.prototype;function r(e){var r=oc(e);t[r]||(!function(e,t){var n=_l.toCamelCase(" "+t);["get","set","has"].forEach(function(r){Object.defineProperty(e,r+n,{value:function(e,n,a){return this[r].call(this,t,e,n,a)},configurable:!0})})}(n,e),t[r]=!0)}return _l.isArray(e)?e.forEach(r):r(e),this}}])}();lc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_l.reduceDescriptors(lc.prototype,function(e,t){var n=e.value,r=t[0].toUpperCase()+t.slice(1);return{get:function(){return n},set:function(e){this[r]=e}}}),_l.freezeMethods(lc);var cc=lc;function uc(e,t){var n=this||nc,r=t||n,a=cc.from(r.headers),o=r.data;return _l.forEach(e,function(e){o=e.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function dc(e){return!(!e||!e.__CANCEL__)}function fc(e,t,n){Tl.call(this,null==e?"canceled":e,Tl.ERR_CANCELED,t,n),this.name="CanceledError"}function mc(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Tl("Request failed with status code "+n.status,[Tl.ERR_BAD_REQUEST,Tl.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}_l.inherits(fc,Tl,{__CANCEL__:!0});var pc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=0,a=function(e,t){e=e||10;var n,r=new Array(e),a=new Array(e),o=0,i=0;return t=void 0!==t?t:1e3,function(s){var l=Date.now(),c=a[i];n||(n=l),r[o]=s,a[o]=l;for(var u=i,d=0;u!==o;)d+=r[u++],u%=e;if((o=(o+1)%e)===i&&(i=(i+1)%e),!(l-n<t)){var f=c&&l-c;return f?Math.round(1e3*d/f):void 0}}}(50,250);return function(e,t){var n,r,a=0,o=1e3/t,i=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();a=o,n=null,r&&(clearTimeout(r),r=null),e.apply(void 0,_(t))};return[function(){for(var e=Date.now(),t=e-a,s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];t>=o?i(l,e):(n=l,r||(r=setTimeout(function(){r=null,i(n)},o-t)))},function(){return n&&i(n)}]}(function(n){var o=n.loaded,i=n.lengthComputable?n.total:void 0,s=o-r,l=a(s);r=o;var c=N({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:l||void 0,estimated:l&&i&&o<=i?(i-o)/l:void 0,event:n,lengthComputable:null!=i},t?"download":"upload",!0);e(c)},n)},hc=function(e,t){var n=null!=e;return[function(r){return t[0]({lengthComputable:n,total:e,loaded:r})},t[1]]},vc=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return _l.asap(function(){return e.apply(void 0,n)})}},gc=Ql.hasStandardBrowserEnv?function(e,t){return function(n){return n=new URL(n,Ql.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)}}(new URL(Ql.origin),Ql.navigator&&/(msie|trident)/i.test(Ql.navigator.userAgent)):function(){return!0},bc=Ql.hasStandardBrowserEnv?{write:function(e,t,n,r,a,o,i){if("undefined"!=typeof document){var s=["".concat(e,"=").concat(encodeURIComponent(t))];_l.isNumber(n)&&s.push("expires=".concat(new Date(n).toUTCString())),_l.isString(r)&&s.push("path=".concat(r)),_l.isString(a)&&s.push("domain=".concat(a)),!0===o&&s.push("secure"),_l.isString(i)&&s.push("SameSite=".concat(i)),document.cookie=s.join("; ")}},read:function(e){if("undefined"==typeof document)return null;var t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove:function(e){this.write(e,"",Date.now()-864e5,"/")}}:{write:function(){},read:function(){return null},remove:function(){}};function yc(e,t,n){var r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var wc=function(e){return e instanceof cc?S({},e):e};function xc(e,t){t=t||{};var n={};function r(e,t,n,r){return _l.isPlainObject(e)&&_l.isPlainObject(t)?_l.merge.call({caseless:r},e,t):_l.isPlainObject(t)?_l.merge({},t):_l.isArray(t)?t.slice():t}function a(e,t,n,a){return _l.isUndefined(t)?_l.isUndefined(e)?void 0:r(void 0,e,0,a):r(e,t,0,a)}function o(e,t){if(!_l.isUndefined(t))return r(void 0,t)}function i(e,t){return _l.isUndefined(t)?_l.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,a,o){return o in t?r(n,a):o in e?r(void 0,n):void 0}var l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:function(e,t,n){return a(wc(e),wc(t),0,!0)}};return _l.forEach(Object.keys(S(S({},e),t)),function(r){var o=l[r]||a,i=o(e[r],t[r],r);_l.isUndefined(i)&&o!==s||(n[r]=i)}),n}var Ec,Nc=function(e){var t=xc({},e),n=t.data,r=t.withXSRFToken,a=t.xsrfHeaderName,o=t.xsrfCookieName,i=t.headers,s=t.auth;if(t.headers=i=cc.from(i),t.url=Hl(yc(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),_l.isFormData(n))if(Ql.hasStandardBrowserEnv||Ql.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(_l.isFunction(n.getHeaders)){var l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(function(e){var t=R(e,2),n=t[0],r=t[1];c.includes(n.toLowerCase())&&i.set(n,r)})}if(Ql.hasStandardBrowserEnv&&(r&&_l.isFunction(r)&&(r=r(t)),r||!1!==r&&gc(t.url))){var u=a&&o&&bc.read(o);u&&i.set(a,u)}return t},kc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){var r,a,o,i,s,l=Nc(e),c=l.data,u=cc.from(l.headers).normalize(),d=l.responseType,f=l.onUploadProgress,m=l.onDownloadProgress;function p(){i&&i(),s&&s(),l.cancelToken&&l.cancelToken.unsubscribe(r),l.signal&&l.signal.removeEventListener("abort",r)}var h=new XMLHttpRequest;function v(){if(h){var r=cc.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());mc(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}}if(h.open(l.method.toUpperCase(),l.url,!0),h.timeout=l.timeout,"onloadend"in h?h.onloadend=v:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(v)},h.onabort=function(){h&&(n(new Tl("Request aborted",Tl.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){var r=new Tl(t&&t.message?t.message:"Network Error",Tl.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){var t=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",r=l.transitional||$l;l.timeoutErrorMessage&&(t=l.timeoutErrorMessage),n(new Tl(t,r.clarifyTimeoutError?Tl.ETIMEDOUT:Tl.ECONNABORTED,e,h)),h=null},void 0===c&&u.setContentType(null),"setRequestHeader"in h&&_l.forEach(u.toJSON(),function(e,t){h.setRequestHeader(t,e)}),_l.isUndefined(l.withCredentials)||(h.withCredentials=!!l.withCredentials),d&&"json"!==d&&(h.responseType=l.responseType),m){var g=R(pc(m,!0),2);o=g[0],s=g[1],h.addEventListener("progress",o)}if(f&&h.upload){var b=R(pc(f),2);a=b[0],i=b[1],h.upload.addEventListener("progress",a),h.upload.addEventListener("loadend",i)}(l.cancelToken||l.signal)&&(r=function(t){h&&(n(!t||t.type?new fc(null,e,h):t),h.abort(),h=null)},l.cancelToken&&l.cancelToken.subscribe(r),l.signal&&(l.signal.aborted?r():l.signal.addEventListener("abort",r)));var y,w,x=(y=l.url,(w=/^([-+\w]{1,25})(:?\/\/|:)/.exec(y))&&w[1]||"");x&&-1===Ql.protocols.indexOf(x)?n(new Tl("Unsupported protocol "+x+":",Tl.ERR_BAD_REQUEST,e)):h.send(c||null)})},Sc=function(e,t){var n=(e=e?e.filter(Boolean):[]).length;if(t||n){var r,a=new AbortController,o=function(e){if(!r){r=!0,s();var t=e instanceof Error?e:this.reason;a.abort(t instanceof Tl?t:new fc(t instanceof Error?t.message:t))}},i=t&&setTimeout(function(){i=null,o(new Tl("timeout ".concat(t," of ms exceeded"),Tl.ETIMEDOUT))},t),s=function(){e&&(i&&clearTimeout(i),i=null,e.forEach(function(e){e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(function(e){return e.addEventListener("abort",o)});var l=a.signal;return l.unsubscribe=function(){return _l.asap(s)},l}},Oc=O().m(function e(t,n){var r,a,o;return O().w(function(e){for(;;)switch(e.n){case 0:if(r=t.byteLength,n&&!(r<n)){e.n=2;break}return e.n=1,t;case 1:return e.a(2);case 2:a=0;case 3:if(!(a<r)){e.n=5;break}return o=a+n,e.n=4,t.slice(a,o);case 4:a=o,e.n=3;break;case 5:return e.a(2)}},e)}),Cc=function(){var e=D(O().m(function e(t,n){var r,a,o,i,s,l,c;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:r=!1,a=!1,e.p=1,i=p(jc(t));case 2:return e.n=3,b(i.next());case 3:if(!(r=!(s=e.v).done)){e.n=5;break}return l=s.value,e.d(j(m(p(Oc(l,n)))),4);case 4:r=!1,e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,c=e.v,a=!0,o=c;case 7:if(e.p=7,e.p=8,!r||null==i.return){e.n=9;break}return e.n=9,b(i.return());case 9:if(e.p=9,!a){e.n=10;break}throw o;case 10:return e.f(9);case 11:return e.f(7);case 12:return e.a(2)}},e,null,[[8,,9,11],[1,6,7,12]])}));return function(t,n){return e.apply(this,arguments)}}(),jc=function(){var e=D(O().m(function e(t){var n,r,a,o;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t[Symbol.asyncIterator]){e.n=2;break}return e.d(j(m(p(t))),1);case 1:return e.a(2);case 2:n=t.getReader(),e.p=3;case 4:return e.n=5,b(n.read());case 5:if(r=e.v,a=r.done,o=r.value,!a){e.n=6;break}return e.a(3,8);case 6:return e.n=7,o;case 7:e.n=4;break;case 8:return e.p=8,e.n=9,b(n.cancel());case 9:return e.f(8);case 10:return e.a(2)}},e,null,[[3,,8,10]])}));return function(t){return e.apply(this,arguments)}}(),Rc=function(e,t,n,r){var a,o=Cc(e,t),i=0,s=function(e){a||(a=!0,r&&r(e))};return new ReadableStream({pull:function(e){return g(O().m(function t(){var r,a,l,c,u,d;return O().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,o.next();case 1:if(r=t.v,a=r.done,l=r.value,!a){t.n=2;break}return s(),e.close(),t.a(2);case 2:c=l.byteLength,n&&(u=i+=c,n(u)),e.enqueue(new Uint8Array(l)),t.n=4;break;case 3:throw t.p=3,d=t.v,s(d),d;case 4:return t.a(2)}},t,null,[[0,3]])}))()},cancel:function(e){return s(e),o.return()}},{highWaterMark:2})},_c=_l.isFunction,Tc={Request:(Ec=_l.global).Request,Response:Ec.Response},Pc=_l.global,Ac=Pc.ReadableStream,Dc=Pc.TextEncoder,Mc=function(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return!!e.apply(void 0,n)}catch(e){return!1}},Lc=function(e){var t=e=_l.merge.call({skipUndefined:!0},Tc,e),n=t.fetch,r=t.Request,a=t.Response,o=n?_c(n):"function"==typeof fetch,i=_c(r),s=_c(a);if(!o)return!1;var l,c=o&&_c(Ac),u=o&&("function"==typeof Dc?(l=new Dc,function(e){return l.encode(e)}):function(){var e=g(O().m(function e(t){var n,a;return O().w(function(e){for(;;)switch(e.n){case 0:return n=Uint8Array,e.n=1,new r(t).arrayBuffer();case 1:return a=e.v,e.a(2,new n(a))}},e)}));return function(t){return e.apply(this,arguments)}}()),d=i&&c&&Mc(function(){var e=!1,t=new r(Ql.origin,{body:new Ac,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),f=s&&c&&Mc(function(){return _l.isReadableStream(new a("").body)}),m={stream:f&&function(e){return e.body}};o&&["text","arrayBuffer","blob","formData","stream"].forEach(function(e){!m[e]&&(m[e]=function(t,n){var r=t&&t[e];if(r)return r.call(t);throw new Tl("Response type '".concat(e,"' is not supported"),Tl.ERR_NOT_SUPPORT,n)})});var p=function(){var e=g(O().m(function e(t){var n;return O().w(function(e){for(;;)switch(e.n){case 0:if(null!=t){e.n=1;break}return e.a(2,0);case 1:if(!_l.isBlob(t)){e.n=2;break}return e.a(2,t.size);case 2:if(!_l.isSpecCompliantForm(t)){e.n=4;break}return n=new r(Ql.origin,{method:"POST",body:t}),e.n=3,n.arrayBuffer();case 3:case 6:return e.a(2,e.v.byteLength);case 4:if(!_l.isArrayBufferView(t)&&!_l.isArrayBuffer(t)){e.n=5;break}return e.a(2,t.byteLength);case 5:if(_l.isURLSearchParams(t)&&(t+=""),!_l.isString(t)){e.n=7;break}return e.n=6,u(t);case 7:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=g(O().m(function e(t,n){var r;return O().w(function(e){for(;;)if(0===e.n)return r=_l.toFiniteNumber(t.getContentLength()),e.a(2,null==r?p(n):r)},e)}));return function(t,n){return e.apply(this,arguments)}}();return function(){var e=g(O().m(function e(t){var o,s,l,c,u,p,v,g,b,y,w,x,E,N,k,C,j,_,T,P,A,D,M,L,I,F,z,B,q,U,H,W,V,$,K,Y,J,G,X;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=Nc(t),s=o.url,l=o.method,c=o.data,u=o.signal,p=o.cancelToken,v=o.timeout,g=o.onDownloadProgress,b=o.onUploadProgress,y=o.responseType,w=o.headers,x=o.withCredentials,E=void 0===x?"same-origin":x,N=o.fetchOptions,k=n||fetch,y=y?(y+"").toLowerCase():"text",C=Sc([u,p&&p.toAbortSignal()],v),j=null,_=C&&C.unsubscribe&&function(){C.unsubscribe()},e.p=1,!(J=b&&d&&"get"!==l&&"head"!==l)){e.n=3;break}return e.n=2,h(w,c);case 2:G=T=e.v,J=0!==G;case 3:if(!J){e.n=4;break}P=new r(s,{method:"POST",body:c,duplex:"half"}),_l.isFormData(c)&&(A=P.headers.get("content-type"))&&w.setContentType(A),P.body&&(D=hc(T,pc(vc(b))),M=R(D,2),L=M[0],I=M[1],c=Rc(P.body,65536,L,I));case 4:return _l.isString(E)||(E=E?"include":"omit"),F=i&&"credentials"in r.prototype,z=S(S({},N),{},{signal:C,method:l.toUpperCase(),headers:w.normalize().toJSON(),body:c,duplex:"half",credentials:F?E:void 0}),j=i&&new r(s,z),e.n=5,i?k(j,N):k(s,z);case 5:return B=e.v,q=f&&("stream"===y||"response"===y),f&&(g||q&&_)&&(U={},["status","statusText","headers"].forEach(function(e){U[e]=B[e]}),H=_l.toFiniteNumber(B.headers.get("content-length")),W=g&&hc(H,pc(vc(g),!0))||[],V=R(W,2),$=V[0],K=V[1],B=new a(Rc(B.body,65536,$,function(){K&&K(),_&&_()}),U)),y=y||"text",e.n=6,m[_l.findKey(m,y)||"text"](B,t);case 6:return Y=e.v,!q&&_&&_(),e.n=7,new Promise(function(e,n){mc(e,n,{data:Y,headers:cc.from(B.headers),status:B.status,statusText:B.statusText,config:t,request:j})});case 7:return e.a(2,e.v);case 8:if(e.p=8,X=e.v,_&&_(),!X||"TypeError"!==X.name||!/Load failed|fetch/i.test(X.message)){e.n=9;break}throw Object.assign(new Tl("Network Error",Tl.ERR_NETWORK,t,j),{cause:X.cause||X});case 9:throw Tl.from(X,X&&X.code,t,j);case 10:return e.a(2)}},e,null,[[1,8]])}));return function(t){return e.apply(this,arguments)}}()},Ic=new Map,Fc=function(e){for(var t,n,r=e&&e.env||{},a=r.fetch,o=[r.Request,r.Response,a],i=o.length,s=Ic;i--;)t=o[i],void 0===(n=s.get(t))&&s.set(t,n=i?new Map:Lc(r)),s=n;return n};Fc();var zc={http:null,xhr:kc,fetch:{get:Fc}};_l.forEach(zc,function(e,t){if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});var Bc=function(e){return"- ".concat(e)},qc=function(e){return _l.isFunction(e)||null===e||!1===e};var Uc={getAdapter:function(e,t){for(var n,r,a=(e=_l.isArray(e)?e:[e]).length,o={},i=0;i<a;i++){var s=void 0;if(r=n=e[i],!qc(n)&&void 0===(r=zc[(s=String(n)).toLowerCase()]))throw new Tl("Unknown adapter '".concat(s,"'"));if(r&&(_l.isFunction(r)||(r=r.get(t))))break;o[s||"#"+i]=r}if(!r){var l=Object.entries(o).map(function(e){var t=R(e,2),n=t[0],r=t[1];return"adapter ".concat(n," ")+(!1===r?"is not supported by the environment":"is not available in the build")});throw new Tl("There is no suitable adapter to dispatch the request "+(a?l.length>1?"since :\n"+l.map(Bc).join("\n"):" "+Bc(l[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r},adapters:zc};function Hc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fc(null,e)}function Wc(e){return Hc(e),e.headers=cc.from(e.headers),e.data=uc.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Uc.getAdapter(e.adapter||nc.adapter,e)(e).then(function(t){return Hc(e),t.data=uc.call(e,e.transformResponse,t),t.headers=cc.from(t.headers),t},function(t){return dc(t)||(Hc(e),t&&t.response&&(t.response.data=uc.call(e,e.transformResponse,t.response),t.response.headers=cc.from(t.response.headers))),Promise.reject(t)})}var Vc="1.13.2",$c={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){$c[e]=function(n){return P(n)===e||"a"+(t<1?"n ":" ")+e}});var Kc={};$c.transitional=function(e,t,n){return function(r,a,o){if(!1===e)throw new Tl(function(e,t){return"[Axios v"+Vc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}(a," has been removed"+(t?" in "+t:"")),Tl.ERR_DEPRECATED);return t&&!Kc[a]&&(Kc[a]=!0),!e||e(r,a,o)}},$c.spelling=function(e){return function(e,t){return!0}};var Yc={assertOptions:function(e,t,n){if("object"!==P(e))throw new Tl("options must be an object",Tl.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),a=r.length;a-- >0;){var o=r[a],i=t[o];if(i){var s=e[o],l=void 0===s||i(s,o,e);if(!0!==l)throw new Tl("option "+o+" must be "+l,Tl.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Tl("Unknown option "+o,Tl.ERR_BAD_OPTION)}},validators:$c},Jc=Yc.validators,Gc=function(){return x(function e(t){y(this,e),this.defaults=t||{},this.interceptors={request:new Vl,response:new Vl}},[{key:"request",value:(e=g(O().m(function e(t,n){var r,a,o;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request(t,n);case 1:return e.a(2,e.v);case 2:if(e.p=2,(o=e.v)instanceof Error){r={},Error.captureStackTrace?Error.captureStackTrace(r):r=new Error,a=r.stack?r.stack.replace(/^.+\n/,""):"";try{o.stack?a&&!String(o.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(o.stack+="\n"+a):o.stack=a}catch(e){}}throw o;case 3:return e.a(2)}},e,this,[[0,2]])})),function(t,n){return e.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var n=t=xc(this.defaults,t),r=n.transitional,a=n.paramsSerializer,o=n.headers;void 0!==r&&Yc.assertOptions(r,{silentJSONParsing:Jc.transitional(Jc.boolean),forcedJSONParsing:Jc.transitional(Jc.boolean),clarifyTimeoutError:Jc.transitional(Jc.boolean)},!1),null!=a&&(_l.isFunction(a)?t.paramsSerializer={serialize:a}:Yc.assertOptions(a,{encode:Jc.function,serialize:Jc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Yc.assertOptions(t,{baseUrl:Jc.spelling("baseURL"),withXsrfToken:Jc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var i=o&&_l.merge(o.common,o[t.method]);o&&_l.forEach(["delete","get","head","post","put","patch","common"],function(e){delete o[e]}),t.headers=cc.concat(i,o);var s=[],l=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(l=l&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});var c,u=[];this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});var d,f=0;if(!l){var m=[Wc.bind(this),void 0];for(m.unshift.apply(m,s),m.push.apply(m,u),d=m.length,c=Promise.resolve(t);f<d;)c=c.then(m[f++],m[f++]);return c}d=s.length;for(var p=t;f<d;){var h=s[f++],v=s[f++];try{p=h(p)}catch(e){v.call(this,e);break}}try{c=Wc.call(this,p)}catch(e){return Promise.reject(e)}for(f=0,d=u.length;f<d;)c=c.then(u[f++],u[f++]);return c}},{key:"getUri",value:function(e){return Hl(yc((e=xc(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}]);var e}();_l.forEach(["delete","get","head","options"],function(e){Gc.prototype[e]=function(t,n){return this.request(xc(n||{},{method:e,url:t,data:(n||{}).data}))}}),_l.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,a){return this.request(xc(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Gc.prototype[e]=t(),Gc.prototype[e+"Form"]=t(!0)});var Xc=Gc,Zc=function(){function e(t){if(y(this,e),"function"!=typeof t)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var r=this;this.promise.then(function(e){if(r._listeners){for(var t=r._listeners.length;t-- >0;)r._listeners[t](e);r._listeners=null}}),this.promise.then=function(e){var t,n=new Promise(function(e){r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},t(function(e,t,a){r.reason||(r.reason=new fc(e,t,a),n(r.reason))})}return x(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,n=function(e){t.abort(e)};return this.subscribe(n),t.signal.unsubscribe=function(){return e.unsubscribe(n)},t.signal}}],[{key:"source",value:function(){var t;return{token:new e(function(e){t=e}),cancel:t}}}])}(),Qc=Zc;var eu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(eu).forEach(function(e){var t=R(e,2),n=t[0],r=t[1];eu[r]=n});var tu=eu;var nu=function e(t){var n=new Xc(t),r=zs(Xc.prototype.request,n);return _l.extend(r,Xc.prototype,n,{allOwnKeys:!0}),_l.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(xc(t,n))},r}(nc);nu.Axios=Xc,nu.CanceledError=fc,nu.CancelToken=Qc,nu.isCancel=dc,nu.VERSION=Vc,nu.toFormData=Fl,nu.AxiosError=Tl,nu.Cancel=nu.CanceledError,nu.all=function(e){return Promise.all(e)},nu.spread=function(e){return function(t){return e.apply(null,t)}},nu.isAxiosError=function(e){return _l.isObject(e)&&!0===e.isAxiosError},nu.mergeConfig=xc,nu.AxiosHeaders=cc,nu.formToJSON=function(e){return ec(_l.isHTMLForm(e)?new FormData(e):e)},nu.getAdapter=Uc.getAdapter,nu.HttpStatusCode=tu,nu.default=nu;var ru=nu;ru.Axios,ru.AxiosError,ru.CanceledError,ru.isCancel,ru.CancelToken,ru.VERSION,ru.all,ru.Cancel,ru.isAxiosError,ru.spread,ru.toFormData,ru.AxiosHeaders,ru.HttpStatusCode,ru.formToJSON,ru.getAdapter,ru.mergeConfig;var au=ru.create({baseURL:"/api/cms",timeout:1e4,headers:{"Content-Type":"application/json"}});au.interceptors.request.use(function(e){e.url&&e.url.startsWith("http")&&(e.baseURL="");var t=localStorage.getItem("cms_token");return t&&(e.headers.Authorization="Bearer ".concat(t)),e},function(e){return Promise.reject(e)}),au.interceptors.response.use(function(e){return e},function(e){var t="请求错误",n=!1;if(e.response){var r=e.response.status,a=e.response.data;401===r?"登录已过期,请重新登录"===(null==a?void 0:a.message)?(t="登录已过期,请重新登录",n=!0):"认证信息无效"===(null==a?void 0:a.message)?(t="认证信息无效,请重新登录",n=!0):(t="认证失败,请登录",n=!0):t=(null==a?void 0:a.message)||"HTTP ".concat(r,": ").concat(e.response.statusText)}else t=e.request?"网络连接失败,请检查网络状态":e.message||"请求错误";return n?(localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),"/login"!==window.location.pathname&&"/"!==window.location.pathname&&(Fs.error(t),setTimeout(function(){window.location.reload()},1e3))):Fs.error(t),Promise.reject(e)});var ou,iu=function(e,t,n){if(t){var r=new URLSearchParams(t).toString();e=e+(e.includes("?")?"&":"?")+r}return au.get(e,n).then(function(e){return e.data})},su=function(e,t,n){return au.post(e,t,n).then(function(e){return e.data})},lu=function(e,t,n){return au.put(e,t,n).then(function(e){return e.data})},cu=function(e,t){return au.delete(e,t).then(function(e){return e.data})};try{var uu=localStorage.getItem("cms_session_id")||void 0;ou=uu}catch(e){}var du=function(){return iu("/models")},fu=function(e){return su("/auth/login/".concat(ou?ou+"_":"","cms_users"),e)},mu=function(){return su("/auth/verify/".concat(ou?ou+"_":"","cms_users"))},pu=function(){return iu("/auth/user/".concat(ou?ou+"_":"","cms_users"))},hu=function(){localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user")},vu=function(){return localStorage.getItem("cms_token")},gu=function(){var e=localStorage.getItem("cms_user");return e?JSON.parse(e):null},bu=function(e,t){var n=t?Object.assign({},t):void 0;return(null==n?void 0:n.filters)&&Array.isArray(n.filters)&&(n.filters=JSON.stringify(n.filters)),iu("/data/".concat(ou?ou+"_":"").concat(e),n)},yu=function(e,t){return iu("/relation/".concat(ou?ou+"_":"").concat(e,"/options"),t)},wu=function(e,t){return su("/data/".concat(ou?ou+"_":"").concat(e),t)},xu=function(e,t){return lu("/data/".concat(ou?ou+"_":"").concat(e),t)},Eu=function(e,t){return cu("/data/".concat(ou?ou+"_":"").concat(e,"?id=").concat(t))};function Nu(t){var n=t.onLoginSuccess,r=R(e.useState(""),2),a=r[0],o=r[1],i=R(e.useState(""),2),s=i[0],l=i[1],c=R(e.useState(!1),2),u=c[0],d=c[1];e.useEffect(function(){var e=vu();if(e){var t=function(){var t=g(O().m(function t(){var r;return O().w(function(t){for(;;)switch(t.p=t.n){case 0:return d(!0),t.p=1,t.n=2,mu();case 2:if(t.v.success){t.n=3;break}throw new Error("token验证失败");case 3:return t.n=4,pu();case 4:if(!(r=t.v).success||!r.data){t.n=5;break}localStorage.setItem("cms_user",JSON.stringify(r.data)),null==n||n(e,r.data),t.n=6;break;case 5:throw new Error("获取用户信息失败");case 6:t.n=8;break;case 7:t.p=7,t.v,hu();case 8:return t.p=8,d(!1),t.f(8);case 9:return t.a(2)}},t,null,[[1,7,8,9]])}));return function(){return t.apply(this,arguments)}}();t()}},[n]);var f=function(){var e=g(O().m(function e(t){var r,o,i;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),a&&s){e.n=1;break}return Fs.error("请完善登录信息"),e.a(2);case 1:return d(!0),e.p=2,e.n=3,fu({username:a,password:s});case 3:if((o=e.v).success&&(null===(r=o.data)||void 0===r?void 0:r.token)){e.n=4;break}return Fs.error(o.message||"登录失败"),e.a(2);case 4:localStorage.setItem("cms_token",o.data.token),localStorage.setItem("cms_user",JSON.stringify(o.data.user)),null==n||n(o.data.token,o.data.user),e.n=6;break;case 5:e.p=5,i=e.v,Fs.error("登陆失败,".concat(i.message||"网络错误,请稍后重试"));case 6:return e.p=6,d(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}();return e.createElement("div",{className:"min-h-screen flex relative overflow-hidden bg-white"},e.createElement("div",{className:"pointer-events-none absolute inset-0"},e.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(110deg,#ffffff_0%,#f7fbff_40%,#edf6ff_70%,#eaf3ff_100%)]"}),e.createElement("div",{className:"absolute inset-0 bg-[radial-gradient(1200px_600px_at_-10%_-10%,rgba(59,130,246,0.12),transparent),radial-gradient(900px_500px_at_110%_20%,rgba(147,51,234,0.10),transparent),radial-gradient(700px_400px_at_60%_120%,rgba(99,102,241,0.10),transparent)]"}),e.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(115deg,rgba(255,255,255,0.6)_0%,rgba(255,255,255,0.15)_32%,transparent_32%,transparent_68%,rgba(255,255,255,0.15)_68%,rgba(255,255,255,0.6)_100%)]"})),e.createElement("div",{className:"flex-1 relative flex items-center justify-center"},e.createElement("div",{className:"relative z-10 max-w-4xl w-full px-16 text-left"},e.createElement("div",{className:"mb-12"},e.createElement("div",{className:"inline-flex items-center rounded-2xl px-4 py-2 bg-white/70 backdrop-blur border border-white/60"},e.createElement("span",{className:"text-2xl font-semibold tracking-tight text-gray-900"},"CMS 管理后台")),e.createElement("h1",{className:"mt-8 text-5xl md:text-6xl font-extrabold leading-tight text-gray-900"},"内容管理平台"),e.createElement("p",{className:"mt-6 text-2xl text-gray-600"},"一站式管理、协作与发布")),e.createElement("div",{className:"mt-8 flex items-center text-gray-500 gap-6"},e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-blue-500"}),"多角色权限"),e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-violet-500"}),"结构化内容"),e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-indigo-500"}),"可扩展 API")))),e.createElement("div",{className:"w-[480px] min-w-[380px] flex items-center justify-center p-8 mt-30"},e.createElement("div",{className:"w-full max-w-sm"},u?e.createElement(ws,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},e.createElement(ks,{className:"p-8"},e.createElement("div",{className:"space-y-4"},e.createElement(ct,{className:"h-12 w-48"}),e.createElement(ct,{className:"h-4 w-64"}),e.createElement(ct,{className:"h-10 w-full"}),e.createElement(ct,{className:"h-10 w-full"})))):e.createElement(ws,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},e.createElement(xs,{className:"p-8 pb-6"},e.createElement(Es,{className:"text-center text-2xl mb-2 text-gray-800"},"欢迎使用 CMS 管理后台"),e.createElement(Ns,{className:"text-center text-gray-500"},"请输入账号和密码登录")),e.createElement(ks,{className:"p-8 pt-0"},e.createElement("form",{onSubmit:f,className:"space-y-6"},e.createElement("div",{className:"space-y-2"},e.createElement(ys,{htmlFor:"username"},"账号/邮箱"),e.createElement("div",{className:"relative"},e.createElement(ce,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.createElement(Ot,{id:"username",type:"text",placeholder:"邮箱",value:a,onChange:function(e){return o(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:2}))),e.createElement("div",{className:"space-y-2"},e.createElement(ys,{htmlFor:"password"},"密码"),e.createElement("div",{className:"relative"},e.createElement(Q,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.createElement(Ot,{id:"password",type:"password",placeholder:"密码",value:s,onChange:function(e){return l(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:6}))),e.createElement(St,{type:"submit",className:"w-full h-12 rounded-xl transition-all duration-200 font-semibold text-base shadow-lg hover:brightness-[1.03] active:scale-[0.99]",style:{backgroundImage:"linear-gradient(135deg, rgba(236, 248, 255, 0.78) 0%, rgba(221, 238, 255, 0.78) 100%)",color:"rgba(0, 0, 0, 0.7)",border:"none",boxShadow:"0 6px 24px rgba(37, 99, 235, 0.12)"},disabled:u},e.createElement(ee,{className:"h-4 w-4 mr-2"}),u?"登录中...":"登录")))))))}function ku(e,[t,n]){return Math.min(n,Math.max(t,e))}var Su=c.createContext(void 0);function Ou(e){const t=c.useRef({value:e,previous:e});return c.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Cu=[" ","Enter","ArrowUp","ArrowDown"],ju=[" ","Enter"],Ru="Select",[_u,Tu,Pu]=function(n){const r=n+"CollectionProvider",[a,o]=At(r),[i,s]=a(r,{collectionRef:{current:null},itemMap:new Map}),l=n=>{const{scope:r,children:a}=n,o=e.useRef(null),s=e.useRef(new Map).current;return t.jsx(i,{scope:r,itemMap:s,collectionRef:o,children:a})};l.displayName=r;const c=n+"CollectionSlot",u=qt(c),d=e.forwardRef((e,n)=>{const{scope:r,children:a}=e,o=ft(n,s(c,r).collectionRef);return t.jsx(u,{ref:o,children:a})});d.displayName=c;const f=n+"CollectionItemSlot",m="data-radix-collection-item",p=qt(f),h=e.forwardRef((n,r)=>{const{scope:a,children:o,...i}=n,l=e.useRef(null),c=ft(r,l),u=s(f,a);return e.useEffect(()=>(u.itemMap.set(l,{ref:l,...i}),()=>{u.itemMap.delete(l)})),t.jsx(p,{[m]:"",ref:c,children:o})});return h.displayName=f,[{Provider:l,Slot:d,ItemSlot:h},function(t){const r=s(n+"CollectionConsumer",t);return e.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},o]}(Ru),[Au,Du]=At(Ru,[Pu,ti]),Mu=ti(),[Lu,Iu]=Au(Ru),[Fu,zu]=Au(Ru),Bu=e=>{const{__scopeSelect:n,children:r,open:a,defaultOpen:o,onOpenChange:i,value:s,defaultValue:l,onValueChange:u,dir:d,name:f,autoComplete:m,disabled:p,required:h,form:v}=e,g=Mu(n),[b,y]=c.useState(null),[w,x]=c.useState(null),[E,N]=c.useState(!1),k=function(e){const t=c.useContext(Su);return e||t||"ltr"}(d),[S,O]=Bt({prop:a,defaultProp:o??!1,onChange:i,caller:Ru}),[C,j]=Bt({prop:s,defaultProp:l,onChange:u,caller:Ru}),R=c.useRef(null),_=!b||(v||!!b.closest("form")),[T,P]=c.useState(new Set),A=Array.from(T).map(e=>e.props.value).join(";");return t.jsx(gi,{...g,children:t.jsxs(Lu,{required:h,scope:n,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:E,onValueNodeHasChildrenChange:N,contentId:Ft(),value:C,onValueChange:j,open:S,onOpenChange:O,dir:k,triggerPointerDownPosRef:R,disabled:p,children:[t.jsx(_u.Provider,{scope:n,children:t.jsx(Fu,{scope:e.__scopeSelect,onNativeOptionAdd:c.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:c.useCallback(e=>{P(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),_?t.jsxs(Od,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:m,value:C,onChange:e=>j(e.target.value),disabled:p,form:v,children:[void 0===C?t.jsx("option",{value:""}):null,Array.from(T)]},A):null]})})};Bu.displayName=Ru;var qu="SelectTrigger",Uu=c.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:a=!1,...o}=e,i=Mu(r),s=Iu(qu,r),l=s.disabled||a,u=ft(n,s.onTriggerChange),d=Tu(r),f=c.useRef("touch"),[m,p,h]=jd(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===s.value),r=Rd(t,e,n);void 0!==r&&s.onValueChange(r.value)}),v=e=>{l||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(bi,{asChild:!0,...i,children:t.jsx(Vt.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Cd(s.value)?"":void 0,...o,ref:u,onClick:Pt(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&v(e)}),onPointerDown:Pt(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(v(e),e.preventDefault())}),onKeyDown:Pt(o.onKeyDown,e=>{const t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||Cu.includes(e.key)&&(v(),e.preventDefault())})})})});Uu.displayName=qu;var Hu="SelectValue",Wu=c.forwardRef((e,n)=>{const{__scopeSelect:r,className:a,style:o,children:i,placeholder:s="",...l}=e,c=Iu(Hu,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==i,f=ft(n,c.onValueNodeChange);return Mt(()=>{u(d)},[u,d]),t.jsx(Vt.span,{...l,ref:f,style:{pointerEvents:"none"},children:Cd(c.value)?t.jsx(t.Fragment,{children:s}):i})});Wu.displayName=Hu;var Vu=c.forwardRef((e,n)=>{const{__scopeSelect:r,children:a,...o}=e;return t.jsx(Vt.span,{"aria-hidden":!0,...o,ref:n,children:a||"▼"})});Vu.displayName="SelectIcon";var $u=e=>t.jsx(fn,{asChild:!0,...e});$u.displayName="SelectPortal";var Ku="SelectContent",Yu=c.forwardRef((e,n)=>{const r=Iu(Ku,e.__scopeSelect),[a,o]=c.useState();if(Mt(()=>{o(new DocumentFragment)},[]),!r.open){const n=a;return n?u.createPortal(t.jsx(Gu,{scope:e.__scopeSelect,children:t.jsx(_u.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Qu,{...e,ref:n})});Yu.displayName=Ku;var Ju=10,[Gu,Xu]=Au(Ku),Zu=qt("SelectContent.RemoveScroll"),Qu=c.forwardRef((e,n)=>{const{__scopeSelect:r,position:a="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:v,hideWhenDetached:g,avoidCollisions:b,...y}=e,w=Iu(Ku,r),[x,E]=c.useState(null),[N,k]=c.useState(null),S=ft(n,e=>E(e)),[O,C]=c.useState(null),[j,R]=c.useState(null),_=Tu(r),[T,P]=c.useState(!1),A=c.useRef(!1);c.useEffect(()=>{if(x)return ur(x)},[x]),vn();const D=c.useCallback(e=>{const[t,...n]=_().map(e=>e.ref.current),[r]=n.slice(-1),a=document.activeElement;for(const n of e){if(n===a)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&N&&(N.scrollTop=0),n===r&&N&&(N.scrollTop=N.scrollHeight),n?.focus(),document.activeElement!==a)return}},[_,N]),M=c.useCallback(()=>D([O,x]),[D,O,x]);c.useEffect(()=>{T&&M()},[T,M]);const{onOpenChange:L,triggerPointerDownPosRef:I}=w;c.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||L(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,L,I]),c.useEffect(()=>{const e=()=>L(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[L]);const[F,z]=jd(e=>{const t=_().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Rd(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),B=c.useCallback((e,t,n)=>{const r=!A.current&&!n;(void 0!==w.value&&w.value===t||r)&&(C(e),r&&(A.current=!0))},[w.value]),q=c.useCallback(()=>x?.focus(),[x]),U=c.useCallback((e,t,n)=>{const r=!A.current&&!n;(void 0!==w.value&&w.value===t||r)&&R(e)},[w.value]),H="popper"===a?td:ed,W=H===td?{side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:v,hideWhenDetached:g,avoidCollisions:b}:{};return t.jsx(Gu,{scope:r,content:x,viewport:N,onViewportChange:k,itemRefCallback:B,selectedItem:O,onItemLeave:q,itemTextRefCallback:U,focusSelectedItem:M,selectedItemText:j,position:a,isPositioned:T,searchRef:F,children:t.jsx(rr,{as:Zu,allowPinchZoom:!0,children:t.jsx(an,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Pt(o,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(Zt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t.jsx(H,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...W,onPlaced:()=>P(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Pt(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=_().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});Qu.displayName="SelectContentImpl";var ed=c.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:a,...o}=e,i=Iu(Ku,r),s=Xu(Ku,r),[l,u]=c.useState(null),[d,f]=c.useState(null),m=ft(n,e=>f(e)),p=Tu(r),h=c.useRef(!1),v=c.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&g&&b&&y){const e=i.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=i.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if("rtl"!==i.dir){const a=r.left-t.left,o=n.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),u=window.innerWidth-Ju,d=ku(o,[Ju,Math.max(Ju,u-c)]);l.style.minWidth=s+"px",l.style.left=d+"px"}else{const a=t.right-r.right,o=window.innerWidth-n.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),u=window.innerWidth-Ju,d=ku(o,[Ju,Math.max(Ju,u-c)]);l.style.minWidth=s+"px",l.style.right=d+"px"}const o=p(),s=window.innerHeight-2*Ju,c=g.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),m=parseInt(u.paddingTop,10),v=parseInt(u.borderBottomWidth,10),w=f+m+c+parseInt(u.paddingBottom,10)+v,x=Math.min(5*b.offsetHeight,w),E=window.getComputedStyle(g),N=parseInt(E.paddingTop,10),k=parseInt(E.paddingBottom,10),S=e.top+e.height/2-Ju,O=s-S,C=b.offsetHeight/2,j=f+m+(b.offsetTop+C),R=w-j;if(j<=S){const e=o.length>0&&b===o[o.length-1].ref.current;l.style.bottom="0px";const t=d.clientHeight-g.offsetTop-g.offsetHeight,n=j+Math.max(O,C+(e?k:0)+t+v);l.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;l.style.top="0px";const t=Math.max(S,f+g.offsetTop+(e?N:0)+C)+R;l.style.height=t+"px",g.scrollTop=j-S+g.offsetTop}l.style.margin=`${Ju}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=s+"px",a?.(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,l,d,g,b,y,i.dir,a]);Mt(()=>x(),[x]);const[E,N]=c.useState();Mt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const k=c.useCallback(e=>{e&&!0===v.current&&(x(),w?.(),v.current=!1)},[x,w]);return t.jsx(nd,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:t.jsx(Vt.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});ed.displayName="SelectItemAlignedPosition";var td=c.forwardRef((e,n)=>{const{__scopeSelect:r,align:a="start",collisionPadding:o=Ju,...i}=e,s=Mu(r);return t.jsx(yi,{...s,...i,ref:n,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});td.displayName="SelectPopperPosition";var[nd,rd]=Au(Ku,{}),ad="SelectViewport",od=c.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:a,...o}=e,i=Xu(ad,r),s=rd(ad,r),l=ft(n,i.onViewportChange),u=c.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),t.jsx(_u.Slot,{scope:r,children:t.jsx(Vt.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Pt(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*Ju,a=parseFloat(n.style.minHeight),o=parseFloat(n.style.height),i=Math.max(a,o);if(i<r){const a=i+e,o=Math.min(r,a),s=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop})})})]})});od.displayName=ad;var id="SelectGroup",[sd,ld]=Au(id);c.forwardRef((e,n)=>{const{__scopeSelect:r,...a}=e,o=Ft();return t.jsx(sd,{scope:r,id:o,children:t.jsx(Vt.div,{role:"group","aria-labelledby":o,...a,ref:n})})}).displayName=id;var cd="SelectLabel",ud=c.forwardRef((e,n)=>{const{__scopeSelect:r,...a}=e,o=ld(cd,r);return t.jsx(Vt.div,{id:o.id,...a,ref:n})});ud.displayName=cd;var dd="SelectItem",[fd,md]=Au(dd),pd=c.forwardRef((e,n)=>{const{__scopeSelect:r,value:a,disabled:o=!1,textValue:i,...s}=e,l=Iu(dd,r),u=Xu(dd,r),d=l.value===a,[f,m]=c.useState(i??""),[p,h]=c.useState(!1),v=ft(n,e=>u.itemRefCallback?.(e,a,o)),g=Ft(),b=c.useRef("touch"),y=()=>{o||(l.onValueChange(a),l.onOpenChange(!1))};if(""===a)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(fd,{scope:r,value:a,disabled:o,textId:g,isSelected:d,onItemTextChange:c.useCallback(e=>{m(t=>t||(e?.textContent??"").trim())},[]),children:t.jsx(_u.ItemSlot,{scope:r,value:a,disabled:o,textValue:f,children:t.jsx(Vt.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:v,onFocus:Pt(s.onFocus,()=>h(!0)),onBlur:Pt(s.onBlur,()=>h(!1)),onClick:Pt(s.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:Pt(s.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:Pt(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:Pt(s.onPointerMove,e=>{b.current=e.pointerType,o?u.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pt(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Pt(s.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(ju.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});pd.displayName=dd;var hd="SelectItemText",vd=c.forwardRef((e,n)=>{const{__scopeSelect:r,className:a,style:o,...i}=e,s=Iu(hd,r),l=Xu(hd,r),d=md(hd,r),f=zu(hd,r),[m,p]=c.useState(null),h=ft(n,e=>p(e),d.onItemTextChange,e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),v=m?.textContent,g=c.useMemo(()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:y}=f;return Mt(()=>(b(g),()=>y(g)),[b,y,g]),t.jsxs(t.Fragment,{children:[t.jsx(Vt.span,{id:d.textId,...i,ref:h}),d.isSelected&&s.valueNode&&!s.valueNodeHasChildren?u.createPortal(i.children,s.valueNode):null]})});vd.displayName=hd;var gd="SelectItemIndicator",bd=c.forwardRef((e,n)=>{const{__scopeSelect:r,...a}=e;return md(gd,r).isSelected?t.jsx(Vt.span,{"aria-hidden":!0,...a,ref:n}):null});bd.displayName=gd;var yd="SelectScrollUpButton",wd=c.forwardRef((e,n)=>{const r=Xu(yd,e.__scopeSelect),a=rd(yd,e.__scopeSelect),[o,i]=c.useState(!1),s=ft(n,a.onScrollButtonChange);return Mt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?t.jsx(Nd,{...e,ref:s,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});wd.displayName=yd;var xd="SelectScrollDownButton",Ed=c.forwardRef((e,n)=>{const r=Xu(xd,e.__scopeSelect),a=rd(xd,e.__scopeSelect),[o,i]=c.useState(!1),s=ft(n,a.onScrollButtonChange);return Mt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;i(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?t.jsx(Nd,{...e,ref:s,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Ed.displayName=xd;var Nd=c.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:a,...o}=e,i=Xu("SelectScrollButton",r),s=c.useRef(null),l=Tu(r),u=c.useCallback(()=>{null!==s.current&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>u(),[u]),Mt(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t.jsx(Vt.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:Pt(o.onPointerDown,()=>{null===s.current&&(s.current=window.setInterval(a,50))}),onPointerMove:Pt(o.onPointerMove,()=>{i.onItemLeave?.(),null===s.current&&(s.current=window.setInterval(a,50))}),onPointerLeave:Pt(o.onPointerLeave,()=>{u()})})}),kd=c.forwardRef((e,n)=>{const{__scopeSelect:r,...a}=e;return t.jsx(Vt.div,{"aria-hidden":!0,...a,ref:n})});kd.displayName="SelectSeparator";var Sd="SelectArrow";c.forwardRef((e,n)=>{const{__scopeSelect:r,...a}=e,o=Mu(r),i=Iu(Sd,r),s=Xu(Sd,r);return i.open&&"popper"===s.position?t.jsx(wi,{...o,...a,ref:n}):null}).displayName=Sd;var Od=c.forwardRef(({__scopeSelect:e,value:n,...r},a)=>{const o=c.useRef(null),i=ft(a,o),s=Ou(n);return c.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(s!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[s,n]),t.jsx(Vt.select,{...r,style:{...xi,...r.style},ref:i,defaultValue:n})});function Cd(e){return""===e||void 0===e}function jd(e){const t=$t(e),n=c.useRef(""),r=c.useRef(0),a=c.useCallback(e=>{const a=n.current+e;t(a),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=c.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function Rd(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=(i=e,s=Math.max(a,0),i.map((e,t)=>i[(s+t)%i.length]));var i,s;1===r.length&&(o=o.filter(e=>e!==n));const l=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Od.displayName="SelectBubbleInput";var _d=Uu,Td=Vu,Pd=$u,Ad=Yu,Dd=od,Md=ud,Ld=pd,Id=vd,Fd=bd,zd=wd,Bd=Ed,qd=kd,Ud=Bu,Hd=Wu,Wd=c.forwardRef(function(e,t){var n=e.className,r=e.children,a=me(e,["className","children"]);return c.createElement(_d,Object.assign({ref:t,className:lt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n)},a),r,c.createElement(Td,{asChild:!0},c.createElement(U,{className:"h-4 w-4 opacity-50"})))});Wd.displayName=_d.displayName;var Vd=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(zd,Object.assign({ref:t,className:lt("flex cursor-default items-center justify-center py-1",n)},r),c.createElement(V,{className:"h-4 w-4"}))});Vd.displayName=zd.displayName;var $d=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Bd,Object.assign({ref:t,className:lt("flex cursor-default items-center justify-center py-1",n)},r),c.createElement(U,{className:"h-4 w-4"}))});$d.displayName=Bd.displayName;var Kd=c.forwardRef(function(e,t){var n=e.className,r=e.children,a=e.position,o=void 0===a?"popper":a,i=me(e,["className","children","position"]);return c.createElement(Pd,null,c.createElement(Ad,Object.assign({ref:t,className:lt("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o},i),c.createElement(Vd,null),c.createElement(Dd,{className:lt("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},r),c.createElement($d,null)))});Kd.displayName=Ad.displayName,c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Md,Object.assign({ref:t,className:lt("py-1.5 pl-8 pr-2 text-sm font-semibold",n)},r))}).displayName=Md.displayName;var Yd=c.forwardRef(function(e,t){var n=e.className,r=e.children,a=me(e,["className","children"]);return c.createElement(Ld,Object.assign({ref:t,className:lt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n)},a),c.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},c.createElement(Fd,null,c.createElement(q,{className:"h-4 w-4"}))),c.createElement(Id,null,r))});Yd.displayName=Ld.displayName,c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(qd,Object.assign({ref:t,className:lt("-mx-1 my-1 h-px bg-muted",n)},r))}).displayName=qd.displayName;var Jd="Switch",[Gd,Xd]=At(Jd),[Zd,Qd]=Gd(Jd),ef=c.forwardRef((e,n)=>{const{__scopeSwitch:r,name:a,checked:o,defaultChecked:i,required:s,disabled:l,value:u="on",onCheckedChange:d,form:f,...m}=e,[p,h]=c.useState(null),v=ft(n,e=>h(e)),g=c.useRef(!1),b=!p||(f||!!p.closest("form")),[y,w]=Bt({prop:o,defaultProp:i??!1,onChange:d,caller:Jd});return t.jsxs(Zd,{scope:r,checked:y,disabled:l,children:[t.jsx(Vt.button,{type:"button",role:"switch","aria-checked":y,"aria-required":s,"data-state":af(y),"data-disabled":l?"":void 0,disabled:l,value:u,...m,ref:v,onClick:Pt(e.onClick,e=>{w(e=>!e),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&t.jsx(rf,{control:p,bubbles:!g.current,name:a,value:u,checked:y,required:s,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});ef.displayName=Jd;var tf="SwitchThumb",nf=c.forwardRef((e,n)=>{const{__scopeSwitch:r,...a}=e,o=Qd(tf,r);return t.jsx(Vt.span,{"data-state":af(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:n})});nf.displayName=tf;var rf=c.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:a=!0,...o},i)=>{const s=c.useRef(null),l=ft(s,i),u=Ou(r),d=Zo(n);return c.useEffect(()=>{const e=s.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(u!==r&&n){const t=new Event("click",{bubbles:a});n.call(e,r),e.dispatchEvent(t)}},[u,r,a]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:l,style:{...o.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function af(e){return e?"checked":"unchecked"}rf.displayName="SwitchBubbleInput";var of=ef,sf=nf,lf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(of,Object.assign({className:lt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},r,{ref:t}),c.createElement(sf,{className:lt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")}))});lf.displayName=of.displayName;var cf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("textarea",Object.assign({className:lt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:t},r))});cf.displayName="Textarea";var uf=Wr,df=Vr,ff=$r,mf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Kr,Object.assign({ref:t,className:lt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)},r))});mf.displayName=Kr.displayName;var pf=c.forwardRef(function(e,t){var n=e.className,r=e.children,a=me(e,["className","children"]);return c.createElement(ff,null,c.createElement(mf,null),c.createElement(Yr,Object.assign({ref:t,className:lt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n)},a),r,c.createElement(Xr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"},c.createElement(de,{className:"h-4 w-4"}),c.createElement("span",{className:"sr-only"},"Close"))))});pf.displayName=Yr.displayName;var hf=function(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex flex-col space-y-1.5 text-center sm:text-left",t)},n))};hf.displayName="DialogHeader";var vf=function(e){var t=e.className,n=me(e,["className"]);return c.createElement("div",Object.assign({className:lt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))};vf.displayName="DialogFooter";var gf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Jr,Object.assign({ref:t,className:lt("text-lg font-semibold leading-none tracking-tight",n)},r))});gf.displayName=Jr.displayName;var bf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement(Gr,Object.assign({ref:t,className:lt("text-sm text-muted-foreground",n)},r))});function yf(e,t){if(!t.length)return"JSON 格式不正确";var n=t[0],r=function(e,t){for(var n=1,r=1,a=Math.max(0,Math.min(t,e.length)),o=0;o<a;o++){"\n"===e.charAt(o)?(n++,r=1):r++}return{line:n,col:r}}(e,n.offset),o=r.line,i=r.col,s=a.printParseErrorCode(n.error);return"JSON 格式不正确(".concat(s,",行 ").concat(o," 列 ").concat(i,")")}function wf(e){if(null==e||""===e)return{ok:!0,value:null,pretty:"null",compact:"null"};try{if("string"!=typeof e)return{ok:!0,value:e,pretty:JSON.stringify(e,null,2),compact:JSON.stringify(e)};var t=e,n=[],r=a.parse(t,n,{allowTrailingComma:!0,disallowComments:!1});return n.length?{ok:!1,message:yf(t,n),pretty:t,compact:t}:{ok:!0,value:r,pretty:JSON.stringify(r,null,2),compact:JSON.stringify(r)}}catch(t){var o="string"==typeof e?e:String(e);return{ok:!1,message:"JSON 格式不正确",pretty:o,compact:o}}}function xf(e){return Ef.apply(this,arguments)}function Ef(){return(Ef=g(O().m(function e(t){var n,r;return O().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(!(null===(n=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===n?void 0:n.writeText)){e.n=3;break}return e.n=2,navigator.clipboard.writeText(t);case 2:return e.a(2);case 3:(r=document.createElement("textarea")).value=t,r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function Nf(e){var t=e.value,n=e.title;if(null==t||""===t)return c.createElement("span",null,"-");var r,a=wf(t),o=a.ok,i=a.pretty,s=a.compact,l=s.length>80?s.slice(0,80)+"…":s;return c.createElement(uf,null,c.createElement(df,{asChild:!0},c.createElement("button",{type:"button",className:"max-w-xs truncate text-left font-mono text-xs text-muted-foreground hover:underline",title:"点击查看 JSON"},l)),c.createElement(pf,{className:"max-w-3xl"},c.createElement(hf,null,c.createElement(gf,null,n||"JSON")),c.createElement("div",{className:"flex items-center justify-end gap-2"},c.createElement(St,{variant:"outline",size:"sm",onClick:(r=g(O().m(function e(){return O().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,xf(i);case 1:Fs.success("已复制 JSON"),e.n=3;break;case 2:e.p=2,e.v,Fs.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return r.apply(this,arguments)})},"复制")),c.createElement("pre",{className:"max-h-[60vh] overflow-auto rounded-md bg-muted p-3 text-xs font-mono whitespace-pre"},i),!o&&c.createElement("div",{className:"text-xs text-destructive"},a.ok?"":a.message)))}function kf(e){e.id;var t=e.value;e.required;var n,r=e.onChange,s=R(c.useState(null),2),l=s[0],u=s[1];return c.createElement("div",{className:"space-y-2"},c.createElement("div",{className:"flex items-center justify-end gap-2"},c.createElement(St,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=(t||"").trim();if(e){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=(e||"").toString(),r=[];if(a.parse(n,r,{allowTrailingComma:!0,disallowComments:!1}),r.length)return{ok:!1,message:yf(n,r)};for(var o=a.format(n,void 0,{insertSpaces:!0,tabSize:t}),i=n,s=o.length-1;s>=0;s--){var l=o[s];i=i.slice(0,l.offset)+l.content+i.slice(l.offset+l.length)}return{ok:!0,formatted:i}}(e,2);n.ok?(r(n.formatted),u(null)):u(n.message)}}},"格式化"),c.createElement(St,{type:"button",variant:"outline",size:"sm",onClick:(n=g(O().m(function e(){return O().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,xf(t||"");case 1:Fs.success("已复制"),e.n=3;break;case 2:e.p=2,e.v,Fs.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return n.apply(this,arguments)})},"复制")),c.createElement("div",{className:"rounded-md border bg-background"},c.createElement(o,{value:t||"",height:"220px",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},extensions:[i.json()],onChange:function(e){r(e),function(e){var t=(e||"").trim();if(!t)return u(null),!0;var n=wf(t);n.ok?u(null):u(n.message)}(e)}})),l&&c.createElement("div",{className:"text-xs text-destructive"},l))}bf.displayName=Gr.displayName;var Sf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("div",{className:"relative w-full overflow-auto"},c.createElement("table",Object.assign({ref:t,className:lt("w-full caption-bottom text-sm",n)},r)))});Sf.displayName="Table";var Of=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("thead",Object.assign({ref:t,className:lt("[&_tr]:border-b",n)},r))});Of.displayName="TableHeader";var Cf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("tbody",Object.assign({ref:t,className:lt("[&_tr:last-child]:border-0",n)},r))});Cf.displayName="TableBody",c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("tfoot",Object.assign({ref:t,className:lt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n)},r))}).displayName="TableFooter";var jf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("tr",Object.assign({ref:t,className:lt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n)},r))});jf.displayName="TableRow";var Rf=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("th",Object.assign({ref:t,className:lt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n)},r))});Rf.displayName="TableHead";var _f=c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("td",Object.assign({ref:t,className:lt("p-4 align-middle [&:has([role=checkbox])]:pr-0",n)},r))});_f.displayName="TableCell",c.forwardRef(function(e,t){var n=e.className,r=me(e,["className"]);return c.createElement("caption",Object.assign({ref:t,className:lt("mt-4 text-sm text-muted-foreground",n)},r))}).displayName="TableCaption";var Tf=Nt("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Pf(e){var t=e.className,n=e.variant,r=me(e,["className","variant"]);return c.createElement("div",Object.assign({className:lt(Tf({variant:n}),t)},r))}function Af(){return"".concat(Date.now(),"_").concat(Math.random().toString(16).slice(2))}function Df(e){return"integer"===e||"float"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"大于"},{value:"gte",label:"大于等于"},{value:"lt",label:"小于"},{value:"lte",label:"小于等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]:"boolean"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"isNull",label:"为空(NULL)"}]:"date"===e||"datetime"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"晚于/大于"},{value:"gte",label:"晚于等于/大于等于"},{value:"lt",label:"早于/小于"},{value:"lte",label:"早于等于/小于等于"},{value:"isNull",label:"为空(NULL)"}]:[{value:"contains",label:"包含"},{value:"startsWith",label:"开头是"},{value:"endsWith",label:"结尾是"},{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]}function Mf(t){var n,r,a=e.useMemo(function(){var e=[];e.push.apply(e,_([{column:"id",label:"ID",type:"id"},{column:"created_at",label:"创建时间",type:"datetime"},{column:"updated_at",label:"更新时间",type:"datetime"}]));var n,r=E(t.fields||[]);try{for(r.s();!(n=r.n()).done;){var a=n.value;if((null==a?void 0:a.name)&&("json"!==a.type&&"jsonb"!==a.type))if("relation"===a.type&&a.relation){var o=a.relation.foreignKey||"".concat(a.relation.target,"_id");e.push({column:o,label:"".concat(a.comment||a.name,"(关联)"),type:"relation"})}else e.push({column:a.name,label:a.comment||a.name,type:a.type})}}catch(e){r.e(e)}finally{r.f()}var i=new Set;return e.filter(function(e){return!i.has(e.column)&&(i.add(e.column),!0)})},[t.fields]),o=e.useMemo(function(){return new Map(a.map(function(e){return[e.column,e]}))},[a]),i=e.useMemo(function(){return new Map(a.map(function(e){return[e.column,e.type]}))},[a]),s=R(e.useState([]),2),l=s[0],c=s[1];e.useEffect(function(){c(function(e,t){return(e||[]).map(function(e){if(t.get(e.column),"is"===e.operator&&(null===e.value||"null"===e.value))return{id:Af(),column:e.column,operator:"isNull",value:""};if(("ilike"===e.operator||"like"===e.operator)&&"string"==typeof e.value){var n=e.value;if(n.startsWith("%")&&n.endsWith("%")&&n.length>=2)return{id:Af(),column:e.column,operator:"contains",value:n.slice(1,-1)};if(n.endsWith("%"))return{id:Af(),column:e.column,operator:"startsWith",value:n.slice(0,-1)};if(n.startsWith("%"))return{id:Af(),column:e.column,operator:"endsWith",value:n.slice(1)}}if("in"===e.operator){var r=Array.isArray(e.value)?e.value:[];return{id:Af(),column:e.column,operator:"in",value:r.join(",")}}return{id:Af(),column:e.column,operator:["eq","neq","gt","gte","lt","lte"].includes(e.operator)?e.operator:"eq",value:void 0===e.value||null===e.value?"":String(e.value)}})}(t.value||[],i))},[JSON.stringify(t.value),a.length]);var u=function(e,t){c(function(n){return n.map(function(n){var r,a;if(n.id!==e)return n;var i=Object.assign(Object.assign({},n),t);if(t.column&&t.column!==n.column){var s=Df((null===(r=o.get(t.column))||void 0===r?void 0:r.type)||"string");i.operator=(null===(a=s[0])||void 0===a?void 0:a.value)||"eq",i.value=""}return t.operator&&"isNull"===t.operator&&(i.value=""),i})})};return e.createElement("div",{className:"space-y-3"},e.createElement("div",{className:"flex items-center justify-between gap-3"},e.createElement(ys,{className:"text-base font-medium flex items-center gap-2"},e.createElement(J,{className:"h-4 w-4"}),"动态筛选"),e.createElement("div",{className:"flex items-center gap-2"},(null===(n=t.value)||void 0===n?void 0:n.length)>0&&e.createElement(Pf,{variant:"secondary"},"已应用 ",t.value.length," 条"),e.createElement(St,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=a[0];if(e){var t=Df(e.type);c(function(n){var r;return[].concat(_(n),[{id:Af(),column:e.column,operator:(null===(r=t[0])||void 0===r?void 0:r.value)||"eq",value:""}])})}}},e.createElement(re,{className:"h-4 w-4 mr-1"}),"添加条件"))),0===l.length?e.createElement("div",{className:"text-sm text-muted-foreground border rounded-lg p-3 bg-muted/20"},"暂无筛选条件(可添加条件后点击“应用”)"):e.createElement("div",{className:"space-y-2"},l.map(function(t){var n=o.get(t.column),r=(null==n?void 0:n.type)||"string",i=Df(r),s="isNull"!==t.operator;return e.createElement("div",{key:t.id,className:"grid grid-cols-12 gap-2 items-center"},e.createElement("div",{className:"col-span-5"},e.createElement(Ud,{value:t.column,onValueChange:function(e){return u(t.id,{column:e})}},e.createElement(Wd,{className:"h-10"},e.createElement(Hd,{placeholder:"字段"})),e.createElement(Kd,null,a.map(function(t){return e.createElement(Yd,{key:t.column,value:t.column},t.label," (",t.column,")")})))),e.createElement("div",{className:"col-span-3"},e.createElement(Ud,{value:t.operator,onValueChange:function(e){return u(t.id,{operator:e})}},e.createElement(Wd,{className:"h-10"},e.createElement(Hd,{placeholder:"操作符"})),e.createElement(Kd,null,i.map(function(t){return e.createElement(Yd,{key:t.value,value:t.value},t.label)})))),e.createElement("div",{className:"col-span-3"},s?"boolean"===r?e.createElement(Ud,{value:t.value,onValueChange:function(e){return u(t.id,{value:e})}},e.createElement(Wd,{className:"h-10"},e.createElement(Hd,{placeholder:"值"})),e.createElement(Kd,null,e.createElement(Yd,{value:"true"},"true"),e.createElement(Yd,{value:"false"},"false"))):e.createElement(Ot,{className:"h-10",placeholder:"in"===t.operator?"多个值用逗号分隔":"值",type:"integer"===r||"float"===r?"number":"date"===r?"date":"datetime"===r?"datetime-local":"text",value:t.value,onChange:function(e){return u(t.id,{value:e.target.value})}}):e.createElement("div",{className:"h-10 flex items-center text-sm text-muted-foreground"},"无需填写")),e.createElement("div",{className:"col-span-1 flex justify-end"},e.createElement(St,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 p-0",onClick:function(){return e=t.id,void c(function(t){return t.filter(function(t){return t.id!==e})});var e}},e.createElement(de,{className:"h-4 w-4"}))))})),e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(St,{type:"button",variant:"outline",onClick:function(){c([]),t.onChange([])},disabled:0===l.length&&0===((null===(r=t.value)||void 0===r?void 0:r.length)||0)},"清空"),e.createElement(St,{type:"button",onClick:function(){var e=function(e,t){var n,r,a=[],o=E(e);try{for(o.s();!(r=o.n()).done;){var i=r.value,s=t.get(i.column);if(s&&i.operator)if("isNull"!==i.operator){var l=null!==(n=i.value)&&void 0!==n?n:"",c=String(l).trim();if(c)if("contains"!==i.operator)if("startsWith"!==i.operator)if("endsWith"!==i.operator)if("in"!==i.operator)a.push({column:s.column,operator:i.operator,value:c});else{var u=c.split(",").map(function(e){return e.trim()}).filter(Boolean);a.push({column:s.column,operator:"in",value:u})}else a.push({column:s.column,operator:"ilike",value:"%".concat(c)});else a.push({column:s.column,operator:"ilike",value:"".concat(c,"%")});else a.push({column:s.column,operator:"ilike",value:"%".concat(c,"%")})}else a.push({column:s.column,operator:"is",value:null})}}catch(e){o.e(e)}finally{o.f()}return a}(l,o);t.onChange(e)},disabled:0===l.length},"应用")))}function Lf(){var t,n=R(e.useState([]),2),r=n[0],a=n[1],o=R(e.useState(null),2),i=o[0],l=o[1],c=R(e.useState([]),2),u=c[0],d=c[1],f=R(e.useState(!1),2),m=f[0],p=f[1],h=R(e.useState(!1),2),v=h[0],b=h[1],y=R(e.useState(null),2),w=y[0],x=y[1],E=R(e.useState({}),2),k=E[0],S=E[1],C=R(e.useState(1),2),j=C[0],_=C[1],T=R(e.useState(10),2),P=T[0];T[1];var A=R(e.useState(0),2),D=A[0],M=A[1],L=R(e.useState(""),2),I=L[0],F=L[1],z=R(e.useState(!1),2),B=z[0],q=z[1],U=R(e.useState(null),2),V=U[0],$=U[1],K=R(e.useState(!0),2),Y=K[0],G=K[1],X=R(e.useState([]),2),Q=X[0],ee=X[1],te=R(e.useState(!1),2),ne=te[0],oe=te[1],se=function(e){return Array.isArray(e)?e:Array.isArray(null==e?void 0:e.models)?e.models:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(null==e?void 0:e.items)?e.items:[]},ce=function(e){var t;if(e&&Array.isArray(e.data)){var n="number"==typeof e.total?e.total:"number"==typeof(null===(t=e.pagination)||void 0===t?void 0:t.total)?e.pagination.total:e.data.length;return{rows:e.data,total:n}}if(e&&Array.isArray(e.rows)){var r="number"==typeof e.total?e.total:e.rows.length;return{rows:e.rows,total:r}}return Array.isArray(e)?{rows:e,total:e.length}:{rows:[],total:0}};e.useEffect(function(){ue()},[]),e.useEffect(function(){i&&de()},[i,j,P,I,Q]);var ue=function(){var e=g(O().m(function e(){var t;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:return G(!0),e.p=1,e.n=2,du();case 2:t=e.v,a(se(t.data)),e.n=4;break;case 3:e.p=3,e.v,Fs.error("加载模型列表失败");case 4:return e.p=4,G(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),de=function(){var e=g(O().m(function e(){var t,n,r;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i){e.n=1;break}return e.a(2);case 1:return p(!0),e.p=2,t={page:j,limit:P},I&&(t.search=I),Q.length>0&&(t.filters=Q),e.n=3,bu(i.table_name,t);case 3:if((n=e.v).success){e.n=4;break}return Fs.error(n.message||"加载数据失败"),d([]),M(0),e.a(2);case 4:r=ce(n.data),d(r.rows),M(r.total),e.n=6;break;case 5:e.p=5,e.v,Fs.error("加载数据失败"),d([]),M(0);case 6:return e.p=6,p(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),fe=function(){var e=g(O().m(function e(t){var n;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return $(t.id),e.p=2,e.n=3,Eu(null==i?void 0:i.table_name,t.id);case 3:(n=e.v).success?(Fs.success("删除成功"),de()):Fs.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Fs.error("删除失败");case 5:return e.p=5,$(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),me=function(){var e=g(O().m(function e(){var t,n,r,a,o;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i){e.n=1;break}return e.a(2);case 1:if(q(!0),e.p=2,t={},i.json_schema.fields.forEach(function(e){if("id"!==e.name){var n=k[e.name];if("date"!==e.type&&"datetime"!==e.type||(n=n?new Date(n).toISOString():null),"json"===e.type||"jsonb"===e.type){var r=(n||"").toString().trim();if(r){var a=wf(r);if(!a.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(a.message));n=a.value}else n=null}t[e.name]=n}}),!w){e.n=4;break}return e.n=3,xu(i.table_name,Object.assign(Object.assign({},t),{id:w.id}));case 3:(n=e.v).success?(Fs.success("更新成功"),b(!1),de()):Fs.error(n.message||"更新失败"),e.n=6;break;case 4:return e.n=5,wu(i.table_name,t);case 5:(r=e.v).success?(Fs.success("创建成功"),b(!1),de()):Fs.error(r.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,o=e.v,a=o instanceof Error?o.message:"操作失败",Fs.error(a);case 8:return e.p=8,q(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},e.createElement("div",{className:"space-y-2"},e.createElement("h1",{className:"text-3xl font-bold tracking-tight"},"数据列表"),e.createElement("p",{className:"text-muted-foreground"},"选择模型查看和管理数据")),e.createElement(ws,{className:"border-2 shadow-lg"},e.createElement(xs,{className:"bg-muted/30"},e.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},e.createElement("div",null,e.createElement(Es,null,"数据管理"),e.createElement(Ns,null,"选择数据模型进行查看和管理")),i&&e.createElement(St,{onClick:function(){x(null),S({}),b(!0)},className:"w-full md:w-auto"},e.createElement(re,{className:"h-4 w-4 mr-2"}),"新建数据"))),e.createElement(ks,{className:"space-y-6 pt-6"},e.createElement("div",{className:"flex flex-col md:flex-row gap-4"},e.createElement("div",{className:"flex-1 space-y-2"},e.createElement(ys,{htmlFor:"model",className:"text-base font-medium flex items-center gap-2"},e.createElement(J,{className:"h-4 w-4"}),"选择数据模型"),e.createElement(Ud,{value:(null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.toString())||"",onValueChange:function(e){var t=r.find(function(t){return t.id.toString()===e});l(t||null),_(1),F(""),ee([])},disabled:Y},e.createElement(Wd,{className:"h-11"},Y?e.createElement("div",{className:"flex items-center gap-2"},e.createElement(Z,{className:"h-4 w-4 animate-spin"}),e.createElement("span",null,"加载中...")):e.createElement(Hd,{placeholder:"请选择模型"})),e.createElement(Kd,null,r.map(function(t){return e.createElement(Yd,{key:t.id,value:t.id.toString()},t.name," (",t.table_name,")")})))),i&&e.createElement("div",{className:"flex-1 space-y-2"},e.createElement(ys,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},e.createElement(ae,{className:"h-4 w-4"}),"搜索"),e.createElement("div",{className:"relative"},e.createElement(ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.createElement(Ot,{id:"search",placeholder:"搜索数据...",value:I,onChange:function(e){return F(e.target.value)},className:"pl-10 h-11"})))),i&&e.createElement(e.Fragment,null,e.createElement("div",{className:"flex items-center justify-end"},e.createElement(St,{type:"button",variant:"outline",className:"h-10",onClick:function(){return oe(!0)}},e.createElement(J,{className:"h-4 w-4 mr-2"}),"筛选",Q.length>0?"(".concat(Q.length,")"):"")),e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",e.createElement("span",{className:"font-semibold text-foreground"},D)," 条数据"),e.createElement(Pf,{variant:"outline"},i.name)),e.createElement("div",{className:"rounded-lg border overflow-hidden"},e.createElement("div",{className:"overflow-x-auto"},e.createElement(Sf,null,e.createElement(Of,null,e.createElement(jf,{className:"bg-muted/50"},e.createElement(Rf,{className:"font-semibold w-20"},"ID"),i.json_schema.fields.map(function(t){return e.createElement(Rf,{key:t.name,className:"font-semibold"},t.comment||t.name)}),e.createElement(Rf,{className:"font-semibold"},"创建时间"),e.createElement(Rf,{className:"font-semibold"},"更新时间"),e.createElement(Rf,{className:"font-semibold w-32 text-center"},"操作"))),e.createElement(Cf,null,m?Array.from({length:3}).map(function(t,n){return e.createElement(jf,{key:n},e.createElement(_f,{colSpan:i.json_schema.fields.length+4},e.createElement("div",{className:"flex items-center gap-2 py-4"},e.createElement(Z,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===u.length?e.createElement(jf,null,e.createElement(_f,{colSpan:i.json_schema.fields.length+4,className:"text-center py-12"},e.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},e.createElement(ae,{className:"h-8 w-8"}),e.createElement("p",null,"暂无数据")))):u.map(function(t,n){return e.createElement(jf,{key:t.id,className:n%2==0?"bg-muted/20":""},e.createElement(_f,{className:"font-mono font-medium"},t.id),i.json_schema.fields.map(function(n){return e.createElement(_f,{key:n.name},function(t,n){return"boolean"===t.type?e.createElement(Pf,{variant:n?"default":"secondary"},n?"是":"否"):"date"===t.type||"datetime"===t.type?n?s(n).format("YYYY-MM-DD HH:mm:ss"):"-":"text"===t.type&&n&&n.length>50?e.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"..."):"json"===t.type||"jsonb"===t.type?e.createElement(Nf,{value:n,title:t.comment||t.name}):n||"-"}(n,t[n.name]))}),e.createElement(_f,{className:"text-sm text-muted-foreground"},s(t.created_at).format("YYYY-MM-DD HH:mm")),e.createElement(_f,{className:"text-sm text-muted-foreground"},s(t.updated_at).format("YYYY-MM-DD HH:mm")),e.createElement(_f,null,e.createElement("div",{className:"flex items-center justify-center gap-2"},e.createElement(St,{variant:"ghost",size:"sm",onClick:function(){return function(e){x(e);var t={};null==i||i.json_schema.fields.forEach(function(n){if("id"!==n.name){var r=e[n.name];"date"!==n.type&&"datetime"!==n.type||(r=r?s(r).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(r=null==r||""===r?"":"string"==typeof r?r:JSON.stringify(r,null,2)),t[n.name]=r}}),S(t),b(!0)}(t)},className:"h-8 w-8 p-0"},e.createElement(ie,{className:"h-4 w-4"})),e.createElement(St,{variant:"ghost",size:"sm",onClick:function(){return fe(t)},disabled:V===t.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},V===t.id?e.createElement(Z,{className:"h-4 w-4 animate-spin"}):e.createElement(le,{className:"h-4 w-4"})))))}))))),D>P&&e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",e.createElement("span",{className:"font-semibold text-foreground"},j)," 页, 共 ",e.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(D/P))," 页"),e.createElement("div",{className:"flex gap-2"},e.createElement(St,{variant:"outline",size:"sm",onClick:function(){return _(Math.max(1,j-1))},disabled:1===j||m},e.createElement(H,{className:"h-4 w-4 mr-1"}),"上一页"),e.createElement(St,{variant:"outline",size:"sm",onClick:function(){return _(Math.min(Math.ceil(D/P),j+1))},disabled:j>=Math.ceil(D/P)||m},"下一页",e.createElement(W,{className:"h-4 w-4 ml-1"}))))))),i&&e.createElement(uf,{open:ne,onOpenChange:oe},e.createElement(pf,{className:"max-w-3xl"},e.createElement(hf,null,e.createElement(gf,{className:"text-xl"},"筛选"),e.createElement(bf,{className:"text-sm"},i.name," - ",i.table_name)),e.createElement("div",{className:"py-2"},e.createElement(Mf,{fields:i.json_schema.fields,value:Q,onChange:function(e){ee(e),_(1)}})),e.createElement(vf,{className:"gap-2"},e.createElement(St,{variant:"outline",onClick:function(){return oe(!1)}},"关闭")))),e.createElement(uf,{open:v,onOpenChange:b},e.createElement(pf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},e.createElement(hf,null,e.createElement(gf,{className:"text-2xl"},w?"编辑数据":"新建数据"),e.createElement(bf,{className:"text-base"},null==i?void 0:i.name," - ",null==i?void 0:i.table_name)),e.createElement("div",{className:"space-y-4 py-4"},null==i?void 0:i.json_schema.fields.map(function(t){return function(t){if("id"===t.name)return null;switch(t.type){case"boolean":return e.createElement("div",{key:t.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},e.createElement(lf,{id:t.name,checked:k[t.name]||!1,onCheckedChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e)))}}),e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium cursor-pointer"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"date",value:k[t.name]||"",onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"datetime":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"datetime-local",value:k[t.name]||"",onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"text":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(cf,{id:t.name,rows:4,value:k[t.name]||"",onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e.target.value)))},required:t.required,className:"resize-none"}));case"json":case"jsonb":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(kf,{id:t.name,value:k[t.name]||"",required:t.required,onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e)))}}));case"integer":case"float":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"number",value:k[t.name]||"",onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));default:return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"email"===t.type?"email":"text",maxLength:t.maxLength,value:k[t.name]||"",onChange:function(e){return S(Object.assign(Object.assign({},k),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}))}}(t)})),e.createElement(vf,{className:"gap-2"},e.createElement(St,{variant:"outline",onClick:function(){return b(!1)},disabled:B},"取消"),e.createElement(St,{onClick:me,disabled:B},B?e.createElement(e.Fragment,null,e.createElement(Z,{className:"h-4 w-4 mr-2 animate-spin"}),w?"更新中...":"创建中..."):w?"更新":"创建"))))))}function If(t){var n=R(e.useState(t||null),2),r=n[0],a=n[1],o=R(e.useState([]),2),i=o[0],l=o[1],c=R(e.useState(!1),2),u=c[0],d=c[1],f=R(e.useState(!1),2),m=f[0],p=f[1],h=R(e.useState(null),2),v=h[0],b=h[1],y=R(e.useState({}),2),w=y[0],x=y[1],E=R(e.useState(1),2),k=E[0],S=E[1],C=R(e.useState(10),2),j=C[0];C[1];var _=R(e.useState(0),2),T=_[0],P=_[1],A=R(e.useState(""),2),D=A[0],M=A[1],L=R(e.useState(!1),2),I=L[0],F=L[1],z=R(e.useState(null),2),B=z[0],q=z[1],U=R(e.useState({}),2),V=U[0],$=U[1];e.useEffect(function(){r&&J()},[r,k,j,D]),e.useEffect(function(){t&&(a(t),S(1),M(""))},[t]);var Y=function(){var e=g(O().m(function e(t){var n,r,a,o,i;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if("relation"===t.type&&t.relation){e.n=1;break}return e.a(2);case 1:if(n=t.relation,r=n.target,a=n.displayField,o="".concat(r,"_").concat(a||"name"),!V[o]){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,yu(r,{displayField:a||"name",limit:200});case 3:(i=e.v).success&&i.data&&$(function(e){return Object.assign(Object.assign({},e),N({},o,i.data))}),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}();e.useEffect(function(){m&&r&&r.json_schema.fields.filter(function(e){return"relation"===e.type&&e.relation}).forEach(function(e){return Y(e)})},[m,r]);var J=function(){var e=g(O().m(function e(){var t,n,a,o;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:return d(!0),e.p=2,a={page:k,limit:j},D&&(a.search=D),e.n=3,bu(r.table_name,a);case 3:o=e.v,l((null===(t=o.data)||void 0===t?void 0:t.data)||[]),P((null===(n=o.data)||void 0===n?void 0:n.total)||0),e.n=5;break;case 4:e.p=4,e.v,Fs.error("加载数据失败"),l([]),P(0);case 5:return e.p=5,d(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),G=function(){var e=g(O().m(function e(t){var n;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return q(t.id),e.p=2,e.n=3,Eu(null==r?void 0:r.table_name,t.id);case 3:(n=e.v).success?(Fs.success("删除成功"),J()):Fs.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Fs.error("删除失败");case 5:return e.p=5,q(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=g(O().m(function e(){var t,n,a,o;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:if(F(!0),e.p=2,t={},r.json_schema.fields.forEach(function(e){if("id"!==e.name)if("relation"===e.type&&e.relation){var n=e.relation.foreignKey||"".concat(e.relation.target,"_id");t[n]=w[n]}else{var r=w[e.name];"date"!==e.type&&"datetime"!==e.type||(r=r?new Date(r).toISOString():null),t[e.name]=r}}),!v){e.n=4;break}return n=Object.assign(Object.assign({},t),{id:v.id}),e.n=3,xu(r.table_name,n);case 3:(a=e.v).success?(Fs.success("更新成功"),p(!1),J()):Fs.error(a.message||"更新失败"),e.n=6;break;case 4:return e.n=5,wu(r.table_name,t);case 5:(o=e.v).success?(Fs.success("创建成功"),p(!1),J()):Fs.error(o.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,e.v,Fs.error("操作失败");case 8:return e.p=8,F(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return r?e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},e.createElement("div",{className:"space-y-2"},e.createElement("div",{className:"flex items-center gap-3"},e.createElement("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10 text-primary"},e.createElement(K,{className:"h-5 w-5"})),e.createElement("div",null,e.createElement("h1",{className:"text-3xl font-bold tracking-tight"},r.name),e.createElement("p",{className:"text-muted-foreground"},"表名: ",r.table_name)))),e.createElement(ws,{className:"border-2 shadow-lg"},e.createElement(xs,{className:"bg-muted/30"},e.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},e.createElement("div",null,e.createElement(Es,null,"数据管理"),e.createElement(Ns,null,"查看和管理 ",r.name," 的数据")),e.createElement(St,{onClick:function(){b(null),x({}),p(!0)},className:"w-full md:w-auto"},e.createElement(re,{className:"h-4 w-4 mr-2"}),"新建数据"))),e.createElement(ks,{className:"space-y-6 pt-6"},e.createElement("div",{className:"space-y-2"},e.createElement(ys,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},e.createElement(ae,{className:"h-4 w-4"}),"搜索"),e.createElement("div",{className:"relative"},e.createElement(ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.createElement(Ot,{id:"search",placeholder:"搜索数据...",value:D,onChange:function(e){return M(e.target.value)},className:"pl-10 h-11"}))),e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",e.createElement("span",{className:"font-semibold text-foreground"},T)," 条数据"),e.createElement(Pf,{variant:"outline"},r.name)),e.createElement("div",{className:"rounded-lg border overflow-hidden"},e.createElement("div",{className:"overflow-x-auto"},e.createElement(Sf,null,e.createElement(Of,null,e.createElement(jf,{className:"bg-muted/50"},e.createElement(Rf,{className:"font-semibold w-20"},"ID"),r.json_schema.fields.map(function(t){return e.createElement(Rf,{key:t.name,className:"font-semibold"},t.comment||t.name)}),e.createElement(Rf,{className:"font-semibold"},"创建时间"),e.createElement(Rf,{className:"font-semibold"},"更新时间"),e.createElement(Rf,{className:"font-semibold w-32 text-center"},"操作"))),e.createElement(Cf,null,u?Array.from({length:3}).map(function(t,n){return e.createElement(jf,{key:n},e.createElement(_f,{colSpan:r.json_schema.fields.length+4},e.createElement("div",{className:"flex items-center gap-2 py-4"},e.createElement(Z,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===i.length?e.createElement(jf,null,e.createElement(_f,{colSpan:r.json_schema.fields.length+4,className:"text-center py-12"},e.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},e.createElement(ae,{className:"h-8 w-8"}),e.createElement("p",null,"暂无数据")))):i.map(function(t,n){return e.createElement(jf,{key:t.id,className:n%2==0?"bg-muted/20":""},e.createElement(_f,{className:"font-mono font-medium"},t.id),r.json_schema.fields.map(function(n){return e.createElement(_f,{key:n.name},function(t,n,r){if("boolean"===t.type)return e.createElement(Pf,{variant:n?"default":"secondary"},n?"是":"否");if("date"===t.type||"datetime"===t.type)return n?s(n).format("YYYY-MM-DD HH:mm:ss"):"-";if("text"===t.type&&n&&n.length>50)return e.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"...");if("relation"===t.type&&t.relation&&r){var a=t.relation.displayField,o=void 0===a?"name":a,i=r["".concat(t.name,"_data")];if(i)return e.createElement(Pf,{variant:"outline"},i[o]||"ID: ".concat(i.id));var l=r[t.relation.foreignKey||"".concat(t.relation.target,"_id")];return l?"ID: ".concat(l):"-"}return n||"-"}(n,t[n.name],t))}),e.createElement(_f,{className:"text-sm text-muted-foreground"},s(t.created_at).format("YYYY-MM-DD HH:mm")),e.createElement(_f,{className:"text-sm text-muted-foreground"},s(t.updated_at).format("YYYY-MM-DD HH:mm")),e.createElement(_f,null,e.createElement("div",{className:"flex items-center justify-center gap-2"},e.createElement(St,{variant:"ghost",size:"sm",onClick:function(){return function(e){b(e);var t={};null==r||r.json_schema.fields.forEach(function(n){if("id"!==n.name)if("relation"===n.type&&n.relation){var r=n.relation.foreignKey||"".concat(n.relation.target,"_id");t[r]=e[r]}else{var a=e[n.name];"date"!==n.type&&"datetime"!==n.type||(a=a?s(a).format("YYYY-MM-DDTHH:mm"):""),t[n.name]=a}}),x(t),p(!0)}(t)},className:"h-8 w-8 p-0"},e.createElement(ie,{className:"h-4 w-4"})),e.createElement(St,{variant:"ghost",size:"sm",onClick:function(){return G(t)},disabled:B===t.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},B===t.id?e.createElement(Z,{className:"h-4 w-4 animate-spin"}):e.createElement(le,{className:"h-4 w-4"})))))}))))),T>j&&e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",e.createElement("span",{className:"font-semibold text-foreground"},k)," 页, 共 ",e.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(T/j))," 页"),e.createElement("div",{className:"flex gap-2"},e.createElement(St,{variant:"outline",size:"sm",onClick:function(){return S(Math.max(1,k-1))},disabled:1===k||u},e.createElement(H,{className:"h-4 w-4 mr-1"}),"上一页"),e.createElement(St,{variant:"outline",size:"sm",onClick:function(){return S(Math.min(Math.ceil(T/j),k+1))},disabled:k>=Math.ceil(T/j)||u},"下一页",e.createElement(W,{className:"h-4 w-4 ml-1"})))))),e.createElement(uf,{open:m,onOpenChange:p},e.createElement(pf,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},e.createElement(hf,null,e.createElement(gf,{className:"text-2xl"},v?"编辑数据":"新建数据"),e.createElement(bf,{className:"text-base"},r.name," - ",r.table_name)),e.createElement("div",{className:"space-y-4 py-4"},r.json_schema.fields.map(function(t){return function(t){if("id"===t.name)return null;switch(t.type){case"boolean":return e.createElement("div",{key:t.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},e.createElement(lf,{id:t.name,checked:w[t.name]||!1,onCheckedChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e)))}}),e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium cursor-pointer"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"date",value:w[t.name]||"",onChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"datetime":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"datetime-local",value:w[t.name]||"",onChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"text":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(cf,{id:t.name,rows:4,value:w[t.name]||"",onChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e.target.value)))},required:t.required,className:"resize-none"}));case"integer":case"float":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"number",value:w[t.name]||"",onChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"relation":if(!t.relation)return null;var n=t.relation,r=n.target,a=n.displayField,o=void 0===a?"name":a,i="".concat(r,"_").concat(o),s=V[i]||[],l=t.relation.foreignKey||"".concat(r,"_id"),c=void 0!==w[l]&&null!==w[l]?String(w[l]):"",u=s.find(function(e){return String(e.id)===c});return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ud,{value:c,onValueChange:function(e){var t=parseInt(e,10),n=!isNaN(t)&&String(t)===e;x(Object.assign(Object.assign({},w),N({},l,n?t:e)))}},e.createElement(Wd,{className:"h-11"},e.createElement(Hd,{placeholder:"请选择".concat(t.comment||t.name)},u?u.label:c?"ID: ".concat(c):"请选择".concat(t.comment||t.name))),e.createElement(Kd,null,0===s.length?e.createElement(Yd,{value:"_loading",disabled:!0},"加载中..."):s.map(function(t){return e.createElement(Yd,{key:t.id,value:String(t.id)},t.label)}))));default:return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ys,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ot,{id:t.name,type:"email"===t.type?"email":"text",maxLength:t.maxLength,value:w[t.name]||"",onChange:function(e){return x(Object.assign(Object.assign({},w),N({},t.name,e.target.value)))},required:t.required,className:"h-11"}))}}(t)})),e.createElement(vf,{className:"gap-2"},e.createElement(St,{variant:"outline",onClick:function(){return p(!1)},disabled:I},"取消"),e.createElement(St,{onClick:X,disabled:I},I?e.createElement(e.Fragment,null,e.createElement(Z,{className:"h-4 w-4 mr-2 animate-spin"}),v?"更新中...":"创建中..."):v?"更新":"创建")))))):e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-8"},e.createElement(ws,{className:"border-2"},e.createElement(ks,{className:"py-16 text-center"},e.createElement(K,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.createElement("p",{className:"text-lg text-muted-foreground"},"请选择数据模型")))))}function Ff(t){return t.models.map(function(t){return{path:"/data/list-".concat(t.id),name:t.name,icon:e.createElement(se),component:function(){return n=t,e.createElement(If,Object.assign({},n));var n}}})}var zf=function(t){return[{path:"/login",name:"登录",icon:e.createElement(ee),component:Nu},{name:"数据管理",icon:e.createElement($),path:"/data",component:Lf,routes:_(Ff(t))}]},Bf=oe,qf=ce,Uf=te;function Hf(t){var n=t.inputModels,r=t.skipAuth,a=void 0!==r&&r,o=R(e.useState("/data"),2),i=o[0],s=o[1],l=R(e.useState([]),2);l[0],l[1];var c=R(e.useState(!1),2),u=c[0],d=c[1],f=R(e.useState(null),2),m=f[0],p=f[1],h=R(e.useState(!0),2),v=h[0],b=h[1];e.useEffect(function(){if(a)return d(!0),p(null),b(!1),void("/login"===i&&s("/data"));var e=function(){var e=g(O().m(function e(){var t,n;return O().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,vu()){e.n=1;break}return d(!1),s("/login"),b(!1),e.a(2);case 1:return e.p=1,e.n=2,mu();case 2:if(e.v.success){e.n=3;break}throw new Error("token验证失败");case 3:if(!(t=gu())){e.n=4;break}p(t),e.n=6;break;case 4:return e.n=5,pu();case 5:(n=e.v).success&&n.data&&(p(n.data),localStorage.setItem("cms_user",JSON.stringify(n.data)));case 6:d(!0),"/login"===i&&s("/data"),e.n=8;break;case 7:e.p=7,e.v,hu(),d(!1),p(null),s("/login");case 8:e.n=10;break;case 9:e.p=9,e.v,d(!1),p(null),s("/login");case 10:return e.p=10,b(!1),e.f(10);case 11:return e.a(2)}},e,null,[[1,7],[0,9,10,11]])}));return function(){return e.apply(this,arguments)}}();e()},[a]);var y=function(e,t){p(t),d(!0),s("/data"),Fs.success("欢迎回来,".concat(t.username,"!"))},w=function(e,t){var n,r=E(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.path===t)return a;if(a.routes){var o=w(a.routes,t);if(o)return o}}}catch(e){r.e(e)}finally{r.f()}return null};if(v)return e.createElement("div",{className:"flex min-h-screen items-center justify-center bg-background"},e.createElement("div",{className:"space-y-4"},e.createElement(ct,{className:"h-12 w-48"}),e.createElement(ct,{className:"h-4 w-64"})));if(!u)return e.createElement(Nu,{onLoginSuccess:y});var x=zf(n).filter(function(e){return"/login"!==e.path}),N=function(t){if(!t)return K;if(e.isValidElement(t)){var n=t.type;if(n&&"function"==typeof n){var r=n.name||"";if(r.includes("Home"))return G;if(r.includes("Table"))return se;if(r.includes("Database"))return K;if(r.includes("File"))return Y}}return K},k=x.flatMap(function(e){return e.routes&&e.routes.length>0?e.routes.map(function(e){return{title:e.name,icon:N(e.icon),path:e.path}}):[{title:e.name,icon:N(e.icon),path:e.path}]});return e.createElement(ns,null,e.createElement(rs,{variant:"inset"},e.createElement(is,{className:"border-b border-sidebar-border"},e.createElement("div",{className:"flex items-center gap-2 px-2 py-1"},e.createElement("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-primary"},e.createElement(Bf,{className:"w-4 h-4 text-primary-foreground"})),e.createElement("span",{className:"font-semibold text-lg"},"WE0-CMS"))),e.createElement(ls,null,e.createElement(cs,null,e.createElement(us,null,"Navigation"),e.createElement(ds,null,e.createElement(fs,null,k.map(function(t){return e.createElement(ms,{key:t.path},e.createElement(hs,{onClick:function(){return s(t.path)},isActive:(n=t.path,i===n||i.startsWith(n+"/")),tooltip:t.title},e.createElement(t.icon,{className:"w-4 h-4"}),e.createElement("span",null,t.title)));var n}))))),e.createElement(ss,{className:"border-t border-sidebar-border"},e.createElement(fs,null,!a&&m&&e.createElement(e.Fragment,null,e.createElement(ms,null,e.createElement(hs,{tooltip:m.username||"User"},e.createElement(qf,{className:"w-4 h-4"}),e.createElement("span",{className:"truncate"},m.username))),e.createElement(ms,null,e.createElement(hs,{onClick:function(){window.confirm("确定要登出系统吗?")&&(hu(),localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),d(!1),p(null),s("/login"),Fs.success("已成功登出"))},tooltip:"Logout"},e.createElement(Uf,{className:"w-4 h-4"}),e.createElement("span",null,"Logout"))))))),e.createElement(os,null,e.createElement("header",{className:"flex h-14 items-center gap-4 border-b bg-background px-6"},e.createElement(as,null),e.createElement("h1",{className:"text-lg font-semibold"},function(){if("/login"===i)return"Login";var e=w(zf(n),i);return(null==e?void 0:e.name)||"数据管理"}())),e.createElement("main",{className:"flex-1 p-6"},function(){if(!a&&"/login"===i)return e.createElement(Nu,{onLoginSuccess:y});if(a&&"/login"===i)return e.createElement(Lf,null);var t=w(zf(n),i);if(t){var r=t.component;return e.createElement(r,null)}return e.createElement(Lf,null)}())))}exports.CmsLayoutShadcn=Hf,exports.cmsRoutes=zf,exports.default=Hf,exports.setSessionId=function(e){ou=e;try{localStorage.setItem("cms_session_id",e)}catch(e){}};
|
|
9
|
+
*/var b={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v0.344.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/const y=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),w=(t,n)=>{const r=e.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:a="",children:l,...c},h)=>e.createElement("svg",{ref:h,...b,width:i,height:i,stroke:r,strokeWidth:s?24*Number(o)/Number(i):o,className:["lucide",`lucide-${y(t)}`,a].join(" "),...c},[...n.map(([t,n])=>e.createElement(t,n)),...Array.isArray(l)?l:[l]]));return r.displayName=`${t}`,r},x=w("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),k=w("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),S=w("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),E=w("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),C=w("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),O=w("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),N=w("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),A=w("Crown",[["path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14",key:"zkxr6b"}]]),T=w("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),M=w("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),R=w("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),D=w("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),P=w("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),L=w("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),B=w("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),I=w("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),j=w("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),_=w("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),F=w("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),W=w("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),z=w("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),H=w("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]),V=w("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),q=w("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),U=w("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),$=w("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),K=w("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Y=function(){return Y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Y.apply(this,arguments)};function G(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function X(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=X(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function J(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=X(e))&&(r&&(r+=" "),r+=t);return r}"function"==typeof SuppressedError&&SuppressedError;const Q=e=>{const t=ne(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),Z(n,t)||te(e)},getConflictingClassGroupIds:(e,t)=>{const i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},Z=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Z(e.slice(1),r):void 0;if(i)return i;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},ee=/^\[(.+)\]$/,te=e=>{if(ee.test(e)){const t=ee.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},ne=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return se(Object.entries(e.classGroups),n).forEach(([e,n])=>{re(n,r,e,t)}),r},re=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:ie(t,e)).classGroupId=n)}if("function"==typeof e)return oe(e)?void re(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,i])=>{re(i,ie(t,e),n,r)})})},ie=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},oe=e=>e.isThemeGetter,se=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,ae=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(i(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},le=e=>{const{separator:t,experimentalParseClassName:n}=e,r=1===t.length,i=t[0],o=t.length,s=e=>{const n=[];let s,a=0,l=0;for(let c=0;c<e.length;c++){let h=e[c];if(0===a){if(h===i&&(r||e.slice(c,c+o)===t)){n.push(e.slice(l,c)),l=c+o;continue}if("/"===h){s=c;continue}}"["===h?a++:"]"===h&&a--}const c=0===n.length?e:e.substring(l),h=c.startsWith("!");return{modifiers:n,hasImportantModifier:h,baseClassName:h?c.substring(1):c,maybePostfixModifierPosition:s&&s>l?s-l:void 0}};return n?e=>n({className:e,parseClassName:s}):s},ce=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},he=/\s+/;function ue(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=de(e))&&(r&&(r+=" "),r+=t);return r}const de=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=de(e[r]))&&(n&&(n+=" "),n+=t);return n};function fe(e,...t){let n,r,i,o=function(a){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:ae(e.cacheSize),parseClassName:le(e),...Q(e)}))(l),r=n.cache.get,i=n.cache.set,o=s,s(a)};function s(e){const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(he);let a="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{modifiers:l,hasImportantModifier:c,baseClassName:h,maybePostfixModifierPosition:u}=n(t);let d=Boolean(u),f=r(d?h.substring(0,u):h);if(!f){if(!d){a=t+(a.length>0?" "+a:a);continue}if(f=r(h),!f){a=t+(a.length>0?" "+a:a);continue}d=!1}const p=ce(l).join(":"),m=c?p+"!":p,g=m+f;if(o.includes(g))continue;o.push(g);const v=i(f,d);for(let e=0;e<v.length;++e){const t=v[e];o.push(m+t)}a=t+(a.length>0?" "+a:a)}return a})(e,n);return i(e,o),o}return function(){return o(ue.apply(null,arguments))}}const pe=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},me=/^\[(?:([a-z-]+):)?(.+)\]$/i,ge=/^\d+\/\d+$/,ve=new Set(["px","full","screen"]),be=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ye=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,we=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ke=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Se=e=>Ce(e)||ve.has(e)||ge.test(e),Ee=e=>_e(e,"length",Fe),Ce=e=>Boolean(e)&&!Number.isNaN(Number(e)),Oe=e=>_e(e,"number",Ce),Ne=e=>Boolean(e)&&Number.isInteger(Number(e)),Ae=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),Te=e=>me.test(e),Me=e=>be.test(e),Re=new Set(["length","size","percentage"]),De=e=>_e(e,Re,We),Pe=e=>_e(e,"position",We),Le=new Set(["image","url"]),Be=e=>_e(e,Le,He),Ie=e=>_e(e,"",ze),je=()=>!0,_e=(e,t,n)=>{const r=me.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},Fe=e=>ye.test(e)&&!we.test(e),We=()=>!1,ze=e=>xe.test(e),He=e=>ke.test(e),Ve=fe(()=>{const e=pe("colors"),t=pe("spacing"),n=pe("blur"),r=pe("brightness"),i=pe("borderColor"),o=pe("borderRadius"),s=pe("borderSpacing"),a=pe("borderWidth"),l=pe("contrast"),c=pe("grayscale"),h=pe("hueRotate"),u=pe("invert"),d=pe("gap"),f=pe("gradientColorStops"),p=pe("gradientColorStopPositions"),m=pe("inset"),g=pe("margin"),v=pe("opacity"),b=pe("padding"),y=pe("saturate"),w=pe("scale"),x=pe("sepia"),k=pe("skew"),S=pe("space"),E=pe("translate"),C=()=>["auto",Te,t],O=()=>[Te,t],N=()=>["",Se,Ee],A=()=>["auto",Ce,Te],T=()=>["","0",Te],M=()=>[Ce,Te];return{cacheSize:500,separator:":",theme:{colors:[je],spacing:[Se,Ee],blur:["none","",Me,Te],brightness:M(),borderColor:[e],borderRadius:["none","","full",Me,Te],borderSpacing:O(),borderWidth:N(),contrast:M(),grayscale:T(),hueRotate:M(),invert:T(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Ae,Ee],inset:C(),margin:C(),opacity:M(),padding:O(),saturate:M(),scale:M(),sepia:T(),skew:M(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Me]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Te]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ne,Te]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:T()}],shrink:[{shrink:T()}],order:[{order:["first","last","none",Ne,Te]}],"grid-cols":[{"grid-cols":[je]}],"col-start-end":[{col:["auto",{span:["full",Ne,Te]},Te]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[je]}],"row-start-end":[{row:["auto",{span:[Ne,Te]},Te]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,t]}],"min-w":[{"min-w":[Te,t,"min","max","fit"]}],"max-w":[{"max-w":[Te,t,"none","full","min","max","fit","prose",{screen:[Me]},Me]}],h:[{h:[Te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Me,Ee]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Oe]}],"font-family":[{font:[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Te]}],"line-clamp":[{"line-clamp":["none",Ce,Oe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Se,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Se,Ee]}],"underline-offset":[{"underline-offset":["auto",Se,Te]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",Pe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",De]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Be]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[Se,Te]}],"outline-w":[{outline:[Se,Ee]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Se,Ee]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Me,Ie]}],"shadow-color":[{shadow:[je]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Me,Te]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[u]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Ne,Te]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Se,Ee,Oe]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ve(J(t))}function Ue(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("animate-pulse rounded-md bg-muted",t)},n))}function $e(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ke(...e){return t=>{let n=!1;const r=e.map(e=>{const r=$e(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():$e(e[t],null)}}}}function Ye(...e){return s.useCallback(Ke(...e),e)}var Ge=Symbol.for("react.lazy"),Xe=s[" use ".trim().toString()];function Je(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Ge&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Qe(e){const n=et(e),r=s.forwardRef((e,r)=>{let{children:i,...o}=e;Je(i)&&"function"==typeof Xe&&(i=Xe(i._payload));const a=s.Children.toArray(i),l=a.find(nt);if(l){const e=l.props.children,i=a.map(t=>t===l?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,i):null})}return t.jsx(n,{...o,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}var Ze=Qe("Slot");function et(e){const t=s.forwardRef((e,t)=>{let{children:n,...r}=e;if(Je(n)&&"function"==typeof Xe&&(n=Xe(n._payload)),s.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==s.Fragment&&(i.ref=t?Ke(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tt=Symbol("radix.slottable");function nt(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tt}const rt=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,it=J,ot=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return it(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(e=>{const t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;const s=rt(t)||rt(r);return i[e][s]}),a=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),l=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...a}[t]):{...o,...a}[t]===n})?[...e,n,r]:e},[]);return it(e,s,l,null==n?void 0:n.class,null==n?void 0:n.className)};var st=ot("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),at=s.forwardRef(function(e,t){var n=e.className,r=e.variant,i=e.size,o=e.asChild,a=void 0!==o&&o,l=G(e,["className","variant","size","asChild"]),c=a?Ze:"button";return s.createElement(c,Object.assign({className:qe(st({variant:r,size:i,className:n})),ref:t},l))});at.displayName="Button";var lt=s.forwardRef(function(e,t){var n=e.className,r=e.type,i=G(e,["className","type"]);return s.createElement("input",Object.assign({type:r,className:qe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:t},i))});lt.displayName="Input";var ct=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=Qe(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),ht="horizontal",ut=["horizontal","vertical"],dt=s.forwardRef((e,n)=>{const{decorative:r,orientation:i=ht,...o}=e,s=function(e){return ut.includes(e)}(i)?i:ht,a=r?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return t.jsx(ct.div,{"data-orientation":s,...a,...o,ref:n})});dt.displayName="Separator";var ft=dt,pt=s.forwardRef(function(e,t){var n=e.className,r=e.orientation,i=void 0===r?"horizontal":r,o=e.decorative,a=void 0===o||o,l=G(e,["className","orientation","decorative"]);return s.createElement(ft,Object.assign({ref:t,decorative:a,orientation:i,className:qe("shrink-0 bg-border","horizontal"===i?"h-[1px] w-full":"h-full w-[1px]",n)},l))});function mt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function gt(e,n=[]){let r=[];const i=()=>{const t=r.map(e=>s.createContext(e));return function(n){const r=n?.[e]||t;return s.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[function(n,i){const o=s.createContext(i),a=r.length;r=[...r,i];const l=n=>{const{scope:r,children:i,...l}=n,c=r?.[e]?.[a]||o,h=s.useMemo(()=>l,Object.values(l));return t.jsx(c.Provider,{value:h,children:i})};return l.displayName=n+"Provider",[l,function(t,r){const l=r?.[e]?.[a]||o,c=s.useContext(l);if(c)return c;if(void 0!==i)return i;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},vt(i,...n)]}function vt(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}pt.displayName=ft.displayName;var bt=globalThis?.document?s.useLayoutEffect:()=>{},yt=s[" useId ".trim().toString()]||(()=>{}),wt=0;function xt(e){const[t,n]=s.useState(yt());return bt(()=>{e||n(e=>e??String(wt++))},[e]),e||(t?`radix-${t}`:"")}var kt=s[" useInsertionEffect ".trim().toString()]||bt;function St({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=function({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),i=s.useRef(n),o=s.useRef(t);return kt(()=>{o.current=t},[t]),s.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:i;{const t=s.useRef(void 0!==e);s.useEffect(()=>{const e=t.current;if(e!==l){}t.current=l},[l,r])}const h=s.useCallback(t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&a.current?.(n)}else o(t)},[l,e,o,a]);return[c,h]}function Et(e){const n=Ct(e),r=s.forwardRef((e,r)=>{const{children:i,...o}=e,a=s.Children.toArray(i),l=a.find(Nt);if(l){const e=l.props.children,i=a.map(t=>t===l?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,i):null})}return t.jsx(n,{...o,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}function Ct(e){const t=s.forwardRef((e,t)=>{const{children:n,...r}=e;if(s.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==s.Fragment&&(i.ref=t?Ke(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ot=Symbol("radix.slottable");function Nt(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ot}var At=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=Et(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function Tt(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...e)=>t.current?.(...e),[])}function Mt(e,t=globalThis?.document){const n=Tt(e);s.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}var Rt,Dt="dismissableLayer.update",Pt="dismissableLayer.pointerDownOutside",Lt="dismissableLayer.focusOutside",Bt=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),It=s.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...h}=e,u=s.useContext(Bt),[d,f]=s.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=s.useState({}),g=Ye(n,e=>f(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1),i=s.useRef(()=>{});return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){_t(Pt,n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},p),E=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1);return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){_t(Lt,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),l?.(e),e.defaultPrevented||c?.())},p);return Mt(e=>{w===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),s.useEffect(()=>{if(d)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Rt=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),jt(),()=>{r&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Rt)}},[d,p,r,u]),s.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),jt())},[d,u]),s.useEffect(()=>{const e=()=>m({});return document.addEventListener(Dt,e),()=>document.removeEventListener(Dt,e)},[]),t.jsx(At.div,{...h,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...e.style},onFocusCapture:mt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:mt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:mt(e.onPointerDownCapture,S.onPointerDownCapture)})});It.displayName="DismissableLayer";function jt(){const e=new CustomEvent(Dt);document.dispatchEvent(e)}function _t(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}s.forwardRef((e,n)=>{const r=s.useContext(Bt),i=s.useRef(null),o=Ye(n,i);return s.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),t.jsx(At.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var Ft="focusScope.autoFocusOnMount",Wt="focusScope.autoFocusOnUnmount",zt={bubbles:!1,cancelable:!0},Ht=s.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,h]=s.useState(null),u=Tt(o),d=Tt(a),f=s.useRef(null),p=Ye(n,e=>h(e)),m=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(i){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:$t(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||$t(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&$t(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[i,c,m.paused]),s.useEffect(()=>{if(c){Kt.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Ft,zt);c.addEventListener(Ft,u),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if($t(r,{select:t}),document.activeElement!==n)return}((e=Vt(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&$t(c))}return()=>{c.removeEventListener(Ft,u),setTimeout(()=>{const e=new CustomEvent(Wt,zt);c.addEventListener(Wt,d),c.dispatchEvent(e),e.defaultPrevented||$t(t??document.body,{select:!0}),c.removeEventListener(Wt,d),Kt.remove(m)},0)}}var e},[c,u,d,m]);const g=s.useCallback(e=>{if(!r&&!i)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Vt(e),n=qt(t,e),r=qt(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&$t(o,{select:!0})):(e.preventDefault(),r&&$t(i,{select:!0})):n===t&&e.preventDefault()}},[r,i,m.paused]);return t.jsx(At.div,{tabIndex:-1,...l,ref:p,onKeyDown:g})});function Vt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qt(e,t){for(const n of e)if(!Ut(n,{upTo:t}))return n}function Ut(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function $t(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Ht.displayName="FocusScope";var Kt=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Yt(e,t),e.unshift(t)},remove(t){e=Yt(e,t),e[0]?.resume()}}}();function Yt(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Gt=s.forwardRef((e,r)=>{const{container:i,...o}=e,[a,l]=s.useState(!1);bt(()=>l(!0),[]);const c=i||a&&globalThis?.document?.body;return c?n.createPortal(t.jsx(At.div,{...o,ref:r}),c):null});Gt.displayName="Portal";var Xt=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=s.useState(),r=s.useRef(null),i=s.useRef(e),o=s.useRef("none"),a=e?"mounted":"unmounted",[l,c]=function(e,t){return s.useReducer((e,n)=>t[e][n]??e,e)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const e=Jt(r.current);o.current="mounted"===l?e:"none"},[l]),bt(()=>{const t=r.current,n=i.current;if(n!==e){const r=o.current,s=Jt(t);if(e)c("MOUNT");else if("none"===s||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==s?"ANIMATION_OUT":"UNMOUNT")}i.current=e}},[e,c]),bt(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,s=o=>{const s=Jt(r.current).includes(CSS.escape(o.animationName));if(o.target===t&&s&&(c("ANIMATION_END"),!i.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},a=e=>{e.target===t&&(o.current=Jt(r.current))};return t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:s.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),i="function"==typeof n?n({present:r.isPresent}):s.Children.only(n),o=Ye(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||r.isPresent?s.cloneElement(i,{ref:o}):null};function Jt(e){return e?.animationName||"none"}Xt.displayName="Presence";var Qt=0;function Zt(){s.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??en()),document.body.insertAdjacentElement("beforeend",e[1]??en()),Qt++,()=>{1===Qt&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Qt--}},[])}function en(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var tn="right-scroll-bar-position",nn="width-before-scroll-bar";function rn(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var on="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,sn=new WeakMap;function an(t,n){var r,i,o,s=(r=n||null,i=function(e){return t.forEach(function(t){return rn(t,e)})},(o=e.useState(function(){return{value:r,callback:i,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=i,o.facade);return on(function(){var e=sn.get(s);if(e){var n=new Set(e),r=new Set(t),i=s.current;n.forEach(function(e){r.has(e)||rn(e,null)}),r.forEach(function(e){n.has(e)||rn(e,i)})}sn.set(s,t)},[t]),s}function ln(e){return e}var cn=function(e){var t=e.sideCar,n=G(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return s.createElement(r,Y({},n))};cn.isSideCarExport=!0;var hn=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=ln);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=Y({async:!0,ssr:!1},e),t}(),un=function(){},dn=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:un,onWheelCapture:un,onTouchMoveCapture:un}),i=r[0],o=r[1],a=e.forwardProps,l=e.children,c=e.className,h=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,y=void 0===b?"div":b,w=e.gapMode,x=G(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,S=an([n,t]),E=Y(Y({},x),i);return s.createElement(s.Fragment,null,u&&s.createElement(k,{sideCar:hn,removeScrollBar:h,shards:d,noRelative:p,noIsolation:m,inert:g,setCallbacks:o,allowPinchZoom:!!v,lockRef:n,gapMode:w}),a?s.cloneElement(s.Children.only(l),Y(Y({},E),{ref:S})):s.createElement(y,Y({},E,{className:c,ref:S}),l))});dn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dn.classNames={fullWidth:nn,zeroRight:tn};function fn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var pn=function(){var e=0,t=null;return{add:function(n){var r,i;0==e&&(t=fn())&&(i=n,(r=t).styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mn=function(){var e,t=(e=pn(),function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},gn={left:0,top:0,right:0,gap:0},vn=function(e){return parseInt(e||"",10)||0},bn=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return gn;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[vn(n),vn(r),vn(i)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},yn=mn(),wn="data-scroll-locked",xn=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(wn,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(tn," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(nn," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(tn," .").concat(tn," {\n right: 0 ").concat(r,";\n }\n \n .").concat(nn," .").concat(nn," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(wn,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},kn=function(){var e=parseInt(document.body.getAttribute(wn)||"0",10);return isFinite(e)?e:0},Sn=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;s.useEffect(function(){return document.body.setAttribute(wn,(kn()+1).toString()),function(){var e=kn()-1;e<=0?document.body.removeAttribute(wn):document.body.setAttribute(wn,e.toString())}},[]);var o=s.useMemo(function(){return bn(i)},[i]);return s.createElement(yn,{styles:xn(o,!t,i,n?"":"!important")})},En=!1;if("undefined"!=typeof window)try{var Cn=Object.defineProperty({},"passive",{get:function(){return En=!0,!0}});window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch(e){En=!1}var On=!!En&&{passive:!1},Nn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},An=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Tn(e,r)){var i=Mn(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Tn=function(e,t){return"v"===e?function(e){return Nn(e,"overflowY")}(t):function(e){return Nn(e,"overflowX")}(t)},Mn=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Rn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dn=function(e){return[e.deltaX,e.deltaY]},Pn=function(e){return e&&"current"in e?e.current:e},Ln=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Bn=0,In=[];function jn(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var _n,Fn=(_n=function(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),i=s.useState(Bn++)[0],o=s.useState(mn)[0],a=s.useRef(e);s.useEffect(function(){a.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Pn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=s.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!a.current.allowPinchZoom;var i,o=Rn(e),s=n.current,l="deltaX"in e?e.deltaX:s[0]-o[0],c="deltaY"in e?e.deltaY:s[1]-o[1],h=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===h.type)return!1;var d=window.getSelection(),f=d&&d.anchorNode;if(f&&(f===h||f.contains(h)))return!1;var p=An(u,h);if(!p)return!0;if(p?i=u:(i="v"===u?"h":"v",p=An(u,h)),!p)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=i),!i)return!0;var m=r.current||i;return function(e,t,n,r,i){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),c=!1,h=s>0,u=0,d=0;do{if(!a)break;var f=Mn(e,a),p=f[0],m=f[1]-f[2]-o*p;(p||m)&&Tn(e,a)&&(u+=m,d+=p);var g=a.parentNode;a=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(h&&(i&&Math.abs(u)<1||!i&&s>u)||!h&&(i&&Math.abs(d)<1||!i&&-s>d))&&(c=!0),c}(m,t,e,"h"===m?l:c,!0)},[]),c=s.useCallback(function(e){var n=e;if(In.length&&In[In.length-1]===o){var r="deltaY"in n?Dn(n):Rn(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,i=r,t[0]===i[0]&&t[1]===i[1]);var t,i})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var s=(a.current.shards||[]).map(Pn).filter(Boolean).filter(function(e){return e.contains(n.target)});(s.length>0?l(n,s[0]):!a.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),h=s.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:jn(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=s.useCallback(function(e){n.current=Rn(e),r.current=void 0},[]),d=s.useCallback(function(t){h(t.type,Dn(t),t.target,l(t,e.lockRef.current))},[]),f=s.useCallback(function(t){h(t.type,Rn(t),t.target,l(t,e.lockRef.current))},[]);s.useEffect(function(){return In.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,On),document.addEventListener("touchmove",c,On),document.addEventListener("touchstart",u,On),function(){In=In.filter(function(e){return e!==o}),document.removeEventListener("wheel",c,On),document.removeEventListener("touchmove",c,On),document.removeEventListener("touchstart",u,On)}},[]);var p=e.removeScrollBar,m=e.inert;return s.createElement(s.Fragment,null,m?s.createElement(o,{styles:Ln(i)}):null,p?s.createElement(Sn,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},hn.useMedium(_n),cn),Wn=s.forwardRef(function(e,t){return s.createElement(dn,Y({},e,{ref:t,sideCar:Fn}))});Wn.classNames=dn.classNames;var zn=Wn,Hn=new WeakMap,Vn=new WeakMap,qn={},Un=0,$n=function(e){return e&&(e.host||$n(e.parentNode))},Kn=function(e,t,n,r){var i=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=$n(t);return n&&e.contains(n)?n:null}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);qn[n]||(qn[n]=new WeakMap);var o=qn[n],s=[],a=new Set,l=new Set(i),c=function(e){e&&!a.has(e)&&(a.add(e),c(e.parentNode))};i.forEach(c);var h=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(a.has(e))h(e);else try{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(Hn.get(e)||0)+1,c=(o.get(e)||0)+1;Hn.set(e,l),o.set(e,c),s.push(e),1===l&&i&&Vn.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}catch(e){}})};return h(t),a.clear(),Un++,function(){s.forEach(function(e){var t=Hn.get(e)-1,i=o.get(e)-1;Hn.set(e,t),o.set(e,i),t||(Vn.has(e)||e.removeAttribute(r),Vn.delete(e)),i||e.removeAttribute(n)}),--Un||(Hn=new WeakMap,Hn=new WeakMap,Vn=new WeakMap,qn={})}},Yn=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Kn(r,i,n,"aria-hidden")):function(){return null}},Gn="Dialog",[Xn,Jn]=gt(Gn),[Qn,Zn]=Xn(Gn),er=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=s.useRef(null),h=s.useRef(null),[u,d]=St({prop:i,defaultProp:o??!1,onChange:a,caller:Gn});return t.jsx(Qn,{scope:n,triggerRef:c,contentRef:h,contentId:xt(),titleId:xt(),descriptionId:xt(),open:u,onOpenChange:d,onOpenToggle:s.useCallback(()=>d(e=>!e),[d]),modal:l,children:r})};er.displayName=Gn;var tr="DialogTrigger",nr=s.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=Zn(tr,r),s=Ye(n,o.triggerRef);return t.jsx(At.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":kr(o.open),...i,ref:s,onClick:mt(e.onClick,o.onOpenToggle)})});nr.displayName=tr;var rr="DialogPortal",[ir,or]=Xn(rr,{forceMount:void 0}),sr=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:o}=e,a=Zn(rr,n);return t.jsx(ir,{scope:n,forceMount:r,children:s.Children.map(i,e=>t.jsx(Xt,{present:r||a.open,children:t.jsx(Gt,{asChild:!0,container:o,children:e})}))})};sr.displayName=rr;var ar="DialogOverlay",lr=s.forwardRef((e,n)=>{const r=or(ar,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,s=Zn(ar,e.__scopeDialog);return s.modal?t.jsx(Xt,{present:i||s.open,children:t.jsx(hr,{...o,ref:n})}):null});lr.displayName=ar;var cr=Et("DialogOverlay.RemoveScroll"),hr=s.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=Zn(ar,r);return t.jsx(zn,{as:cr,allowPinchZoom:!0,shards:[o.contentRef],children:t.jsx(At.div,{"data-state":kr(o.open),...i,ref:n,style:{pointerEvents:"auto",...i.style}})})}),ur="DialogContent",dr=s.forwardRef((e,n)=>{const r=or(ur,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,s=Zn(ur,e.__scopeDialog);return t.jsx(Xt,{present:i||s.open,children:s.modal?t.jsx(fr,{...o,ref:n}):t.jsx(pr,{...o,ref:n})})});dr.displayName=ur;var fr=s.forwardRef((e,n)=>{const r=Zn(ur,e.__scopeDialog),i=s.useRef(null),o=Ye(n,r.contentRef,i);return s.useEffect(()=>{const e=i.current;if(e)return Yn(e)},[]),t.jsx(mr,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mt(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:mt(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:mt(e.onFocusOutside,e=>e.preventDefault())})}),pr=s.forwardRef((e,n)=>{const r=Zn(ur,e.__scopeDialog),i=s.useRef(!1),o=s.useRef(!1);return t.jsx(mr,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||r.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const n=t.target,s=r.triggerRef.current?.contains(n);s&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),mr=s.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,c=Zn(ur,r),h=s.useRef(null),u=Ye(n,h);return Zt(),t.jsxs(t.Fragment,{children:[t.jsx(Ht,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:a,children:t.jsx(It,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":kr(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(Or,{titleId:c.titleId}),t.jsx(Nr,{contentRef:h,descriptionId:c.descriptionId})]})]})}),gr="DialogTitle",vr=s.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=Zn(gr,r);return t.jsx(At.h2,{id:o.titleId,...i,ref:n})});vr.displayName=gr;var br="DialogDescription",yr=s.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=Zn(br,r);return t.jsx(At.p,{id:o.descriptionId,...i,ref:n})});yr.displayName=br;var wr="DialogClose",xr=s.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=Zn(wr,r);return t.jsx(At.button,{type:"button",...i,ref:n,onClick:mt(e.onClick,()=>o.onOpenChange(!1))})});function kr(e){return e?"open":"closed"}xr.displayName=wr;var Sr="DialogTitleWarning",[Er,Cr]=function(e,n){const r=s.createContext(n),i=e=>{const{children:n,...i}=e,o=s.useMemo(()=>i,Object.values(i));return t.jsx(r.Provider,{value:o,children:n})};return i.displayName=e+"Provider",[i,function(t){const i=s.useContext(r);if(i)return i;if(void 0!==n)return n;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Sr,{contentName:ur,titleName:gr,docsSlug:"dialog"}),Or=({titleId:e})=>{const t=Cr(Sr),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{if(e){document.getElementById(e)}},[n,e]),null},Nr=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Cr("DialogDescriptionWarning").contentName}}.`;return s.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)}},[n,e,t]),null},Ar=er,Tr=nr,Mr=sr,Rr=lr,Dr=dr,Pr=vr,Lr=yr,Br=xr,Ir=Ar,jr=Mr,_r=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Rr,Object.assign({className:qe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)},r,{ref:t}))});_r.displayName=Rr.displayName;var Fr=ot("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Wr=s.forwardRef(function(e,t){var n=e.side,r=void 0===n?"right":n,i=e.className,o=e.children,a=G(e,["side","className","children"]);return s.createElement(jr,null,s.createElement(_r,null),s.createElement(Dr,Object.assign({ref:t,className:qe(Fr({side:r}),i)},a),o,s.createElement(Br,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"},s.createElement(K,{className:"h-4 w-4"}),s.createElement("span",{className:"sr-only"},"Close"))))});Wr.displayName=Dr.displayName;var zr=function(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex flex-col space-y-2 text-center sm:text-left",t)},n))};zr.displayName="SheetHeader";var Hr=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Pr,Object.assign({ref:t,className:qe("text-lg font-semibold text-foreground",n)},r))});Hr.displayName=Pr.displayName;var Vr=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Lr,Object.assign({ref:t,className:qe("text-sm text-muted-foreground",n)},r))});function qr(e){const t=s.forwardRef((e,t)=>{const{children:n,...r}=e;if(s.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==s.Fragment&&(i.ref=t?Ke(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Vr.displayName=Lr.displayName;var Ur=Symbol("radix.slottable");function $r(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ur}var Kr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=function(e){const n=qr(e),r=s.forwardRef((e,r)=>{const{children:i,...o}=e,a=s.Children.toArray(i),l=a.find($r);if(l){const e=l.props.children,i=a.map(t=>t===l?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,i):null})}return t.jsx(n,{...o,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});var Yr,Gr="dismissableLayer.update",Xr="dismissableLayer.pointerDownOutside",Jr="dismissableLayer.focusOutside",Qr=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zr=s.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...h}=e,u=s.useContext(Qr),[d,f]=s.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=s.useState({}),g=Ye(n,e=>f(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1),i=s.useRef(()=>{});return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){ti(Xr,n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},p),E=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1);return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){ti(Jr,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),l?.(e),e.defaultPrevented||c?.())},p);return Mt(e=>{w===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),s.useEffect(()=>{if(d)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Yr=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ei(),()=>{r&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Yr)}},[d,p,r,u]),s.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ei())},[d,u]),s.useEffect(()=>{const e=()=>m({});return document.addEventListener(Gr,e),()=>document.removeEventListener(Gr,e)},[]),t.jsx(Kr.div,{...h,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...e.style},onFocusCapture:mt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:mt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:mt(e.onPointerDownCapture,S.onPointerDownCapture)})});Zr.displayName="DismissableLayer";function ei(){const e=new CustomEvent(Gr);document.dispatchEvent(e)}function ti(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}s.forwardRef((e,n)=>{const r=s.useContext(Qr),i=s.useRef(null),o=Ye(n,i);return s.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),t.jsx(Kr.div,{...e,ref:o})}).displayName="DismissableLayerBranch";const ni=["top","right","bottom","left"],ri=Math.min,ii=Math.max,oi=Math.round,si=Math.floor,ai=e=>({x:e,y:e}),li={left:"right",right:"left",bottom:"top",top:"bottom"},ci={start:"end",end:"start"};function hi(e,t,n){return ii(e,ri(t,n))}function ui(e,t){return"function"==typeof e?e(t):e}function di(e){return e.split("-")[0]}function fi(e){return e.split("-")[1]}function pi(e){return"x"===e?"y":"x"}function mi(e){return"y"===e?"height":"width"}const gi=new Set(["top","bottom"]);function vi(e){return gi.has(di(e))?"y":"x"}function bi(e){return pi(vi(e))}function yi(e){return e.replace(/start|end/g,e=>ci[e])}const wi=["left","right"],xi=["right","left"],ki=["top","bottom"],Si=["bottom","top"];function Ei(e,t,n,r){const i=fi(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?xi:wi:t?wi:xi;case"left":case"right":return t?ki:Si;default:return[]}}(di(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(yi)))),o}function Ci(e){return e.replace(/left|right|bottom|top/g,e=>li[e])}function Oi(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ni(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ai(e,t,n){let{reference:r,floating:i}=e;const o=vi(t),s=bi(t),a=mi(s),l=di(t),c="y"===o,h=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:h,y:r.y-i.height};break;case"bottom":f={x:h,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-i.width,y:u};break;default:f={x:r.x,y:r.y}}switch(fi(t)){case"start":f[s]-=d*(n&&c?-1:1);break;case"end":f[s]+=d*(n&&c?-1:1)}return f}async function Ti(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:d=!1,padding:f=0}=ui(t,e),p=Oi(f),m=a[d?"floating"===u?"reference":"floating":u],g=Ni(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),v="floating"===u?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},w=Ni(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-w.top+p.top)/y.y,bottom:(w.bottom-g.bottom+p.bottom)/y.y,left:(g.left-w.left+p.left)/y.x,right:(w.right-g.right+p.right)/y.x}}function Mi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ri(e){return ni.some(t=>e[t]>=0)}const Di=new Set(["left","top"]);function Pi(){return"undefined"!=typeof window}function Li(e){return ji(e)?(e.nodeName||"").toLowerCase():"#document"}function Bi(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ii(e){var t;return null==(t=(ji(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ji(e){return!!Pi()&&(e instanceof Node||e instanceof Bi(e).Node)}function _i(e){return!!Pi()&&(e instanceof Element||e instanceof Bi(e).Element)}function Fi(e){return!!Pi()&&(e instanceof HTMLElement||e instanceof Bi(e).HTMLElement)}function Wi(e){return!(!Pi()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Bi(e).ShadowRoot)}const zi=new Set(["inline","contents"]);function Hi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=eo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zi.has(i)}const Vi=new Set(["table","td","th"]);function qi(e){return Vi.has(Li(e))}const Ui=[":popover-open",":modal"];function $i(e){return Ui.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Ki=["transform","translate","scale","rotate","perspective"],Yi=["transform","translate","scale","rotate","perspective","filter"],Gi=["paint","layout","strict","content"];function Xi(e){const t=Ji(),n=_i(e)?eo(e):e;return Ki.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Yi.some(e=>(n.willChange||"").includes(e))||Gi.some(e=>(n.contain||"").includes(e))}function Ji(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Qi=new Set(["html","body","#document"]);function Zi(e){return Qi.has(Li(e))}function eo(e){return Bi(e).getComputedStyle(e)}function to(e){return _i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function no(e){if("html"===Li(e))return e;const t=e.assignedSlot||e.parentNode||Wi(e)&&e.host||Ii(e);return Wi(t)?t.host:t}function ro(e){const t=no(e);return Zi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fi(t)&&Hi(t)?t:ro(t)}function io(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=ro(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=Bi(i);if(o){const e=oo(s);return t.concat(s,s.visualViewport||[],Hi(i)?i:[],e&&n?io(e):[])}return t.concat(i,io(i,[],n))}function oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function so(e){const t=eo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fi(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=oi(n)!==o||oi(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function ao(e){return _i(e)?e:e.contextElement}function lo(e){const t=ao(e);if(!Fi(t))return ai(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=so(t);let s=(o?oi(n.width):n.width)/r,a=(o?oi(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const co=ai(0);function ho(e){const t=Bi(e);return Ji()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:co}function uo(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=ao(e);let s=ai(1);t&&(r?_i(r)&&(s=lo(r)):s=lo(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Bi(e))&&t}(o,n,r)?ho(o):ai(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,h=i.width/s.x,u=i.height/s.y;if(o){const e=Bi(o),t=r&&_i(r)?Bi(r):r;let n=e,i=oo(n);for(;i&&r&&t!==n;){const e=lo(i),t=i.getBoundingClientRect(),r=eo(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,h*=e.x,u*=e.y,l+=o,c+=s,n=Bi(i),i=oo(n)}}return Ni({width:h,height:u,x:l,y:c})}function fo(e,t){const n=to(e).scrollLeft;return t?t.left+n:uo(Ii(e)).left+n}function po(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-fo(e,n),y:n.top+t.scrollTop}}const mo=new Set(["absolute","fixed"]);function go(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Bi(e),r=Ii(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=Ji();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=fo(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ii(e),n=to(e),r=e.ownerDocument.body,i=ii(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ii(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+fo(e);const a=-n.scrollTop;return"rtl"===eo(r).direction&&(s+=ii(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(Ii(e));else if(_i(t))r=function(e,t){const n=uo(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Fi(e)?lo(e):ai(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=ho(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ni(r)}function vo(e,t){const n=no(e);return!(n===t||!_i(n)||Zi(n))&&("fixed"===eo(n).position||vo(n,t))}function bo(e,t,n){const r=Fi(t),i=Ii(t),o="fixed"===n,s=uo(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=ai(0);function c(){l.x=fo(i)}if(r||!r&&!o)if(("body"!==Li(t)||Hi(i))&&(a=to(t)),r){const e=uo(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const h=!i||r||o?ai(0):po(i,a);return{x:s.left+a.scrollLeft-l.x-h.x,y:s.top+a.scrollTop-l.y-h.y,width:s.width,height:s.height}}function yo(e){return"static"===eo(e).position}function wo(e,t){if(!Fi(e)||"fixed"===eo(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ii(e)===n&&(n=n.ownerDocument.body),n}function xo(e,t){const n=Bi(e);if($i(e))return n;if(!Fi(e)){let t=no(e);for(;t&&!Zi(t);){if(_i(t)&&!yo(t))return t;t=no(t)}return n}let r=wo(e,t);for(;r&&qi(r)&&yo(r);)r=wo(r,t);return r&&Zi(r)&&yo(r)&&!Xi(r)?n:r||function(e){let t=no(e);for(;Fi(t)&&!Zi(t);){if(Xi(t))return t;if($i(t))return null;t=no(t)}return null}(e)||n}const ko={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=Ii(r),a=!!t&&$i(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=ai(1);const h=ai(0),u=Fi(r);if((u||!u&&!o)&&(("body"!==Li(r)||Hi(s))&&(l=to(r)),Fi(r))){const e=uo(r);c=lo(r),h.x=e.x+r.clientLeft,h.y=e.y+r.clientTop}const d=!s||u||o?ai(0):po(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+d.x,y:n.y*c.y-l.scrollTop*c.y+h.y+d.y}},getDocumentElement:Ii,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?$i(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=io(e,[],!1).filter(e=>_i(e)&&"body"!==Li(e)),i=null;const o="fixed"===eo(e).position;let s=o?no(e):e;for(;_i(s)&&!Zi(s);){const t=eo(s),n=Xi(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&mo.has(i.position)||Hi(s)&&!n&&vo(e,s))?r=r.filter(e=>e!==s):i=t,s=no(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=o[0],a=o.reduce((e,n)=>{const r=go(t,n,i);return e.top=ii(r.top,e.top),e.right=ri(r.right,e.right),e.bottom=ri(r.bottom,e.bottom),e.left=ii(r.left,e.left),e},go(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:xo,getElementRects:async function(e){const t=this.getOffsetParent||xo,n=this.getDimensions,r=await n(e.floating);return{reference:bo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=so(e);return{width:t,height:n}},getScale:lo,isElement:_i,isRTL:function(e){return"rtl"===eo(e).direction}};function So(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eo(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=ao(e),h=i||o?[...c?io(c):[],...io(t)]:[];h.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const u=c&&a?function(e,t){let n,r=null;const i=Ii(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:h,top:u,width:d,height:f}=c;if(a||t(),!d||!f)return;const p={rootMargin:-si(u)+"px "+-si(i.clientWidth-(h+d))+"px "+-si(i.clientHeight-(u+f))+"px "+-si(h)+"px",threshold:ii(0,ri(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||So(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),o}(c,n):null;let d,f=-1,p=null;s&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m=l?uo(e):null;return l&&function t(){const r=uo(e);m&&!So(m,r)&&n();m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;h.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(d)}}const Co=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=di(n),a=fi(n),l="y"===vi(n),c=Di.has(s)?-1:1,h=o&&l?-1:1,u=ui(t,e);let{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof p&&(f="end"===a?-1*p:p),l?{x:f*h,y:d*c}:{x:d*c,y:f*h}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Oo=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ui(e,t),c={x:n,y:r},h=await Ti(t,l),u=vi(di(i)),d=pi(u);let f=c[d],p=c[u];if(o){const e="y"===d?"bottom":"right";f=hi(f+h["y"===d?"top":"left"],f,f-h[e])}if(s){const e="y"===u?"bottom":"right";p=hi(p+h["y"===u?"top":"left"],p,p-h[e])}const m=a.fn({...t,[d]:f,[u]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:o,[u]:s}}}}}},No=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=ui(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const v=di(i),b=vi(a),y=di(a)===a,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(y||!m?[Ci(a)]:function(e){const t=Ci(e);return[yi(e),t,yi(t)]}(a)),k="none"!==p;!d&&k&&x.push(...Ei(a,m,p,w));const S=[a,...x],E=await Ti(t,g),C=[];let O=(null==(r=o.flip)?void 0:r.overflows)||[];if(h&&C.push(E[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=fi(e),i=bi(e),o=mi(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ci(s)),[s,Ci(s)]}(i,s,w);C.push(E[e[0]],E[e[1]])}if(O=[...O,{placement:i,overflows:C}],!C.every(e=>e<=0)){var N,A;const e=((null==(N=o.flip)?void 0:N.index)||0)+1,t=S[e];if(t){if(!("alignment"===u&&b!==vi(t))||O.every(e=>vi(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:O},reset:{placement:t}}}let n=null==(A=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!n)switch(f){case"bestFit":{var T;const e=null==(T=O.filter(e=>{if(k){const t=vi(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},Ao=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=ui(e,t),h=await Ti(t,c),u=di(i),d=fi(i),f="y"===vi(i),{width:p,height:m}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=d===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(v=u,g="end"===d?"top":"bottom");const b=m-h.top-h.bottom,y=p-h.left-h.right,w=ri(m-h[g],b),x=ri(p-h[v],y),k=!t.middlewareData.shift;let S=w,E=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(E=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=b),k&&!d){const e=ii(h.left,0),t=ii(h.right,0),n=ii(h.top,0),r=ii(h.bottom,0);f?E=p-2*(0!==e||0!==t?e+t:ii(h.left,h.right)):S=m-2*(0!==n||0!==r?n+r:ii(h.top,h.bottom))}await l({...t,availableWidth:E,availableHeight:S});const C=await s.getDimensions(a.floating);return p!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},To=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=ui(e,t);switch(r){case"referenceHidden":{const e=Mi(await Ti(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ri(e)}}}case"escaped":{const e=Mi(await Ti(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ri(e)}}}default:return{}}}}},Mo=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:h=0}=ui(e,t)||{};if(null==c)return{};const u=Oi(h),d={x:n,y:r},f=bi(i),p=mi(f),m=await s.getDimensions(c),g="y"===f,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[f]-d[f]-o.floating[p],x=d[f]-o.reference[f],k=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let S=k?k[y]:0;S&&await(null==s.isElement?void 0:s.isElement(k))||(S=a.floating[y]||o.floating[p]);const E=w/2-x/2,C=S/2-m[p]/2-1,O=ri(u[v],C),N=ri(u[b],C),A=O,T=S-m[p]-N,M=S/2-m[p]/2+E,R=hi(A,M,T),D=!l.arrow&&null!=fi(i)&&M!==R&&o.reference[p]/2-(M<A?O:N)-m[p]/2<0,P=D?M<A?M-A:M-T:0;return{[f]:d[f]+P,data:{[f]:R,centerOffset:M-R-P,...D&&{alignmentOffset:P}},reset:D}}}),Ro=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ui(e,t),h={x:n,y:r},u=vi(i),d=pi(u);let f=h[d],p=h[u];const m=ui(a,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===d?"height":"width",t=o.reference[d]-o.floating[e]+g.mainAxis,n=o.reference[d]+o.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,b;const e="y"===d?"width":"height",t=Di.has(di(i)),n=o.reference[u]-o.floating[e]+(t&&(null==(v=s.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),r=o.reference[u]+o.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[d]:f,[u]:p}}}},Do=(e,t,n)=>{const r=new Map,i={platform:ko,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:u}=Ai(c,r,l),d=r,f={},p=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:g,y:v,data:b,reset:y}=await m({x:h,y:u,initialPlacement:r,placement:d,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});h=null!=g?g:h,u=null!=v?v:u,f={...f,[o]:{...f[o],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(c=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):y.rects),({x:h,y:u}=Ai(c,d,l))),n=-1)}return{x:h,y:u,placement:d,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var Po="undefined"!=typeof document?e.useLayoutEffect:function(){};function Lo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Lo(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(("_owner"!==n||!e.$$typeof)&&!Lo(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Bo(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Io(e,t){const n=Bo(e);return Math.round(t*n)/n}function jo(e){const t=s.useRef(e);return Po(()=>{t.current=e}),t}function _o(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:c=!0,whileElementsMounted:h,open:u}=e,[d,f]=s.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=s.useState(r);Lo(p,r)||m(r);const[g,v]=s.useState(null),[b,y]=s.useState(null),w=s.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),x=s.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),k=o||g,S=l||b,E=s.useRef(null),C=s.useRef(null),O=s.useRef(d),N=null!=h,A=jo(h),T=jo(i),M=jo(u),R=s.useCallback(()=>{if(!E.current||!C.current)return;const e={placement:t,strategy:n,middleware:p};T.current&&(e.platform=T.current),Do(E.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==M.current};D.current&&!Lo(O.current,t)&&(O.current=t,a.flushSync(()=>{f(t)}))})},[p,t,n,T,M]);Po(()=>{!1===u&&O.current.isPositioned&&(O.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);const D=s.useRef(!1);Po(()=>(D.current=!0,()=>{D.current=!1}),[]),Po(()=>{if(k&&(E.current=k),S&&(C.current=S),k&&S){if(A.current)return A.current(k,S,R);R()}},[k,S,R,A,N]);const P=s.useMemo(()=>({reference:E,floating:C,setReference:w,setFloating:x}),[w,x]),L=s.useMemo(()=>({reference:k,floating:S}),[k,S]),B=s.useMemo(()=>{const e={position:n,left:0,top:0};if(!L.floating)return e;const t=Io(L.floating,d.x),r=Io(L.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...Bo(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,L.floating,d.x,d.y]);return s.useMemo(()=>({...d,update:R,refs:P,elements:L,floatingStyles:B}),[d,R,P,L,B])}const Fo=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(i=n,{}.hasOwnProperty.call(i,"current"))?null!=n.current?Mo({element:n.current,padding:r}).fn(t):{}:n?Mo({element:n,padding:r}).fn(t):{};var i}}),Wo=(e,t)=>({...Co(e),options:[e,t]}),zo=(e,t)=>({...Oo(e),options:[e,t]}),Ho=(e,t)=>({...Ro(e),options:[e,t]}),Vo=(e,t)=>({...No(e),options:[e,t]}),qo=(e,t)=>({...Ao(e),options:[e,t]}),Uo=(e,t)=>({...To(e),options:[e,t]}),$o=(e,t)=>({...Fo(e),options:[e,t]});var Ko=s.forwardRef((e,n)=>{const{children:r,width:i=10,height:o=5,...s}=e;return t.jsx(Kr.svg,{...s,ref:n,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ko.displayName="Arrow";var Yo=Ko;function Go(e){const[t,n]=s.useState(void 0);return bt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let i,o;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,o=t.blockSize}else i=e.offsetWidth,o=e.offsetHeight;n({width:i,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var Xo="Popper",[Jo,Qo]=gt(Xo),[Zo,es]=Jo(Xo),ts=e=>{const{__scopePopper:n,children:r}=e,[i,o]=s.useState(null);return t.jsx(Zo,{scope:n,anchor:i,onAnchorChange:o,children:r})};ts.displayName=Xo;var ns="PopperAnchor",rs=s.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...o}=e,a=es(ns,r),l=s.useRef(null),c=Ye(n,l),h=s.useRef(null);return s.useEffect(()=>{const e=h.current;h.current=i?.current||l.current,e!==h.current&&a.onAnchorChange(h.current)}),i?null:t.jsx(Kr.div,{...o,ref:c})});rs.displayName=ns;var is="PopperContent",[os,ss]=Jo(is),as=s.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,b=es(is,r),[y,w]=s.useState(null),x=Ye(n,e=>w(e)),[k,S]=s.useState(null),E=Go(k),C=E?.width??0,O=E?.height??0,N=i+("center"!==a?"-"+a:""),A="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],M=T.length>0,R={padding:A,boundary:T.filter(us),altBoundary:M},{refs:D,floatingStyles:P,placement:L,isPositioned:B,middlewareData:I}=_o({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Eo(...e,{animationFrame:"always"===m}),elements:{reference:b.anchor},middleware:[Wo({mainAxis:o+O,alignmentAxis:l}),h&&zo({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?Ho():void 0,...R}),h&&Vo({...R}),qo({...R,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&$o({element:k,padding:c}),ds({arrowWidth:C,arrowHeight:O}),p&&Uo({strategy:"referenceHidden",...R})]}),[j,_]=fs(L),F=Tt(g);bt(()=>{B&&F?.()},[B,F]);const W=I.arrow?.x,z=I.arrow?.y,H=0!==I.arrow?.centerOffset,[V,q]=s.useState();return bt(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),t.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:B?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(os,{scope:r,placedSide:j,onArrowChange:S,arrowX:W,arrowY:z,shouldHideArrow:H,children:t.jsx(Kr.div,{"data-side":j,"data-align":_,...v,ref:x,style:{...v.style,animation:B?void 0:"none"}})})})});as.displayName=is;var ls="PopperArrow",cs={top:"bottom",right:"left",bottom:"top",left:"right"},hs=s.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=ss(ls,r),s=cs[o.placedSide];return t.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t.jsx(Yo,{...i,ref:n,style:{...i.style,display:"block"}})})});function us(e){return null!==e}hs.displayName=ls;var ds=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,o=0!==i.arrow?.centerOffset,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=fs(n),h={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,d=(i.arrow?.y??0)+a/2;let f="",p="";return"bottom"===l?(f=o?h:`${u}px`,p=-a+"px"):"top"===l?(f=o?h:`${u}px`,p=`${r.floating.height+a}px`):"right"===l?(f=-a+"px",p=o?h:`${d}px`):"left"===l&&(f=`${r.floating.width+a}px`,p=o?h:`${d}px`),{data:{x:f,y:p}}}});function fs(e){const[t,n="center"]=e.split("-");return[t,n]}var ps=ts,ms=rs,gs=as,vs=hs;var bs=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=s.useState(),r=s.useRef(null),i=s.useRef(e),o=s.useRef("none"),a=e?"mounted":"unmounted",[l,c]=function(e,t){return s.useReducer((e,n)=>t[e][n]??e,e)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const e=ys(r.current);o.current="mounted"===l?e:"none"},[l]),bt(()=>{const t=r.current,n=i.current;if(n!==e){const r=o.current,s=ys(t);if(e)c("MOUNT");else if("none"===s||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==s?"ANIMATION_OUT":"UNMOUNT")}i.current=e}},[e,c]),bt(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,s=o=>{const s=ys(r.current).includes(CSS.escape(o.animationName));if(o.target===t&&s&&(c("ANIMATION_END"),!i.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},a=e=>{e.target===t&&(o.current=ys(r.current))};return t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:s.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),i="function"==typeof n?n({present:r.isPresent}):s.Children.only(n),o=Ye(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||r.isPresent?s.cloneElement(i,{ref:o}):null};function ys(e){return e?.animationName||"none"}bs.displayName="Presence";var ws=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),xs=s.forwardRef((e,n)=>t.jsx(Kr.span,{...e,ref:n,style:{...ws,...e.style}}));xs.displayName="VisuallyHidden";var ks=xs,[Ss,Es]=gt("Tooltip",[Qo]),Cs=Qo(),Os="TooltipProvider",Ns=700,As="tooltip.open",[Ts,Ms]=Ss(Os),Rs=e=>{const{__scopeTooltip:n,delayDuration:r=Ns,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:a}=e,l=s.useRef(!0),c=s.useRef(!1),h=s.useRef(0);return s.useEffect(()=>{const e=h.current;return()=>window.clearTimeout(e)},[]),t.jsx(Ts,{scope:n,isOpenDelayedRef:l,delayDuration:r,onOpen:s.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:s.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,i)},[i]),isPointerInTransitRef:c,onPointerInTransitChange:s.useCallback(e=>{c.current=e},[]),disableHoverableContent:o,children:a})};Rs.displayName=Os;var Ds="Tooltip",[Ps,Ls]=Ss(Ds),Bs=e=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:o,onOpenChange:a,disableHoverableContent:l,delayDuration:c}=e,h=Ms(Ds,e.__scopeTooltip),u=Cs(n),[d,f]=s.useState(null),p=xt(),m=s.useRef(0),g=l??h.disableHoverableContent,v=c??h.delayDuration,b=s.useRef(!1),[y,w]=St({prop:i,defaultProp:o??!1,onChange:e=>{e?(h.onOpen(),document.dispatchEvent(new CustomEvent(As))):h.onClose(),a?.(e)},caller:Ds}),x=s.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),k=s.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b.current=!1,w(!0)},[w]),S=s.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=s.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{b.current=!0,w(!0),m.current=0},v)},[v,w]);return s.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),t.jsx(ps,{...u,children:t.jsx(Ps,{scope:n,contentId:p,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:s.useCallback(()=>{h.isOpenDelayedRef.current?E():k()},[h.isOpenDelayedRef,E,k]),onTriggerLeave:s.useCallback(()=>{g?S():(window.clearTimeout(m.current),m.current=0)},[S,g]),onOpen:k,onClose:S,disableHoverableContent:g,children:r})})};Bs.displayName=Ds;var Is="TooltipTrigger",js=s.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,o=Ls(Is,r),a=Ms(Is,r),l=Cs(r),c=Ye(n,s.useRef(null),o.onTriggerChange),h=s.useRef(!1),u=s.useRef(!1),d=s.useCallback(()=>h.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),t.jsx(ms,{asChild:!0,...l,children:t.jsx(Kr.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:c,onPointerMove:mt(e.onPointerMove,e=>{"touch"!==e.pointerType&&(u.current||a.isPointerInTransitRef.current||(o.onTriggerEnter(),u.current=!0))}),onPointerLeave:mt(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:mt(e.onPointerDown,()=>{o.open&&o.onClose(),h.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:mt(e.onFocus,()=>{h.current||o.onOpen()}),onBlur:mt(e.onBlur,o.onClose),onClick:mt(e.onClick,o.onClose)})})});js.displayName=Is;var[_s,Fs]=Ss("TooltipPortal",{forceMount:void 0}),Ws="TooltipContent",zs=s.forwardRef((e,n)=>{const r=Fs(Ws,e.__scopeTooltip),{forceMount:i=r.forceMount,side:o="top",...s}=e,a=Ls(Ws,e.__scopeTooltip);return t.jsx(bs,{present:i||a.open,children:a.disableHoverableContent?t.jsx($s,{side:o,...s,ref:n}):t.jsx(Hs,{side:o,...s,ref:n})})}),Hs=s.forwardRef((e,n)=>{const r=Ls(Ws,e.__scopeTooltip),i=Ms(Ws,e.__scopeTooltip),o=s.useRef(null),a=Ye(n,o),[l,c]=s.useState(null),{trigger:h,onClose:u}=r,d=o.current,{onPointerInTransitChange:f}=i,p=s.useCallback(()=>{c(null),f(!1)},[f]),m=s.useCallback((e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(r,n.getBoundingClientRect()),o=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(r,i),s=function(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}(t.getBoundingClientRect()),a=function(e){const t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const r=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const r=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x)))break;n.pop()}n.push(r)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...o,...s]);c(a),f(!0)},[f]);return s.useEffect(()=>()=>p(),[p]),s.useEffect(()=>{if(h&&d){const e=e=>m(e,d),t=e=>m(e,h);return h.addEventListener("pointerleave",e),d.addEventListener("pointerleave",t),()=>{h.removeEventListener("pointerleave",e),d.removeEventListener("pointerleave",t)}}},[h,d,m,p]),s.useEffect(()=>{if(l){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=h?.contains(t)||d?.contains(t),i=!function(e,t){const{x:n,y:r}=e;let i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){const s=t[e],a=t[o],l=s.x,c=s.y,h=a.x,u=a.y;c>r!=u>r&&n<(h-l)*(r-c)/(u-c)+l&&(i=!i)}return i}(n,l);r?p():i&&(p(),u())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[h,d,l,u,p]),t.jsx($s,{...e,ref:a})}),[Vs,qs]=Ss(Ds,{isInside:!1}),Us=function(e){const n=({children:e})=>t.jsx(t.Fragment,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=Ur,n}("TooltipContent"),$s=s.forwardRef((e,n)=>{const{__scopeTooltip:r,children:i,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=e,h=Ls(Ws,r),u=Cs(r),{onClose:d}=h;return s.useEffect(()=>(document.addEventListener(As,d),()=>document.removeEventListener(As,d)),[d]),s.useEffect(()=>{if(h.trigger){const e=e=>{const t=e.target;t?.contains(h.trigger)&&d()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[h.trigger,d]),t.jsx(Zr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:t.jsxs(gs,{"data-state":h.stateAttribute,...u,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx(Us,{children:i}),t.jsx(Vs,{scope:r,isInside:!0,children:t.jsx(ks,{id:h.contentId,role:"tooltip",children:o||i})})]})})});zs.displayName=Ws;var Ks="TooltipArrow";s.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,o=Cs(r);return qs(Ks,r).isInside?null:t.jsx(vs,{...o,...i,ref:n})}).displayName=Ks;var Ys=zs,Gs=Rs,Xs=Bs,Js=js,Qs=s.forwardRef(function(e,t){var n=e.className,r=e.sideOffset,i=void 0===r?4:r,o=G(e,["className","sideOffset"]);return s.createElement(Ys,Object.assign({ref:t,sideOffset:i,className:qe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",n)},o))});Qs.displayName=Ys.displayName;var Zs=s.createContext(null);function ea(){var e=s.useContext(Zs);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function ta(e){var t=e.defaultOpen,n=void 0===t||t,r=e.open,i=e.onOpenChange,o=e.className,a=e.style,l=e.children,c=G(e,["defaultOpen","open","onOpenChange","className","style","children"]),h=function(){var e=m(s.useState(void 0),2),t=e[0],n=e[1];return s.useEffect(function(){var e=window.matchMedia("(max-width: ".concat(767,"px)")),t=function(){n(window.innerWidth<768)};return e.addEventListener("change",t),n(window.innerWidth<768),function(){return e.removeEventListener("change",t)}},[]),!!t}(),u=m(s.useState(!1),2),d=u[0],f=u[1],p=m(s.useState(n),2),g=p[0],v=p[1],b=null!=r?r:g,y=s.useCallback(function(e){var t="function"==typeof e?e(b):e;i?i(t):v(t),document.cookie="".concat("sidebar_state","=").concat(t,"; path=/; max-age=").concat(604800)},[i,b]),w=s.useCallback(function(){return h?f(function(e){return!e}):y(function(e){return!e})},[h,y,f]);s.useEffect(function(){var e=function(e){"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w())};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[w]);var x=b?"expanded":"collapsed",k=s.useMemo(function(){return{state:x,open:b,setOpen:y,isMobile:h,openMobile:d,setOpenMobile:f,toggleSidebar:w}},[x,b,y,h,d,f,w]);return s.createElement(Zs.Provider,{value:k},s.createElement(Gs,{delayDuration:0},s.createElement("div",Object.assign({style:Object.assign({"--sidebar-width":"16rem","--sidebar-width-icon":"3rem"},a),className:qe("group/sidebar-wrapper flex min-h-svh w-full",o)},c),l)))}function na(e){var t=e.side,n=void 0===t?"left":t,r=e.variant,i=void 0===r?"sidebar":r,o=e.collapsible,a=void 0===o?"offcanvas":o,l=e.className,c=e.children,h=G(e,["side","variant","collapsible","className","children"]),u=ea(),d=u.isMobile,f=u.state,p=u.openMobile,m=u.setOpenMobile;return"none"===a?s.createElement("div",Object.assign({className:qe("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",l)},h),c):d?s.createElement(Ir,Object.assign({open:p,onOpenChange:m},h),s.createElement(Wr,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:n},s.createElement(zr,{className:"sr-only"},s.createElement(Hr,null,"Sidebar"),s.createElement(Vr,null,"Displays the mobile sidebar.")),s.createElement("div",{className:"flex h-full w-full flex-col"},c))):s.createElement("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":f,"data-collapsible":"collapsed"===f?a:"","data-variant":i,"data-side":n},s.createElement("div",{className:qe("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","floating"===i||"inset"===i?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),s.createElement("div",Object.assign({className:qe("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===n?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===i||"inset"===i?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",l)},h),s.createElement("div",{className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"},c)))}function ra(e){var t=e.className,n=e.onClick,r=G(e,["className","onClick"]),i=ea().toggleSidebar;return s.createElement(at,Object.assign({variant:"ghost",size:"icon",className:qe("h-7 w-7",t),onClick:function(e){null==n||n(e),i()}},r),s.createElement(_,null),s.createElement("span",{className:"sr-only"},"Toggle Sidebar"))}function ia(e){var t=e.className,n=G(e,["className"]);return s.createElement("main",Object.assign({className:qe("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t)},n))}function oa(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex flex-col gap-2 p-2",t)},n))}function sa(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex flex-col gap-2 p-2",t)},n))}function aa(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t)},n))}function la(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("relative flex w-full min-w-0 flex-col p-2",t)},n))}function ca(e){var t=e.className,n=e.asChild,r=void 0!==n&&n,i=G(e,["className","asChild"]),o=r?Ze:"div";return s.createElement(o,Object.assign({className:qe("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t)},i))}function ha(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("w-full text-sm",t)},n))}function ua(e){var t=e.className,n=G(e,["className"]);return s.createElement("ul",Object.assign({className:qe("flex w-full min-w-0 flex-col gap-1",t)},n))}function da(e){var t=e.className,n=G(e,["className"]);return s.createElement("li",Object.assign({className:qe("group/menu-item relative",t)},n))}var fa=ot("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function pa(e){var t=e.asChild,n=void 0!==t&&t,r=e.isActive,i=void 0!==r&&r,o=e.variant,a=void 0===o?"default":o,l=e.size,c=void 0===l?"default":l,h=e.tooltip,u=e.className,d=G(e,["asChild","isActive","variant","size","tooltip","className"]),f=n?Ze:"button",p=ea(),m=p.isMobile,g=p.state,v=s.createElement(f,Object.assign({"data-size":c,"data-active":i,className:qe(fa({variant:a,size:c}),u)},d));return h?("string"==typeof h&&(h={children:h}),s.createElement(Xs,null,s.createElement(Js,{asChild:!0},v),s.createElement(Qs,Object.assign({side:"right",align:"center",hidden:"collapsed"!==g||m},h)))):v}var ma=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=Qe(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),ga=s.forwardRef((e,n)=>t.jsx(ma.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));ga.displayName="Label";var va=ga,ba=ot("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ya=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(va,Object.assign({ref:t,className:qe(ba(),n)},r))});ya.displayName=va.displayName;var wa=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("rounded-lg border bg-card text-card-foreground shadow-sm",n)},r))});wa.displayName="Card";var xa=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("flex flex-col space-y-1.5 p-6",n)},r))});xa.displayName="CardHeader";var ka=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("text-2xl font-semibold leading-none tracking-tight",n)},r))});ka.displayName="CardTitle";var Sa=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("text-sm text-muted-foreground",n)},r))});Sa.displayName="CardDescription";var Ea=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("p-6 pt-0",n)},r))});Ea.displayName="CardContent";var Ca=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",Object.assign({ref:t,className:qe("flex items-center p-6 pt-0",n)},r))});Ca.displayName="CardFooter";var Oa={items:[],config:Object.assign({},{top:24,duration:3,maxCount:5})},Na=new Set;function Aa(){Na.forEach(function(e){return e(Oa.items.slice())})}function Ta(t){switch(t){case"success":return e.createElement(k,null);case"error":return e.createElement($,null);case"warning":return e.createElement(x,null);case"loading":return e.createElement(L,{className:"animate-spin"});default:return e.createElement(P,null)}}function Ma(e){var t,n,r;La();var i=Date.now(),o=null!==(t=e.key)&&void 0!==t?t:"msg_".concat(i,"_").concat(Math.random().toString(36).slice(2)),s=Oa.items.findIndex(function(e){return e.key===o}),a={key:o,content:e.content,duration:null!==(n=e.duration)&&void 0!==n?n:Oa.config.duration,type:e.type,onClose:e.onClose,icon:null!==(r=e.icon)&&void 0!==r?r:Ta(e.type),className:e.className,createdAt:i};return s>=0?Oa.items[s]=Object.assign({},Oa.items[s],a):(Oa.items.length>=Oa.config.maxCount&&Oa.items.shift(),Oa.items.push(a)),Aa(),a.duration>0&&"loading"!==a.type&&window.setTimeout(function(){Ra(o)},1e3*a.duration),{close:function(){return Ra(o)}}}function Ra(e){var t;if(void 0===e)return Oa.items.forEach(function(e){var t;return null===(t=e.onClose)||void 0===t?void 0:t.call(e)}),Oa.items=[],void Aa();var n=Oa.items.findIndex(function(t){return t.key===e});if(n>=0){var r=m(Oa.items.splice(n,1),1)[0];null===(t=null==r?void 0:r.onClose)||void 0===t||t.call(r),Aa()}}var Da=null,Pa=null;function La(){"undefined"!=typeof window&&(Pa||((Pa=document.createElement("div")).setAttribute("data-custom-message-holder",""),document.body.appendChild(Pa)),Da||(Da=r.createRoot(Pa)).render(e.createElement(Ba,null)))}function Ba(){var t=function(){var t=m(e.useState(Oa.items),2),n=t[0],r=t[1];return e.useEffect(function(){var e=r;return Na.add(e),function(){Na.delete(e)}},[]),n}(),n=Oa.config.top;return e.createElement("div",{className:"fixed left-1/2 -translate-x-1/2 z-[1000] w-80 pointer-events-none",style:{top:n}},e.createElement("div",{className:"mx-auto flex w-full max-w-xl flex-col items-center gap-2 px-4"},t.map(function(t){var n,r,i=function(e){switch(e){case"success":return{container:"border-green-200 bg-green-50/90 text-green-800 border-l-4 border-l-green-500",icon:"text-green-500",text:"text-green-800"};case"error":return{container:"border-red-200 bg-red-50/90 text-red-800 border-l-4 border-l-red-500",icon:"text-red-500",text:"text-red-800"};case"warning":return{container:"border-yellow-200 bg-yellow-50/90 text-yellow-800 border-l-4 border-l-yellow-500",icon:"text-yellow-500",text:"text-yellow-800"};default:return{container:"border-blue-200 bg-blue-50/90 text-blue-800 border-l-4 border-l-blue-500",icon:"text-blue-500",text:"text-blue-800"}}}(t.type);return e.createElement("div",{key:t.key,className:"pointer-events-auto flex w-full items-center gap-2 rounded-md border px-3 py-2 backdrop-blur ".concat(i.container," ").concat(null!==(n=t.className)&&void 0!==n?n:"")},e.createElement("span",{className:"text-[18px] leading-none ".concat(i.icon)},null!==(r=t.icon)&&void 0!==r?r:Ta(t.type)),e.createElement("div",{className:"min-w-0 flex-1 text-[14px] leading-normal ".concat(i.text)},"string"==typeof t.content?e.createElement("span",{className:"break-words align-middle"},t.content):t.content))})))}function Ia(t,n,r,i){if(e.isValidElement(n)||"string"==typeof n||"number"==typeof n)return{type:t,content:n,duration:r,onClose:i};var o=n;return Object.assign({},o,{type:t})}var ja,_a,Fa=(_a={open:function(e){var t;return Ma(Object.assign({},e,{type:null!==(t=e.type)&&void 0!==t?t:"info"}))},info:function(e,t,n){return Ma(Ia("info",e,t,n))},success:function(e,t,n){return Ma(Ia("success",e,t,n))},error:function(e,t,n){return Ma(Ia("error",e,t,n))},warning:function(e,t,n){return Ma(Ia("warning",e,t,n))},loading:function(e,t,n){return Ma(Ia("loading",e,null!=t?t:0,n))},destroy:function(e){return Ra(e)},config:function(e){return t=e,Oa.config=Object.assign({},Oa.config,t),void Aa();var t},useMessage:function(){var t=e.useMemo(function(){return"undefined"!=typeof window&&La(),e.createElement(e.Fragment,null)},[]);return[ja.current,t]}},(ja={}).current=_a,_a);function Wa(e,t){return function(){return e.apply(t,arguments)}}const{toString:za}=Object.prototype,{getPrototypeOf:Ha}=Object,{iterator:Va,toStringTag:qa}=Symbol,Ua=($a=Object.create(null),e=>{const t=za.call(e);return $a[t]||($a[t]=t.slice(8,-1).toLowerCase())});var $a;const Ka=e=>(e=e.toLowerCase(),t=>Ua(t)===e),Ya=e=>t=>typeof t===e,{isArray:Ga}=Array,Xa=Ya("undefined");function Ja(e){return null!==e&&!Xa(e)&&null!==e.constructor&&!Xa(e.constructor)&&el(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qa=Ka("ArrayBuffer");const Za=Ya("string"),el=Ya("function"),tl=Ya("number"),nl=e=>null!==e&&"object"==typeof e,rl=e=>{if("object"!==Ua(e))return!1;const t=Ha(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||qa in e||Va in e)},il=Ka("Date"),ol=Ka("File"),sl=Ka("Blob"),al=Ka("FileList"),ll=Ka("URLSearchParams"),[cl,hl,ul,dl]=["ReadableStream","Request","Response","Headers"].map(Ka);function fl(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),Ga(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(Ja(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(r=0;r<o;r++)s=i[r],t.call(null,e[s],s,e)}}function pl(e,t){if(Ja(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const ml="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,gl=e=>!Xa(e)&&e!==ml;const vl=(bl="undefined"!=typeof Uint8Array&&Ha(Uint8Array),e=>bl&&e instanceof bl);var bl;const yl=Ka("HTMLFormElement"),wl=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xl=Ka("RegExp"),kl=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};fl(n,(n,i)=>{let o;!1!==(o=t(n,i,e))&&(r[i]=o||n)}),Object.defineProperties(e,r)};const Sl=Ka("AsyncFunction"),El=(Cl="function"==typeof setImmediate,Ol=el(ml.postMessage),Cl?setImmediate:Ol?(Nl=`axios@${Math.random()}`,Al=[],ml.addEventListener("message",({source:e,data:t})=>{e===ml&&t===Nl&&Al.length&&Al.shift()()},!1),e=>{Al.push(e),ml.postMessage(Nl,"*")}):e=>setTimeout(e));var Cl,Ol,Nl,Al;const Tl="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ml):"undefined"!=typeof process&&process.nextTick||El;var Ml={isArray:Ga,isArrayBuffer:Qa,isBuffer:Ja,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||el(e.append)&&("formdata"===(t=Ua(e))||"object"===t&&el(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Qa(e.buffer),t},isString:Za,isNumber:tl,isBoolean:e=>!0===e||!1===e,isObject:nl,isPlainObject:rl,isEmptyObject:e=>{if(!nl(e)||Ja(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:cl,isRequest:hl,isResponse:ul,isHeaders:dl,isUndefined:Xa,isDate:il,isFile:ol,isBlob:sl,isRegExp:xl,isFunction:el,isStream:e=>nl(e)&&el(e.pipe),isURLSearchParams:ll,isTypedArray:vl,isFileList:al,forEach:fl,merge:function e(){const{caseless:t,skipUndefined:n}=gl(this)&&this||{},r={},i=(i,o)=>{const s=t&&pl(r,o)||o;rl(r[s])&&rl(i)?r[s]=e(r[s],i):rl(i)?r[s]=e({},i):Ga(i)?r[s]=i.slice():n&&Xa(i)||(r[s]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&fl(arguments[e],i);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(fl(t,(t,r)=>{n&&el(t)?e[r]=Wa(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Ha(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ua,kindOfTest:Ka,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ga(e))return e;let t=e.length;if(!tl(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Va]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:yl,hasOwnProperty:wl,hasOwnProp:wl,reduceDescriptors:kl,freezeMethods:e=>{kl(e,(t,n)=>{if(el(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];el(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Ga(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pl,global:ml,isContextDefined:gl,isSpecCompliantForm:function(e){return!!(e&&el(e.append)&&"FormData"===e[qa]&&e[Va])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(nl(e)){if(t.indexOf(e)>=0)return;if(Ja(e))return e;if(!("toJSON"in e)){t[r]=e;const i=Ga(e)?[]:{};return fl(e,(e,t)=>{const o=n(e,r+1);!Xa(o)&&(i[t]=o)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:Sl,isThenable:e=>e&&(nl(e)||el(e))&&el(e.then)&&el(e.catch),setImmediate:El,asap:Tl,isIterable:e=>null!=e&&el(e[Va])};function Rl(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Ml.inherits(Rl,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ml.toJSONObject(this.config),code:this.code,status:this.status}}});const Dl=Rl.prototype,Pl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Pl[e]={value:e}}),Object.defineProperties(Rl,Pl),Object.defineProperty(Dl,"isAxiosError",{value:!0}),Rl.from=(e,t,n,r,i,o)=>{const s=Object.create(Dl);Ml.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Rl.call(s,a,l,n,r,i),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function Ll(e){return Ml.isPlainObject(e)||Ml.isArray(e)}function Bl(e){return Ml.endsWith(e,"[]")?e.slice(0,-2):e}function Il(e,t,n){return e?e.concat(t).map(function(e,t){return e=Bl(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const jl=Ml.toFlatObject(Ml,{},null,function(e){return/^is[A-Z]/.test(e)});function _l(e,t,n){if(!Ml.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Ml.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ml.isUndefined(t[e])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Ml.isSpecCompliantForm(t);if(!Ml.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Ml.isDate(e))return e.toISOString();if(Ml.isBoolean(e))return e.toString();if(!a&&Ml.isBlob(e))throw new Rl("Blob is not supported. Use a Buffer instead.");return Ml.isArrayBuffer(e)||Ml.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(Ml.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Ml.isArray(e)&&function(e){return Ml.isArray(e)&&!e.some(Ll)}(e)||(Ml.isFileList(e)||Ml.endsWith(n,"[]"))&&(a=Ml.toArray(e)))return n=Bl(n),a.forEach(function(e,r){!Ml.isUndefined(e)&&null!==e&&t.append(!0===s?Il([n],r,o):null===s?n:n+"[]",l(e))}),!1;return!!Ll(e)||(t.append(Il(i,n,o),l(e)),!1)}const h=[],u=Object.assign(jl,{defaultVisitor:c,convertValue:l,isVisitable:Ll});if(!Ml.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Ml.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),Ml.forEach(n,function(n,o){!0===(!(Ml.isUndefined(n)||null===n)&&i.call(t,n,Ml.isString(o)?o.trim():o,r,u))&&e(n,r?r.concat(o):[o])}),h.pop()}}(e),t}function Fl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Wl(e,t){this._pairs=[],e&&_l(e,this,t)}const zl=Wl.prototype;function Hl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vl(e,t,n){if(!t)return e;const r=n&&n.encode||Hl;Ml.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(o=i?i(t,n):Ml.isURLSearchParams(t)?t.toString():new Wl(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}zl.append=function(e,t){this._pairs.push([e,t])},zl.toString=function(e){const t=e?function(t){return e.call(this,t,Fl)}:Fl;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ql=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ml.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ul={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},$l={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Wl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Kl="undefined"!=typeof window&&"undefined"!=typeof document,Yl="object"==typeof navigator&&navigator||void 0,Gl=Kl&&(!Yl||["ReactNative","NativeScript","NS"].indexOf(Yl.product)<0),Xl="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Jl=Kl&&window.location.href||"http://localhost";var Ql={...Object.freeze({__proto__:null,hasBrowserEnv:Kl,hasStandardBrowserEnv:Gl,hasStandardBrowserWebWorkerEnv:Xl,navigator:Yl,origin:Jl}),...$l};function Zl(e){function t(e,n,r,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&Ml.isArray(r)?r.length:o,a)return Ml.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Ml.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],i)&&Ml.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}(r[o])),!s}if(Ml.isFormData(e)&&Ml.isFunction(e.entries)){const n={};return Ml.forEachEntry(e,(e,r)=>{t(function(e){return Ml.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ec={transitional:Ul,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=Ml.isObject(e);i&&Ml.isHTMLForm(e)&&(e=new FormData(e));if(Ml.isFormData(e))return r?JSON.stringify(Zl(e)):e;if(Ml.isArrayBuffer(e)||Ml.isBuffer(e)||Ml.isStream(e)||Ml.isFile(e)||Ml.isBlob(e)||Ml.isReadableStream(e))return e;if(Ml.isArrayBufferView(e))return e.buffer;if(Ml.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return _l(e,new Ql.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ql.isNode&&Ml.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Ml.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return _l(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(Ml.isString(e))try{return(t||JSON.parse)(e),Ml.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ec.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Ml.isResponse(e)||Ml.isReadableStream(e))return e;if(e&&Ml.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Rl.from(e,Rl.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ql.classes.FormData,Blob:Ql.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ml.forEach(["delete","get","head","post","put","patch"],e=>{ec.headers[e]={}});var tc=ec;const nc=Ml.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const rc=Symbol("internals");function ic(e){return e&&String(e).trim().toLowerCase()}function oc(e){return!1===e||null==e?e:Ml.isArray(e)?e.map(oc):String(e)}function sc(e,t,n,r,i){return Ml.isFunction(r)?r.call(this,t,n):(i&&(t=n),Ml.isString(t)?Ml.isString(r)?-1!==t.indexOf(r):Ml.isRegExp(r)?r.test(t):void 0:void 0)}class ac{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=ic(t);if(!i)throw new Error("header name must be a non-empty string");const o=Ml.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=oc(e))}const o=(e,t)=>Ml.forEach(e,(e,n)=>i(e,n,t));if(Ml.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ml.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&nc[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Ml.isObject(e)&&Ml.isIterable(e)){let n,r,i={};for(const t of e){if(!Ml.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?Ml.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=ic(e)){const n=Ml.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Ml.isFunction(t))return t.call(this,e,n);if(Ml.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ic(e)){const n=Ml.findKey(this,e);return!(!n||void 0===this[n]||t&&!sc(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=ic(e)){const i=Ml.findKey(n,e);!i||t&&!sc(0,n[i],i,t)||(delete n[i],r=!0)}}return Ml.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!sc(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return Ml.forEach(this,(r,i)=>{const o=Ml.findKey(n,i);if(o)return t[o]=oc(r),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete t[i],t[s]=oc(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ml.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Ml.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[rc]=this[rc]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ic(e);t[r]||(!function(e,t){const n=Ml.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return Ml.isArray(e)?e.forEach(r):r(e),this}}ac.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ml.reduceDescriptors(ac.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Ml.freezeMethods(ac);var lc=ac;function cc(e,t){const n=this||tc,r=t||n,i=lc.from(r.headers);let o=r.data;return Ml.forEach(e,function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function hc(e){return!(!e||!e.__CANCEL__)}function uc(e,t,n){Rl.call(this,null==e?"canceled":e,Rl.ERR_CANCELED,t,n),this.name="CanceledError"}function dc(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Rl("Request failed with status code "+n.status,[Rl.ERR_BAD_REQUEST,Rl.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Ml.inherits(uc,Rl,{__CANCEL__:!0});const fc=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=r[s];i||(i=l),n[o]=a,r[o]=l;let h=s,u=0;for(;h!==o;)u+=n[h++],h%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const d=c&&l-c;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(e,t){let n,r,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]}(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,l=i(a);r=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&o<=s?(s-o)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pc=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},mc=e=>(...t)=>Ml.asap(()=>e(...t));var gc=Ql.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ql.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ql.origin),Ql.navigator&&/(msie|trident)/i.test(Ql.navigator.userAgent)):()=>!0,vc=Ql.hasStandardBrowserEnv?{write(e,t,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Ml.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Ml.isString(r)&&a.push(`path=${r}`),Ml.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Ml.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function bc(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const yc=e=>e instanceof lc?{...e}:e;function wc(e,t){t=t||{};const n={};function r(e,t,n,r){return Ml.isPlainObject(e)&&Ml.isPlainObject(t)?Ml.merge.call({caseless:r},e,t):Ml.isPlainObject(t)?Ml.merge({},t):Ml.isArray(t)?t.slice():t}function i(e,t,n,i){return Ml.isUndefined(t)?Ml.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function o(e,t){if(!Ml.isUndefined(t))return r(void 0,t)}function s(e,t){return Ml.isUndefined(t)?Ml.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>i(yc(e),yc(t),0,!0)};return Ml.forEach(Object.keys({...e,...t}),function(r){const o=l[r]||i,s=o(e[r],t[r],r);Ml.isUndefined(s)&&o!==a||(n[r]=s)}),n}var xc=e=>{const t=wc({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=lc.from(s),t.url=Vl(bc(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Ml.isFormData(n))if(Ql.hasStandardBrowserEnv||Ql.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Ml.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(Ql.hasStandardBrowserEnv&&(r&&Ml.isFunction(r)&&(r=r(t)),r||!1!==r&&gc(t.url))){const e=i&&o&&vc.read(o);e&&s.set(i,e)}return t};var kc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=xc(e);let i=r.data;const o=lc.from(r.headers).normalize();let s,a,l,c,h,{responseType:u,onUploadProgress:d,onDownloadProgress:f}=r;function p(){c&&c(),h&&h(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=lc.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());dc(function(e){t(e),p()},function(e){n(e),p()},{data:u&&"text"!==u&&"json"!==u?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Rl("Request aborted",Rl.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new Rl(t&&t.message?t.message:"Network Error",Rl.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||Ul;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Rl(t,i.clarifyTimeoutError?Rl.ETIMEDOUT:Rl.ECONNABORTED,e,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Ml.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Ml.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),u&&"json"!==u&&(m.responseType=r.responseType),f&&([l,h]=fc(f,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,c]=fc(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new uc(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===Ql.protocols.indexOf(v)?n(new Rl("Unsupported protocol "+v+":",Rl.ERR_BAD_REQUEST,e)):m.send(i||null)})};var Sc=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Rl?t:new uc(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,i(new Rl(`timeout ${t} of ms exceeded`,Rl.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>Ml.asap(s),a}};const Ec=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},Cc=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Oc=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of Cc(e))yield*Ec(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:Nc}=Ml,Ac=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ml.global),{ReadableStream:Tc,TextEncoder:Mc}=Ml.global,Rc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Dc=e=>{e=Ml.merge.call({skipUndefined:!0},Ac,e);const{fetch:t,Request:n,Response:r}=e,i=t?Nc(t):"function"==typeof fetch,o=Nc(n),s=Nc(r);if(!i)return!1;const a=i&&Nc(Tc),l=i&&("function"==typeof Mc?(c=new Mc,e=>c.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var c;const h=o&&a&&Rc(()=>{let e=!1;const t=new n(Ql.origin,{body:new Tc,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&Rc(()=>Ml.isReadableStream(new r("").body)),d={stream:u&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Rl(`Response type '${e}' is not supported`,Rl.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=Ml.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Ml.isBlob(e))return e.size;if(Ml.isSpecCompliantForm(e)){const t=new n(Ql.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ml.isArrayBufferView(e)||Ml.isArrayBuffer(e)?e.byteLength:(Ml.isURLSearchParams(e)&&(e+=""),Ml.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:i,method:s,data:a,signal:l,cancelToken:c,timeout:p,onDownloadProgress:m,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:w}=xc(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let k=Sc([l,c&&c.toAbortSignal()],p),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let C;try{if(g&&h&&"get"!==s&&"head"!==s&&0!==(C=await f(b,a))){let e,t=new n(i,{method:"POST",body:a,duplex:"half"});if(Ml.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=pc(C,fc(mc(g)));a=Oc(t.body,65536,e,n)}}Ml.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in n.prototype,l={...w,signal:k,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?y:void 0};S=o&&new n(i,l);let c=await(o?x(S,w):x(i,l));const p=u&&("stream"===v||"response"===v);if(u&&(m||p&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=Ml.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&pc(t,fc(mc(m),!0))||[];c=new r(Oc(c.body,65536,n,()=>{i&&i(),E&&E()}),e)}v=v||"text";let O=await d[Ml.findKey(d,v)||"text"](c,e);return!p&&E&&E(),await new Promise((t,n)=>{dc(t,n,{data:O,headers:lc.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:S})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Rl("Network Error",Rl.ERR_NETWORK,e,S),{cause:t.cause||t});throw Rl.from(t,t&&t.code,e,S)}}},Pc=new Map,Lc=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let s,a,l=o.length,c=Pc;for(;l--;)s=o[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:Dc(t)),c=a;return a};Lc();const Bc={http:null,xhr:kc,fetch:{get:Lc}};Ml.forEach(Bc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ic=e=>`- ${e}`,jc=e=>Ml.isFunction(e)||null===e||!1===e;var _c={getAdapter:function(e,t){e=Ml.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=e[s],i=r,!jc(r)&&(i=Bc[(n=String(r)).toLowerCase()],void 0===i))throw new Rl(`Unknown adapter '${n}'`);if(i&&(Ml.isFunction(i)||(i=i.get(t))))break;o[n||"#"+s]=i}if(!i){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Rl("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Ic).join("\n"):" "+Ic(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:Bc};function Fc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new uc(null,e)}function Wc(e){Fc(e),e.headers=lc.from(e.headers),e.data=cc.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _c.getAdapter(e.adapter||tc.adapter,e)(e).then(function(t){return Fc(e),t.data=cc.call(e,e.transformResponse,t),t.headers=lc.from(t.headers),t},function(t){return hc(t)||(Fc(e),t&&t.response&&(t.response.data=cc.call(e,e.transformResponse,t.response),t.response.headers=lc.from(t.response.headers))),Promise.reject(t)})}const zc="1.13.2",Hc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Hc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Vc={};Hc.transitional=function(e,t,n){return(r,i,o)=>{if(!1===e)throw new Rl(function(e,t){return"[Axios v"+zc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}(i," has been removed"+(t?" in "+t:"")),Rl.ERR_DEPRECATED);return t&&!Vc[i]&&(Vc[i]=!0),!e||e(r,i,o)}},Hc.spelling=function(e){return(e,t)=>!0};var qc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Rl("options must be an object",Rl.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new Rl("option "+o+" must be "+n,Rl.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Rl("Unknown option "+o,Rl.ERR_BAD_OPTION)}},validators:Hc};const Uc=qc.validators;class $c{constructor(e){this.defaults=e||{},this.interceptors={request:new ql,response:new ql}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=wc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&qc.assertOptions(n,{silentJSONParsing:Uc.transitional(Uc.boolean),forcedJSONParsing:Uc.transitional(Uc.boolean),clarifyTimeoutError:Uc.transitional(Uc.boolean)},!1),null!=r&&(Ml.isFunction(r)?t.paramsSerializer={serialize:r}:qc.assertOptions(r,{encode:Uc.function,serialize:Uc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),qc.assertOptions(t,{baseUrl:Uc.spelling("baseURL"),withXsrfToken:Uc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&Ml.merge(i.common,i[t.method]);i&&Ml.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=lc.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let h,u=0;if(!a){const e=[Wc.bind(this),void 0];for(e.unshift(...s),e.push(...l),h=e.length,c=Promise.resolve(t);u<h;)c=c.then(e[u++],e[u++]);return c}h=s.length;let d=t;for(;u<h;){const e=s[u++],t=s[u++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=Wc.call(this,d)}catch(e){return Promise.reject(e)}for(u=0,h=l.length;u<h;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Vl(bc((e=wc(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}Ml.forEach(["delete","get","head","options"],function(e){$c.prototype[e]=function(t,n){return this.request(wc(n||{},{method:e,url:t,data:(n||{}).data}))}}),Ml.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(wc(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}$c.prototype[e]=t(),$c.prototype[e+"Form"]=t(!0)});var Kc=$c;class Yc{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new uc(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Yc(function(t){e=t}),cancel:e}}}var Gc=Yc;const Xc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Xc).forEach(([e,t])=>{Xc[t]=e});var Jc=Xc;const Qc=function e(t){const n=new Kc(t),r=Wa(Kc.prototype.request,n);return Ml.extend(r,Kc.prototype,n,{allOwnKeys:!0}),Ml.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(wc(t,n))},r}(tc);Qc.Axios=Kc,Qc.CanceledError=uc,Qc.CancelToken=Gc,Qc.isCancel=hc,Qc.VERSION=zc,Qc.toFormData=_l,Qc.AxiosError=Rl,Qc.Cancel=Qc.CanceledError,Qc.all=function(e){return Promise.all(e)},Qc.spread=function(e){return function(t){return e.apply(null,t)}},Qc.isAxiosError=function(e){return Ml.isObject(e)&&!0===e.isAxiosError},Qc.mergeConfig=wc,Qc.AxiosHeaders=lc,Qc.formToJSON=e=>Zl(Ml.isHTMLForm(e)?new FormData(e):e),Qc.getAdapter=_c.getAdapter,Qc.HttpStatusCode=Jc,Qc.default=Qc;var Zc=Qc.create({baseURL:"/api/cms",timeout:1e4,headers:{"Content-Type":"application/json"}});Zc.interceptors.request.use(function(e){e.url&&e.url.startsWith("http")&&(e.baseURL="");var t=localStorage.getItem("cms_token");return t&&(e.headers.Authorization="Bearer ".concat(t)),e},function(e){return Promise.reject(e)}),Zc.interceptors.response.use(function(e){return e},function(e){var t="请求错误",n=!1;if(e.response){var r=e.response.status,i=e.response.data;401===r?"登录已过期,请重新登录"===(null==i?void 0:i.message)?(t="登录已过期,请重新登录",n=!0):"认证信息无效"===(null==i?void 0:i.message)?(t="认证信息无效,请重新登录",n=!0):(t="认证失败,请登录",n=!0):t=(null==i?void 0:i.message)||"HTTP ".concat(r,": ").concat(e.response.statusText)}else t=e.request?"网络连接失败,请检查网络状态":e.message||"请求错误";return n?(localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),"/login"!==window.location.pathname&&"/"!==window.location.pathname&&(Fa.error(t),setTimeout(function(){window.location.reload()},1e3))):Fa.error(t),Promise.reject(e)});var eh,th=function(e,t,n){if(t){var r=new URLSearchParams(t).toString();e=e+(e.includes("?")?"&":"?")+r}return Zc.get(e,n).then(function(e){return e.data})},nh=function(e,t,n){return Zc.post(e,t,n).then(function(e){return e.data})},rh=function(e,t,n){return Zc.put(e,t,n).then(function(e){return e.data})},ih=function(e,t){return Zc.delete(e,t).then(function(e){return e.data})};try{var oh=localStorage.getItem("cms_session_id")||void 0;eh=oh}catch(Uk){}var sh=function(){return th("/models")},ah=function(){return th("/auth/signup/status/".concat(eh?eh+"_":"","cms_users"))},lh=function(e){return nh("/auth/signup/".concat(eh?eh+"_":"","cms_users"),e)},ch=function(e){return nh("/auth/login/".concat(eh?eh+"_":"","cms_users"),e)},hh=function(){return nh("/auth/verify/".concat(eh?eh+"_":"","cms_users"))},uh=function(){return th("/auth/user/".concat(eh?eh+"_":"","cms_users"))},dh=function(){localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user")},fh=function(){return localStorage.getItem("cms_token")},ph=function(){var e=localStorage.getItem("cms_user");return e?JSON.parse(e):null},mh=function(e,t){var n=t?Object.assign({},t):void 0;return(null==n?void 0:n.filters)&&Array.isArray(n.filters)&&(n.filters=JSON.stringify(n.filters)),th("/data/".concat(eh?eh+"_":"").concat(e),n)},gh=function(e,t){return th("/relation/".concat(eh?eh+"_":"").concat(e,"/options"),t)},vh=function(e,t){return nh("/data/".concat(eh?eh+"_":"").concat(e),t)},bh=function(e,t){return rh("/data/".concat(eh?eh+"_":"").concat(e),t)},yh=function(e,t){return ih("/data/".concat(eh?eh+"_":"").concat(e,"?id=").concat(t))};function wh(t){var n=t.onLoginSuccess,r=m(e.useState(""),2),i=r[0],o=r[1],s=m(e.useState(""),2),a=s[0],l=s[1],c=m(e.useState(!1),2),u=c[0],d=c[1],p=m(e.useState("login"),2),g=p[0],v=p[1];e.useEffect(function(){var e=fh();if(e){var t=function(){var t=h(f().m(function t(){var r;return f().w(function(t){for(;;)switch(t.p=t.n){case 0:return d(!0),t.p=1,t.n=2,hh();case 2:if(t.v.success){t.n=3;break}throw new Error("token验证失败");case 3:return t.n=4,uh();case 4:if(!(r=t.v).success||!r.data){t.n=5;break}localStorage.setItem("cms_user",JSON.stringify(r.data)),null==n||n(e,r.data),t.n=6;break;case 5:throw new Error("获取用户信息失败");case 6:t.n=8;break;case 7:t.p=7,t.v,dh();case 8:return t.p=8,d(!1),t.f(8);case 9:return t.a(2)}},t,null,[[1,7,8,9]])}));return function(){return t.apply(this,arguments)}}();t()}},[n]),e.useEffect(function(){if(!fh()){var e=function(){var e=h(f().m(function e(){var t,n;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return d(!0),e.p=1,e.n=2,ah();case 2:(n=e.v).success&&(null===(t=n.data)||void 0===t?void 0:t.allowSignup)?v("signup"):v("login"),e.n=4;break;case 3:e.p=3,e.v,v("login");case 4:return e.p=4,d(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()}},[]);var b=function(){var e=h(f().m(function e(t){var r,o,s,l,c;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),i&&a){e.n=1;break}return Fa.error("请完善登录信息"),e.a(2);case 1:if(d(!0),e.p=2,"signup"!==g){e.n=4;break}return e.n=3,lh({username:i,password:a});case 3:l=e.v,e.n=6;break;case 4:return e.n=5,ch({username:i,password:a});case 5:l=e.v;case 6:if((s=l).success&&(null===(r=s.data)||void 0===r?void 0:r.token)){e.n=7;break}return Fa.error(s.message||"登录失败"),"signup"===g&&(null===(o=s.message)||void 0===o?void 0:o.includes("已存在管理员"))&&v("login"),e.a(2);case 7:localStorage.setItem("cms_token",s.data.token),localStorage.setItem("cms_user",JSON.stringify(s.data.user)),null==n||n(s.data.token,s.data.user),e.n=9;break;case 8:e.p=8,c=e.v,Fa.error("登陆失败,".concat(c.message||"网络错误,请稍后重试"));case 9:return e.p=9,d(!1),e.f(9);case 10:return e.a(2)}},e,null,[[2,8,9,10]])}));return function(t){return e.apply(this,arguments)}}();return e.createElement("div",{className:"min-h-screen flex relative overflow-hidden bg-white"},e.createElement("div",{className:"pointer-events-none absolute inset-0"},e.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(110deg,#ffffff_0%,#f7fbff_40%,#edf6ff_70%,#eaf3ff_100%)]"}),e.createElement("div",{className:"absolute inset-0 bg-[radial-gradient(1200px_600px_at_-10%_-10%,rgba(59,130,246,0.12),transparent),radial-gradient(900px_500px_at_110%_20%,rgba(147,51,234,0.10),transparent),radial-gradient(700px_400px_at_60%_120%,rgba(99,102,241,0.10),transparent)]"}),e.createElement("div",{className:"absolute inset-0 bg-[linear-gradient(115deg,rgba(255,255,255,0.6)_0%,rgba(255,255,255,0.15)_32%,transparent_32%,transparent_68%,rgba(255,255,255,0.15)_68%,rgba(255,255,255,0.6)_100%)]"})),e.createElement("div",{className:"flex-1 relative flex items-center justify-center"},e.createElement("div",{className:"relative z-10 max-w-4xl w-full px-16 text-left"},e.createElement("div",{className:"mb-12"},e.createElement("div",{className:"inline-flex items-center rounded-2xl px-4 py-2 bg-white/70 backdrop-blur border border-white/60"},e.createElement("span",{className:"text-2xl font-semibold tracking-tight text-gray-900"},"CMS 管理后台")),e.createElement("h1",{className:"mt-8 text-5xl md:text-6xl font-extrabold leading-tight text-gray-900"},"内容管理平台"),e.createElement("p",{className:"mt-6 text-2xl text-gray-600"},"一站式管理、协作与发布")),e.createElement("div",{className:"mt-8 flex items-center text-gray-500 gap-6"},e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-blue-500"}),"多角色权限"),e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-violet-500"}),"结构化内容"),e.createElement("span",{className:"flex items-center gap-2"},e.createElement("span",{className:"h-2 w-2 rounded-full bg-indigo-500"}),"可扩展 API")))),e.createElement("div",{className:"w-[480px] min-w-[380px] flex items-center justify-center p-8 mt-30"},e.createElement("div",{className:"w-full max-w-sm"},u?e.createElement(wa,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},e.createElement(Ea,{className:"p-8"},e.createElement("div",{className:"space-y-4"},e.createElement(Ue,{className:"h-12 w-48"}),e.createElement(Ue,{className:"h-4 w-64"}),e.createElement(Ue,{className:"h-10 w-full"}),e.createElement(Ue,{className:"h-10 w-full"})))):e.createElement(wa,{className:"bg-white/30 backdrop-blur-xl border border-white/50 shadow-none rounded-3xl overflow-hidden"},e.createElement(xa,{className:"p-8 pb-6"},e.createElement(ka,{className:"text-center text-2xl mb-2 text-gray-800"},"signup"===g?"创建管理员账号":"欢迎使用 CMS 管理后台"),e.createElement(Sa,{className:"text-center text-gray-500"},"signup"===g?"首次进入需要先创建一个管理员账号":"请输入账号和密码登录")),e.createElement(Ea,{className:"p-8 pt-0"},e.createElement("form",{onSubmit:b,className:"space-y-6"},e.createElement("div",{className:"space-y-2"},e.createElement(ya,{htmlFor:"username"},"账号/邮箱"),e.createElement("div",{className:"relative"},e.createElement(U,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.createElement(lt,{id:"username",type:"text",placeholder:"邮箱",value:i,onChange:function(e){return o(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:2}))),e.createElement("div",{className:"space-y-2"},e.createElement(ya,{htmlFor:"password"},"密码"),e.createElement("div",{className:"relative"},e.createElement(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.createElement(lt,{id:"password",type:"password",placeholder:"密码",value:a,onChange:function(e){return l(e.target.value)},className:"pl-10 h-12 rounded-xl border-gray-200 hover:border-blue-400 focus:border-blue-500 transition-colors",required:!0,minLength:6}))),e.createElement(at,{type:"submit",className:"w-full h-12 rounded-xl transition-all duration-200 font-semibold text-base shadow-lg hover:brightness-[1.03] active:scale-[0.99]",style:{backgroundImage:"linear-gradient(135deg, rgba(236, 248, 255, 0.78) 0%, rgba(221, 238, 255, 0.78) 100%)",color:"rgba(0, 0, 0, 0.7)",border:"none",boxShadow:"0 6px 24px rgba(37, 99, 235, 0.12)"},disabled:u},e.createElement(I,{className:"h-4 w-4 mr-2"}),u?"signup"===g?"创建中...":"登录中...":"signup"===g?"创建账号并进入":"登录"),e.createElement("div",{className:"text-center text-sm text-gray-500"},"signup"===g?e.createElement("button",{type:"button",className:"underline underline-offset-4 hover:text-gray-700",onClick:function(){return v("login")},disabled:u},"已有账号?去登录"):e.createElement("button",{type:"button",className:"underline underline-offset-4 hover:text-gray-700",onClick:function(){return v("signup")},disabled:u},"首次使用?创建管理员"))))))))}function xh(e,[t,n]){return Math.min(n,Math.max(t,e))}function kh(e){const n=Sh(e),r=s.forwardRef((e,r)=>{const{children:i,...o}=e,a=s.Children.toArray(i),l=a.find(Ch);if(l){const e=l.props.children,i=a.map(t=>t===l?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,i):null})}return t.jsx(n,{...o,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}function Sh(e){const t=s.forwardRef((e,t)=>{const{children:n,...r}=e;if(s.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==s.Fragment&&(i.ref=t?Ke(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Eh=Symbol("radix.slottable");function Ch(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Eh}var Oh=s.createContext(void 0);var Nh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=kh(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});var Ah,Th="dismissableLayer.update",Mh="dismissableLayer.pointerDownOutside",Rh="dismissableLayer.focusOutside",Dh=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ph=s.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...h}=e,u=s.useContext(Dh),[d,f]=s.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=s.useState({}),g=Ye(n,e=>f(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=d?v.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,k=w>=y,S=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1),i=s.useRef(()=>{});return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Bh(Mh,n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));k&&!n&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},p),E=function(e,t=globalThis?.document){const n=Tt(e),r=s.useRef(!1);return s.useEffect(()=>{const e=e=>{if(e.target&&!r.current){Bh(Rh,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),l?.(e),e.defaultPrevented||c?.())},p);return Mt(e=>{w===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),s.useEffect(()=>{if(d)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Ah=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Lh(),()=>{r&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Ah)}},[d,p,r,u]),s.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Lh())},[d,u]),s.useEffect(()=>{const e=()=>m({});return document.addEventListener(Th,e),()=>document.removeEventListener(Th,e)},[]),t.jsx(Nh.div,{...h,ref:g,style:{pointerEvents:x?k?"auto":"none":void 0,...e.style},onFocusCapture:mt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:mt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:mt(e.onPointerDownCapture,S.onPointerDownCapture)})});Ph.displayName="DismissableLayer";function Lh(){const e=new CustomEvent(Th);document.dispatchEvent(e)}function Bh(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync(()=>e.dispatchEvent(t))}(i,o):i.dispatchEvent(o)}s.forwardRef((e,n)=>{const r=s.useContext(Dh),i=s.useRef(null),o=Ye(n,i);return s.useEffect(()=>{const e=i.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),t.jsx(Nh.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var Ih="focusScope.autoFocusOnMount",jh="focusScope.autoFocusOnUnmount",_h={bubbles:!1,cancelable:!0},Fh=s.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,h]=s.useState(null),u=Tt(o),d=Tt(a),f=s.useRef(null),p=Ye(n,e=>h(e)),m=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(i){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:Vh(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Vh(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Vh(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[i,c,m.paused]),s.useEffect(()=>{if(c){qh.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Ih,_h);c.addEventListener(Ih,u),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Vh(r,{select:t}),document.activeElement!==n)return}((e=Wh(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Vh(c))}return()=>{c.removeEventListener(Ih,u),setTimeout(()=>{const e=new CustomEvent(jh,_h);c.addEventListener(jh,d),c.dispatchEvent(e),e.defaultPrevented||Vh(t??document.body,{select:!0}),c.removeEventListener(jh,d),qh.remove(m)},0)}}var e},[c,u,d,m]);const g=s.useCallback(e=>{if(!r&&!i)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[i,o]=function(e){const t=Wh(e),n=zh(t,e),r=zh(t.reverse(),e);return[n,r]}(t);i&&o?e.shiftKey||n!==o?e.shiftKey&&n===i&&(e.preventDefault(),r&&Vh(o,{select:!0})):(e.preventDefault(),r&&Vh(i,{select:!0})):n===t&&e.preventDefault()}},[r,i,m.paused]);return t.jsx(Nh.div,{tabIndex:-1,...l,ref:p,onKeyDown:g})});function Wh(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zh(e,t){for(const n of e)if(!Hh(n,{upTo:t}))return n}function Hh(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Vh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Fh.displayName="FocusScope";var qh=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Uh(e,t),e.unshift(t)},remove(t){e=Uh(e,t),e[0]?.resume()}}}();function Uh(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var $h=s.forwardRef((e,n)=>{const{children:r,width:i=10,height:o=5,...s}=e;return t.jsx(Nh.svg,{...s,ref:n,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});$h.displayName="Arrow";var Kh=$h,Yh="Popper",[Gh,Xh]=gt(Yh),[Jh,Qh]=Gh(Yh),Zh=e=>{const{__scopePopper:n,children:r}=e,[i,o]=s.useState(null);return t.jsx(Jh,{scope:n,anchor:i,onAnchorChange:o,children:r})};Zh.displayName=Yh;var eu="PopperAnchor",tu=s.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...o}=e,a=Qh(eu,r),l=s.useRef(null),c=Ye(n,l),h=s.useRef(null);return s.useEffect(()=>{const e=h.current;h.current=i?.current||l.current,e!==h.current&&a.onAnchorChange(h.current)}),i?null:t.jsx(Nh.div,{...o,ref:c})});tu.displayName=eu;var nu="PopperContent",[ru,iu]=Gh(nu),ou=s.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,b=Qh(nu,r),[y,w]=s.useState(null),x=Ye(n,e=>w(e)),[k,S]=s.useState(null),E=Go(k),C=E?.width??0,O=E?.height??0,N=i+("center"!==a?"-"+a:""),A="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],M=T.length>0,R={padding:A,boundary:T.filter(cu),altBoundary:M},{refs:D,floatingStyles:P,placement:L,isPositioned:B,middlewareData:I}=_o({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Eo(...e,{animationFrame:"always"===m}),elements:{reference:b.anchor},middleware:[Wo({mainAxis:o+O,alignmentAxis:l}),h&&zo({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?Ho():void 0,...R}),h&&Vo({...R}),qo({...R,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&$o({element:k,padding:c}),hu({arrowWidth:C,arrowHeight:O}),p&&Uo({strategy:"referenceHidden",...R})]}),[j,_]=uu(L),F=Tt(g);bt(()=>{B&&F?.()},[B,F]);const W=I.arrow?.x,z=I.arrow?.y,H=0!==I.arrow?.centerOffset,[V,q]=s.useState();return bt(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),t.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:B?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(ru,{scope:r,placedSide:j,onArrowChange:S,arrowX:W,arrowY:z,shouldHideArrow:H,children:t.jsx(Nh.div,{"data-side":j,"data-align":_,...v,ref:x,style:{...v.style,animation:B?void 0:"none"}})})})});ou.displayName=nu;var su="PopperArrow",au={top:"bottom",right:"left",bottom:"top",left:"right"},lu=s.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=iu(su,r),s=au[o.placedSide];return t.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t.jsx(Kh,{...i,ref:n,style:{...i.style,display:"block"}})})});function cu(e){return null!==e}lu.displayName=su;var hu=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,o=0!==i.arrow?.centerOffset,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=uu(n),h={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,d=(i.arrow?.y??0)+a/2;let f="",p="";return"bottom"===l?(f=o?h:`${u}px`,p=-a+"px"):"top"===l?(f=o?h:`${u}px`,p=`${r.floating.height+a}px`):"right"===l?(f=-a+"px",p=o?h:`${d}px`):"left"===l&&(f=`${r.floating.width+a}px`,p=o?h:`${d}px`),{data:{x:f,y:p}}}});function uu(e){const[t,n="center"]=e.split("-");return[t,n]}var du=Zh,fu=tu,pu=ou,mu=lu,gu=s.forwardRef((e,r)=>{const{container:i,...o}=e,[a,l]=s.useState(!1);bt(()=>l(!0),[]);const c=i||a&&globalThis?.document?.body;return c?n.createPortal(t.jsx(Nh.div,{...o,ref:r}),c):null});function vu(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}gu.displayName="Portal";var bu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});s.forwardRef((e,n)=>t.jsx(Nh.span,{...e,ref:n,style:{...bu,...e.style}})).displayName="VisuallyHidden";var yu=[" ","Enter","ArrowUp","ArrowDown"],wu=[" ","Enter"],xu="Select",[ku,Su,Eu]=function(n){const r=n+"CollectionProvider",[i,o]=gt(r),[s,a]=i(r,{collectionRef:{current:null},itemMap:new Map}),l=n=>{const{scope:r,children:i}=n,o=e.useRef(null),a=e.useRef(new Map).current;return t.jsx(s,{scope:r,itemMap:a,collectionRef:o,children:i})};l.displayName=r;const c=n+"CollectionSlot",h=kh(c),u=e.forwardRef((e,n)=>{const{scope:r,children:i}=e,o=Ye(n,a(c,r).collectionRef);return t.jsx(h,{ref:o,children:i})});u.displayName=c;const d=n+"CollectionItemSlot",f="data-radix-collection-item",p=kh(d),m=e.forwardRef((n,r)=>{const{scope:i,children:o,...s}=n,l=e.useRef(null),c=Ye(r,l),h=a(d,i);return e.useEffect(()=>(h.itemMap.set(l,{ref:l,...s}),()=>{h.itemMap.delete(l)})),t.jsx(p,{[f]:"",ref:c,children:o})});return m.displayName=d,[{Provider:l,Slot:u,ItemSlot:m},function(t){const r=a(n+"CollectionConsumer",t);return e.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},o]}(xu),[Cu,Ou]=gt(xu,[Eu,Xh]),Nu=Xh(),[Au,Tu]=Cu(xu),[Mu,Ru]=Cu(xu),Du=e=>{const{__scopeSelect:n,children:r,open:i,defaultOpen:o,onOpenChange:a,value:l,defaultValue:c,onValueChange:h,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:g}=e,v=Nu(n),[b,y]=s.useState(null),[w,x]=s.useState(null),[k,S]=s.useState(!1),E=function(e){const t=s.useContext(Oh);return e||t||"ltr"}(u),[C,O]=St({prop:i,defaultProp:o??!1,onChange:a,caller:xu}),[N,A]=St({prop:l,defaultProp:c,onChange:h,caller:xu}),T=s.useRef(null),M=!b||(g||!!b.closest("form")),[R,D]=s.useState(new Set),P=Array.from(R).map(e=>e.props.value).join(";");return t.jsx(du,{...v,children:t.jsxs(Au,{required:m,scope:n,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:xt(),value:N,onValueChange:A,open:C,onOpenChange:O,dir:E,triggerPointerDownPosRef:T,disabled:p,children:[t.jsx(ku.Provider,{scope:n,children:t.jsx(Mu,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{D(t=>new Set(t).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{D(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),M?t.jsxs(bd,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:N,onChange:e=>A(e.target.value),disabled:p,form:g,children:[void 0===N?t.jsx("option",{value:""}):null,Array.from(R)]},P):null]})})};Du.displayName=xu;var Pu="SelectTrigger",Lu=s.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:i=!1,...o}=e,a=Nu(r),l=Tu(Pu,r),c=l.disabled||i,h=Ye(n,l.onTriggerChange),u=Su(r),d=s.useRef("touch"),[f,p,m]=wd(e=>{const t=u().filter(e=>!e.disabled),n=t.find(e=>e.value===l.value),r=xd(t,e,n);void 0!==r&&l.onValueChange(r.value)}),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(fu,{asChild:!0,...a,children:t.jsx(Nh.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":yd(l.value)?"":void 0,...o,ref:h,onClick:mt(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&g(e)}),onPointerDown:mt(o.onPointerDown,e=>{d.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:mt(o.onKeyDown,e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||yu.includes(e.key)&&(g(),e.preventDefault())})})})});Lu.displayName=Pu;var Bu="SelectValue",Iu=s.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:o,children:s,placeholder:a="",...l}=e,c=Tu(Bu,r),{onValueNodeHasChildrenChange:h}=c,u=void 0!==s,d=Ye(n,c.onValueNodeChange);return bt(()=>{h(u)},[h,u]),t.jsx(Nh.span,{...l,ref:d,style:{pointerEvents:"none"},children:yd(c.value)?t.jsx(t.Fragment,{children:a}):s})});Iu.displayName=Bu;var ju=s.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,...o}=e;return t.jsx(Nh.span,{"aria-hidden":!0,...o,ref:n,children:i||"▼"})});ju.displayName="SelectIcon";var _u=e=>t.jsx(gu,{asChild:!0,...e});_u.displayName="SelectPortal";var Fu="SelectContent",Wu=s.forwardRef((e,n)=>{const r=Tu(Fu,e.__scopeSelect),[i,o]=s.useState();if(bt(()=>{o(new DocumentFragment)},[]),!r.open){const n=i;return n?a.createPortal(t.jsx(Hu,{scope:e.__scopeSelect,children:t.jsx(ku.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Uu,{...e,ref:n})});Wu.displayName=Fu;var zu=10,[Hu,Vu]=Cu(Fu),qu=kh("SelectContent.RemoveScroll"),Uu=s.forwardRef((e,n)=>{const{__scopeSelect:r,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:h,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=e,w=Tu(Fu,r),[x,k]=s.useState(null),[S,E]=s.useState(null),C=Ye(n,e=>k(e)),[O,N]=s.useState(null),[A,T]=s.useState(null),M=Su(r),[R,D]=s.useState(!1),P=s.useRef(!1);s.useEffect(()=>{if(x)return Yn(x)},[x]),Zt();const L=s.useCallback(e=>{const[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(const n of e){if(n===i)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i)return}},[M,S]),B=s.useCallback(()=>L([O,x]),[L,O,x]);s.useEffect(()=>{R&&B()},[R,B]);const{onOpenChange:I,triggerPointerDownPosRef:j}=w;s.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(j.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||I(!1),document.removeEventListener("pointermove",t),j.current=null};return null!==j.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,I,j]),s.useEffect(()=>{const e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);const[_,F]=wd(e=>{const t=M().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=xd(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),W=s.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&(N(e),r&&(P.current=!0))},[w.value]),z=s.useCallback(()=>x?.focus(),[x]),H=s.useCallback((e,t,n)=>{const r=!P.current&&!n;(void 0!==w.value&&w.value===t||r)&&T(e)},[w.value]),V="popper"===i?Ku:$u,q=V===Ku?{side:c,sideOffset:h,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return t.jsx(Hu,{scope:r,content:x,viewport:S,onViewportChange:E,itemRefCallback:W,selectedItem:O,onItemLeave:z,itemTextRefCallback:H,focusSelectedItem:B,selectedItemText:A,position:i,isPositioned:R,searchRef:_,children:t.jsx(zn,{as:qu,allowPinchZoom:!0,children:t.jsx(Fh,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:mt(o,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(Ph,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t.jsx(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...q,onPlaced:()=>D(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:mt(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>L(t)),e.preventDefault()}})})})})})})});Uu.displayName="SelectContentImpl";var $u=s.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:i,...o}=e,a=Tu(Fu,r),l=Vu(Fu,r),[c,h]=s.useState(null),[u,d]=s.useState(null),f=Ye(n,e=>d(e)),p=Su(r),m=s.useRef(!1),g=s.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=l,x=s.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&v&&b&&y){const e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if("rtl"!==a.dir){const i=r.left-t.left,o=n.left-i,s=e.left-o,a=e.width+s,l=Math.max(a,t.width),h=window.innerWidth-zu,u=xh(o,[zu,Math.max(zu,h-l)]);c.style.minWidth=a+"px",c.style.left=u+"px"}else{const i=t.right-r.right,o=window.innerWidth-n.right-i,s=window.innerWidth-e.right-o,a=e.width+s,l=Math.max(a,t.width),h=window.innerWidth-zu,u=xh(o,[zu,Math.max(zu,h-l)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const o=p(),s=window.innerHeight-2*zu,l=v.scrollHeight,h=window.getComputedStyle(u),d=parseInt(h.borderTopWidth,10),f=parseInt(h.paddingTop,10),g=parseInt(h.borderBottomWidth,10),w=d+f+l+parseInt(h.paddingBottom,10)+g,x=Math.min(5*b.offsetHeight,w),k=window.getComputedStyle(v),S=parseInt(k.paddingTop,10),E=parseInt(k.paddingBottom,10),C=e.top+e.height/2-zu,O=s-C,N=b.offsetHeight/2,A=d+f+(b.offsetTop+N),T=w-A;if(A<=C){const e=o.length>0&&b===o[o.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(O,N+(e?E:0)+t+g);c.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;c.style.top="0px";const t=Math.max(C,d+v.offsetTop+(e?S:0)+N)+T;c.style.height=t+"px",v.scrollTop=A-C+v.offsetTop}c.style.margin=`${zu}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=s+"px",i?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,c,u,v,b,y,a.dir,i]);bt(()=>x(),[x]);const[k,S]=s.useState();bt(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const E=s.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t.jsx(Yu,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:t.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:t.jsx(Nh.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});$u.displayName="SelectItemAlignedPosition";var Ku=s.forwardRef((e,n)=>{const{__scopeSelect:r,align:i="start",collisionPadding:o=zu,...s}=e,a=Nu(r);return t.jsx(pu,{...a,...s,ref:n,align:i,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ku.displayName="SelectPopperPosition";var[Yu,Gu]=Cu(Fu,{}),Xu="SelectViewport",Ju=s.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:i,...o}=e,a=Vu(Xu,r),l=Gu(Xu,r),c=Ye(n,a.onViewportChange),h=s.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),t.jsx(ku.Slot,{scope:r,children:t.jsx(Nh.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:mt(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(h.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*zu,i=parseFloat(n.style.minHeight),o=parseFloat(n.style.height),s=Math.max(i,o);if(s<r){const i=s+e,o=Math.min(r,i),a=i-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=a>0?a:0,n.style.justifyContent="flex-end")}}}h.current=t.scrollTop})})})]})});Ju.displayName=Xu;var Qu="SelectGroup",[Zu,ed]=Cu(Qu);s.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=xt();return t.jsx(Zu,{scope:r,id:o,children:t.jsx(Nh.div,{role:"group","aria-labelledby":o,...i,ref:n})})}).displayName=Qu;var td="SelectLabel",nd=s.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=ed(td,r);return t.jsx(Nh.div,{id:o.id,...i,ref:n})});nd.displayName=td;var rd="SelectItem",[id,od]=Cu(rd),sd=s.forwardRef((e,n)=>{const{__scopeSelect:r,value:i,disabled:o=!1,textValue:a,...l}=e,c=Tu(rd,r),h=Vu(rd,r),u=c.value===i,[d,f]=s.useState(a??""),[p,m]=s.useState(!1),g=Ye(n,e=>h.itemRefCallback?.(e,i,o)),v=xt(),b=s.useRef("touch"),y=()=>{o||(c.onValueChange(i),c.onOpenChange(!1))};if(""===i)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(id,{scope:r,value:i,disabled:o,textId:v,isSelected:u,onItemTextChange:s.useCallback(e=>{f(t=>t||(e?.textContent??"").trim())},[]),children:t.jsx(ku.ItemSlot,{scope:r,value:i,disabled:o,textValue:d,children:t.jsx(Nh.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:mt(l.onFocus,()=>m(!0)),onBlur:mt(l.onBlur,()=>m(!1)),onClick:mt(l.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:mt(l.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:mt(l.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:mt(l.onPointerMove,e=>{b.current=e.pointerType,o?h.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:mt(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:mt(l.onKeyDown,e=>{""!==h.searchRef?.current&&" "===e.key||(wu.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});sd.displayName=rd;var ad="SelectItemText",ld=s.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:o,...l}=e,c=Tu(ad,r),h=Vu(ad,r),u=od(ad,r),d=Ru(ad,r),[f,p]=s.useState(null),m=Ye(n,e=>p(e),u.onItemTextChange,e=>h.itemTextRefCallback?.(e,u.value,u.disabled)),g=f?.textContent,v=s.useMemo(()=>t.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:y}=d;return bt(()=>(b(v),()=>y(v)),[b,y,v]),t.jsxs(t.Fragment,{children:[t.jsx(Nh.span,{id:u.textId,...l,ref:m}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})});ld.displayName=ad;var cd="SelectItemIndicator",hd=s.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return od(cd,r).isSelected?t.jsx(Nh.span,{"aria-hidden":!0,...i,ref:n}):null});hd.displayName=cd;var ud="SelectScrollUpButton",dd=s.forwardRef((e,n)=>{const r=Vu(ud,e.__scopeSelect),i=Gu(ud,e.__scopeSelect),[o,a]=s.useState(!1),l=Ye(n,i.onScrollButtonChange);return bt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollTop>0;a(e)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?t.jsx(md,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});dd.displayName=ud;var fd="SelectScrollDownButton",pd=s.forwardRef((e,n)=>{const r=Vu(fd,e.__scopeSelect),i=Gu(fd,e.__scopeSelect),[o,a]=s.useState(!1),l=Ye(n,i.onScrollButtonChange);return bt(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?t.jsx(md,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});pd.displayName=fd;var md=s.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:i,...o}=e,a=Vu("SelectScrollButton",r),l=s.useRef(null),c=Su(r),h=s.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return s.useEffect(()=>()=>h(),[h]),bt(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),t.jsx(Nh.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:mt(o.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(i,50))}),onPointerMove:mt(o.onPointerMove,()=>{a.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(i,50))}),onPointerLeave:mt(o.onPointerLeave,()=>{h()})})}),gd=s.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return t.jsx(Nh.div,{"aria-hidden":!0,...i,ref:n})});gd.displayName="SelectSeparator";var vd="SelectArrow";s.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=Nu(r),s=Tu(vd,r),a=Vu(vd,r);return s.open&&"popper"===a.position?t.jsx(mu,{...o,...i,ref:n}):null}).displayName=vd;var bd=s.forwardRef(({__scopeSelect:e,value:n,...r},i)=>{const o=s.useRef(null),a=Ye(i,o),l=vu(n);return s.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[l,n]),t.jsx(Nh.select,{...r,style:{...bu,...r.style},ref:a,defaultValue:n})});function yd(e){return""===e||void 0===e}function wd(e){const t=Tt(e),n=s.useRef(""),r=s.useRef(0),i=s.useCallback(e=>{const i=n.current+e;t(i),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),o=s.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function xd(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=(s=e,a=Math.max(i,0),s.map((e,t)=>s[(a+t)%s.length]));var s,a;1===r.length&&(o=o.filter(e=>e!==n));const l=o.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}bd.displayName="SelectBubbleInput";var kd=Lu,Sd=ju,Ed=_u,Cd=Wu,Od=Ju,Nd=nd,Ad=sd,Td=ld,Md=hd,Rd=dd,Dd=pd,Pd=gd,Ld=Du,Bd=Iu,Id=s.forwardRef(function(e,t){var n=e.className,r=e.children,i=G(e,["className","children"]);return s.createElement(kd,Object.assign({ref:t,className:qe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n)},i),r,s.createElement(Sd,{asChild:!0},s.createElement(E,{className:"h-4 w-4 opacity-50"})))});Id.displayName=kd.displayName;var jd=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Rd,Object.assign({ref:t,className:qe("flex cursor-default items-center justify-center py-1",n)},r),s.createElement(N,{className:"h-4 w-4"}))});jd.displayName=Rd.displayName;var _d=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Dd,Object.assign({ref:t,className:qe("flex cursor-default items-center justify-center py-1",n)},r),s.createElement(E,{className:"h-4 w-4"}))});_d.displayName=Dd.displayName;var Fd=s.forwardRef(function(e,t){var n=e.className,r=e.children,i=e.position,o=void 0===i?"popper":i,a=G(e,["className","children","position"]);return s.createElement(Ed,null,s.createElement(Cd,Object.assign({ref:t,className:qe("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o},a),s.createElement(jd,null),s.createElement(Od,{className:qe("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},r),s.createElement(_d,null)))});Fd.displayName=Cd.displayName;var Wd=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Nd,Object.assign({ref:t,className:qe("py-1.5 pl-8 pr-2 text-sm font-semibold",n)},r))});Wd.displayName=Nd.displayName;var zd=s.forwardRef(function(e,t){var n=e.className,r=e.children,i=G(e,["className","children"]);return s.createElement(Ad,Object.assign({ref:t,className:qe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n)},i),s.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},s.createElement(Md,null,s.createElement(S,{className:"h-4 w-4"}))),s.createElement(Td,null,r))});zd.displayName=Ad.displayName;var Hd=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Pd,Object.assign({ref:t,className:qe("-mx-1 my-1 h-px bg-muted",n)},r))});function Vd(e){const t=s.forwardRef((e,t)=>{const{children:n,...r}=e;if(s.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{const t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==s.Fragment&&(i.ref=t?Ke(t,e):e),s.cloneElement(n,i)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Hd.displayName=Pd.displayName;var qd=Symbol("radix.slottable");function Ud(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qd}var $d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=function(e){const n=Vd(e),r=s.forwardRef((e,r)=>{const{children:i,...o}=e,a=s.Children.toArray(i),l=a.find(Ud);if(l){const e=l.props.children,i=a.map(t=>t===l?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...o,ref:r,children:s.isValidElement(e)?s.cloneElement(e,void 0,i):null})}return t.jsx(n,{...o,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}(`Primitive.${n}`),i=s.forwardRef((e,i)=>{const{asChild:o,...s}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...s,ref:i})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),Kd="Switch",[Yd,Gd]=gt(Kd),[Xd,Jd]=Yd(Kd),Qd=s.forwardRef((e,n)=>{const{__scopeSwitch:r,name:i,checked:o,defaultChecked:a,required:l,disabled:c,value:h="on",onCheckedChange:u,form:d,...f}=e,[p,m]=s.useState(null),g=Ye(n,e=>m(e)),v=s.useRef(!1),b=!p||(d||!!p.closest("form")),[y,w]=St({prop:o,defaultProp:a??!1,onChange:u,caller:Kd});return t.jsxs(Xd,{scope:r,checked:y,disabled:c,children:[t.jsx($d.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":nf(y),"data-disabled":c?"":void 0,disabled:c,value:h,...f,ref:g,onClick:mt(e.onClick,e=>{w(e=>!e),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&t.jsx(tf,{control:p,bubbles:!v.current,name:i,value:h,checked:y,required:l,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});Qd.displayName=Kd;var Zd="SwitchThumb",ef=s.forwardRef((e,n)=>{const{__scopeSwitch:r,...i}=e,o=Jd(Zd,r);return t.jsx($d.span,{"data-state":nf(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:n})});ef.displayName=Zd;var tf=s.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:i=!0,...o},a)=>{const l=s.useRef(null),c=Ye(l,a),h=vu(r),u=Go(n);return s.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(h!==r&&n){const t=new Event("click",{bubbles:i});n.call(e,r),e.dispatchEvent(t)}},[h,r,i]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function nf(e){return e?"checked":"unchecked"}tf.displayName="SwitchBubbleInput";var rf=Qd,of=ef,sf=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(rf,Object.assign({className:qe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},r,{ref:t}),s.createElement(of,{className:qe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")}))});sf.displayName=rf.displayName;var af=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("textarea",Object.assign({className:qe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:t},r))});af.displayName="Textarea";var lf=Ar,cf=Tr,hf=Mr,uf=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Rr,Object.assign({ref:t,className:qe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n)},r))});uf.displayName=Rr.displayName;var df=s.forwardRef(function(e,t){var n=e.className,r=e.children,i=G(e,["className","children"]);return s.createElement(hf,null,s.createElement(uf,null),s.createElement(Dr,Object.assign({ref:t,className:qe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n)},i),r,s.createElement(Br,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"},s.createElement(K,{className:"h-4 w-4"}),s.createElement("span",{className:"sr-only"},"Close"))))});df.displayName=Dr.displayName;var ff=function(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex flex-col space-y-1.5 text-center sm:text-left",t)},n))};ff.displayName="DialogHeader";var pf=function(e){var t=e.className,n=G(e,["className"]);return s.createElement("div",Object.assign({className:qe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},n))};pf.displayName="DialogFooter";var mf=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Pr,Object.assign({ref:t,className:qe("text-lg font-semibold leading-none tracking-tight",n)},r))});mf.displayName=Pr.displayName;var gf,vf=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement(Lr,Object.assign({ref:t,className:qe("text-sm text-muted-foreground",n)},r))});function bf(e,t=!1){const n=e.length;let r=0,i="",o=0,s=16,a=0,l=0,c=0,h=0,u=0;function d(t,n){let i=0,o=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)o=16*o+t-48;else if(t>=65&&t<=70)o=16*o+t-65+10;else{if(!(t>=97&&t<=102))break;o=16*o+t-97+10}r++,i++}return i<t&&(o=-1),o}function f(){if(i="",u=0,o=r,l=a,h=c,r>=n)return o=n,s=17;let t=e.charCodeAt(r);if(yf(t)){do{r++,i+=String.fromCharCode(t),t=e.charCodeAt(r)}while(yf(t));return s=15}if(wf(t))return r++,i+=String.fromCharCode(t),13===t&&10===e.charCodeAt(r)&&(r++,i+="\n"),a++,c=r,s=14;switch(t){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,i=function(){let t="",i=r;for(;;){if(r>=n){t+=e.substring(i,r),u=2;break}const o=e.charCodeAt(r);if(34===o){t+=e.substring(i,r),r++;break}if(92!==o){if(o>=0&&o<=31){if(wf(o)){t+=e.substring(i,r),u=2;break}u=6}r++}else{if(t+=e.substring(i,r),r++,r>=n){u=2;break}switch(e.charCodeAt(r++)){case 34:t+='"';break;case 92:t+="\\";break;case 47:t+="/";break;case 98:t+="\b";break;case 102:t+="\f";break;case 110:t+="\n";break;case 114:t+="\r";break;case 116:t+="\t";break;case 117:const e=d(4,!0);e>=0?t+=String.fromCharCode(e):u=4;break;default:u=5}i=r}}return t}(),s=10;case 47:const l=r-1;if(47===e.charCodeAt(r+1)){for(r+=2;r<n&&!wf(e.charCodeAt(r));)r++;return i=e.substring(l,r),s=12}if(42===e.charCodeAt(r+1)){r+=2;const t=n-1;let o=!1;for(;r<t;){const t=e.charCodeAt(r);if(42===t&&47===e.charCodeAt(r+1)){r+=2,o=!0;break}r++,wf(t)&&(13===t&&10===e.charCodeAt(r)&&r++,a++,c=r)}return o||(r++,u=1),i=e.substring(l,r),s=13}return i+=String.fromCharCode(t),r++,s=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!xf(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=function(){let t=r;if(48===e.charCodeAt(r))r++;else for(r++;r<e.length&&xf(e.charCodeAt(r));)r++;if(r<e.length&&46===e.charCodeAt(r)){if(r++,!(r<e.length&&xf(e.charCodeAt(r))))return u=3,e.substring(t,r);for(r++;r<e.length&&xf(e.charCodeAt(r));)r++}let n=r;if(r<e.length&&(69===e.charCodeAt(r)||101===e.charCodeAt(r)))if(r++,(r<e.length&&43===e.charCodeAt(r)||45===e.charCodeAt(r))&&r++,r<e.length&&xf(e.charCodeAt(r))){for(r++;r<e.length&&xf(e.charCodeAt(r));)r++;n=r}else u=3;return e.substring(t,n)}(),s=11;default:for(;r<n&&p(t);)r++,t=e.charCodeAt(r);if(o!==r){switch(i=e.substring(o,r),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(t),r++,s=16}}function p(e){if(yf(e)||wf(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}return{setPosition:function(e){r=e,i="",o=0,s=16,u=0},getPosition:()=>r,scan:t?function(){let e;do{e=f()}while(e>=12&&e<=15);return e}:f,getToken:()=>s,getTokenValue:()=>i,getTokenOffset:()=>o,getTokenLength:()=>r-o,getTokenStartLine:()=>l,getTokenStartCharacter:()=>o-h,getTokenError:()=>u}}function yf(e){return 32===e||9===e}function wf(e){return 10===e||13===e}function xf(e){return e>=48&&e<=57}vf.displayName=Lr.displayName,function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"}(gf||(gf={}));const kf=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Sf=200,Ef={" ":{"\n":new Array(Sf).fill(0).map((e,t)=>"\n"+" ".repeat(t)),"\r":new Array(Sf).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Sf).fill(0).map((e,t)=>"\r\n"+" ".repeat(t))},"\t":{"\n":new Array(Sf).fill(0).map((e,t)=>"\n"+"\t".repeat(t)),"\r":new Array(Sf).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":new Array(Sf).fill(0).map((e,t)=>"\r\n"+"\t".repeat(t))}},Cf=["\n","\r","\r\n"];function Of(e,t,n){let r,i,o,s,a;if(t){for(s=t.offset,a=s+t.length,o=s;o>0&&!Af(e,o-1);)o--;let l=a;for(;l<e.length&&!Af(e,l);)l++;i=e.substring(o,l),r=function(e,t){let n=0,r=0;const i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===kf[1])r++;else{if("\t"!==t)break;r+=i}n++}return Math.floor(r/i)}(i,n)}else i=e,r=0,o=0,s=0,a=e.length;const l=function(e,t){for(let e=0;e<t.length;e++){const n=t.charAt(e);if("\r"===n)return e+1<t.length&&"\n"===t.charAt(e+1)?"\r\n":"\r";if("\n"===n)return"\n"}return e&&e.eol||"\n"}(n,e),c=Cf.includes(l);let h,u=0,d=0;h=n.insertSpaces?kf[n.tabSize||4]??Nf(kf[1],n.tabSize||4):"\t";const f="\t"===h?"\t":" ";let p=bf(i,!1),m=!1;function g(){if(u>1)return Nf(l,u)+Nf(h,r+d);const e=h.length*(r+d);return!c||e>Ef[f][l].length?l+Nf(h,r+d):e<=0?l:Ef[f][l][e]}function v(){let e=p.scan();for(u=0;15===e||14===e;)14===e&&n.keepLines?u+=1:14===e&&(u=1),e=p.scan();return m=16===e||0!==p.getTokenError(),e}const b=[];function y(n,r,i){m||t&&!(r<a&&i>s)||e.substring(r,i)===n||b.push({offset:r,length:i-r,content:n})}let w=v();if(n.keepLines&&u>0&&y(Nf(l,u),0,0),17!==w){let e=p.getTokenOffset()+o;y(h.length*r<20&&n.insertSpaces?kf[h.length*r]:Nf(h,r),o,e)}for(;17!==w;){let e=p.getTokenOffset()+p.getTokenLength()+o,t=v(),r="",i=!1;for(;0===u&&(12===t||13===t);){let n=p.getTokenOffset()+o;y(kf[1],e,n),e=p.getTokenOffset()+p.getTokenLength()+o,i=12===t,r=i?g():"",t=v()}if(2===t)1!==w&&d--,n.keepLines&&u>0||!n.keepLines&&1!==w?r=g():n.keepLines&&(r=kf[1]);else if(4===t)3!==w&&d--,n.keepLines&&u>0||!n.keepLines&&3!==w?r=g():n.keepLines&&(r=kf[1]);else{switch(w){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():kf[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():kf[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=kf[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=kf[1]);break;case 10:n.keepLines&&u>0?r=g():6!==t||i||(r="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():12!==t&&13!==t||i?5!==t&&17!==t&&(m=!0):r=kf[1];break;case 16:m=!0}u>0&&(12===t||13===t)&&(r=g())}17===t&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?l:"");y(r,e,p.getTokenOffset()+o),w=t}return b}function Nf(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Af(e,t){return-1!=="\r\n".indexOf(e.charAt(t))}var Tf,Mf,Rf;!function(e){e.DEFAULT={allowTrailingComma:!1}}(Tf||(Tf={})),function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"}(Mf||(Mf={})),function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"}(Rf||(Rf={}));const Df=function(e,t=[],n=Tf.DEFAULT){let r=null,i=[];const o=[];function s(e){Array.isArray(i)?i.push(e):null!==r&&(i[r]=e)}const a={onObjectBegin:()=>{const e={};s(e),o.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=o.pop()},onArrayBegin:()=>{const e=[];s(e),o.push(i),i=e,r=null},onArrayEnd:()=>{i=o.pop()},onLiteralValue:s,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}};return function(e,t,n=Tf.DEFAULT){const r=bf(e,!1),i=[];let o=0;function s(e){return e?()=>0===o&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(e){return e?t=>0===o&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>0===o&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function c(e){return e?()=>{if(o>0)o++;else{!1===e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())&&(o=1)}}:()=>!0}function h(e){return e?()=>{o>0&&o--,0===o&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const u=c(t.onObjectBegin),d=l(t.onObjectProperty),f=h(t.onObjectEnd),p=c(t.onArrayBegin),m=h(t.onArrayEnd),g=l(t.onLiteralValue),v=a(t.onSeparator),b=s(t.onComment),y=a(t.onError),w=n&&n.disallowComments,x=n&&n.allowTrailingComma;function k(){for(;;){const e=r.scan();switch(r.getTokenError()){case 4:S(14);break;case 5:S(15);break;case 3:S(13);break;case 1:w||S(11);break;case 2:S(12);break;case 6:S(16)}switch(e){case 12:case 13:w?S(10):b();break;case 16:S(1);break;case 15:case 14:break;default:return e}}}function S(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;17!==e;){if(-1!==t.indexOf(e)){k();break}if(-1!==n.indexOf(e))break;e=k()}}}function E(e){const t=r.getTokenValue();return e?g(t):(d(t),i.push(t)),k(),!0}function C(){switch(r.getToken()){case 11:const e=r.getTokenValue();let t=Number(e);isNaN(t)&&(S(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return k(),!0}function O(){return 10!==r.getToken()?(S(3,[],[2,5]),!1):(E(!1),6===r.getToken()?(v(":"),k(),T()||S(4,[],[2,5])):S(5,[],[2,5]),i.pop(),!0)}function N(){u(),k();let e=!1;for(;2!==r.getToken()&&17!==r.getToken();){if(5===r.getToken()){if(e||S(4,[],[]),v(","),k(),2===r.getToken()&&x)break}else e&&S(6,[],[]);O()||S(4,[],[2,5]),e=!0}return f(),2!==r.getToken()?S(7,[2],[]):k(),!0}function A(){p(),k();let e=!0,t=!1;for(;4!==r.getToken()&&17!==r.getToken();){if(5===r.getToken()){if(t||S(4,[],[]),v(","),k(),4===r.getToken()&&x)break}else t&&S(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,T()||S(4,[],[4,5]),t=!0}return m(),e||i.pop(),4!==r.getToken()?S(8,[4],[]):k(),!0}function T(){switch(r.getToken()){case 3:return A();case 1:return N();case 10:return E(!0);default:return C()}}if(k(),17===r.getToken())return!!n.allowEmptyContent||(S(4,[],[]),!1);if(!T())return S(4,[],[]),!1;17!==r.getToken()&&S(9,[],[])}(e,a,n),i[0]};var Pf;function Lf(e,t){if(!t.length)return"JSON 格式不正确";var n=t[0],r=function(e,t){for(var n=1,r=1,i=Math.max(0,Math.min(t,e.length)),o=0;o<i;o++){"\n"===e.charAt(o)?(n++,r=1):r++}return{line:n,col:r}}(e,n.offset),i=r.line,o=r.col,s=function(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}(n.error);return"JSON 格式不正确(".concat(s,",行 ").concat(i," 列 ").concat(o,")")}function Bf(e){if(null==e||""===e)return{ok:!0,value:null,pretty:"null",compact:"null"};try{if("string"!=typeof e)return{ok:!0,value:e,pretty:JSON.stringify(e,null,2),compact:JSON.stringify(e)};var t=e,n=[],r=Df(t,n,{allowTrailingComma:!0,disallowComments:!1});return n.length?{ok:!1,message:Lf(t,n),pretty:t,compact:t}:{ok:!0,value:r,pretty:JSON.stringify(r,null,2),compact:JSON.stringify(r)}}catch(t){var i="string"==typeof e?e:String(e);return{ok:!1,message:"JSON 格式不正确",pretty:i,compact:i}}}function If(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=(e||"").toString(),r=[];if(Df(n,r,{allowTrailingComma:!0,disallowComments:!1}),r.length)return{ok:!1,message:Lf(n,r)};for(var i=function(e,t,n){return Of(e,t,n)}(n,void 0,{insertSpaces:!0,tabSize:t}),o=n,s=i.length-1;s>=0;s--){var a=i[s];o=o.slice(0,a.offset)+a.content+o.slice(a.offset+a.length)}return{ok:!0,formatted:o}}function jf(){return jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jf.apply(null,arguments)}!function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"}(Pf||(Pf={}));let _f=[],Ff=[];function Wf(e){if(e<768)return!1;for(let t=0,n=_f.length;;){let r=t+n>>1;if(e<_f[r])n=r;else{if(!(e>=Ff[r]))return!0;t=r+1}if(t==n)return!1}}function zf(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?Ff:_f).push(n+=e[t])})();function Hf(e,t,n=!0,r=!0){return(n?Vf:qf)(e,t,r)}function Vf(e,t,n){if(t==e.length)return t;t&&$f(e.charCodeAt(t))&&Kf(e.charCodeAt(t-1))&&t--;let r=Uf(e,t);for(t+=Yf(r);t<e.length;){let i=Uf(e,t);if(8205==r||8205==i||n&&Wf(i))t+=Yf(i),r=i;else{if(!zf(i))break;{let n=0,r=t-2;for(;r>=0&&zf(Uf(e,r));)n++,r-=2;if(n%2==0)break;t+=2}}}return t}function qf(e,t,n){for(;t>0;){let r=Vf(e,t-2,n);if(r<t)return r;t--}return 0}function Uf(e,t){let n=e.charCodeAt(t);if(!Kf(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return $f(r)?r-56320+(n-55296<<10)+65536:n}function $f(e){return e>=56320&&e<57344}function Kf(e){return e>=55296&&e<56320}function Yf(e){return e<65536?1:2}class Gf{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=ip(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Jf.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ip(this,e,t);let n=[];return this.decompose(e,t,n,0),Jf.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ep(this),i=new ep(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new ep(this,e)}iterRange(e,t=this.length){return new tp(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new np(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Xf(e):Jf.from(Xf.split(e,[])):Gf.empty}}class Xf extends Gf{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new rp(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new Xf(Zf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=Qf(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new Xf(t,e.length+i.length));else{let e=t.length>>1;n.push(new Xf(t.slice(0,e)),new Xf(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof Xf))return super.replace(e,t,n);[e,t]=ip(this,e,t);let r=Qf(this.text,Qf(n.text,Zf(this.text,0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new Xf(r,i):Jf.from(Xf.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=ip(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new Xf(n,r)),n=[],r=-1);return r>-1&&t.push(new Xf(n,r)),t}}class Jf extends Gf{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(e,t,n){if([e,t]=ip(this,e,t),n.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],s=i+o.length;if(e>=i&&t<=s){let a=o.replace(e-i,t-i,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let i=this.children.slice();return i[r]=a,new Jf(i,this.length-(t-e)+n.length)}return super.replace(i,s,a)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=ip(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Jf))return 0;let n=0,[r,i,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==o||i==s)return n;let a=this.children[r],l=e.children[i];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new Xf(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>i&&e instanceof Jf)for(let t of e.children)h(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof Xf&&a&&(t=c[c.length-1])instanceof Xf&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Xf(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>r&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:Jf.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new Jf(s,t)}}function Qf(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}function Zf(e,t,n){return Qf(e,[""],t,n)}Gf.empty=new Xf([""],0);class ep{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Xf?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof Xf?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof Xf){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof Xf?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class tp{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new ep(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class np{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(Gf.prototype[Symbol.iterator]=function(){return this.iter()},ep.prototype[Symbol.iterator]=tp.prototype[Symbol.iterator]=np.prototype[Symbol.iterator]=function(){return this});class rp{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function ip(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function op(e,t,n=!0,r=!0){return Hf(e,t,n,r)}function sp(e,t){let n=e.charCodeAt(t);if(!(r=n,r>=55296&&r<56320&&t+1!=e.length))return n;var r;let i=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(i)?i-56320+(n-55296<<10)+65536:n}function ap(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function lp(e){return e<65536?1:2}const cp=/\r\n?|\n/;var hp=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(hp||(hp={}));class up{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){mp(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new up(e)}composeDesc(e){return this.empty?e:e.empty?this:vp(this,e)}mapDesc(e,t=!1){return e.empty?this:gp(this,e,t)}mapPos(e,t=-1,n=hp.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=hp.Simple&&l>=e&&(n==hp.TrackDel&&r<e&&l>e||n==hp.TrackBefore&&r<e||n==hp.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=r+this.sections[n++];if(this.sections[n++]>=0&&r<=t&&i>=e)return!(r<e&&i>t)||"cover";r=i}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new up(e)}static create(e){return new up(e)}}class dp extends up{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return mp(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return gp(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(Gf.empty);n.push(o?e.slice(i,i+o):Gf.empty)}i+=o}return new dp(t,n)}compose(e){return this.empty?e:e.empty?this:vp(this,e,!0)}map(e,t=!1){return e.empty?this:gp(this,e,t,!0)}iterChanges(e,t=!1){mp(this,e,t)}get desc(){return up.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new bp(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-s);fp(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;fp(t,e,o),o>0&&pp(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break e;let e=Math.min(i.len,l-s);fp(t,e,-1),fp(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new dp(t,n),filtered:up.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;o<t&&fp(r,t-o,-1);let n=new dp(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof dp){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?Gf.of(c.split(n||cp)):c:Gf.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&fp(r,e-o,-1),fp(r,s-e,u),pp(i,r,h),o=s}}(e),a(!s),s}static empty(e){return new dp(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else{if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(Gf.empty);n[r]=Gf.of(i.slice(1)),t.push(i[0],n[r].length)}}}return new dp(t,n)}static createSet(e,t){return new dp(e,t)}}function fp(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function pp(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Gf.empty);e.push(n)}}function mp(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,h=o,u=Gf.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,c,o,h,u),i=c,o=h}}}function gp(e,t,n,r=!1){let i=[],o=r?[]:null,s=new bp(e),a=new bp(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);fp(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(fp(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(fp(i,0,s.ins),o&&pp(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?dp.createSet(i,o):up.create(i);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}fp(i,t,e<s.i?s.ins:0),o&&e<s.i&&pp(o,i,s.text),e=s.i,s.forward(s.len-n)}}}}function vp(e,t,n=!1){let r=[],i=n?[]:null,o=new bp(e),s=new bp(t);for(let e=!1;;){if(o.done&&s.done)return i?dp.createSet(r,i):up.create(r);if(0==o.ins)fp(r,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;fp(r,t,n,e),i&&n&&pp(i,r,s.text)}else-1==s.ins?(fp(r,o.off?0:o.len,t,e),i&&pp(i,r,o.textBit(t))):(fp(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&pp(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}}else fp(r,0,s.ins,e),i&&pp(i,r,s.text),s.next()}}class bp{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Gf.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Gf.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yp{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new yp(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return wp.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return wp.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return wp.range(e.anchor,e.head)}static create(e,t,n){return new yp(e,t,n)}}class wp{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:wp.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new wp([this.main],0)}addRange(e,t=!0){return wp.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,wp.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new wp(e.ranges.map(e=>yp.fromJSON(e)),e.main)}static single(e,t=e){return new wp([wp.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return wp.normalized(e.slice(),t);n=i.to}return new wp(e,t)}static cursor(e,t=0,n,r){return yp.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}static range(e,t,n,r){let i=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return t<e?yp.create(t,e,48|i):yp.create(e,t,(t>e?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?wp.range(s,o):wp.range(o,s))}}return new wp(e,t)}}function xp(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let kp=0;class Sp{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=kp++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new Sp(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Ep),!!e.static,e.enables)}of(e){return new Cp([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Cp(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Cp(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function Ep(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Cp{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=kp++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Np(e,c)){let t=n(e);if(s?!Op(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=Hp(t,l);if(this.dependencies.every(n=>n instanceof Sp?t.facet(n)===e.facet(n):!(n instanceof Mp)||t.field(n,!1)==e.field(n,!1))||(s?Op(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function Op(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Np(e,t){let n=!1;for(let r of t)1&zp(e,r)&&(n=!0);return n}function Ap(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<r.length;t++){let o=Hp(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)zp(e,t);return e.values[s]=a(e),1},update(e,n){if(!Np(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=Np(e,r),l=i.config.facets[t.id],c=i.facet(t);if(l&&!o&&Ep(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const Tp=Sp.define({static:!0});class Mp{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new Mp(kp++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Tp).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r,i=e.facet(Tp),o=n.facet(Tp);return(r=i.find(e=>e.field==this))&&r!=o.find(e=>e.field==this)?(e.values[t]=r.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,Tp.of({field:this,create:e})]}get extension(){return this}}const Rp=4,Dp=3,Pp=2,Lp=1;function Bp(e){return t=>new jp(t,e)}const Ip={highest:Bp(0),high:Bp(Lp),default:Bp(Pp),low:Bp(Dp),lowest:Bp(Rp)};class jp{constructor(e,t){this.inner=e,this.prec=t}}class _p{of(e){return new Fp(this,e)}reconfigure(e){return _p.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Fp{constructor(e,t){this.compartment=e,this.inner=t}}class Wp{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r=[],i=Object.create(null),o=new Map;for(let n of function(e,t,n){let r=[[],[],[],[],[]],i=new Map;function o(e,s){let a=i.get(e);if(null!=a){if(a<=s)return;let t=r[a].indexOf(e);t>-1&&r[a].splice(t,1),e instanceof Fp&&n.delete(e.compartment)}if(i.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof Fp){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),o(r,s)}else if(e instanceof jp)o(e.inner,e.prec);else if(e instanceof Mp)r[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof Cp)r[s].push(e),e.facet.extensions&&o(e.facet.extensions,Pp);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(t,s)}}return o(e,Pp),r.reduce((e,t)=>e.concat(t))}(e,t,o))n instanceof Mp?r.push(n):(i[n.facet.id]||(i[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of r)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in i){let t=i[e],r=t[0].facet,o=c&&c[e]||[];if(t.every(e=>0==e.type))if(s[r.id]=a.length<<1|1,Ep(o,t))a.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));a.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[r.id]=l.length<<1,l.push(e=>Ap(e,r,t))}}let h=l.map(e=>e(s));return new Wp(e,o,h,s,a,i)}}function zp(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Hp(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const Vp=Sp.define(),qp=Sp.define({combine:e=>e.some(e=>e),static:!0}),Up=Sp.define({combine:e=>e.length?e[0]:void 0,static:!0}),$p=Sp.define(),Kp=Sp.define(),Yp=Sp.define(),Gp=Sp.define({combine:e=>!!e.length&&e[0]});class Xp{constructor(e,t){this.type=e,this.value=t}static define(){return new Jp}}class Jp{of(e){return new Xp(this,e)}}class Qp{constructor(e){this.map=e}of(e){return new Zp(this,e)}}class Zp{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new Zp(this.type,t)}is(e){return this.type==e}static define(e={}){return new Qp(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}Zp.reconfigure=Zp.define(),Zp.appendConfig=Zp.define();class em{constructor(e,t,n,r,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xp(n,t.newLength),i.some(e=>e.type==em.time)||(this.annotations=i.concat(em.time.of(Date.now())))}static create(e,t,n,r,i,o){return new em(e,t,n,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(em.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function tm(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function nm(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=dp.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null===(r=e.selection)||void 0===r?void 0:r.map(i),effects:Zp.mapEffects(e.effects,i).concat(Zp.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function rm(e,t,n){let r=t.selection,i=sm(t.annotations);return t.userEvent&&(i=i.concat(em.userEvent.of(t.userEvent))),{changes:t.changes instanceof dp?t.changes:dp.of(t.changes||[],n,e.facet(Up)),selection:r&&(r instanceof wp?r:wp.single(r.anchor,r.head)),effects:sm(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function im(e,t,n){let r=rm(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let i=1;i<t.length;i++){!1===t[i].filter&&(n=!1);let o=!!t[i].sequential;r=nm(r,rm(e,t[i],o?r.changes.newLength:e.doc.length),o)}let i=em.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return function(e){let t=e.startState,n=t.facet(Yp),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=nm(r,rm(t,o,e.changes.newLength),!0))}return r==e?e:em.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let r of t.facet($p)){let t=r(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:tm(n,t))}if(!0!==n){let r,i;if(!1===n)i=e.changes.invertedDesc,r=dp.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=em.create(t,r,e.selection&&e.selection.map(i),Zp.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Kp);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof em?i:Array.isArray(i)&&1==i.length&&i[0]instanceof em?i[0]:im(t,sm(i),!1)}return e}(i):i)}em.time=Xp.define(),em.userEvent=Xp.define(),em.addToHistory=Xp.define(),em.remote=Xp.define();const om=[];function sm(e){return null==e?om:Array.isArray(e)?e:[e]}var am=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(am||(am={}));const lm=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let cm;try{cm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function hm(e){return t=>{if(!/\S/.test(t))return am.Space;if(function(e){if(cm)return cm.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||lm.test(n)))return!0}return!1}(t))return am.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return am.Word;return am.Other}}class um{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)zp(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return zp(this,n),Hp(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return im(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:i}=n;for(let t of e.effects)t.is(_p.reconfigure)?(n&&(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),n=null),i.set(t.value.compartment,t.value.extension)):t.is(Zp.reconfigure)?(n=null,r=t.value):t.is(Zp.appendConfig)&&(n=null,r=sm(r).concat(t.value));if(n)t=e.startState.values.slice();else{n=Wp.resolve(r,i,this);let e=new um(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null);t=e.values}let o=e.startState.facet(qp)?e.newSelection:e.newSelection.asSingle();new um(n,e.newDoc,o,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:wp.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=sm(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let c=r.mapDesc(a,!0);i.push(s.range.map(c)),r=r.compose(l),o=Zp.mapEffects(o,l).concat(Zp.mapEffects(sm(s.effects),c))}return{changes:r,selection:wp.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof dp?e:dp.of(e,this.doc.length,this.facet(um.lineSeparator))}toText(e){return Gf.of(e.split(this.facet(um.lineSeparator)||cp))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(zp(this,t),Hp(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Mp&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let i=n[t],o=e[t];r.push(i.init(e=>i.spec.fromJSON(o,e)))}return um.create({doc:e.doc,selection:wp.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Wp.resolve(e.extensions||[],new Map),n=e.doc instanceof Gf?e.doc:Gf.of((e.doc||"").split(t.staticFacet(um.lineSeparator)||cp)),r=e.selection?e.selection instanceof wp?e.selection:wp.single(e.selection.anchor,e.selection.head):wp.single(0);return xp(r,n.length),t.staticFacet(qp)||(r=r.asSingle()),new um(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(um.tabSize)}get lineBreak(){return this.facet(um.lineSeparator)||"\n"}get readOnly(){return this.facet(Gp)}phrase(e,...t){for(let t of this.facet(um.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Vp))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return hm(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=op(t,o,!1);if(i(t.slice(e,o))!=am.Word)break;o=e}for(;s<r;){let e=op(t,s);if(i(t.slice(s,e))!=am.Word)break;s=e}return o==s?null:wp.range(o+n,s+n)}}function dm(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);r[e]=n[e](o,i)}}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}um.allowMultipleSelections=qp,um.tabSize=Sp.define({combine:e=>e.length?e[0]:4}),um.lineSeparator=Up,um.readOnly=Gp,um.phrases=Sp.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),um.languageData=Vp,um.changeFilter=$p,um.transactionFilter=Kp,um.transactionExtender=Yp,_p.reconfigure=Zp.define();class fm{eq(e){return this==e}range(e,t=e){return mm.create(e,t,this)}}function pm(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}fm.prototype.startSide=fm.prototype.endSide=0,fm.prototype.point=!1,fm.prototype.mapMode=hp.TrackDel;let mm=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function gm(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class vm{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),r.push(l-o),i.push(c-o))}return{mapped:n.length?new vm(r,i,n,s):null,pos:o}}}class bm{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new bm(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(gm)),this.isEmpty)return t.length?bm.of(t):this;let s=new xm(this,null,-1).goto(0),a=0,l=[],c=new ym;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(mm.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?bm.empty:this.nextLayer.update({add:l,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new bm(n,t,i||bm.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return km.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return km.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=wm(o,s,n),l=new Em(o,a,i),c=new Em(s,a,i);n.iterGaps((e,t,n)=>Cm(l,e,c,t,n,r)),n.empty&&0==n.length&&Cm(l,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),o=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let s=wm(i,o),a=new Em(i,s,0).goto(n),l=new Em(o,s,0).goto(n);for(;;){if(a.to!=l.to||!Om(a.active,l.active)||a.point&&(!l.point||!pm(a.point,l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new Em(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new ym;for(let r of e instanceof mm?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(gm(t,r)>0)return e.slice().sort(gm);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return bm.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=bm.empty;r=r.nextLayer)t=new bm(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}bm.empty=new bm([],[],null,-1),bm.empty.nextLayer=bm.empty;class ym{finishChunk(e){this.chunks.push(new vm(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new ym)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(bm.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=bm.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function wm(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class xm{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class km{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new xm(o,t,n,i));return 1==r.length?r[0]:new km(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Sm(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Sm(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Sm(this.heap,0)}}}function Sm(e,t){for(let n=e[t];;){let r=1+(t<<1);if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class Em{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=km.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Nm(this.active,e),Nm(this.activeTo,e),Nm(this.activeRank,e),this.minActive=Tm(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;Am(this.active,t,n),Am(this.activeTo,t,r),Am(this.activeRank,t,i),e&&Am(e,t,this.cursor.from),this.minActive=Tm(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&Nm(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Cm(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t,c=!!o.boundChange;for(let t=!1;;){let r=e.to+l-n.to,i=r||e.endSide-n.endSide,h=i<0?e.to+l:n.to,u=Math.min(h,s);if(e.point||n.point?(e.point&&n.point&&pm(e.point,n.point)&&Om(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,u,e.point,n.point),t=!1):(t&&o.boundChange(a),u>a&&!Om(e.active,n.active)&&o.compareRange(a,u,e.active,n.active),c&&u<s&&(r||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>s)break;a=h,i<=0&&e.next(),i>=0&&n.next()}}function Om(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!pm(e[n],t[n]))return!1;return!0}function Nm(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Am(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Tm(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function Mm(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=op(e,i));return r}function Rm(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=op(e,r)}return!0===r?-1:e.length}const Dm="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Pm="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Lm="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Bm{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");i(r(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Lm[Dm]||1;return Lm[Dm]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[Pm],i=n&&n.nonce;r?i&&r.setNonce(i):r=new jm(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let Im=new Map;class jm{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Im.get(n);if(t)return e[Pm]=t;this.sheet=new r.CSSStyleSheet,Im.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Pm]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var _m={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Fm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Wm="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),zm="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Hm=0;Hm<10;Hm++)_m[48+Hm]=_m[96+Hm]=String(Hm);for(Hm=1;Hm<=24;Hm++)_m[Hm+111]="F"+Hm;for(Hm=65;Hm<=90;Hm++)_m[Hm]=String.fromCharCode(Hm+32),Fm[Hm]=String.fromCharCode(Hm);for(var Vm in _m)Fm.hasOwnProperty(Vm)||(Fm[Vm]=_m[Vm]);function qm(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)Um(e,arguments[t]);return e}function Um(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)Um(e,t[n])}}let $m="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Km="undefined"!=typeof document?document:{documentElement:{style:{}}};const Ym=/Edge\/(\d+)/.exec($m.userAgent),Gm=/MSIE \d/.test($m.userAgent),Xm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($m.userAgent),Jm=!!(Gm||Xm||Ym),Qm=!Jm&&/gecko\/(\d+)/i.test($m.userAgent),Zm=!Jm&&/Chrome\/(\d+)/.exec($m.userAgent),eg="webkitFontSmoothing"in Km.documentElement.style,tg=!Jm&&/Apple Computer/.test($m.vendor),ng=tg&&(/Mobile\/\w+/.test($m.userAgent)||$m.maxTouchPoints>2);var rg={mac:ng||/Mac/.test($m.platform),windows:/Win/.test($m.platform),linux:/Linux|X11/.test($m.platform),ie:Jm,ie_version:Gm?Km.documentMode||6:Xm?+Xm[1]:Ym?+Ym[1]:0,gecko:Qm,gecko_version:Qm?+(/Firefox\/(\d+)/.exec($m.userAgent)||[0,0])[1]:0,chrome:!!Zm,chrome_version:Zm?+Zm[1]:0,ios:ng,android:/Android\b/.test($m.userAgent),webkit:eg,webkit_version:eg?+(/\bAppleWebKit\/(\d+)/.exec($m.userAgent)||[0,0])[1]:0,safari:tg,safari_version:tg?+(/\bVersion\/(\d+(\.\d+)?)/.exec($m.userAgent)||[0,0])[1]:0,tabSize:null!=Km.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function ig(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const og=Object.create(null);function sg(e,t,n){if(e==t)return!0;e||(e=og),t||(t=og);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function ag(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function lg(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class cg{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var hg=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(hg||(hg={}));class ug extends fm{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new dg(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new pg(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:i,end:o}=mg(e,r);t=(i?r?-3e8:-1:5e8)-1,n=1+(o?r?2e8:1:-6e8)}return new pg(e,t,n,r,e.widget||null,!0)}static line(e){return new fg(e)}static set(e,t=!1){return bm.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ug.none=bm.empty;class dg extends ug{constructor(e){let{start:t,end:n}=mg(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?ig(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||og}eq(e){return this==e||e instanceof dg&&this.tagName==e.tagName&&sg(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}dg.prototype.point=!1;class fg extends ug{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof fg&&this.spec.class==e.spec.class&&sg(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}fg.prototype.mapMode=hp.TrackBefore,fg.prototype.point=!0;class pg extends ug{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?hp.TrackBefore:hp.TrackAfter:hp.TrackDel}get type(){return this.startSide!=this.endSide?hg.WidgetRange:this.startSide<=0?hg.WidgetBefore:hg.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof pg&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function mg(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function gg(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}pg.prototype.point=!0;class vg extends fm{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof vg&&this.tagName==e.tagName&&sg(this.attributes,e.attributes)}static create(e){return new vg(e.tagName,e.attributes||og)}static set(e,t=!1){return bm.of(e,t)}}function bg(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function yg(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function wg(e,t){if(!t.anchorNode)return!1;try{return yg(e,t.anchorNode)}catch(e){return!1}}function xg(e){return 3==e.nodeType?Lg(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function kg(e,t,n,r){return!!n&&(Cg(e,t,n,r,-1)||Cg(e,t,n,r,1))}function Sg(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Eg(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Cg(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Og(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Sg(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?Og(e):0}}}function Og(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ng(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Ag(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Tg(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}vg.prototype.startSide=vg.prototype.endSide=-1;class Mg{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Og(t):0),n,Math.min(e.focusOffset,n?Og(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let Rg,Dg=null;function Pg(e){if(e.setActive)return e.setActive();if(Dg)return e.focus(Dg);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Dg?{get preventScroll(){return Dg={preventScroll:!0},!0}}:void 0),!Dg){Dg=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function Lg(e,t,n=t){let r=Rg||(Rg=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function Bg(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Ig(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function jg(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;n=n.childNodes[r-1],r=Og(n)}else{if(!n.parentNode||Eg(n))return null;r=Sg(n),n=n.parentNode}}}function _g(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||Eg(n))return null;r=Sg(n)+1,n=n.parentNode}}}rg.safari&&rg.safari_version>=26&&(Dg=!1);class Fg{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Fg(e.parentNode,Sg(e),t)}static after(e,t){return new Fg(e.parentNode,Sg(e)+1,t)}}var Wg=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Wg||(Wg={}));const zg=Wg.LTR,Hg=Wg.RTL;function Vg(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const qg=Vg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ug=Vg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),$g=Object.create(null),Kg=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);$g[t]=n,$g[n]=-t}function Yg(e){return e<=247?qg[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Ug[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const Gg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Xg{get dir(){return this.level%2?Hg:zg}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function Jg(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Jg(r.inner,i.inner))return!1}return!0}const Qg=[];function Zg(e,t,n,r,i,o,s){let a=r%2?2:1;if(r%2==i%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=Qg[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?r:r+1,f=l;e:for(;;)if(c<o.length&&f==o[c].from){if(h)break e;let p=o[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(Qg[e]==a)break e;break}e=o[t++].to}if(c++,u)u.push(p);else{p.from>l&&s.push(new Xg(l,p.from,d)),ev(e,p.direction==zg!=!(d%2)?r+1:r,i,p.inner,p.from,p.to,s),l=p.to}f=p.to}else{if(f==n||(t?Qg[f]!=a:Qg[f]==a))break;f++}u?Zg(e,l,f,r+1,i,u,s):l<f&&s.push(new Xg(l,f,d)),l=f}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=Qg[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?r:r+1,f=l;e:for(;;)if(c&&f==o[c-1].to){if(h)break e;let p=o[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(Qg[e-1]==a)break e;break}e=o[--n].from}if(u)u.push(p);else{p.to<l&&s.push(new Xg(p.to,l,d)),ev(e,p.direction==zg!=!(d%2)?r+1:r,i,p.inner,p.from,p.to,s),l=p.from}f=p.from}else{if(f==t||(n?Qg[f-1]!=a:Qg[f-1]==a))break;f--}u?Zg(e,f,l,r+1,i,u,s):f<l&&s.push(new Xg(f,l,d)),l=f}}function ev(e,t,n,r,i,o,s){let a=t%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=Yg(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),Qg[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=Qg[e];if(128==i)e<a-1&&t==Qg[e+1]&&24&t?i=Qg[e]=t:Qg[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==Qg[i];)i++;let o=e&&8==t||i<n&&8==Qg[i]?1==r?1:8:256;for(let t=e;t<i;t++)Qg[t]=o;e=i-1}else 8==i&&1==r&&(Qg[e]=1);t=i,7&i&&(r=i)}}}(e,i,o,r,a),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let c=s?r[s-1].to:t,h=s<r.length?r[s].from:n;for(let t,n,r,s=c;s<h;s++)if(n=$g[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(Kg[e+1]==-n){let t=Kg[e+2],n=2&t?i:4&t?1&t?o:i:0;n&&(Qg[s]=Qg[Kg[e]]=n),a=e;break}}else{if(189==Kg.length)break;Kg[a++]=s,Kg[a++]=t,Kg[a++]=l}else if(2==(r=Qg[s])||1==r){let e=r==i;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=Kg[t+2];if(2&n)break;if(e)Kg[t+2]|=2;else{if(4&n)break;Kg[t+2]|=4}}}}}(e,i,o,r,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=Qg[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else{if(256!=Qg[s])break;s++}let c=1==o,h=c==(1==(s<t?Qg[s]:r))?c?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),Qg[--t]=h;l=s}else o=s,l++}}}(i,o,r,a),Zg(e,i,o,t,n,r,s)}function tv(e){return[new Xg(0,e,0)]}let nv="";function rv(e,t,n,r,i){var o;let s=r.head-e.from,a=Xg.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],c=l.side(i,n);if(s==c){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!i,n),c=l.side(i,n)}let h=op(e.text,s,l.forward(i,n));(h<l.from||h>l.to)&&(h=c),nv=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?wp.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):wp.cursor(h+e.from,l.forward(i,n)?-1:1,l.level)}function iv(e,t,n){for(let r=t;r<n;r++){let t=Yg(e.charCodeAt(r));if(1==t)return zg;if(2==t||4==t)return Hg}return zg}const ov=Sp.define(),sv=Sp.define(),av=Sp.define(),lv=Sp.define(),cv=Sp.define(),hv=Sp.define(),uv=Sp.define(),dv=Sp.define(),fv=Sp.define(),pv=Sp.define({combine:e=>e.some(e=>e)}),mv=Sp.define({combine:e=>e.some(e=>e)}),gv=Sp.define();class vv{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new vv(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new vv(wp.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const bv=Zp.define({map:(e,t)=>e.map(t)}),yv=Zp.define();function wv(e,t,n){let r=e.facet(lv);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)}const xv=Sp.define({combine:e=>!e.length||e[0]});let kv=0;const Sv=Sp.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class Ev{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Sv.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Sv.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new Ev(kv++,e,n,r,e=>{let t=[];return o&&t.push(Av.of(t=>{let n=t.plugin(e);return n?o(n):ug.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return Ev.define((t,n)=>new e(t,n),t)}}class Cv{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(wv(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){wv(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){wv(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ov=Sp.define(),Nv=Sp.define(),Av=Sp.define(),Tv=Sp.define(),Mv=Sp.define(),Rv=Sp.define(),Dv=Sp.define();function Pv(e,t){let n=e.state.facet(Dv);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return bm.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n,i=r[e].spec.bidiIsolate;if(null==i&&(i=iv(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==i)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),i}const Lv=Sp.define();function Bv(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(Lv)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}const Iv=Sp.define();class jv{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new jv(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0;;){let s=r<e.length?e[r].fromB:1e9,a=i<t.length?t[i]:1e9,l=Math.min(s,a);if(1e9==l)break;let c=l+o,h=l,u=c;for(;;)if(i<t.length&&t[i]<=h){let n=t[i+1];i+=2,h=Math.max(h,n);for(let t=r;t<e.length&&e[t].fromB<=h;t++)o=e[t].toA-e[t].toB;u=Math.max(u,n+o)}else{if(!(r<e.length&&e[r].fromB<=h))break;{let t=e[r++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),o=t.toA-t.toB}}n.push(new jv(c,u,l,h))}return n}}class _v{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=dp.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new jv(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new _v(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const Fv=[];class Wv{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Fv}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;null==t[r]&&e.removeAttribute(r)}for(let n in t){let r=t[n];"style"==n?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Sg(this.dom),r=this.length?e>0:t>0;return new Fg(this.parent.dom,n+(r?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Vv)return e;return null}static get(e){return e.cmTile}}class zv extends Wv{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,r=null,i=(null==e?void 0:e.node)==n?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,t=r?r.nextSibling:n.firstChild,i&&t!=s.dom&&(i.written=!0),s.dom.parentNode==n)for(;t&&t!=s.dom;)t=Hv(t);else n.insertBefore(s.dom,t);r=s.dom}for(t=r?r.nextSibling:n.firstChild,i&&t&&(i.written=!0);t;)t=Hv(t);this.length=o}}function Hv(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Vv extends zv{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Wv.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let o=n.children[r++];if(o instanceof qv)t.push(r),n=o,r=0;else{let t=i+o.length,n=e(o,i);if(void 0!==n)return n;i=t+o.breakAfter}}}resolveBlock(e,t){let n,r,i=-1,o=-1;if(this.blockTiles((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,i=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget())&&(r=s,o=e-a)}}),!n&&!r)throw new Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class qv extends zv{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new qv(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Uv extends zv{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new Uv(t||document.createElement("div"),e);return t&&n||(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(a,l){for(let c=0,h=0;c<a.children.length&&h<=l;c++){let u=a.children[c],d=h+u.length;d>=l&&(u.isComposite()?e(u,l-h):(!o||o.isHidden&&(t>0||n&&$v(o,u)))&&(d>l||32&u.flags)?(o=u,s=l-h):(h<l||16&u.flags&&!u.isHidden)&&(r=u,i=l-h)),h=d}}(this,e);let a=(t<0?r:o)||r||o;return a?{tile:a,offset:a==r?i:s}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=xg(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new Fg(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,16&e.flags?1:32&e.flags?-1:t);let i=n.tile.parent,o=!1;for(let e of i.children){if(o)return new Fg(e.dom,0);e==n.tile&&(o=!0)}}return new Fg(this.dom,0)}}function $v(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Kv extends zv{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new Kv(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Yv extends Wv{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,i=e,o=0;0==e&&t<0||e==n&&t>=0?rg.chrome||rg.gecko||(e?(r--,o=1):i<n&&(i++,o=-1)):t<0?r--:i<n&&i++;let s=Lg(this.dom,r,i).getClientRects();if(!s.length)return null;let a=s[(o?o<0:t>=0)?0:s.length-1];return rg.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(s,e=>e.width)||a),o?Ng(a,o<0):a||null}static of(e,t){let n=new Yv(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class Gv extends Wv{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return Ng(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?0==i:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return Ng(n,!r)}}get overrideDOMText(){if(!this.length)return Gf.empty;let{root:e}=this;if(!e)return Gf.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,i){return i||(i=e.toDOM(t),e.editable||(i.contentEditable="false")),new Gv(i,n,e,r)}}class Xv extends Wv{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Gf.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Jv{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:o,parents:s}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(i==r.children.length){if(!e&&!s.length)break;n&&n.leave(r),o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++}else{let a=r.children[i],l=a.breakAfter;!(t>0?a.length<=e:a.length<e)||n&&!1===n.skip(a,0,a.length)&&a.isComposite?(s.push({tile:r,index:i}),r=a,i=0,n&&a.isComposite()&&n.enter(a)):(o=!!l,i++,e-=a.length)}else if(i==r.length)o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++;else{if(!e)break;{let t=Math.min(e,r.length-i);n&&n.skip(r,i,i+t),e-=t,i+=t}}return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Qv{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class Zv{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var i;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;if(!s||!s.isText()||8&s.flags)o.append(r||Yv.of(e,null===(i=this.cache.find(Yv))||void 0===i?void 0:i.dom));else{this.cache.reused.set(s,2),(o.children[o.children.length-1]=new Yv(s.dom,s.text+e)).parent=o}this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?sb(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Kv&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(sb(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=Wv.get(n.dom);e&&e.setDOM(sb(n.dom))}let e=Kv.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=Wv.get(e.text);i&&this.cache.reused.set(i,2);let o=new Yv(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);r||this.flushBuffer();let i=this.ensureMarks(t,n);r||16&e.flags||i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=ob);let r=Uv.start(e,t||(null===(n=this.cache.find(Uv))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let i=e.length-1;i>=0;i--){let o,s=e[i];if(t>0&&(o=r.lastChild)&&o instanceof Kv&&o.mark.eq(s))r=o,t--;else{let e=Kv.of(s,null===(n=this.cache.find(Kv,e=>e.mark.eq(s)))||void 0===n?void 0:n.dom);r.append(e),r=e,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&ib(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||rg.ios&&ib(this.curLine,!0))||this.curLine.append(this.cache.findWidget(lb,0,32)||new Gv(lb.toDOM(),0,lb,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new Qv(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof qv&&r.wrapper.eq(n.wrapper))t=r;else{let r=qv.of(n.wrapper,null===(e=this.cache.find(qv,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Xv,void 0,1);return n&&(n.flags=t),n||new Xv(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class eb{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw new Error("Ran out of text content when drawing inline views");this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const tb=[Gv,Uv,Yv,Kv,Xv,qv,Vv];for(let e=0;e<tb.length;e++)tb[e].bucket=e;class nb{constructor(e){this.view=e,this.buckets=tb.map(()=>[]),this.index=tb.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],o=this.index[r];for(let e=i.length-1;e>=0;e--){let s=(e+o)%i.length,a=i[s];if((!t||t(a))&&!this.reused.has(a))return i.splice(s,1),s<o&&this.index[r]--,this.reused.set(a,n),a}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let s=r[i];if(!this.reused.has(s)&&(0==o?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==n?(this.reused.set(s,1),s):(this.reused.set(s,2),new Gv(s.dom,t,e,-498&s.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class rb{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new nb(e),this.text=new eb(e.state.doc),this.builder=new Zv(this.cache,new Vv(e,e.contentDOM),bm.iter(n)),this.cache.reused.set(t,2),this.old=new Jv(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,o=0;;){let s=o<e.length?e[o++]:null,a=s?s.fromA:this.old.root.length;if(a>r){let e=a-r;this.preserve(e,!o,!s),r=a,i+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit(i,s.toB)),i=s.toB,r=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Kv&&t.push(r.mark)}return t}(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let o=n>0||t<e.length?Gv.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&o.flags?(o.flags&=-2,this.builder.addBlockWidget(o)):(this.builder.ensureLine(null),this.builder.addInlineWidget(o,r,i),i=r.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)):this.builder.addText(e.text,r,i,this.cache.reuse(e)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Xv)this.cache.add(e);else{if(!(e instanceof Kv))return!1;this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Kv&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&(r.length=i=0):e instanceof Kv&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,o=bm.spans(this.decorations,e,t,{point:(e,t,o,s,a,l)=>{if(o instanceof pg){if(this.disallowBlockEffectsFor[l]){if(o.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=s.length,a>s.length)r.continueWidget(t-e);else{let i=o.widget||(o.block?ab.block:ab.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;e.block&&(t|=256);return t}(o),c=this.cache.findWidget(i,t-e,l)||Gv.of(i,this.view,t-e,l);o.block?(o.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(c)):(r.ensureLine(n),r.addInlineWidget(c,s,a))}n=null}else n=function(e,t){let n=t.spec.attributes,r=t.spec.class;if(!n&&!r)return e;e||(e={class:"cm-line"});n&&ig(n,e);r&&(e.class+=" "+r);return e}(n,o);t>e&&this.text.skip(t-e)},span:(e,t,i,o)=>{for(let s=e;s<t;){let e=this.text.next(Math.min(512,t-s));null==e?(r.addLineStartIfNotCovered(n),r.addBreak(),s++):(r.ensureLine(n),r.addText(e,i,o),s+=e.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=o>i,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=Wv.get(r);if(r==this.view.contentDOM)break;e instanceof Kv?t.push(e):(null==e?void 0:e.isLine())?n=e:"DIV"!=r.nodeName||n||r==this.view.contentDOM?t.push(Kv.of(new dg({tagName:r.nodeName.toLowerCase(),attributes:lg(r)}),r)):n=new Uv(r,ob)}return{line:n,marks:t}}}function ib(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}const ob={class:"cm-line"};function sb(e){let t=Wv.get(e);return t&&t.setDOM(e.cloneNode()),e}class ab extends cg{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ab.inline=new ab("span"),ab.block=new ab("div");const lb=new class extends cg{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class cb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ug.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Vv(e,e.contentDOM),this.updateInner([new jv(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)});return n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let i=r>-1?function(e,t,n){let r=ub(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new jv(l.mapPos(o),l.mapPos(s),o,s),text:i}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:r}=this.hasComposition;n=new jv(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(rg.ie||rg.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,s=this.blockWrappers;this.updateDeco();let a=function(e,t,n){let r=new db;return bm.compare(e,t,n,r),r.changes}(o,this.decorations,e.changes);a.length&&(n=jv.extendWithRanges(n,a));let l=function(e,t,n){let r=new fb;return bm.compare(e,t,n,r),r.changes}(s,this.blockWrappers,e.changes);return l.length&&(n=jv.extendWithRanges(n,l)),i&&!n.some(e=>e.fromA<=i.range.fromA&&e.toA>=i.range.toA)&&(n=i.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length)&&(this.updateInner(n,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new rb(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=r.run(e,t),hb(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=rg.chrome||rg.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),!r||!r.written&&n.selectionRange.focusNode==r.node&&this.tile.dom.contains(r.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof pb&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(yv)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,o=!i&&!(this.view.state.facet(xv)||n.tabIndex>-1)&&wg(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),rg.gecko&&c.empty&&!this.hasComposition&&(1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new Fg(e,0),s=!0}var h;let u=this.view.observer.selectionRange;!s&&u.focusNode&&(kg(a.node,a.offset,u.anchorNode,u.anchorOffset)&&kg(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{rg.android&&rg.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=bg(this.view.root);if(e)if(c.empty){if(rg.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?jg:_g)(a.node,a.offset);t&&(a=new Fg(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new Fg(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new Fg(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&kg(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=bg(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let r=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r;{let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=0==Og(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!Wv.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r,i=-1,o=!1,s=-1,a=!1;return this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(o=!0)}else{let c=l+t.length;if(l<=e&&(n=t,i=e-l,o=c<e),c>=e&&!r&&(r=t,s=e-l,a=l>e),l>e&&r)return!0}}),n||r?(o&&r?n=null:a&&n&&(r=null),n&&t<0||!r?n.domIn(i,t):r.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof pb?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;return function e(t,n){if(t.isComposite())for(let r of t.children){if(r.length>=n){let t=e(r,n);if(t)return t}if((n-=r.length)<0)break}else if(t.isText()&&n<t.length){let e=op(t.text,n);if(e==n)return null;let r=Lg(t.dom,n,e).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==Wg.LTR,l=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>r);d++){let r=e.children[d],f=h+r.length,p=r.dom.getBoundingClientRect(),{height:m}=p;if(u&&!d&&(l+=p.top-u.top),r instanceof qv)f>n&&c(r,h,p);else if(h>=n&&(l>0&&t.push(-l),t.push(m+l),l=0,o)){let e=r.dom.lastChild,t=e?xg(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(l+=u.bottom-p.bottom),h=f+r.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?Wg.RTL:Wg.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=xg(r.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,r,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let e=xg(i.firstChild)[0];t=i.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,r=e&&e.height?e.height:t,i.remove()}),{lineHeight:t,charWidth:n,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ug.replace({widget:new pb(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return ug.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Av).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(Mv).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(bm.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Tv).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(gv))try{if(t(this.view,e.range,e))return!0}catch(e){wv(this.view.state,e,"scroll handler")}let t,{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!r)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,t.left),top:Math.min(r.top,t.top),right:Math.max(r.right,t.right),bottom:Math.max(r.bottom,t.bottom)});let i=Bv(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,p=1;if(d)e=Ag(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=Tg(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let m=0,g=0;if("nearest"==i)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/p,n=(h.scrollTop-e)*p}if(m){let t=h.scrollLeft;h.scrollLeft+=m/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(r="nearest"),n&&Math.abs(n-g)<1&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==Wg.LTR)}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){hb(this.tile)}}function hb(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)hb(n,t)}}function ub(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=jg(n.focusNode,n.focusOffset),i=_g(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=Wv.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=Wv.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let db=class{constructor(){this.changes=[]}compareRange(e,t){gg(e,t,this.changes)}comparePoint(e,t){gg(e,t,this.changes)}boundChange(e){gg(e,e,this.changes)}};class fb{constructor(){this.changes=[]}compareRange(e,t){gg(e,t,this.changes)}comparePoint(){}boundChange(e){gg(e,e,this.changes)}}class pb extends cg{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function mb(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;e&&(i.type!=hg.Text||e.type==i.type&&!(n<0?i.from<t:i.to>t))||(e=i)}}return e||r}return r}function gb(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=rv(i,o,s,a,n),c=nv;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return t;l=r(c)}a=t}}function vb(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function bb(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],o=null;if(i.empty){let t=vb(e,i.from,0);t!=i.from&&(o=wp.cursor(t,-1))}else{let t=vb(e,i.from,-1),n=vb(e,i.to,1);t==i.from&&n==i.to||(o=wp.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}o&&(n||(n=t.ranges.slice()),n[r]=o)}return n?wp.create(n,t.mainIndex):t}function yb(e,t,n){let r=vb(e.state.facet(Rv).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:wp.cursor(r,r<n.from?1:-1)}class wb{constructor(e,t){this.pos=e,this.assoc=t}}function xb(e,t,n,r){let i,o=e.contentDOM.getBoundingClientRect(),s=o.top+e.viewState.paddingTop,{x:a,y:l}=t,c=l-s;for(;;){if(c<0)return new wb(0,1);if(c>e.viewState.docHeight)return new wb(e.state.doc.length,-1);if(i=e.elementAtHeight(c),null==r)break;if(i.type==hg.Text){let t=e.docView.coordsAt(r<0?i.from:i.to,r);if(t&&(r<0?t.top<=c+s:t.bottom>=c+s))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?i.bottom+t:i.top-t}if(e.viewport.from>=i.to||e.viewport.to<=i.from){if(n)return null;if(i.type==hg.Text){let t=function(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+Rm(s,o,e.state.tabSize)}(e,o,i,a,l);return new wb(t,t==i.from?1:-1)}}if(i.type!=hg.Text)return c<(i.top+i.bottom)/2?new wb(i.from,1):new wb(i.to,-1);let h=e.docView.lineAt(i.from,2);return h&&h.length==i.length||(h=e.docView.lineAt(i.from,-2)),kb(e,h,i.from,a,l)}function kb(e,t,n,r,i){let o=-1,s=null,a=1e9,l=1e9,c=i,h=i,u=(e,t)=>{for(let n=0;n<e.length;n++){let u=e[n];if(u.top==u.bottom)continue;let d=u.left>r?u.left-r:u.right<r?r-u.right:0,f=u.top>i?u.top-i:u.bottom<i?i-u.bottom:0;u.top<=h&&u.bottom>=c&&(c=Math.min(u.top,c),h=Math.max(u.bottom,h),f=0),(o<0||(f-l||d-a)<0)&&(o>=0&&l&&a<d&&s.top<=h-2&&s.bottom>=c+2?l=0:(o=t,a=d,l=f,s=u))}};if(t.isText()){for(let e=0;e<t.length;){let n=op(t.text,e);if(u(Lg(t.dom,e,n).getClientRects(),e),!a&&!l)break;e=n}return r>(s.left+s.right)/2==(Sb(e,o+n)==Wg.LTR)?new wb(n+op(t.text,o),-1):new wb(n+o,1)}{if(!t.length)return new wb(n,1);for(let e=0;e<t.children.length;e++){let n=t.children[e];if(!(48&n.flags)&&(u((1==n.dom.nodeType?n.dom:Lg(n.dom,0,n.length)).getClientRects(),e),!a&&!l))break}let c=t.children[o],h=t.posBefore(c,n);return c.isComposite()||c.isText()?kb(e,c,h,Math.max(s.left,Math.min(s.right,r)),i):r>(s.left+s.right)/2==(Sb(e,o+n)==Wg.LTR)?new wb(h+c.length,-1):new wb(h,1)}}function Sb(e,t){let n=e.state.doc.lineAt(t);return e.bidiSpans(n)[Xg.find(e.bidiSpans(n),t-n.from,-1,1)].dir}const Eb="";class Cb{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(um.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Eb}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=Wv.get(r),o=r.nextSibling;if(o==t){(null==i?void 0:i.breakAfter)&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let s=Wv.get(o);(i&&s?i.breakAfter:(i?i.breakAfter:Eg(r))||Eg(o)&&("BR"!=r.nodeName||(null==i?void 0:i.isWidget()))&&this.text.length>e)&&!Nb(o,t)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(i=r.exec(t))&&(o=i.index,s=i[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){let t=Wv.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Ob(e,n.node,n.offset)?t:0))}}function Ob(e,t,n){for(;;){if(!t||n<Og(t))return!1;if(t==e)return!0;n=Sg(t)+1,t=t.parentNode}}function Nb(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Wv.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Ab{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Tb{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Mb(e.docView.tile,t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;n&&(t.push(new Ab(n,r)),i==n&&o==r||t.push(new Ab(i,o)));return t}(e),n=new Cb(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?wp.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!yg(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!yg(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((rg.ios||rg.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=s.from-t,a=s.to-i;0!=o&&1!=o&&0!=t||0!=a&&-1!=a&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(wp.range(r,n)):this.newSel=wp.single(r,n)}}}function Mb(e,t,n,r){if(e.isComposite()){let i=-1,o=-1,s=-1,a=-1;for(let l=0,c=r,h=r;l<e.children.length;l++){let r=e.children[l],u=c+r.length;if(c<t&&u>n)return Mb(r,t,n,c);if(u>=t&&-1==i&&(i=l,o=c),c>n&&r.dom.parentNode==e.dom){s=l,a=h;break}h=u,c=u+r.breakAfter}return{from:o,to:a<0?r+e.length:a,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Rb(e,t){let n,{newSel:r}=t,i=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,a=i.from,l=null;(8===o||rg.android&&t.text.length<s-r)&&(a=i.to,l="end");let c=Pb(e.state.doc.sliceString(r,s,Eb),t.text,a-r,l);c&&(rg.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Eb+Eb&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:Gf.of(t.text.slice(c.from,c.toB).split(Eb))})}else r&&(!e.hasFocus&&e.state.facet(xv)||Lb(r,i))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,i.to)}:(rg.mac||rg.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=wp.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Gf.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:e.state.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:e.state.toText(e.inputState.insertingText)}:rg.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=wp.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Gf.of([" "])}),n)return Db(e,n,r,o);if(r&&!Lb(r,i)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=bb(e.state.facet(Rv).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Db(e,t,n,r=-1){if(rg.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(rg.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&Bg(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>i.head)&&Bg(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&Bg(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let n=t.from<o.from?-1:1,r=n<0?o.from:o.to,a=vb(i.facet(Rv).map(t=>t(e)),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:wp.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&ub(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-u,h=r-c.length;if(e.state.sliceDoc(h,r)!=c||r>=l.from&&h<=l.to)return{range:n};let d=i.changes({from:h,to:r,insert:t.insert}),f=n.to-o.to;return{changes:d,range:a?wp.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(d)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1));return i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(hv).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}function Pb(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.length<t.length){o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o}else if(a<o){o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function Lb(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Bb{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,rg.safari&&e.contentDOM.addEventListener("input",()=>null),rg.gecko&&function(e){oy.has(e)||(oy.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=Wv.get(r))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=jb(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&i!=!o.handlers.length&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Wb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),rg.android&&rg.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!rg.ios||e.synthetic||e.altKey||e.metaKey||!((t=_b.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Fb.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,Bg(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(rg.safari&&!rg.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ib(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){wv(n.state,e)}}}function jb(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(Ib(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Ib(t.value,r))}}for(let e in Vb)n(e).handlers.push(Vb[e]);for(let e in qb)n(e).observers.push(qb[e]);return t}const _b=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Fb="dthko",Wb=[16,17,18,20,91,92,224,225];function zb(e){return.7*Math.max(0,e)+8}class Hb{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,r=e.ownerDocument;for(let i=e.parentNode;i&&!(i==r.body||t&&n);)if(1==i.nodeType)!n&&i.scrollHeight>i.clientHeight&&(n=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(Rv).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(um.allowMultipleSelections)&&function(e,t){let n=e.state.facet(ov);return n.length?n[0](t):rg.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=bg(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Zb(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let r=0,i=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=Bv(this.view);e.clientX-c.left<=o+6?r=-zb(o-e.clientX):e.clientX+c.right>=a-6&&(r=zb(e.clientX-a)),e.clientY-c.top<=s+6?i=-zb(s-e.clientY):e.clientY+c.bottom>=l-6&&(i=zb(e.clientY-l)),this.setScrollSpeed(r,i)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=bb(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Vb=Object.create(null),qb=Object.create(null),Ub=rg.ie&&rg.ie_version<15||rg.ios&&rg.webkit_version<604;function $b(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Kb(e,t){t=$b(e.state,dv,t);let n,{state:r}=e,i=1,o=r.toText(t),s=o.lines==r.selection.ranges.length,a=null!=ty&&r.selection.ranges.every(e=>e.empty)&&ty==o.toString();if(a){let e=-1;n=r.changeByRange(n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((s?o.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:wp.cursor(n.from+l.length)}})}else n=s?r.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:wp.cursor(e.from+t.length)}}):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Yb(e,t,n,r){if(1==r)return wp.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return wp.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=op(i.text,o,!1):a=op(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=op(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=op(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return wp.range(s+i.from,a+i.from)}(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,s=r?r.posAtEnd:i.to;return s<e.state.doc.length&&s==i.to&&s++,wp.range(o,s)}}qb.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Vb.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),qb.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},qb.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Vb.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(av))if(n=r(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Zb(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,o,s){let a,l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=Yb(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let t=Yb(e,n.pos,n.assoc,r),i=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=i<c.from?wp.range(i,o):wp.range(o,i)}return o?i.replaceRange(i.main.extend(c.from,c.to)):s&&1==r&&i.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return wp.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(i,l.pos))?a:s?i.addRange(c):wp.create([c])}}}(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Hb(e,t,n,r)),r&&e.observer.ignore(()=>{Pg(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),!1===i.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const Gb=rg.ie&&rg.ie_version<=11;let Xb=null,Jb=0,Qb=0;function Zb(e){if(!Gb)return e.detail;let t=Xb,n=Qb;return Xb=e,Qb=Date.now(),Jb=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Jb+1)%3:1}function ey(e,t,n,r){if(!(n=$b(e.state,dv,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=r&&o&&function(e,t){let n=e.state.facet(sv);return n.length?n[0](t):rg.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:i,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Vb.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=wp.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",$b(e.state,fv,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Vb.dragend=e=>(e.inputState.draggedContent=null,!1),Vb.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&ey(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return ey(e,t,n,!0),!0}return!1},Vb.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Ub?null:t.clipboardData;return n?(Kb(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),Kb(e,n.value)},50)}(e),!1)};let ty=null;Vb.copy=Vb.cut=(e,t)=>{let n=bg(e.root);if(n&&!wg(e.contentDOM,n))return!1;let{text:r,ranges:i,linewise:o}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:$b(e,fv,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!r&&!o)return!1;ty=o?r:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Ub?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,r),!1)};const ny=Xp.define();function ry(e,t){let n=[];for(let r of e.facet(uv)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:ny.of(!0)}):null}function iy(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=ry(e.state,t);n?e.dispatch(n):e.update([])}},10)}qb.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),iy(e)},qb.blur=e=>{e.observer.clearSelectionRange(),iy(e)},qb.compositionstart=qb.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},qb.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,rg.chrome&&rg.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},qb.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Vb.beforeinput=(e,t)=>{var n,r;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return Db(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}let i;if(rg.chrome&&rg.android&&(i=_b.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return rg.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),rg.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>qb.compositionend(e,t),20),!1};const oy=new Set;const sy=["pre-wrap","normal","pre-line","break-spaces"];let ay=!1;function ly(){ay=!1}class cy{constructor(e){this.lineWrapping=e,this.doc=Gf.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return sy.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=sy.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class hy{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class uy{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?hg.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof pg?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new uy(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var dy=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(dy||(dy={}));const fy=.001;class py{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>fy&&(ay=!0),this.height=e)}replace(e,t,n){return py.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=r[s],u=i.lineAt(a,dy.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,dy.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=r[s-1].toA;)a=r[s-1].fromA,c=r[s-1].fromB,s--,a<u.from&&(u=i.lineAt(a,dy.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let f=ky.build(n.setDoc(o),e,c,h);i=my(i,i.replace(a,l,f))}return i.updateHeight(n,0)}static empty(){return new by(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else{if(!(i>2*r))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}}else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new wy(py.of(e.slice(0,t)),o,py.of(e.slice(n)))}}function my(e,t){return e==t?e:(e.constructor!=t.constructor&&(ay=!0),t)}py.prototype.size=1;const gy=ug.replace({});class vy extends py{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new uy(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new uy(r,0,n,this.spaceAbove,gy):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(o):o}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.lineAt(0,dy.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class by extends vy{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new uy(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof by||r instanceof yy&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof yy?r=new by(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):py.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class yy extends py{constructor(e){super(e,0)}heightMetrics(e,t){let n,r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-r+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:r,lastLine:i,perLine:n,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),l=s+o.length*a,c=Math.max(n,e-l/2);return new uy(o.from,o.length,c,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new uy(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==dy.ByHeight)return this.blockAt(e,n,r,i);if(t==dy.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new uy(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=r+s*h+a*(l.from-i-h);return new uy(l.from,l.length,Math.max(r,Math.min(u,r+this.height-c)),c,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let c=e,h=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new uy(t.from,t.length,h,r,0)),h+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof yy?n[n.length-1]=new yy(e.length+r):n.push(null,new yy(r-1))}if(e>0){let t=n[0];t instanceof yy?n[0]=new yy(e+t.length):n.unshift(new yy(e-1),null)}return py.of(n)}decomposeLeft(e,t){t.push(new yy(e-1),null)}decomposeRight(e,t){t.push(null,new yy(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new yy(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++],a=0;i<0&&(a=-i,i=r.heights[r.index++]),-1==s?s=i:Math.abs(i-s)>=fy&&(s=-2);let l=new by(t,i,a);l.outdated=!1,n.push(l),o+=t+1}o<=i&&n.push(null,new yy(i-o).updateHeight(e,o));let a=py.of(n);return(s<0||Math.abs(a.height-this.height)>=fy||Math.abs(s-this.heightMetrics(e,t).perLine)>=fy)&&(ay=!0),my(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class wy extends py{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,a=t==dy.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==dy.ByPosNoHeight?dy.ByPosNoHeight:dy.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,dy.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&xy(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),xy(i,e)}return py.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?py.of(this.break?[e,null,t]:[e,t]):(this.left=my(this.left,e),this.right=my(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function xy(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof yy&&(r=e[t+1])instanceof yy&&e.splice(t-1,3,new yy(n.length+1+r.length))}class ky{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof by?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new by(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new vy(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new by(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new yy(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof by)return e;let t=new by(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof by||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new by(0,-1,0));let n=e;for(let e of this.nodes)e instanceof by&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new ky(n,e);return bm.spans(t,n,r,i,0),i.finish(n)}}class Sy{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&gg(e,t,this.changes,5)}}function Ey(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Cy(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Oy{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return ug.replace({widget:new Ny(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Ny extends cg{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ay{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Dy,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Wg.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Nv).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new cy(t),this.stateDeco=Py(e),this.heightMap=py.empty().applyChanges(this.stateDeco,Gf.empty,this.heightOracle.setDoc(e.doc),[new jv(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ug.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new Ty(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Dy:new Ly(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(By(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Py(this.state);let r=e.changedRanges,i=jv.extendWithRanges(r,function(e,t,n){let r=new Sy;return bm.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:dp.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ly(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||ay)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(mv)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wg.RTL:Wg.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent,s=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=Tg(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Ig(e.scrollDOM);let f=(this.printing?Cy:Ey)(t,this.paddingTop),p=f.top-this.pixelViewport.top,m=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&r.refresh(i,n,s,a,Math.max(5,v/s),t),o&&(e.docView.minWidth=0,l|=16)}p>0&&m>0?c=Math.max(p,m):p<0&&m<0&&(c=Math.min(p,m)),ly();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?py.empty().applyChanges(this.stateDeco,Gf.empty,this.heightOracle,[new jv(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new hy(n.from,i))}ay&&(l|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new Ty(r.lineAt(o-1e3*n,dy.ByHeight,i,0,0).from,r.lineAt(s+1e3*(1-n),dy.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=r.lineAt(e,dy.ByPos,i,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new Ty(r.lineAt(n-500,dy.ByHeight,i,0,0).from,r.lineAt(n+o+500,dy.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Ty(this.heightMap.lineAt(n,dy.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,dy.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,dy.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,dy.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Oy(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=Wg.LTR&&!n)return[];let s=[],a=(r,o,l,c)=>{if(o-r<i)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>r&&e<o)return a(r,e-10,l,c),void a(e+10,o,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(wp.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,c);d=new Oy(r,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<o||t.type!=hg.Text)return;let i=function(e,t,n){let r=[],i=e,o=0;bm.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),o+=t-i);return{total:o,ranges:r}}(t.from,t.to,this.stateDeco);if(i.total<o)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let r=Ry(i,c),s=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=r-s,n=r+s}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;s=My(i,e),l=My(i,n)}else{let n=i.total*this.heightOracle.charWidth,o=r*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+a,f=this.pixelViewport.right+a;if(null!=c){let e=Ry(i,c),t=((f-d)/2+o)/n;h=e-t,u=e+t}else h=(d-o)/n,u=(f+o)/n;s=My(i,h),l=My(i,u)}s>t.from&&a(t.from,s,t,i),l<t.to&&a(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=Ry(r,n)-Ry(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Oy.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ug.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];bm.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];i.from==o.from&&i.to==o.to||(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||By(this.heightMap.lineAt(e,dy.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||By(this.heightMap.lineAt(this.scaler.fromDOM(e),dy.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return By(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ty{constructor(e,t){this.from=e,this.to=t}}function My({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function Ry(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}const Dy={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function Py(e){let t=e.facet(Av).filter(e=>"function"!=typeof e),n=e.facet(Mv).filter(e=>"function"!=typeof e);return n.length&&t.push(bm.join(n)),t}class Ly{constructor(e,t,n){let r=0,i=0,o=0;this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,dy.ByPos,e,0,0).top,s=t.lineAt(i,dy.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=o+(e.top-i)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof Ly&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function By(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new uy(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>By(e,t)):e._content)}const Iy=Sp.define({combine:e=>e.join(" ")}),jy=Sp.define({combine:e=>e.indexOf(!0)>-1}),_y=Bm.newName(),Fy=Bm.newName(),Wy=Bm.newName(),zy={"&light":"."+Fy,"&dark":"."+Wy};function Hy(e,t,n){return new Bm(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const Vy=Hy("."+_y,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},zy),qy={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Uy=rg.ie&&rg.ie_version<=11;class $y{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Mg,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(rg.ie&&rg.ie_version<=11||rg.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!rg.android||!1===e.constructor.EDIT_CONTEXT||rg.chrome&&rg.chrome_version<126||(this.editContext=new Gy(e),e.state.facet(xv)&&(e.contentDOM.editContext=this.editContext.editContext)),Uy&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(xv)?n.root.activeElement!=this.dom:!wg(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(rg.ie&&rg.ie_version<=11||rg.android&&rg.chrome)&&!n.state.selection.main.empty&&r.focusNode&&kg(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=bg(e.root);if(!t)return!1;let n=rg.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Yy(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?Yy(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=wg(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Og(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:(n=e,r=Og(n))}else{if(n==e)return!0;r=Sg(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,qy),Uy&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Uy&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Bg(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&wg(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Tb(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=Rb(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Lb(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=Ky(t,e.previousSibling||e.target.previousSibling,-1),r=Ky(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(xv)!=e.state.facet(xv)&&(e.view.contentDOM.editContext=e.state.facet(xv)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Ky(e,t,n){for(;t;){let r=Wv.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function Yy(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return kg(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class Gy{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&i<this.from?s=i:a==this.to&&i>this.to&&(a=i);let c=Pb(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!c){let t=wp.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Lb(t,r)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+s,to:c.toA+s,insert:Gf.of(n.text.slice(c.from,c.toB).split("\n"))};if((rg.mac||rg.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:s,to:a,insert:Gf.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);Db(e,h,wp.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(ug.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:yv.of(ug.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=bg(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,a,l)=>{if(n)return;let c=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l))return r=this.pendingContextChange=null,t+=c,void(this.to+=c);r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==r||this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Xy{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Ay(e.state||um.create(e)),e.scrollTo&&e.scrollTo.is(bv)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Sv).map(e=>new Cv(e));for(let e of this.plugins)e.update(this);this.observer=new $y(this),this.inputState=new Bb(this),this.inputState.ensureHandlers(this.plugins),this.docView=new cb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof em?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,i=this.state;for(let t of e){if(t.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed)return void(this.viewState.state=i);let o=this.hasFocus,s=0,a=null;e.some(e=>e.annotation(ny))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=ry(i,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(um.phrases)!=this.state.facet(um.phrases))return this.setState(i);t=_v.create(this,i,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new vv(e.empty?e:wp.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(bv)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=Zy.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Iv)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(Iy)!=t.state.facet(Iy)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(cv))try{e(t)}catch(e){wv(this.state,e,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Rb(this,c)&&l.force&&Bg(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Ay(e),this.plugins=e.facet(Sv).map(e=>new Cv(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new cb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Sv),n=e.state.facet(Sv);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Cv(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){wv(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(Ig(n))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5)break;let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return wv(this.state,e),Qy}}),c=_v.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=Qy)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){wv(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(cv))e(t)}get themeClasses(){return _y+" "+(this.state.facet(jy)?Wy:Fy)+" "+this.state.facet(Iy)}updateAttrs(){let e=ew(this,Ov,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xv)?"true":"false",class:"cm-content",style:`${rg.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),ew(this,Nv,t);let n=this.observer.ignore(()=>{let n=ag(this.contentDOM,this.contentAttrs,t),r=ag(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(Xy.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(Iv);let e=this.state.facet(Xy.cspNonce);Bm.mount(this.root,this.styleModules.concat(Vy).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return yb(this,e,gb(this,e,t,n))}moveByGroup(e,t){return yb(this,e,gb(this,e,t,t=>function(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==am.Space&&(i=t),i==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return wp.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=mb(e,t.head,t.assoc||-1),o=r&&i.type==hg.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==Wg.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return wp.cursor(s,n?-1:1)}return wp.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return yb(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return wp.cursor(i,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),s=(o<0?t.top:t.bottom)+h}let u=xb(e,{x:l.left+a,y:s+(null!=r?r:e.viewState.heightOracle.textHeight>>1)*o},!1,o);return wp.cursor(u.pos,u.assoc,void 0,a)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=xb(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),xb(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return Ng(n,i[Xg.find(i,e-r.from,-1,t)].dir==Wg.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(pv)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Jy)return tv(e.length);let t,n=this.textDirectionAt(e.from);for(let r of this.bidiCache)if(r.from==e.from&&r.dir==n&&(r.fresh||Jg(r.isolates,t=Pv(this,e))))return r.order;t||(t=Pv(this,e));let r=function(e,t,n){if(!e)return[new Xg(0,0,t==Hg?1:0)];if(t==zg&&!n.length&&!Gg.test(e))return tv(e.length);if(n.length)for(;e.length>Qg.length;)Qg[Qg.length]=256;let r=[],i=t==zg?0:1;return ev(e,i,i,n,0,e.length,r),r}(e.text,n,t);return this.bidiCache.push(new Zy(e.from,e.to,n,t,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||rg.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Pg(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return bv.of(new vv("number"==typeof e?wp.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return bv.of(new vv(wp.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ev.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ev.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Bm.newName(),r=[Iy.of(n),Iv.of(Hy(`.${n}`,e))];return t&&t.dark&&r.push(jy.of(!0)),r}static baseTheme(e){return Ip.lowest(Iv.of(Hy("."+_y,e,zy)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&Wv.get(n)||Wv.get(e);return(null===(t=null==r?void 0:r.root)||void 0===t?void 0:t.view)||null}}Xy.styleModule=Iv,Xy.inputHandler=hv,Xy.clipboardInputFilter=dv,Xy.clipboardOutputFilter=fv,Xy.scrollHandler=gv,Xy.focusChangeEffect=uv,Xy.perLineTextDirection=pv,Xy.exceptionSink=lv,Xy.updateListener=cv,Xy.editable=xv,Xy.mouseSelectionStyle=av,Xy.dragMovesSelection=sv,Xy.clickAddsSelectionRange=ov,Xy.decorations=Av,Xy.blockWrappers=Tv,Xy.outerDecorations=Mv,Xy.atomicRanges=Rv,Xy.bidiIsolatedRanges=Dv,Xy.scrollMargins=Lv,Xy.darkTheme=jy,Xy.cspNonce=Sp.define({combine:e=>e.length?e[0]:""}),Xy.contentAttributes=Nv,Xy.editorAttributes=Ov,Xy.lineWrapping=Xy.contentAttributes.of({class:"cm-lineWrapping"}),Xy.announce=Zp.define();const Jy=4096,Qy={};class Zy{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Wg.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new Zy(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function ew(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&ig(o,n)}return n}const tw=rg.mac?"mac":rg.windows?"win":rg.linux?"linux":"key";function nw(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const rw=Ip.default(Xy.domEventHandlers({keydown:(e,t)=>hw(sw(t.state),e,t,"editor")})),iw=Sp.define({enables:rw}),ow=new WeakMap;function sw(e){let t=e.facet(iw),n=ow.get(t);return n||ow.set(t,n=function(e,t=tw){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=r.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let r,i,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:i=!0}}return r&&(a="Alt-"+a),i&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");i(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=aw={view:t,prefix:n,scope:e};return setTimeout(()=>{aw==r&&(aw=null)},lw),!0}]})}let d=u.join(" ");i(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,cw))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let aw=null;const lw=4e3;let cw=null;function hw(e,t,n,r){cw=t;let i=function(e){var t=!(Wm&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||zm&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Fm:_m)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),o=lp(sp(i,0))==i.length&&" "!=i,s="",a=!1,l=!1,c=!1;aw&&aw.view==n&&aw.scope==r&&(s=aw.prefix+" ",Wb.indexOf(t.keyCode)<0&&(l=!0,aw=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},p=e[r];return p&&(f(p[s+nw(i,t,!o)])?a=!0:!o||!(t.altKey||t.metaKey||t.ctrlKey)||rg.windows&&t.ctrlKey&&t.altKey||rg.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=_m[t.keyCode])||h==i?o&&t.shiftKey&&f(p[s+nw(i,t,!0)])&&(a=!0):(f(p[s+nw(h,t,!0)])||t.shiftKey&&(u=Fm[t.keyCode])!=i&&u!=h&&f(p[s+nw(u,t,!1)]))&&(a=!0),!a&&f(p._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),cw=null,a}class uw{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=dw(e);return[new uw(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==Wg.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=dw(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=mb(e,r,1),p=mb(e,i,-1),m=f.type==hg.Text?f:null,g=p.type==hg.Text?p:null;m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=fw(e,r,1,m));g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=fw(e,i,-1,g));if(m&&g&&m.from==g.from&&m.to==g.to)return b(y(n.from,n.to,m));{let t=m?y(n.from,null,m):w(f,!1),r=g?y(null,n.to,g):w(p,!0),i=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(u,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==hg.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),b(t).concat(i).concat(b(r))}function v(e,n,r,i){return new uw(t,e-l.left,n-l.top,r-e,i-n)}function b({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,c,h){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(l,l==r.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),s=Math.max(f.bottom,p.bottom,s),h==Wg.LTR?a.push(o&&n?u:f.left,o&&c?d:p.right):a.push(!o&&c?u:p.left,!o&&n?d:f.right))}let c=null!=t?t:r.from,h=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<h)for(let i=Math.max(r.from,c),o=Math.min(r.to,h);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(i=r.to+1,i>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function w(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function dw(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Wg.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function fw(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class pw{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(mw)!=e.state.facet(mw)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(mw);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;e==this.scaleX&&t==this.scaleY||(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{return n=e,r=this.drawn[t],!(n.constructor==r.constructor&&n.eq(r));var n,r})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,rg.safari&&rg.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const mw=Sp.define();function gw(e){return[Ev.define(t=>new pw(t,e)),mw.of(e)]}const vw=Sp.define({combine:e=>dm(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function bw(e){return e.startState.facet(vw)!=e.state.facet(vw)}const yw=gw({above:!0,markers(e){let{state:t}=e,n=t.facet(vw),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:wp.cursor(i.head,i.head>i.anchor?-1:1);for(let i of uw.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=bw(e);return n&&ww(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){ww(t.state,e)},class:"cm-cursorLayer"});function ww(e,t){t.style.animationDuration=e.facet(vw).cursorBlinkRate+"ms"}const xw=gw({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:uw.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||bw(e),class:"cm-selectionLayer"}),kw=Ip.highest(Xy.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Sw=Zp.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Ew=Mp.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Sw)?t.value:e,e))}),Cw=Ev.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(Ew);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Ew)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Ew),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Ew)!=e&&this.view.dispatch({effects:Sw.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Ow(e,t,n,r,i){t.lastIndex=0;for(let o,s=e.iterRange(n,r),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}class Nw{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n)}this.boundary=i,this.maxLength=o}createDeco(e){let t=new ym,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))Ow(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,u);else Ow(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}const Aw=null!=/x/.unicode?"gu":"g",Tw=new RegExp("[\0-\b\n--\u2028\u2029\ufeff-]",Aw),Mw={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Rw=null;const Dw=Sp.define({combine(e){let t=dm(e,{render:null,specialChars:Tw,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Rw&&"undefined"!=typeof document&&document.body){let t=document.body.style;Rw=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Rw||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Aw)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Aw)),t}});let Pw=null;class Lw extends cg{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(Mw[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Bw extends cg{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Iw=ug.line({class:"cm-activeLine"}),jw=Ev.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(Iw.range(i.from)),t=i.from)}return ug.set(n)}},{decorations:e=>e.decorations});class _w extends cg{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?xg(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=Ng(t[0],"rtl"!=n.direction),i=parseInt(n.lineHeight);return r.bottom-r.top>1.5*i?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}const Fw=2e3;function Ww(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>Fw?-1:i==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):Mm(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function zw(e,t){let n=Ww(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,o){let s=Ww(e,t);if(!s)return r;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>Fw||n.off>Fw||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(wp.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=Rm(n.text,s,e.tabSize,!0);if(r<0)o.push(wp.cursor(n.to));else{let t=Rm(n.text,a,e.tabSize);o.push(wp.range(n.from+r,n.from+t))}}}return o}(e.state,n,s);return a.length?o?wp.create(a.concat(r.ranges)):wp.create(a):r}}:null}const Hw={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Vw={style:"cursor: crosshair"};const qw="-10000px";class Uw{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)o.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function $w(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Kw=Sp.define({combine:e=>{var t,n,r;return{position:rg.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||$w}}}),Yw=new WeakMap,Gw=Ev.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Kw);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Uw(e,Zw,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Kw);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=qw,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(rg.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Bv(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Kw).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=qw;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,m=d.right-d.left,g=null!==(t=Yw.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||Qw,b=this.view.textDirection==Wg.LTR,y=d.width>r.right-r.left?b?r.left:r.right-d.width:b?Math.max(r.left,Math.min(u.left-(f?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,u.left-m+(f?14:0)-v.x),r.right-m),w=this.above[a];!l.strictSide&&(w?u.top-g-p-v.y<r.top:u.bottom+g+p+v.y>r.bottom)&&w==r.bottom-u.bottom>u.top-r.top&&(w=this.above[a]=!w);let x=(w?u.top-r.top:r.bottom-u.bottom)-p;if(x<g&&!1!==c.resize){if(x<this.view.defaultLineHeight){h.style.top=qw;continue}Yw.set(c,g),h.style.height=(g=x)/o+"px"}else h.style.height&&(h.style.height="");let k=w?u.top-g-p-v.y:u.bottom+p+v.y,S=y+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>y&&e.top<k+g&&e.bottom>k&&(k=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(k-e.parent.top)/o+"px",Xw(h,(y-e.parent.left)/i)):(h.style.top=k/o+"px",Xw(h,y/i)),f){let e=u.left+(b?v.x:-v.x)-(y+14-7);f.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:y,top:k,right:S,bottom:k+g}),h.classList.toggle("cm-tooltip-above",w),h.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=qw}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Xw(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Jw=Xy.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Qw={x:0,y:0},Zw=Sp.define({enables:[Gw,Jw]}),ex=Sp.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class tx{static create(e){return new tx(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Uw(e,ex,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r)if(void 0===t)t=r;else if(t!==r)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const nx=Zw.compute([ex],e=>{let t=e.facet(ex);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:tx.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class rx{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),null==r)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==Wg.RTL?-1:1;i=t.x<n.left?-s:s}let o=this.source(e,r,i);if(null==o?void 0:o.then){let t=this.pending={pos:r};o.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>wv(e.state,t,"hover tooltip"))}else!o||Array.isArray(o)&&!o.length||e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Gw),t=e?e.manager.tooltips.findIndex(e=>e.create==tx.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!function(e,t){let n,{left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=r-ix&&t.clientX<=i+ix&&t.clientY>=o-ix&&t.clientY<=s+ix}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,r,i){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ix=4;function ox(e,t={}){let n=Zp.define(),r=Mp.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,hp.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(ax)&&(e=[]);return e},provide:e=>ex.from(e)});return{active:r,extension:[r,Ev.define(i=>new rx(i,e,r,n,t.hoverTime||300)),nx]}}function sx(e,t){let n=e.plugin(Gw);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const ax=Zp.define(),lx=Sp.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function cx(e,t){let n=e.plugin(hx),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const hx=Ev.fromClass(class{constructor(e){this.input=e.state.facet(fx),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(lx);this.top=new ux(e,!0,t.topContainer),this.bottom=new ux(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(lx);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ux(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ux(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(fx);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),r.push(t),(t.top?i:o).push(t)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Xy.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ux{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=dx(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=dx(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function dx(e){let t=e.nextSibling;return e.remove(),t}const fx=Sp.define({enables:hx});function px(e,t){let n,r=new Promise(e=>n=e),i=e=>function(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=qm("form"),t.input){let e=qm("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),r.appendChild(qm("label",(t.label||"")+": ",e))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(qm("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i="FORM"==r.nodeName?[r]:r.querySelectorAll("form");for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),s(null)):13==e.keyCode&&(e.preventDefault(),s(t))}),t.addEventListener("submit",e=>{e.preventDefault(),s(t)})}let o=qm("div",r,qm("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(o.className=t.class);function s(t){o.contains(o.ownerDocument.activeElement)&&e.focus(),n(t)}return o.classList.add("cm-dialog"),{dom:o,top:t.top,mount:()=>{if(t.focus){let e;e="string"==typeof t.focus?r.querySelector(t.focus):r.querySelector("input")||r.querySelector("button"),e&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}}(e,t,n);e.state.field(mx,!1)?e.dispatch({effects:gx.of(i)}):e.dispatch({effects:Zp.appendConfig.of(mx.init(()=>[i]))});let o=vx.of(i);return{close:o,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(mx).indexOf(i)>-1&&e.dispatch({effects:o})}),t))}}const mx=Mp.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(gx)?e=[n.value].concat(e):n.is(vx)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>fx.computeN([e],t=>t.field(e))}),gx=Zp.define(),vx=Zp.define();class bx extends fm{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}bx.prototype.elementClass="",bx.prototype.toDOM=void 0,bx.prototype.mapMode=hp.TrackBefore,bx.prototype.startSide=bx.prototype.endSide=-1,bx.prototype.point=!0;const yx=Sp.define(),wx=Sp.define(),xx={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>bm.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},kx=Sp.define();function Sx(e){return[Cx(),kx.of({...xx,...e})]}const Ex=Sp.define({combine:e=>e.some(e=>e)});function Cx(e){let t=[Ox];return e&&!1===e.fixed&&t.push(Ex.of(!0)),t}const Ox=Ev.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(kx).map(t=>new Mx(e,t)),this.fixed=!e.state.facet(Ex);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Ex)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=bm.iter(this.view.state.facet(yx),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Tx(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==hg.Text&&t){Ax(n,r,o.from);for(let e of i)e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==hg.Text){Ax(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(kx),n=e.state.facet(kx),r=e.docChanged||e.heightChanged||e.viewportChanged||!bm.eq(e.startState.facet(yx),e.state.facet(yx),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new Mx(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Xy.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Wg.LTR?{left:r,right:i}:{right:r,left:i}})});function Nx(e){return Array.isArray(e)?e:[e]}function Ax(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Tx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=bm.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new Rx(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Ax(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(wx)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Mx{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i,o=r.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=Nx(t.markers(e)),t.initialSpacer&&(this.spacer=new Rx(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Nx(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!bm.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Rx{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const Dx=Sp.define(),Px=Sp.define(),Lx=Sp.define({combine:e=>dm(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class Bx extends bx{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ix(e,t){return e.state.facet(Lx).formatNumber(t,e.state)}const jx=kx.compute([Lx],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Dx),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new Bx(Ix(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(Px)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Lx)!=e.state.facet(Lx),initialSpacer:e=>new Bx(Ix(e,_x(e.state.doc.lines))),updateSpacer(e,t){let n=Ix(t.view,_x(t.view.state.doc.lines));return n==e.number?e:new Bx(n)},domEventHandlers:e.facet(Lx).domEventHandlers,side:"before"}));function _x(e){let t=9;for(;t<e;)t=10*t+9;return t}const Fx=new class extends bx{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Wx=yx.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Fx.range(i)))}return bm.of(t)});const zx=1024;let Hx=0;class Vx{constructor(e,t){this.from=e,this.to=t}}class qx{constructor(e={}){this.id=Hx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=Kx.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}qx.closedBy=new qx({deserialize:e=>e.split(" ")}),qx.openedBy=new qx({deserialize:e=>e.split(" ")}),qx.group=new qx({deserialize:e=>e.split(" ")}),qx.isolate=new qx({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),qx.contextHash=new qx({perNode:!0}),qx.lookAhead=new qx({perNode:!0}),qx.mounted=new qx({perNode:!0});class Ux{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[qx.mounted.id]}}const $x=Object.create(null);class Kx{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):$x,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new Kx(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(qx.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(qx.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}Kx.none=new Kx("",Object.create(null),0,8);class Yx{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new Kx(n.name,r,n.id,n.flags):n)}return new Yx(t)}}const Gx=new WeakMap,Xx=new WeakMap;var Jx;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(Jx||(Jx={}));class Qx{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=Ux.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new uk(this.topNode,e)}cursorAt(e,t=0,n=0){let r=Gx.get(this)||this.topNode,i=new uk(r);return i.moveTo(e,t),Gx.set(this,i._tree),i}get topNode(){return new ik(this,0,0,null)}resolve(e,t=0){let n=nk(Gx.get(this)||this.topNode,e,t,!1);return Gx.set(this,n),n}resolveInner(e,t=0){let n=nk(Xx.get(this)||this.topNode,e,t,!0);return Xx.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof ik?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=Ux.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new ik(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(nk(s,t,n,!1))}}return i?ck(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&Jx.IncludeAnonymous)>0;for(let e=this.cursor(o|Jx.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:mk(Kx.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new Qx(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new Qx(Kx.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=zx,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new Zx(n,n.length):n,l=r.types,c=0,h=0;function u(e,t,n,b,y,w){let{id:x,start:k,end:S,size:E}=a,C=h,O=c;if(E<0){if(a.next(),-1==E){let t=o[x];return n.push(t),void b.push(k-e)}if(-3==E)return void(c=x);if(-4==E)return void(h=x);throw new RangeError(`Unrecognized record size: ${E}`)}let N,A,T=l[x],M=k-e;if(S-k<=i&&(A=g(a.pos-t,y))){let t=new Uint16Array(A.size-A.skip),n=a.pos-A.size,i=t.length;for(;a.pos>n;)i=v(A.start,t,i);N=new ek(t,S-A.start,r),M=A.start-e}else{let e=a.pos-E;a.next();let t=[],n=[],r=x>=s?x:-1,o=0,l=S;for(;a.pos>e;)r>=0&&a.id==r&&a.size>=0?(a.end<=l-i&&(p(t,n,k,o,a.end,l,r,C,O),o=t.length,l=a.end),a.next()):w>2500?d(k,e,t,n):u(k,e,t,n,r,w+1);if(r>=0&&o>0&&o<t.length&&p(t,n,k,o,k,l,r,C,O),t.reverse(),n.reverse(),r>-1&&o>0){let e=f(T,O);N=mk(T,t,n,0,t.length,0,S-k,e,e)}else N=m(T,t,n,S-k,C-S,O)}n.push(N),b.push(M)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-i),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new ek(t,s[2]-i,r)),o.push(i-e)}}function f(e,t){return(n,r,i)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof Qx){if(!l&&o.type==e&&o.length==i)return o;(s=o.prop(qx.lookAhead))&&(a=r[l]+o.length+s)}return m(e,n,r,i,a,t)}}function p(e,t,n,i,o,s,a,l,c){let h=[],u=[];for(;e.length>i;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(m(r.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function m(e,t,n,r,i,o,s){if(o){let e=[qx.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[qx.lookAhead,i];s=s?[e].concat(s):[e]}return new Qx(e,t,n,r,s)}function g(e,t){let n=a.fork(),r=0,o=0,l=0,c=n.end-i,h={size:0,start:0,skip:0};e:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){h.size=r,h.start=o,h.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<c)break;let u=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,r+=e,l+=u}return(t<0||r==e)&&(h.size=r,h.start=o,h.skip=l),h.size>4?h:void 0}function v(e,t,n){let{id:r,start:i,end:o,size:l}=a;if(a.next(),l>=0&&r<s){let s=n;if(l>4){let r=a.pos-(l-4);for(;a.pos>r;)n=v(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==l?c=r:-4==l&&(h=r);return n}let b=[],y=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,b,y,-1,0);let w=null!==(t=e.length)&&void 0!==t?t:b.length?y[0]+b[0].length:0;return new Qx(l[e.topID],b.reverse(),y.reverse(),w)}(e)}}Qx.empty=new Qx(Kx.none,[],[],0);class Zx{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Zx(this.buffer,this.index)}}class ek{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Kx.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&!(tk(i,r,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new ek(i,o,this.set)}}function tk(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function nk(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof ik&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:Jx.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;r=s,s=r.parent)r instanceof ik&&r.index<0&&(null===(i=s.enter(t,n,o))||void 0===i?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class rk{cursor(e=0){return new uk(this,e)}getChild(e,t=null,n=null){let r=ok(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return ok(this,e,t,n)}resolve(e,t=0){return nk(this,e,t,!1)}resolveInner(e,t=0){return nk(this,e,t,!0)}matchContext(e){return sk(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class ik extends rk{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,i=0){var o;for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=t>0?a.length:-1;e!=c;e+=t){let c=a[e],h=l[e]+s.from;if(i&Jx.EnterBracketed&&c instanceof Qx&&null===(null===(o=Ux.get(c))||void 0===o?void 0:o.overlay)&&(h>=n||h+c.length<=n)||tk(r,n,h,h+c.length))if(c instanceof ek){if(i&Jx.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,n-h,r);if(o>-1)return new lk(new ak(s,c,e,h),null,o)}else if(i&Jx.IncludeAnonymous||!c.type.isAnonymous||dk(c)){let o;if(!(i&Jx.IgnoreMounts)&&(o=Ux.get(c))&&!o.overlay)return new ik(o.tree,h,e,s);let a=new ik(c,h,e,s);return i&Jx.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?c.children.length-1:0,t,n,r,i)}}if(i&Jx.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&Jx.IgnoreOverlays)&&(r=Ux.get(this._tree))&&r.overlay){let i=e-this.from,o=n&Jx.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||o?e<=i:e<i)&&(t<0||o?n>=i:n>i))return new ik(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ok(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function sk(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class ak{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class lk extends rk{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new lk(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&Jx.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new lk(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new lk(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new lk(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new Qx(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ck(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof ik&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new hk(i,n)}class hk{constructor(e,t){this.heads=e,this.node=t}get next(){return ck(this.heads)}}class uk{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Jx.EnterBracketed,e instanceof ik)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof ik?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&Jx.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Jx.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Jx.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&Jx.IncludeAnonymous||e instanceof ek||!e.type.isAnonymous||dk(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new lk(this.buffer,t,this.stack[e]);return this.bufferNode=new lk(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return sk(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return sk(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function dk(e){return e.children.some(e=>e instanceof ek||!e.type.isAnonymous||dk(e))}const fk=new WeakMap;function pk(e,t){if(!e.isAnonymous||t instanceof ek||t.type!=e)return 1;let n=fk.get(t);if(null==n){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Qx)){n=1;break}n+=pk(e,r)}fk.set(t,n)}return n}function mk(e,t,n,r,i,o,s,a,l){let c=0;for(let n=r;n<i;n++)c+=pk(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,r,i,s,a){for(let c=i;c<s;){let i=c,f=r[c],p=pk(e,n[c]);for(c++;c<s;c++){let t=pk(e,n[c]);if(p+t>=h)break;p+=t}if(c==i+1){if(p>h){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}u.push(n[i])}else{let t=r[c-1]+n[c-1].length-f;u.push(mk(e,n,r,i,c,f,t,null,l))}d.push(f+a-o)}}(t,n,r,i,0),(a||l)(u,d,s)}class gk{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new gk(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let t=o;if(a>=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new gk(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&r.push(t),o.to>h)break;o=i<e.length?e[i++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return r}}class vk{startParse(e,t,n){return"string"==typeof e&&(e=new bk(e)),n=n?n.length?n.map(e=>new Vx(e.from,e.to)):[new Vx(0,0)]:[new Vx(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class bk{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new qx({perNode:!0});let yk=0;class wk{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=yk++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof wk&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new wk(n,[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new kk(e);return e=>e.modified.indexOf(t)>-1?e:kk.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let xk=0;class kk{constructor(e){this.name=e,this.instances=[],this.id=xk++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]));var r,i});if(n)return n;let r=[],i=new wk(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(kk.get(t,e));return i}}function Sk(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(" "))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw new RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new Ck(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return Ek.add(t)}const Ek=new qx({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new Ck(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class Ck{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function Ok(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function Nk(e,t,n,r=0,i=e.length){let o=new Ak(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}Ck.empty=new Ck([],2,null);class Ak{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,c=function(e){let t=e.type.prop(Ek);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Ck.empty,h=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(qx.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,f=s;;d++){let p=d<u.overlay.length?u.overlay[d]:null,m=p?p.from+s:a,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&h)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;f=p.to+s,f>t&&(this.highlightRange(o.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),l))}h&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const Tk=wk.define,Mk=Tk(),Rk=Tk(),Dk=Tk(Rk),Pk=Tk(Rk),Lk=Tk(),Bk=Tk(Lk),Ik=Tk(Lk),jk=Tk(),_k=Tk(jk),Fk=Tk(),Wk=Tk(),zk=Tk(),Hk=Tk(zk),Vk=Tk(),qk={comment:Mk,lineComment:Tk(Mk),blockComment:Tk(Mk),docComment:Tk(Mk),name:Rk,variableName:Tk(Rk),typeName:Dk,tagName:Tk(Dk),propertyName:Pk,attributeName:Tk(Pk),className:Tk(Rk),labelName:Tk(Rk),namespace:Tk(Rk),macroName:Tk(Rk),literal:Lk,string:Bk,docString:Tk(Bk),character:Tk(Bk),attributeValue:Tk(Bk),number:Ik,integer:Tk(Ik),float:Tk(Ik),bool:Tk(Lk),regexp:Tk(Lk),escape:Tk(Lk),color:Tk(Lk),url:Tk(Lk),keyword:Fk,self:Tk(Fk),null:Tk(Fk),atom:Tk(Fk),unit:Tk(Fk),modifier:Tk(Fk),operatorKeyword:Tk(Fk),controlKeyword:Tk(Fk),definitionKeyword:Tk(Fk),moduleKeyword:Tk(Fk),operator:Wk,derefOperator:Tk(Wk),arithmeticOperator:Tk(Wk),logicOperator:Tk(Wk),bitwiseOperator:Tk(Wk),compareOperator:Tk(Wk),updateOperator:Tk(Wk),definitionOperator:Tk(Wk),typeOperator:Tk(Wk),controlOperator:Tk(Wk),punctuation:zk,separator:Tk(zk),bracket:Hk,angleBracket:Tk(Hk),squareBracket:Tk(Hk),paren:Tk(Hk),brace:Tk(Hk),content:jk,heading:_k,heading1:Tk(_k),heading2:Tk(_k),heading3:Tk(_k),heading4:Tk(_k),heading5:Tk(_k),heading6:Tk(_k),contentSeparator:Tk(jk),list:Tk(jk),quote:Tk(jk),emphasis:Tk(jk),strong:Tk(jk),link:Tk(jk),monospace:Tk(jk),strikethrough:Tk(jk),inserted:Tk(),deleted:Tk(),changed:Tk(),invalid:Tk(),meta:Vk,documentMeta:Tk(Vk),annotation:Tk(Vk),processingInstruction:Tk(Vk),definition:wk.defineModifier("definition"),constant:wk.defineModifier("constant"),function:wk.defineModifier("function"),standard:wk.defineModifier("standard"),local:wk.defineModifier("local"),special:wk.defineModifier("special")};for(let e in qk){let t=qk[e];t instanceof wk&&(t.name=e)}var Uk;Ok([{tag:qk.link,class:"tok-link"},{tag:qk.heading,class:"tok-heading"},{tag:qk.emphasis,class:"tok-emphasis"},{tag:qk.strong,class:"tok-strong"},{tag:qk.keyword,class:"tok-keyword"},{tag:qk.atom,class:"tok-atom"},{tag:qk.bool,class:"tok-bool"},{tag:qk.url,class:"tok-url"},{tag:qk.labelName,class:"tok-labelName"},{tag:qk.inserted,class:"tok-inserted"},{tag:qk.deleted,class:"tok-deleted"},{tag:qk.literal,class:"tok-literal"},{tag:qk.string,class:"tok-string"},{tag:qk.number,class:"tok-number"},{tag:[qk.regexp,qk.escape,qk.special(qk.string)],class:"tok-string2"},{tag:qk.variableName,class:"tok-variableName"},{tag:qk.local(qk.variableName),class:"tok-variableName tok-local"},{tag:qk.definition(qk.variableName),class:"tok-variableName tok-definition"},{tag:qk.special(qk.variableName),class:"tok-variableName2"},{tag:qk.definition(qk.propertyName),class:"tok-propertyName tok-definition"},{tag:qk.typeName,class:"tok-typeName"},{tag:qk.namespace,class:"tok-namespace"},{tag:qk.className,class:"tok-className"},{tag:qk.macroName,class:"tok-macroName"},{tag:qk.propertyName,class:"tok-propertyName"},{tag:qk.operator,class:"tok-operator"},{tag:qk.comment,class:"tok-comment"},{tag:qk.meta,class:"tok-meta"},{tag:qk.invalid,class:"tok-invalid"},{tag:qk.punctuation,class:"tok-punctuation"}]);const $k=new qx;const Kk=new qx;class Yk{constructor(e,t,n=[],r=""){this.data=e,this.name=r,um.prototype.hasOwnProperty("tree")||Object.defineProperty(um.prototype,"tree",{get(){return Jk(this)}}),this.parser=t,this.extension=[sS.of(this),um.languageData.of((e,t,n)=>{let r=Gk(e,t,n),i=r.type.prop($k);if(!i)return[];let o=e.facet(i),s=r.type.prop(Kk);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return Gk(e,t,n).type.prop($k)==this.data}findRegions(e){let t=e.facet(sS);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop($k)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(qx.mounted);if(i){if(i.tree.prop($k)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof Qx&&r(i,e.positions[n]+t)}};return r(Jk(e),0),n}get allowsNesting(){return!0}}function Gk(e,t,n){let r=e.facet(sS),i=Jk(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Jx.ExcludeBuffers|Jx.EnterBracketed))e.type.isTop&&(i=e);return i}Yk.setState=Zp.define();class Xk extends Yk{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,Sp.define({combine:n?e=>e.concat(n):void 0}));var n;return new Xk(t,e.parser.configure({props:[$k.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new Xk(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Jk(e){let t=e.field(Yk.state,!1);return t?t.tree:Qx.empty}class Qk{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Zk=null;class eS{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new eS(e,t,[],Qx.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Qk(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Qx.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(gk.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(gk.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Zk;Zk=this;try{return e()}finally{Zk=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=tS(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=gk.applyChanges(n,t),r=Qx.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&s.push({from:n,to:r})}}}return new eS(this.parser,t,n,r,i,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=tS(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends vk{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to,s={parsedPos:i,advance(){let t=Zk;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new Qx(Kx.none,[],[],o-i)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Zk}}function tS(e,t,n){return gk.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class nS{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new nS(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=eS.create(e.facet(sS).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new nS(n)}}Yk.state=Mp.define({create:nS.init,update(e,t){for(let e of t.effects)if(e.is(Yk.setState))return e.value;return t.startState.facet(sS)!=t.state.facet(sS)?nS.init(t.state):e.apply(t)}});let rS=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(rS=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const iS="undefined"!=typeof navigator&&(null===(Uk=navigator.scheduling)||void 0===Uk?void 0:Uk.isInputPending)?()=>navigator.scheduling.isInputPending():null,oS=Ev.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Yk.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Yk.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=rS(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(Yk.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!iS?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>iS&&iS()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Yk.setState.of(new nS(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>wv(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),sS=Sp.define({combine:e=>e.length?e[0]:null,enables:e=>[Yk.state,oS,Xy.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class aS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const lS=Sp.define(),cS=Sp.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function hS(e){let t=e.facet(cS);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function uS(e,t){let n="",r=e.tabSize,i=e.facet(cS)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function dS(e,t){e instanceof um&&(e=new fS(e));for(let n of e.state.facet(lS)){let r=n(e,t);if(void 0!==r)return r}let n=Jk(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return mS(r,e,n)}(e,n,t):null}class fS{constructor(e,t={}){this.state=e,this.options=t,this.unit=hS(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return Mm(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const pS=new qx;function mS(e,t,n){for(let r=e;r;r=r.next){let e=gS(r.node);if(e)return e(bS.create(t,n,r))}return 0}function gS(e){let t=e.type.prop(pS);if(t)return t;let n,r=e.firstChild;if(r&&(n=r.type.prop(qx.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}(e,!0,1,void 0,r&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?vS:null}function vS(){return 0}class bS extends fS{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new bS(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(yS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return mS(this.context.next,this.base,this.pos)}}function yS(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function wS({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const xS=Sp.define(),kS=new qx;function SS(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function ES(e,t,n){for(let r of e.facet(xS)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=Jk(e);if(r.length<n)return null;let i=null;for(let o=r.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<t)break;let a=s.type.prop(kS);if(a&&(s.to<r.length-50||r.length==e.doc.length||!SS(s))){let r=a(s,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function CS(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const OS=Zp.define({map:CS}),NS=Zp.define({map:CS});function AS(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const TS=Mp.define({create:()=>ug.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=MS(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(OS)&&!DS(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(jS),i=r?ug.replace({widget:new zS(r(t.state,n.value))}):WS;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(NS)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=MS(e,t.selection.main.head)),e},provide:e=>Xy.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid JSON for fold state");t.push(WS.range(r,i))}return ug.set(t,!0)}});function MS(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function RS(e,t,n){var r;let i=null;return null===(r=e.field(TS,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function DS(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function PS(e,t){return e.field(TS,!1)?t:t.concat(Zp.appendConfig.of(_S()))}function LS(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return Xy.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const BS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of AS(e)){let n=ES(e.state,t.from,t.to);if(n)return e.dispatch({effects:PS(e.state,[OS.of(n),LS(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(TS,!1))return!1;let t=[];for(let n of AS(e)){let r=RS(e.state,n.from,n.to);r&&t.push(NS.of(r),LS(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=ES(t,i.from,i.to);o&&n.push(OS.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:PS(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(TS,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(NS.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],IS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},jS=Sp.define({combine:e=>dm(e,IS)});function _S(e){let t=[TS,qS];return e&&t.push(jS.of(e)),t}function FS(e,t){let{state:n}=e,r=n.facet(jS),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=RS(e.state,n.from,n.to);r&&e.dispatch({effects:NS.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const WS=ug.replace({widget:new class extends cg{toDOM(e){return FS(e,null)}}});class zS extends cg{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return FS(e,this.value)}}const HS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class VS extends bx{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}const qS=Xy.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class US{constructor(e,t){let n;function r(e){let t=Bm.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Yk?e=>e.prop($k)==o.data:o?e=>e==o:void 0,this.style=Ok(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Bm(n):null,this.themeType=t.themeType}static define(e,t){return new US(e,t||{})}}const $S=Sp.define(),KS=Sp.define({combine:e=>e.length?[e[0]]:null});function YS(e){let t=e.facet($S);return t.length?t:e.facet(KS)}function GS(e,t){let n,r=[JS];return e instanceof US&&(e.module&&r.push(Xy.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(KS.of(e)):n?r.push($S.computeN([Xy.darkTheme],t=>t.facet(Xy.darkTheme)==("dark"==n)?[e]:[])):r.push($S.of(e)),r}class XS{constructor(e){this.markCache=Object.create(null),this.tree=Jk(e.state),this.decorations=this.buildDeco(e,YS(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Jk(e.state),n=YS(e.state),r=n!=YS(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return ug.none;let n=new ym;for(let{from:r,to:i}of e.visibleRanges)Nk(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=ug.mark({class:r})))},r,i);return n.finish()}}const JS=Ip.high(Ev.fromClass(XS,{decorations:e=>e.decorations})),QS=US.define([{tag:qk.meta,color:"#404740"},{tag:qk.link,textDecoration:"underline"},{tag:qk.heading,textDecoration:"underline",fontWeight:"bold"},{tag:qk.emphasis,fontStyle:"italic"},{tag:qk.strong,fontWeight:"bold"},{tag:qk.strikethrough,textDecoration:"line-through"},{tag:qk.keyword,color:"#708"},{tag:[qk.atom,qk.bool,qk.url,qk.contentSeparator,qk.labelName],color:"#219"},{tag:[qk.literal,qk.inserted],color:"#164"},{tag:[qk.string,qk.deleted],color:"#a11"},{tag:[qk.regexp,qk.escape,qk.special(qk.string)],color:"#e40"},{tag:qk.definition(qk.variableName),color:"#00f"},{tag:qk.local(qk.variableName),color:"#30a"},{tag:[qk.typeName,qk.namespace],color:"#085"},{tag:qk.className,color:"#167"},{tag:[qk.special(qk.variableName),qk.macroName],color:"#256"},{tag:qk.definition(qk.propertyName),color:"#00c"},{tag:qk.comment,color:"#940"},{tag:qk.invalid,color:"#f00"}]),ZS=Xy.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),eE="()[]{}",tE=Sp.define({combine:e=>dm(e,{afterCursor:!0,brackets:eE,maxScanDistance:1e4,renderMatch:iE})}),nE=ug.mark({class:"cm-matchingBracket"}),rE=ug.mark({class:"cm-nonmatchingBracket"});function iE(e){let t=[],n=e.matched?nE:rE;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const oE=Mp.define({create:()=>ug.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(tE);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=hE(t.state,e.head,-1,r)||e.head>0&&hE(t.state,e.head-1,1,r)||r.afterCursor&&(hE(t.state,e.head,1,r)||e.head<t.state.doc.length&&hE(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return ug.set(n,!0)},provide:e=>Xy.decorations.from(e)}),sE=[oE,ZS];const aE=new qx;function lE(e,t,n){let r=e.prop(t<0?qx.openedBy:qx.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function cE(e){let t=e.type.prop(aE);return t?t(e.node):e}function hE(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||eE,s=Jk(e),a=s.resolveInner(t,n);for(let r=a;r;r=r.parent){let i=lE(r.type,n,o);if(i&&r.from<r.to){let s=cE(r);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return uE(e,t,n,r,s,i,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,i,o)}function uE(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do{if(n<0?h.to<=r.from:h.from>=r.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from<h.to){let e=cE(h);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(lE(h.type,n,s))c++;else if(lE(h.type,-n,s)){if(0==c){let e=cE(h);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}const dE=Object.create(null),fE=[Kx.none],pE=[],mE=Object.create(null),gE=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])gE[e]=bE(dE,t);function vE(e,t){pE.indexOf(e)>-1||pE.push(e)}function bE(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||qk[n];r?"function"==typeof r?t.length?t=t.map(r):vE(n):t.length?vE(n):t=Array.isArray(r)?r:[r]:vE(n)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=mE[i];if(o)return o.id;let s=mE[i]=Kx.define({id:fE.length,name:r,props:[Sk({[r]:n})]});return fE.push(s),s.id}Wg.RTL,Wg.LTR;function yE(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}const wE=yE(OE,0),xE=yE(CE,0),kE=yE((e,t)=>CE(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function SE(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const EE=50;function CE(e,t,n=t.selection.ranges){let r=n.map(e=>SE(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-EE,r),l=e.sliceDoc(i,i+EE),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=2*EE?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+EE),s=e.sliceDoc(i-EE,i));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null}(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t,n=0;n<i.length;n++)if(t=i[n]){let i=r[n],{open:o,close:s}=t;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}function OE(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:o}of n){let n=r.length,s=1e9,a=SE(t,e).line;if(a){for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)!s&&o||e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null}const NE=Xp.define(),AE=Xp.define(),TE=Sp.define(),ME=Sp.define({combine:e=>dm(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),RE=Mp.define({create:()=>KE.empty,update(e,t){let n=t.state.facet(ME),r=t.annotation(NE);if(r){let i=jE.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?_E(s,s.length,n.minDepth,i):HE(s,t.startState.selection),new KE(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(AE);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(em.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=jE.fromTransaction(t),s=t.annotation(em.time),a=t.annotation(em.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new KE(e.done.map(jE.fromJSON),e.undone.map(jE.fromJSON))});function DE(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(RE,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}const PE=DE(0,!1),LE=DE(1,!1),BE=DE(0,!0),IE=DE(1,!0);class jE{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new jE(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new jE(e.changes&&dp.fromJSON(e.changes),[],e.mapped&&up.fromJSON(e.mapped),e.startSelection&&wp.fromJSON(e.startSelection),e.selectionsAfter.map(wp.fromJSON))}static fromTransaction(e,t){let n=WE;for(let t of e.startState.facet(TE)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new jE(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,WE)}static selection(e){return new jE(void 0,WE,void 0,void 0,e)}}function _E(e,t,n,r){let i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function FE(e,t){return e.length?t.length?e.concat(t):e:t}const WE=[],zE=200;function HE(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-zE));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),_E(e,e.length-1,1e9,n.setSelAfter(r)))}return[jE.selection([t])]}function VE(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function qE(e,t){if(!e.length)return e;let n=e.length,r=WE;for(;n;){let i=UE(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[jE.selection(r)]:WE}function UE(e,t,n){let r=FE(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):WE,n);if(!e.changes)return jE.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new jE(i,Zp.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const $E=/^(input\.type|delete)($|\.)/;class KE{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new KE(this.done,this.undone):this}addChanges(e,t,n,r,i){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||$E.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,function(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,o)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];o>=t&&i<=s&&(r=!0)}}),r}(s.changes,e.changes))||"input.type.compose"==n)?_E(o,o.length-1,r.minDepth,new jE(e.changes.compose(s.changes),FE(Zp.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,WE)):_E(o,o.length,r.minDepth,e),new KE(o,WE,t,n)}addSelection(e,t,n,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:WE;return i.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(o=i[i.length-1],s=e,o.ranges.length==s.ranges.length&&0===o.ranges.filter((e,t)=>e.empty!=s.ranges[t].empty).length)?this:new KE(HE(this.done,e),this.undone,t,n);var o,s}addMapping(e){return new KE(qE(this.done,e),qE(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:NE.of({side:e,rest:VE(r),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let n=1==r.length?WE:r.slice(0,r.length-1);return i.mapped&&(n=qE(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:NE.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}KE.empty=new KE(WE,WE);const YE=[{key:"Mod-z",run:PE,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:LE,preventDefault:!0},{linux:"Ctrl-Shift-z",run:LE,preventDefault:!0},{key:"Mod-u",run:BE,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:IE,preventDefault:!0}];function GE(e,t){return wp.create(e.ranges.map(t),e.mainIndex)}function XE(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function JE({state:e,dispatch:t},n){let r=GE(e.selection,n);return!r.eq(e.selection,!0)&&(t(XE(e,r)),!0)}function QE(e,t){return wp.cursor(t?e.to:e.from)}function ZE(e,t){return JE(e,n=>n.empty?e.moveByChar(n,t):QE(n,t))}function eC(e){return e.textDirectionAt(e.state.selection.main.head)==Wg.LTR}const tC=e=>ZE(e,!eC(e)),nC=e=>ZE(e,eC(e));function rC(e,t){return JE(e,n=>n.empty?e.moveByGroup(n,t):QE(n,t))}function iC(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function oC(e,t,n){let r,i,o=Jk(e).resolveInner(t.head),s=n?qx.closedBy:qx.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;iC(e,t,s)?o=t:r=n?t.to:t.from}return i=o.type.prop(s)&&(r=n?hE(e,o.from,1):hE(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,wp.cursor(i,n?-1:1)}function sC(e,t){return JE(e,n=>{if(!n.empty)return QE(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const aC=e=>sC(e,!1),lC=e=>sC(e,!0);function cC(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(Xy.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function hC(e,t){let n,r=cC(e),{state:i}=e,o=GE(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):QE(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=Xy.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(XE(i,o),{effects:n}),!0}const uC=e=>hC(e,!1),dC=e=>hC(e,!0);function fC(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=wp.cursor(r.from+n))}return i}function pC(e,t){let n=GE(e.state.selection,e=>{let n=t(e);return wp.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(XE(e.state,n)),!0)}function mC(e,t){return pC(e,n=>e.moveByChar(n,t))}const gC=e=>mC(e,!eC(e)),vC=e=>mC(e,eC(e));function bC(e,t){return pC(e,n=>e.moveByGroup(n,t))}function yC(e,t){return pC(e,n=>e.moveVertically(n,t))}const wC=e=>yC(e,!1),xC=e=>yC(e,!0);function kC(e,t){return pC(e,n=>e.moveVertically(n,t,cC(e).height))}const SC=e=>kC(e,!1),EC=e=>kC(e,!0),CC=({state:e,dispatch:t})=>(t(XE(e,{anchor:0})),!0),OC=({state:e,dispatch:t})=>(t(XE(e,{anchor:e.doc.length})),!0),NC=({state:e,dispatch:t})=>(t(XE(e,{anchor:e.selection.main.anchor,head:0})),!0),AC=({state:e,dispatch:t})=>(t(XE(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function TC(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(XE(n,wp.create(i,i.length-1))),!0)}function MC(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=RC(e,s,!1)):s>i&&(n="delete.forward",s=RC(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=RC(e,i,!1),o=RC(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:wp.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Xy.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function RC(e,t,n){if(e instanceof Xy)for(let r of e.state.facet(Xy.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}const DC=(e,t,n)=>MC(e,r=>{let i,o,s=r.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(i=l.text.slice(0,s-l.from))){if("\t"==i[i.length-1])return s-1;let e=Mm(i,a.tabSize)%hS(a)||hS(a);for(let t=0;t<e&&" "==i[i.length-1-t];t++)s--;o=s}else o=op(l.text,s-l.from,t,t)+l.from,o==s&&l.number!=(t?a.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(o-l.from,s-l.from))&&(o=op(l.text,o-l.from,!1,!1)+l.from);return o}),PC=e=>DC(e,!1,!0),LC=e=>DC(e,!0,!1),BC=(e,t)=>MC(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=op(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&r==n.head||(e=c),r=a}return r}),IC=e=>BC(e,!1);function jC(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function _C(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of jC(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)i.push(wp.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)i.push(wp.range(e.anchor-s,e.head-s))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:wp.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function FC(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of jC(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const WC=HC(!1),zC=HC(!0);function HC(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=Jk(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(qx.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(i.to,o.from))?{from:i.to,to:o.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new fS(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=dS(a,r);for(null==l&&(l=Mm(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?({from:r,to:i}=s):r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let c=["",uS(t,l)];return s&&c.push(uS(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:Gf.of(c)},range:wp.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function VC(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:wp.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const qC=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(VC(e,(t,n)=>{n.push({from:t.from,insert:e.facet(cS)})}),{userEvent:"input.indent"})),!0),UC=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(VC(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Mm(r,e.tabSize),o=0,s=uS(e,Math.max(0,i-hS(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),$C=[{key:"Ctrl-b",run:tC,shift:gC,preventDefault:!0},{key:"Ctrl-f",run:nC,shift:vC},{key:"Ctrl-p",run:aC,shift:wC},{key:"Ctrl-n",run:lC,shift:xC},{key:"Ctrl-a",run:e=>JE(e,t=>wp.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>pC(e,t=>wp.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>JE(e,t=>wp.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>pC(e,t=>wp.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:LC},{key:"Ctrl-h",run:PC},{key:"Ctrl-k",run:e=>MC(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:IC},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Gf.of(["",""])},range:wp.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:op(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:op(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:wp.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:dC}],KC=[{key:"ArrowLeft",run:tC,shift:gC,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>rC(e,!eC(e)),shift:e=>bC(e,!eC(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>JE(e,t=>fC(e,t,!eC(e))),shift:e=>pC(e,t=>fC(e,t,!eC(e))),preventDefault:!0},{key:"ArrowRight",run:nC,shift:vC,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>rC(e,eC(e)),shift:e=>bC(e,eC(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>JE(e,t=>fC(e,t,eC(e))),shift:e=>pC(e,t=>fC(e,t,eC(e))),preventDefault:!0},{key:"ArrowUp",run:aC,shift:wC,preventDefault:!0},{mac:"Cmd-ArrowUp",run:CC,shift:NC},{mac:"Ctrl-ArrowUp",run:uC,shift:SC},{key:"ArrowDown",run:lC,shift:xC,preventDefault:!0},{mac:"Cmd-ArrowDown",run:OC,shift:AC},{mac:"Ctrl-ArrowDown",run:dC,shift:EC},{key:"PageUp",run:uC,shift:SC},{key:"PageDown",run:dC,shift:EC},{key:"Home",run:e=>JE(e,t=>fC(e,t,!1)),shift:e=>pC(e,t=>fC(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:CC,shift:NC},{key:"End",run:e=>JE(e,t=>fC(e,t,!0)),shift:e=>pC(e,t=>fC(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:OC,shift:AC},{key:"Enter",run:WC,shift:WC},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:PC,shift:PC,preventDefault:!0},{key:"Delete",run:LC,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:IC,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>BC(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>MC(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>MC(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat($C.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),YC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>JE(e,t=>oC(e.state,t,!eC(e))),shift:e=>pC(e,t=>oC(e.state,t,!eC(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>JE(e,t=>oC(e.state,t,eC(e))),shift:e=>pC(e,t=>oC(e.state,t,eC(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>_C(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>FC(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>_C(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>FC(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>TC(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>TC(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=wp.create([n.main]):n.main.empty||(r=wp.create([wp.cursor(n.main.head)])),!!r&&(t(XE(e,r)),!0)}},{key:"Mod-Enter",run:zC},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=jC(e).map(({from:t,to:n})=>wp.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:wp.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=GE(e.selection,t=>{let n=Jk(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return wp.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(XE(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:UC},{key:"Mod-]",run:qC},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new fS(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=VC(e,(t,i,o)=>{let s=dS(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=uS(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(jC(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=GE(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let r=!1,i=GE(e.selection,t=>{let i=hE(e,t.head,-1)||hE(e,t.head,1)||t.head>0&&hE(e,t.head-1,1)||t.head<e.doc.length&&hE(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let o=i.start.from==t.head?i.end.to:i.end.from;return n?wp.range(t.anchor,o):wp.cursor(o)});return!!r&&(t(XE(e,i)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=SE(e.state,n.from);return r.line?wE(e):!!r.block&&kE(e)}},{key:"Alt-A",run:xE},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(KC),GC={key:"Tab",run:qC,shift:UC},XC="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class JC{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(XC(e)):XC,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return sp(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ap(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=lp(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&e<t.length&&t.charCodeAt(e)==o&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(JC.prototype[Symbol.iterator]=function(){return this});const QC={from:-1,to:-1,match:/.*/.exec("")},ZC="gm"+(null==/x/.unicode?"":"u");class eO{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=QC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new rO(e,t,n,r,i);this.re=new RegExp(t,ZC+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=iO(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=iO(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const tO=new WeakMap;class nO{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=tO.get(e);if(!r||r.from>=n||r.to<=t){let r=new nO(t,e.sliceString(t,n));return tO.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),tO.set(e,new nO(o,i)),new nO(t,i.slice(t-o,n-o))}}class rO{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=QC,this.matchPos=iO(e,r),this.re=new RegExp(t,ZC+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=nO.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=iO(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function iO(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(eO.prototype[Symbol.iterator]=rO.prototype[Symbol.iterator]=function(){return this});const oO={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},sO=Sp.define({combine:e=>dm(e,oO,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});const aO=ug.mark({class:"cm-selectionMatch"}),lO=ug.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function cO(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==am.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==am.Word)}const hO=Ev.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(sO),{state:n}=e,r=n.selection;if(r.ranges.length>1)return ug.none;let i,o=r.main,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return ug.none;let e=n.wordAt(o.head);if(!e)return ug.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return ug.none;if(t.wholeWords){if(i=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!cO(s,n,o.from,o.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==am.Word&&e(t.sliceDoc(r-1,r))==am.Word}(s,n,o.from,o.to))return ug.none}else if(i=n.sliceDoc(o.from,o.to),!i)return ug.none}let a=[];for(let r of e.visibleRanges){let e=new JC(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||cO(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?a.push(lO.range(r,i)):(r>=o.to||i<=o.from)&&a.push(aO.range(r,i)),a.length>t.maxMatches))return ug.none}}return ug.set(a)}},{decorations:e=>e.decorations}),uO=Xy.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const dO=Sp.define({combine:e=>dm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new zO(e),scrollToMatch:e=>Xy.scrollIntoView(e)})});class fO{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,ZC),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new wO(this):new gO(this)}getCursor(e,t=0,n){let r=e.doc?e:um.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?vO(this,r,t,n):mO(this,r,t,n)}}class pO{constructor(e){this.spec=e}}function mO(e,t,n,r){let i;return e.wholeWord&&(i=function(e,t){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=e.sliceString(o,Math.min(e.length,r+2))),!(t(bO(i,n-o))==am.Word&&t(yO(i,n-o))==am.Word||t(yO(i,r-o))==am.Word&&t(bO(i,r-o))==am.Word))}(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=function(e,t,n){return(r,i,o,s)=>{if(n&&!n(r,i,o,s))return!1;let a=r>=s&&i<=s+o.length?o.slice(r-s,i-s):t.doc.sliceString(r,i);return e(a,t,r,i)}}(e.test,t,i)),new JC(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}class gO extends pO{constructor(e){super(e)}nextMatch(e,t,n){let r=mO(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=mO(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=mO(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=mO(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=mO(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function vO(e,t,n,r){let i;var o;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),i=(e,t,n)=>!n[0].length||(o(bO(n.input,n.index))!=am.Word||o(yO(n.input,n.index))!=am.Word)&&(o(yO(n.input,n.index+n[0].length))!=am.Word||o(bO(n.input,n.index+n[0].length))!=am.Word)),e.test&&(i=function(e,t,n){return(r,i,o)=>(!n||n(r,i,o))&&e(o[0],t,r,i)}(e.test,t,i)),new eO(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function bO(e,t){return e.slice(op(e,t,!1),t)}function yO(e,t){return e.slice(t,op(e,t))}class wO extends pO{nextMatch(e,t,n){let r=vO(this.spec,e,n,e.doc.length).next();return r.done&&(r=vO(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=vO(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=vO(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=vO(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const xO=Zp.define(),kO=Zp.define(),SO=Mp.define({create:e=>new EO(BO(e).create(),null),update(e,t){for(let n of t.effects)n.is(xO)?e=new EO(n.value.create(),e.panel):n.is(kO)&&(e=new EO(e.query,n.value?LO:null));return e},provide:e=>fx.from(e,e=>e.panel)});class EO{constructor(e,t){this.query=e,this.panel=t}}const CO=ug.mark({class:"cm-searchMatch"}),OO=ug.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NO=Ev.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(SO))}update(e){let t=e.state.field(SO);(t!=e.startState.field(SO)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return ug.none;let{view:n}=this,r=new ym;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?OO:CO)})}return r.finish()}},{decorations:e=>e.decorations});function AO(e){return t=>{let n=t.state.field(SO,!1);return n&&n.query.spec.valid?e(t,n):_O(t)}}const TO=AO((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=wp.single(r.from,r.to),o=e.state.facet(dO);return e.dispatch({selection:i,effects:[UO(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),jO(e),!0}),MO=AO((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=wp.single(i.from,i.to),s=e.state.facet(dO);return e.dispatch({selection:o,effects:[UO(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jO(e),!0}),RO=AO((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:wp.create(n.map(e=>wp.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),DO=AO((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s,a,l=o,c=[],h=[];l.from==r&&l.to==i&&(a=n.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=t.nextMatch(n,l.from,l.to),h.push(Xy.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=e.state.changes(c);return l&&(s=wp.single(l.from,l.to).map(u),h.push(UO(e,l)),h.push(n.facet(dO).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:h,userEvent:"input.replace"}),!0}),PO=AO((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Xy.announce.of(r),userEvent:"input.replace.all"}),!0});function LO(e){return e.state.facet(dO).createPanel(e)}function BO(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(dO);return new fO({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function IO(e){let t=cx(e,LO);return t&&t.dom.querySelector("[main-field]")}function jO(e){let t=IO(e);t&&t==e.root.activeElement&&t.select()}const _O=e=>{let t=e.state.field(SO,!1);if(t&&t.panel){let n=IO(e);if(n&&n!=e.root.activeElement){let r=BO(e.state,t.query.spec);r.valid&&e.dispatch({effects:xO.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[kO.of(!0),t?xO.of(BO(e.state,t.query.spec)):Zp.appendConfig.of(KO)]});return!0},FO=e=>{let t=e.state.field(SO,!1);if(!t||!t.panel)return!1;let n=cx(e,LO);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:kO.of(!1)}),!0},WO=[{key:"Mod-f",run:_O,scope:"editor search-panel"},{key:"F3",run:TO,shift:MO,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:TO,shift:MO,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:FO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new JC(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(wp.range(t.value.from,t.value.to))}return t(e.update({selection:wp.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=px(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i)return void e.dispatch({effects:r});let o=t.doc.lineAt(t.selection.main.head),[,s,a,l,c]=i,h=l?+l.slice(1):0,u=a?+a:o.number;if(a&&c){let e=u/100;s&&(e=e*("-"==s?-1:1)+o.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else a&&s&&(u=u*("-"==s?-1:1)+o.number);let d=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),f=wp.cursor(d.from+Math.max(0,Math.min(h,d.length)));e.dispatch({effects:[r,Xy.scrollIntoView(f.from,{y:"center"})],selection:f})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=wp.create(n.ranges.map(t=>e.wordAt(t.head)||wp.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new JC(e.doc,t,r[r.length-1].to);;){if(i.next(),!i.done){if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(n)return null;i=new JC(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(wp.range(i.from,i.to),!1),effects:Xy.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class zO{constructor(e){this.view=e;let t=this.query=e.state.field(SO).query.spec;function n(e,t,n){return qm("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=qm("input",{value:t.search,placeholder:HO(e,"Find"),"aria-label":HO(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=qm("input",{value:t.replace,placeholder:HO(e,"Replace"),"aria-label":HO(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=qm("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=qm("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=qm("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=qm("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>TO(e),[HO(e,"next")]),n("prev",()=>MO(e),[HO(e,"previous")]),n("select",()=>RO(e),[HO(e,"all")]),qm("label",null,[this.caseField,HO(e,"match case")]),qm("label",null,[this.reField,HO(e,"regexp")]),qm("label",null,[this.wordField,HO(e,"by word")]),...e.state.readOnly?[]:[qm("br"),this.replaceField,n("replace",()=>DO(e),[HO(e,"replace")]),n("replaceAll",()=>PO(e),[HO(e,"replace all")])],qm("button",{name:"close",onclick:()=>FO(e),"aria-label":HO(e,"close"),type:"button"},["×"])])}commit(){let e=new fO({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:xO.of(e)}))}keydown(e){var t,n,r;t=this.view,n=e,r="search-panel",hw(sw(t.state),n,t,r)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?MO:TO)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),DO(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(xO)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(dO).top}}function HO(e,t){return e.state.phrase(t)}const VO=30,qO=/[\s\.,:;?!]/;function UO(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-VO),s=Math.min(i,n+VO),a=e.state.sliceDoc(o,s);if(o!=r.from)for(let e=0;e<VO;e++)if(!qO.test(a[e+1])&&qO.test(a[e])){a=a.slice(e);break}if(s!=i)for(let e=a.length-1;e>a.length-VO;e--)if(!qO.test(a[e-1])&&qO.test(a[e])){a=a.slice(0,e);break}return Xy.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const $O=Xy.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),KO=[SO,Ip.low(NO),$O];class YO{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Jk(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(ZO(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function GO(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function XO(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=GO(t)+GO(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}class JO{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function QO(e){return e.selection.main.from}function ZO(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const eN=Xp.define();function tN(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:wp.cursor(a.from+o+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const nN=new WeakMap;function rN(e){if(!Array.isArray(e))return e;let t=nN.get(e);return t||nN.set(e,t=XO(e)),t}const iN=Zp.define(),oN=Zp.define();class sN{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=sp(e,t),r=lp(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(sp(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=sp(e,0),i=lp(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=sp(e,i);o!=t[l]&&o!=n[l]||(r[l++]=i),i+=lp(o)}if(l<a)return null}let c=0,h=0,u=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&h<a;){let l=sp(e,r);s<0&&(c<a&&l==t[c]&&(i[c++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let b,y=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(b=ap(l))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!r||1==y&&m||0==v&&0!=y)&&(t[h]==l||n[h]==l&&(u=!0)?o[h++]=r:o.length&&(g=!1)),v=y,r+=lp(l)}return h==a&&0==o[0]&&g?this.result((u?-200:0)-100,o,e):d==a&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[f,p]):h==a?this.result((u?-200:0)-100-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?lp(sp(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class aN{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const lN=Sp.define({combine:e=>dm(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hN,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>cN(e(n),t(n)),optionClass:(e,t)=>n=>cN(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function cN(e,t){return e?t?e+" "+t:e:t}function hN(e,t,n,r,i,o){let s,a,l=e.textDirection==Wg.RTL,c=l,h=!1,u="top",d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(c&&d<Math.min(p,f)?c=!1:!c&&f<Math.min(p,d)&&(c=!0),p<=(c?d:f))s=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,a=Math.min(400,c?d:f);else{h=!0,a=Math.min(400,(l?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${a/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":c?"left":"right")}}function uN(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class dN{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(lN);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=uN(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t,i=n.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]<r.length)return this.applyCompletion(e,r[+t[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(lN).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:oN.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=uN(i.length,o,e.state.facet(lN).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=uN(t.options.length,t.selected,this.view.state.facet(lN).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>wv(this.view.state,e,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):r--;return t&&function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(lN).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=i&&(o>n.from||0==n.from))if(i=e,"string"!=typeof l&&l.header)r.appendChild(l.header(l));else{r.appendChild(document.createElement("completion-section")).textContent=e}}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function fN(e,t){return n=>new dN(n,e,t)}function pN(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class mN{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new mN(this.options,yN(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(lN);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new JO(t,r.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(r.from,r.to),l=s.filterStrict?new aN(a):new sN(a);for(let t of r.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new JO(t,r.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(a,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,c=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):pN(e.completion)>pN(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(lN).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new mN(s,yN(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:AN,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new mN(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new mN(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class gN{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new gN(wN,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(lN),r=(n.override||t.languageDataAt("autocomplete",QO(t)).map(rN)).map(t=>(this.active.find(e=>e.source==t)||new kN(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(EN));i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=mN.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new kN(e.source,0):e));for(let t of e.effects)t.is(CN)&&(i=i&&i.setSelected(t.value,this.id));return r==this.active&&i==this.open?this:new gN(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vN:bN}}const vN={"aria-autocomplete":"list"},bN={};function yN(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const wN=[];function xN(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(eN);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class kN{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=xN(e,t),r=this;(8&n||16&n&&this.touches(e))&&(r=new kN(r.source,0)),4&n&&0==r.state&&(r=new kN(this.source,1)),r=r.updateFor(e,n);for(let t of e.effects)if(t.is(iN))r=new kN(r.source,1,t.value);else if(t.is(oN))r=new kN(r.source,0);else if(t.is(EN))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(QO(e.state))}}class SN extends kN{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=QO(e.state);if(s>o||!r||2&t&&(QO(e.startState)==this.from||s<this.limit))return new kN(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):ZO(e,!0).test(i)}(r.validFor,e.state,i,o)?new SN(this.source,this.explicit,a,r,i,o):r.update&&(r=r.update(r,i,o,new YO(e.state,s,!1)))?new SN(this.source,this.explicit,a,r,r.from,null!==(n=r.to)&&void 0!==n?n:QO(e.state)):new kN(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new SN(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new kN(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const EN=Zp.define({map:(e,t)=>e.map(e=>e.map(t))}),CN=Zp.define(),ON=Mp.define({create:()=>gN.start(),update:(e,t)=>e.update(t),provide:e=>[Zw.from(e,e=>e.tooltip),Xy.contentAttributes.from(e,e=>e.attrs)]});function NN(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(ON).active.find(e=>e.source==t.source);return r instanceof SN&&("string"==typeof n?e.dispatch({...tN(e.state,n,r.from,r.to),annotations:eN.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}const AN=fN(ON,NN);function TN(e,t="option"){return n=>{let r=n.state.field(ON,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(lN).interactionDelay)return!1;let i,o=1;"page"==t&&(i=sx(n,r.open.tooltip))&&(o=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,a=r.open.selected>-1?r.open.selected+o*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:CN.of(a)}),!0}}const MN=e=>!!e.state.field(ON,!1)&&(e.dispatch({effects:iN.of(!0)}),!0);class RN{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const DN=Ev.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(ON).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(ON),n=e.state.facet(lN);if(!e.selectionSet&&!e.docChanged&&e.startState.field(ON)==t)return;let r=e.transactions.some(e=>{let t=xN(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){wv(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(iN)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(ON);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(lN).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=QO(t),r=new YO(t,n,e.explicit,this.view),i=new RN(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:oN.of(null)}),wv(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(lN).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(lN),r=this.view.state.field(ON);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=QO(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+(o.active.explicit?0:1)),s=new SN(o.active.source,o.active.explicit,i,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new kN(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:EN.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(ON,!1);if(t&&t.tooltip&&this.view.state.facet(lN).closeOnBlur){let n=t.open&&sx(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:oN.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:iN.of(!1)}),20),this.composing=0}}}),PN="object"==typeof navigator&&/Win/.test(navigator.platform),LN=Ip.highest(Xy.domEventHandlers({keydown(e,t){let n=t.state.field(ON,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!PN||!e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&NN(t,r),!1}})),BN=Xy.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),IN={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},jN=Zp.define({map(e,t){let n=t.mapPos(e,-1,hp.TrackAfter);return null==n?void 0:n}}),_N=new class extends fm{};_N.startSide=1,_N.endSide=-1;const FN=Mp.define({create:()=>bm.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(jN)&&(e=e.update({add:[_N.range(n.value,n.value+1)]}));return e}});const WN="()[]{}<>«»»«[]{}";function zN(e){for(let t=0;t<16;t+=2)if(WN.charCodeAt(t)==e)return WN.charAt(t+1);return ap(e<128?e:e+1)}function HN(e,t){return e.languageDataAt("closeBrackets",t)[0]||IN}const VN="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),qN=Xy.inputHandler.of((e,t,n,r)=>{if((VN?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==lp(sp(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=HN(e,e.selection.main.head),r=n.brackets||IN.brackets;for(let i of r){let o=zN(sp(i,0));if(t==i)return o==i?XN(e,i,r.indexOf(i+i+i)>-1,n):YN(e,i,o,n.before||IN.before);if(t==o&&$N(e,e.selection.main.from))return GN(e,i,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),UN=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=HN(e,e.selection.main.head).brackets||IN.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return lp(sp(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&KN(e.doc,t.head)==zN(sp(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:wp.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function $N(e,t){let n=!1;return e.field(FN).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function KN(e,t){let n=e.sliceString(t,t+2);return n.slice(0,lp(sp(n,0)))}function YN(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:jN.of(o.to+t.length),range:wp.range(o.anchor+t.length,o.head+t.length)};let s=KN(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:jN.of(o.head+t.length),range:wp.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function GN(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&KN(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:wp.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function XN(e,t,n,r){let i=r.stringPrefixes||IN.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:jN.of(r.to+t.length),range:wp.range(r.anchor+t.length,r.head+t.length)};let s,a=r.head,l=KN(e.doc,a);if(l==t){if(JN(e,a))return{changes:{insert:t+t,from:a},effects:jN.of(a+t.length),range:wp.cursor(a+t.length)};if($N(e,a)){let r=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+r.length,insert:r},range:wp.cursor(a+r.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=QN(e,a-2*t.length,i))>-1&&JN(e,s))return{changes:{insert:t+t+t+t,from:a},effects:jN.of(a+t.length),range:wp.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=am.Word&&QN(e,a,i)>-1&&!function(e,t,n,r){let i=Jk(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,a,t,i))return{changes:{insert:t+t,from:a},effects:jN.of(a+t.length),range:wp.cursor(a+t.length)}}return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function JN(e,t){let n=Jk(e).resolveInner(t+1);return n.parent&&n.from==t}function QN(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=am.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=am.Word)return n}return-1}const ZN=[{key:"Ctrl-Space",run:MN},{mac:"Alt-`",run:MN},{mac:"Alt-i",run:MN},{key:"Escape",run:e=>{let t=e.state.field(ON,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:oN.of(null)}),!0)}},{key:"ArrowDown",run:TN(!0)},{key:"ArrowUp",run:TN(!1)},{key:"PageDown",run:TN(!0,"page")},{key:"PageUp",run:TN(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(ON,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(lN).interactionDelay)&&NN(e,t.open.options[t.open.selected])}}],eA=Ip.highest(iw.computeN([lN],e=>e.facet(lN).defaultKeymap?[ZN]:[]));class tA{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class nA{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(pA).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new ym,s=[],a=0,l=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>h)break;n=r.to,s.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from!=t||!(r.to>r.from||r.to==t)){n=Math.min(r.from,n);break}s.push(r),e++,n=Math.min(r.to,n)}n=Math.min(n,h);let u=!1;if(s.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=EA(s);if(u)o.add(t,t,ug.widget({widget:new bA(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");o.add(t,n,ug.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if(a=n,a==h)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let u=o.finish();return new nA(u,t,rA(u))}}function rA(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(r){if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new tA(r.from,n,r.diagnostic)}else r=new tA(e,n,t||i.diagnostics[0])}),r}function iA(e,t){return e.field(lA,!1)?t:t.concat(Zp.appendConfig.of(CA))}const oA=Zp.define(),sA=Zp.define(),aA=Zp.define(),lA=Mp.define({create:()=>new nA(ug.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=rA(n,e.selected.diagnostic,i)||rA(n,null,i)}!n.size&&i&&t.state.facet(pA).autoPanel&&(i=null),e=new nA(n,i,r)}for(let n of t.effects)if(n.is(oA)){let r=t.state.facet(pA).autoPanel?n.value.length?wA.open:null:e.panel;e=nA.init(n.value,r,t.state)}else n.is(sA)?e=new nA(e.diagnostics,n.value?wA.open:null,e.selected):n.is(aA)&&(e=new nA(e.diagnostics,e.panel,n.value));return e},provide:e=>[fx.from(e,e=>e.panel),Xy.decorations.from(e,e=>e.diagnostics)]}),cA=ug.mark({class:"cm-lintRange cm-lintRange-active"});function hA(e,t,n){let r,{diagnostics:i}=e.state.field(lA),o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(e,i,{spec:a})=>{if(t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t<i||n<0)))return r=a.diagnostics,o=e,s=i,!1});let a=e.state.facet(pA).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:uA(e,r)})}:null}function uA(e,t){return qm("ul",{class:"cm-tooltip-lint"},t.map(t=>vA(e,t,!1)))}const dA=e=>{let t=e.state.field(lA,!1);return!(!t||!t.panel)&&(e.dispatch({effects:sA.of(!1)}),!0)},fA=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(lA,!1);t&&t.panel||e.dispatch({effects:iA(e.state,[sA.of(!0)])});let n=cx(e,wA.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(lA,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!(!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],pA=Sp.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...dm(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:mA,tooltipFilter:mA,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function mA(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function gA(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function vA(e,t,n){var r;let i=n?gA(t.actions):[];return qm("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},qm("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=rA(e.state.field(lA).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,c=l<0?a:[a.slice(0,l),qm("u",a.slice(l,l+1)),a.slice(l+1)];return qm("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&qm("div",{class:"cm-diagnosticSource"},t.source))}class bA extends cg{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return qm("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class yA{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=vA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class wA{constructor(e){this.view=e,this.items=[];this.list=qm("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)dA(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],r=gA(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=rA(this.view.state.field(lA).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=qm("div",{class:"cm-panel-lint"},this.list,qm("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>dA(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(lA).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(lA),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new yA(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),i=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new yA(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=rA(this.view.state.field(lA).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:aA.of(t)})}static open(e){return new wA(e)}}function xA(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const kA=Xy.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:xA("#d11")},".cm-lintRange-warning":{backgroundImage:xA("orange")},".cm-lintRange-info":{backgroundImage:xA("#999")},".cm-lintRange-hint":{backgroundImage:xA("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function SA(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function EA(e){let t="hint",n=1;for(let r of e){let e=SA(r.severity);e>n&&(n=e,t=r.severity)}return t}const CA=[lA,Xy.decorations.compute([lA],e=>{let{selected:t,panel:n}=e.field(lA);return t&&n&&t.from!=t.to?ug.set([cA.range(t.from,t.to)]):ug.none}),ox(hA,{hideOn:function(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(pA).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(oA))&&!e.changes.touchesRange(o.from,Math.max(o.to,r)))}}),kA];var OA=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(UN)),!1!==e.defaultKeymap&&(n=n.concat(YC)),!1!==e.searchKeymap&&(n=n.concat(WO)),!1!==e.historyKeymap&&(n=n.concat(YE)),!1!==e.foldKeymap&&(n=n.concat(BS)),!1!==e.completionKeymap&&(n=n.concat(ZN)),!1!==e.lintKeymap&&(n=n.concat(fA));var r=[];return!1!==e.lineNumbers&&r.push(function(e={}){return[Lx.of(e),Cx(),jx]}()),!1!==e.highlightActiveLineGutter&&r.push(Wx),!1!==e.highlightSpecialChars&&r.push(function(e={}){return[Dw.of(e),Pw||(Pw=Ev.fromClass(class{constructor(e){this.view=e,this.decorations=ug.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Dw)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Nw({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=sp(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=Mm(e.text,t,r-e.from);return ug.replace({widget:new Bw((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ug.replace({widget:new Lw(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Dw);e.startState.facet(Dw)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&r.push(function(e={}){return[RE,ME.of(e),Xy.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?PE:"historyRedo"==e.inputType?LE:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push(function(e={}){let t={...HS,...e},n=new VS(t,!0),r=new VS(t,!1),i=Ev.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(sS)!=e.state.facet(sS)||e.startState.field(TS,!1)!=e.state.field(TS,!1)||Jk(e.startState)!=Jk(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new ym;for(let i of e.viewportLineBlocks){let o=RS(e.state,i.from,i.to)?r:ES(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,Sx({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||bm.empty},initialSpacer:()=>new VS(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=RS(e.state,t.from,t.to);if(r)return e.dispatch({effects:NS.of(r)}),!0;let i=ES(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:OS.of(i)}),!0)}}}),_S()]}()),!1!==e.drawSelection&&r.push(function(e={}){return[vw.of(e),yw,xw,kw,mv.of(!0)]}()),!1!==e.dropCursor&&r.push([Ew,Cw]),!1!==e.allowMultipleSelections&&r.push(um.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push(um.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=dS(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=uS(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&r.push(GS(QS,{fallback:!0})),!1!==e.bracketMatching&&r.push(function(e={}){return[tE.of(e),sE]}()),!1!==e.closeBrackets&&r.push([qN,FN]),!1!==e.autocompletion&&r.push(function(e={}){return[LN,ON,lN.of(e),DN,eA,BN]}()),!1!==e.rectangularSelection&&r.push(function(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return Xy.mouseSelectionStyle.of((e,n)=>t(n)?zw(e,n):null)}()),!1!==t&&r.push(function(e={}){let[t,n]=Hw[e.key||"Alt"],r=Ev.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,Xy.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?Vw:null})]}()),!1!==e.highlightActiveLine&&r.push(jw),!1!==e.highlightSelectionMatches&&r.push(function(e){let t=[uO,hO];return e&&t.push(sO.of(e)),t}()),e.tabSize&&"number"==typeof e.tabSize&&r.push(cS.of(" ".repeat(e.tabSize))),r.concat([iw.of(n.flat())]).filter(Boolean)};const NA="#e06c75",AA="#abb2bf",TA="#7d8799",MA="#d19a66",RA="#2c313a",DA="#282c34",PA="#353a42",LA="#528bff",BA=[Xy.theme({"&":{color:AA,backgroundColor:DA},".cm-content":{caretColor:LA},".cm-cursor, .cm-dropCursor":{borderLeftColor:LA},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:AA},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:DA,color:TA,border:"none"},".cm-activeLineGutter":{backgroundColor:RA},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:PA},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:PA,borderBottomColor:PA},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:RA,color:AA}}},{dark:!0}),GS(US.define([{tag:qk.keyword,color:"#c678dd"},{tag:[qk.name,qk.deleted,qk.character,qk.propertyName,qk.macroName],color:NA},{tag:[qk.function(qk.variableName),qk.labelName],color:"#61afef"},{tag:[qk.color,qk.constant(qk.name),qk.standard(qk.name)],color:MA},{tag:[qk.definition(qk.name),qk.separator],color:AA},{tag:[qk.typeName,qk.className,qk.number,qk.changed,qk.annotation,qk.modifier,qk.self,qk.namespace],color:"#e5c07b"},{tag:[qk.operator,qk.operatorKeyword,qk.url,qk.escape,qk.regexp,qk.link,qk.special(qk.string)],color:"#56b6c2"},{tag:[qk.meta,qk.comment],color:TA},{tag:qk.strong,fontWeight:"bold"},{tag:qk.emphasis,fontStyle:"italic"},{tag:qk.strikethrough,textDecoration:"line-through"},{tag:qk.link,color:TA,textDecoration:"underline"},{tag:qk.heading,fontWeight:"bold",color:NA},{tag:[qk.atom,qk.bool,qk.special(qk.variableName)],color:MA},{tag:[qk.processingInstruction,qk.string,qk.inserted],color:"#98c379"},{tag:qk.invalid,color:"#ffffff"}]))];var IA=Xy.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),jA=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,a=[];switch(t&&a.unshift(iw.of([GC])),s&&("boolean"==typeof s?a.unshift(OA()):a.unshift(OA(s))),o&&a.unshift(function(e){let t=Ev.fromClass(class{constructor(t){this.view=t,this.placeholder=e?ug.set([ug.widget({widget:new _w(e),side:1}).range(0)]):ug.none}get decorations(){return this.view.state.doc.length?ug.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,Xy.contentAttributes.of({"aria-placeholder":e})]:t}(o)),i){case"light":a.push(IA);break;case"dark":a.push(BA);break;case"none":break;default:a.push(i)}return!1===n&&a.push(Xy.editable.of(!1)),r&&a.push(um.readOnly.of(!0)),[...a]};class _A{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class FA{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var WA=null,zA=Xp.define(),HA=[];function VA(t){var{value:n,selection:r,onChange:i,onStatistics:o,onCreateEditor:s,onUpdate:a,extensions:l=HA,autoFocus:c,theme:h="light",height:u=null,minHeight:d=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:g=null,placeholder:v="",editable:b=!0,readOnly:y=!1,indentWithTab:w=!0,basicSetup:x=!0,root:k,initialState:S}=t,[E,C]=e.useState(),[O,N]=e.useState(),[A,T]=e.useState(),M=e.useState(()=>({current:null}))[0],R=e.useState(()=>({current:null}))[0],D=Xy.theme({"&":{height:u,minHeight:d,maxHeight:f,width:p,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),P=Xy.updateListener.of(e=>{if(e.docChanged&&"function"==typeof i&&!e.transactions.some(e=>e.annotation(zA))){M.current?M.current.reset():(M.current=new _A(()=>{if(R.current){var e=R.current;R.current=null,e()}M.current=null},200),("undefined"==typeof window?new FA:(WA||(WA=new FA),WA)).add(M.current));var t=e.state.doc.toString();i(t,e)}o&&o((e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}))(e))}),L=[P,D,...jA({theme:h,editable:b,readOnly:y,placeholder:v,indentWithTab:w,basicSetup:x})];return a&&"function"==typeof a&&L.push(Xy.updateListener.of(a)),L=L.concat(l),e.useLayoutEffect(()=>{if(E&&!A){var e={doc:n,selection:r,extensions:L},t=S?um.fromJSON(S.json,e,S.fields):um.create(e);if(T(t),!O){var i=new Xy({state:t,parent:E,root:k});N(i),s&&s(i,t)}}return()=>{O&&(T(void 0),N(void 0))}},[E,A]),e.useEffect(()=>{t.container&&C(t.container)},[t.container]),e.useEffect(()=>()=>{O&&(O.destroy(),N(void 0)),M.current&&(M.current.cancel(),M.current=null)},[O]),e.useEffect(()=>{c&&O&&O.focus()},[c,O]),e.useEffect(()=>{O&&O.dispatch({effects:Zp.reconfigure.of(L)})},[h,l,u,d,f,p,m,g,v,b,y,w,x,i,a]),e.useEffect(()=>{if(void 0!==n){var e=O?O.state.doc.toString():"";if(O&&n!==e){var t=()=>{O&&n!==O.state.doc.toString()&&O.dispatch({changes:{from:0,to:O.state.doc.toString().length,insert:n||""},annotations:[zA.of(!0)]})};M.current&&!M.current.isDone?R.current=t:t()}}},[n,O]),{state:A,setState:T,view:O,setView:N,container:E,setContainer:C}}var qA=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],UA=e.forwardRef((n,r)=>{var{className:i,value:o="",selection:s,extensions:a=[],onChange:l,onStatistics:c,onCreateEditor:h,onUpdate:u,autoFocus:d,theme:f="light",height:p,minHeight:m,maxHeight:g,width:v,minWidth:b,maxWidth:y,basicSetup:w,placeholder:x,indentWithTab:k,editable:S,readOnly:E,root:C,initialState:O}=n,N=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(n,qA),A=e.useRef(null),{state:T,view:M,container:R,setContainer:D}=VA({root:C,value:o,autoFocus:d,theme:f,height:p,minHeight:m,maxHeight:g,width:v,minWidth:b,maxWidth:y,basicSetup:w,placeholder:x,indentWithTab:k,editable:S,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:h,onUpdate:u,extensions:a,initialState:O});e.useImperativeHandle(r,()=>({editor:A.current,state:T,view:M}),[A,R,T,M]);var P=e.useCallback(e=>{A.current=e,D(e)},[D]);if("string"!=typeof o)throw new Error("value must be typeof string but got "+typeof o);var L="string"==typeof f?"cm-theme-"+f:"cm-theme";return t.jsx("div",jf({ref:P,className:L+(i?" "+i:"")},N))});UA.displayName="CodeMirror";class $A{constructor(e,t,n,r,i,o,s,a,l,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new $A(e,[],t,n,n,0,[],0,r?new KA(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=i.dynamicPrecedence(r);if(s&&(this.score+=s),0==n)return this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),void this.reduceContext(r,this.reducePos);let a=this.stack.length-3*(n-1)-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let h=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-h;if(r<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,e,u+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=i.getGoto(e,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,t,n,r=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(0==r&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&0==e.buffer[r-4]&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t)return void(e.buffer[r-2]=n)}}if(i&&this.pos!=n){let i=this.buffer.length;if(i>0&&(0!=this.buffer[i-4]||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:o}=this.p;this.pos=r,!o.stateFlag(i,1)&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(i,Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new $A(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new YA(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r,i=0;i<t.length;i+=2)(r=t[i+1])!=this.state&&this.p.parser.hasAction(r,e)&&n.push(t[i],r);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>1&t&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=65535&t,i=this.stack.length-3*n;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-i;if(n>1){let r=65535&t,i=this.stack.length-3*n;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new KA(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class KA{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class YA{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class GA{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new GA(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new GA(this.stack,this.pos,this.index)}}function XA(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,i=0;r<e.length;){let o=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(126==t){o=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),o+=i,n)break;o*=46}n?n[i++]=o:n=new t(o)}return n}class JA{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const QA=new JA;class ZA{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=QA,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,r=this.chunkOff+e;if(r>=0&&r<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(r);else{let r=this.resolveOffset(e,1);if(null==r)return-1;if(t=r,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,r=this.range;for(;r.to<=t;)r=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=QA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class eT{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;0!=(a&e[s]);){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&a)>0){let n=e[r];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||nT(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,c=0,h=e[s+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let i=c+h>>1,o=n+i+(i<<1),a=e[o],l=e[o+1]||65536;if(r<a)h=i;else{if(!(r>=l)){s=e[o+2],t.advance();continue e}c=i+1}}break}s=e[n+3*h-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function tT(e,t,n){for(let r,i=t;65535!=(r=e[i]);i++)if(r==n)return i-t;return-1}function nT(e,t,n,r){let i=tT(n,r,t);return i<0||tT(n,r,e)<i}eT.prototype.contextual=eT.prototype.fallback=eT.prototype.extend=!1,eT.prototype.fallback=eT.prototype.extend=!1;const rT="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let iT=null;function oT(e,t,n){let r=e.cursor(Jx.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class sT{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?oT(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?oT(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof Qx){if(o==e){if(o<this.safeFrom)return null;let e=o+i.length;if(e<=this.safeTo){let t=i.prop(qx.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class aT{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new JA)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let r=0;r<i.length;r++){if(!(1<<r&o))continue;let l=i[r],c=this.tokens[r];if((!n||l.fallback)&&((l.contextual||c.start!=e.pos||c.mask!=o||c.context!=s)&&(this.updateCachedToken(c,l,e),c.mask=o,c.context=s),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let r=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new JA,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new JA,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){1&i?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let e=0;e<2;e++)for(let a=o.stateSlot(i,e?2:1);;a+=3){if(65535==s[a]){if(1!=s[a+1]){0==r&&2==s[a+1]&&(r=this.putAction(dT(s,a+2),t,n,r));break}a=dT(s,a+2)}s[a]==t&&(r=this.putAction(dT(s,a+1),t,n,r))}return r}}class lT{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new ZA(t,r),this.tokens=new aT(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[$A.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>4*e.bufferLength?new sT(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let s=n[o];for(;;){if(this.tokens.mainToken=null,s.pos>r)i.push(s);else{if(this.advanceStack(s,i,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!i.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return this.stackToTree(t);if(this.parser.strict)throw new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(n)return this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort((e,t)=>t.score-e.score);i.length>e;)i.pop();i.some(e=>e.reducePos>r)&&this.recovering--}else if(i.length>1){e:for(let e=0;e<i.length-1;e++){let t=i[e];for(let n=e+1;n<i.length;n++){let r=i[n];if(t.sameState(r)||t.buffer.length>500&&r.buffer.length>500){if(!((t.score-r.score||t.buffer.length-r.buffer.length)>0)){i.splice(e--,1);continue e}i.splice(n--,1)}}}i.length>12&&(i.sort((e,t)=>t.score-e.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this;rT&&this.stackID(e);if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(qx.contextHash)||0)==n))return e.useNode(o,r),!0;if(!(o instanceof Qx)||0==o.children.length||o.positions[0]>0)break;let s=o.children[0];if(!(s instanceof Qx&&0==o.positions[0]))break;o=s}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let i=0;i<s.length;){let o=s[i++],a=s[i++],l=s[i++],c=i==s.length||!n,h=c?e:e.split(),u=this.tokens.mainToken;if(h.apply(o,a,u?u.start:h.pos,l),c)return!0;h.pos>r?t.push(h):n.push(h)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return cT(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=t[o<<1],l=t[1+(o<<1)],c=rT?this.stackID(s)+" -> ":"";if(s.deadEnd){if(i)continue;if(i=!0,s.restart(),this.advanceFully(s,n))continue}let h=s.split(),u=c;for(let e=0;e<10&&h.forceReduce();e++){if(this.advanceFully(h,n))break;rT&&(u=this.stackID(h)+" -> ")}for(let e of s.recoverByInsert(a))this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),cT(s,n)):(!r||r.score<h.score)&&(r=h)}return r}stackToTree(e){return e.close(),Qx.build({buffer:GA.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(iT||(iT=new WeakMap)).get(e);return t||iT.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function cT(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class hT{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class uT extends vk{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=qx[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let o=t[n+-r];for(let s=-r;s>0;s--)i(t[n++],e,o);n++}}}this.nodeSet=new Yx(t.map((t,i)=>Kx.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=zx;let o=XA(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(fT),this.states=XA(e.states,Uint32Array),this.data=XA(e.stateData),this.goto=XA(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new eT(o,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new lT(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],o=1&t,s=r[i++];if(o&&n)return s;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return s;if(o)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i,o=this.stateSlot(e,r?2:1);;o+=3){if(65535==(i=n[o])){if(1!=n[o+1]){if(2==n[o+1])return dT(n,o+2);break}i=n[o=dT(n,o+2)]}if(i==t||0==i)return dT(n,o+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=dT(this.data,n+2)}r=t(dT(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=dT(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(uT.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let i=e.specializers.find(e=>e.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=fT(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,i=this.dialects[t[e]];65535!=(n=this.data[i++]);)(r||(r=new Uint8Array(this.maxTerm+1)))[n]=1;return new hT(e,n,r)}static deserialize(e){return new uT(e)}}function dT(e,t){return e[t]|e[t+1]<<16}function fT(e){if(e.external){let t=e.extend?1:0;return(n,r)=>e.external(n,r)<<1|t}return e.get}const pT=Sk({String:qk.string,Number:qk.number,"True False":qk.bool,PropertyName:qk.propertyName,Null:qk.null,", :":qk.separator,"[ ]":qk.squareBracket,"{ }":qk.brace}),mT=uT.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[pT],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),gT=Xk.define({name:"json",parser:mT.configure({props:[pS.add({Object:wS({except:/^\s*\}/}),Array:wS({except:/^\s*\]/})}),kS.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function vT(e){return bT.apply(this,arguments)}function bT(){return bT=h(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(!(null===(n=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===n?void 0:n.writeText)){e.n=3;break}return e.n=2,navigator.clipboard.writeText(t);case 2:return e.a(2);case 3:(r=document.createElement("textarea")).value=t,r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r);case 4:return e.a(2)}},e)})),bT.apply(this,arguments)}function yT(e){var t=e.value,n=e.title;if(null==t||""===t)return s.createElement("span",null,"-");var r,i=Bf(t),o=i.ok,a=i.pretty,l=i.compact,c=l.length>80?l.slice(0,80)+"…":l;return s.createElement(lf,null,s.createElement(cf,{asChild:!0},s.createElement("button",{type:"button",className:"max-w-xs truncate text-left font-mono text-xs text-muted-foreground hover:underline",title:"点击查看 JSON"},c)),s.createElement(df,{className:"max-w-3xl"},s.createElement(ff,null,s.createElement(mf,null,n||"JSON")),s.createElement("div",{className:"flex items-center justify-end gap-2"},s.createElement(at,{variant:"outline",size:"sm",onClick:(r=h(f().m(function e(){return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,vT(a);case 1:Fa.success("已复制 JSON"),e.n=3;break;case 2:e.p=2,e.v,Fa.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return r.apply(this,arguments)})},"复制")),s.createElement("pre",{className:"max-h-[60vh] overflow-auto rounded-md bg-muted p-3 text-xs font-mono whitespace-pre"},a),!o&&s.createElement("div",{className:"text-xs text-destructive"},i.ok?"":i.message)))}function wT(e){e.id;var t=e.value;e.required;var n,r=e.onChange,i=m(s.useState(null),2),o=i[0],a=i[1];return s.createElement("div",{className:"space-y-2"},s.createElement("div",{className:"flex items-center justify-end gap-2"},s.createElement(at,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=(t||"").trim();if(e){var n=If(e,2);n.ok?(r(n.formatted),a(null)):a(n.message)}}},"格式化"),s.createElement(at,{type:"button",variant:"outline",size:"sm",onClick:(n=h(f().m(function e(){return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,vT(t||"");case 1:Fa.success("已复制"),e.n=3;break;case 2:e.p=2,e.v,Fa.error("复制失败");case 3:return e.a(2)}},e,null,[[0,2]])})),function(){return n.apply(this,arguments)})},"复制")),s.createElement("div",{className:"rounded-md border bg-background"},s.createElement(UA,{value:t||"",height:"220px",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},extensions:[new aS(gT)],onChange:function(e){r(e),function(e){var t=(e||"").trim();if(!t)return a(null),!0;var n=Bf(t);n.ok?a(null):a(n.message)}(e)}})),o&&s.createElement("div",{className:"text-xs text-destructive"},o))}var xT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("div",{className:"relative w-full overflow-auto"},s.createElement("table",Object.assign({ref:t,className:qe("w-full caption-bottom text-sm",n)},r)))});xT.displayName="Table";var kT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("thead",Object.assign({ref:t,className:qe("[&_tr]:border-b",n)},r))});kT.displayName="TableHeader";var ST=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("tbody",Object.assign({ref:t,className:qe("[&_tr:last-child]:border-0",n)},r))});ST.displayName="TableBody";var ET=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("tfoot",Object.assign({ref:t,className:qe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n)},r))});ET.displayName="TableFooter";var CT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("tr",Object.assign({ref:t,className:qe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n)},r))});CT.displayName="TableRow";var OT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("th",Object.assign({ref:t,className:qe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n)},r))});OT.displayName="TableHead";var NT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("td",Object.assign({ref:t,className:qe("p-4 align-middle [&:has([role=checkbox])]:pr-0",n)},r))});NT.displayName="TableCell";var AT=s.forwardRef(function(e,t){var n=e.className,r=G(e,["className"]);return s.createElement("caption",Object.assign({ref:t,className:qe("mt-4 text-sm text-muted-foreground",n)},r))});AT.displayName="TableCaption";var TT=ot("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function MT(e){var t=e.className,n=e.variant,r=G(e,["className","variant"]);return s.createElement("div",Object.assign({className:qe(TT({variant:n}),t)},r))}function RT(){return"".concat(Date.now(),"_").concat(Math.random().toString(16).slice(2))}function DT(e){return"integer"===e||"float"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"大于"},{value:"gte",label:"大于等于"},{value:"lt",label:"小于"},{value:"lte",label:"小于等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]:"boolean"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"isNull",label:"为空(NULL)"}]:"date"===e||"datetime"===e?[{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"gt",label:"晚于/大于"},{value:"gte",label:"晚于等于/大于等于"},{value:"lt",label:"早于/小于"},{value:"lte",label:"早于等于/小于等于"},{value:"isNull",label:"为空(NULL)"}]:[{value:"contains",label:"包含"},{value:"startsWith",label:"开头是"},{value:"endsWith",label:"结尾是"},{value:"eq",label:"等于"},{value:"neq",label:"不等于"},{value:"in",label:"属于(多个)"},{value:"isNull",label:"为空(NULL)"}]}function PT(t){var n,r,i=e.useMemo(function(){var e=[];e.push.apply(e,g([{column:"id",label:"ID",type:"id"},{column:"created_at",label:"创建时间",type:"datetime"},{column:"updated_at",label:"更新时间",type:"datetime"}]));var n,r=u(t.fields||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if((null==i?void 0:i.name)&&("json"!==i.type&&"jsonb"!==i.type))if("relation"===i.type&&i.relation){var o=i.relation.foreignKey||"".concat(i.relation.target,"_id");e.push({column:o,label:"".concat(i.comment||i.name,"(关联)"),type:"relation"})}else e.push({column:i.name,label:i.comment||i.name,type:i.type})}}catch(e){r.e(e)}finally{r.f()}var s=new Set;return e.filter(function(e){return!s.has(e.column)&&(s.add(e.column),!0)})},[t.fields]),o=e.useMemo(function(){return new Map(i.map(function(e){return[e.column,e]}))},[i]),s=e.useMemo(function(){return new Map(i.map(function(e){return[e.column,e.type]}))},[i]),a=m(e.useState([]),2),l=a[0],c=a[1];e.useEffect(function(){c(function(e,t){return(e||[]).map(function(e){if(t.get(e.column),"is"===e.operator&&(null===e.value||"null"===e.value))return{id:RT(),column:e.column,operator:"isNull",value:""};if(("ilike"===e.operator||"like"===e.operator)&&"string"==typeof e.value){var n=e.value;if(n.startsWith("%")&&n.endsWith("%")&&n.length>=2)return{id:RT(),column:e.column,operator:"contains",value:n.slice(1,-1)};if(n.endsWith("%"))return{id:RT(),column:e.column,operator:"startsWith",value:n.slice(0,-1)};if(n.startsWith("%"))return{id:RT(),column:e.column,operator:"endsWith",value:n.slice(1)}}if("in"===e.operator){var r=Array.isArray(e.value)?e.value:[];return{id:RT(),column:e.column,operator:"in",value:r.join(",")}}return{id:RT(),column:e.column,operator:["eq","neq","gt","gte","lt","lte"].includes(e.operator)?e.operator:"eq",value:void 0===e.value||null===e.value?"":String(e.value)}})}(t.value||[],s))},[JSON.stringify(t.value),i.length]);var h=function(e,t){c(function(n){return n.map(function(n){var r,i;if(n.id!==e)return n;var s=Object.assign(Object.assign({},n),t);if(t.column&&t.column!==n.column){var a=DT((null===(r=o.get(t.column))||void 0===r?void 0:r.type)||"string");s.operator=(null===(i=a[0])||void 0===i?void 0:i.value)||"eq",s.value=""}return t.operator&&"isNull"===t.operator&&(s.value=""),s})})};return e.createElement("div",{className:"space-y-3"},e.createElement("div",{className:"flex items-center justify-between gap-3"},e.createElement(ya,{className:"text-base font-medium flex items-center gap-2"},e.createElement(R,{className:"h-4 w-4"}),"动态筛选"),e.createElement("div",{className:"flex items-center gap-2"},(null===(n=t.value)||void 0===n?void 0:n.length)>0&&e.createElement(MT,{variant:"secondary"},"已应用 ",t.value.length," 条"),e.createElement(at,{type:"button",variant:"outline",size:"sm",onClick:function(){var e=i[0];if(e){var t=DT(e.type);c(function(n){var r;return[].concat(g(n),[{id:RT(),column:e.column,operator:(null===(r=t[0])||void 0===r?void 0:r.value)||"eq",value:""}])})}}},e.createElement(F,{className:"h-4 w-4 mr-1"}),"添加条件"))),0===l.length?e.createElement("div",{className:"text-sm text-muted-foreground border rounded-lg p-3 bg-muted/20"},"暂无筛选条件(可添加条件后点击“应用”)"):e.createElement("div",{className:"space-y-2"},l.map(function(t){var n=o.get(t.column),r=(null==n?void 0:n.type)||"string",s=DT(r),a="isNull"!==t.operator;return e.createElement("div",{key:t.id,className:"grid grid-cols-12 gap-2 items-center"},e.createElement("div",{className:"col-span-5"},e.createElement(Ld,{value:t.column,onValueChange:function(e){return h(t.id,{column:e})}},e.createElement(Id,{className:"h-10"},e.createElement(Bd,{placeholder:"字段"})),e.createElement(Fd,null,i.map(function(t){return e.createElement(zd,{key:t.column,value:t.column},t.label," (",t.column,")")})))),e.createElement("div",{className:"col-span-3"},e.createElement(Ld,{value:t.operator,onValueChange:function(e){return h(t.id,{operator:e})}},e.createElement(Id,{className:"h-10"},e.createElement(Bd,{placeholder:"操作符"})),e.createElement(Fd,null,s.map(function(t){return e.createElement(zd,{key:t.value,value:t.value},t.label)})))),e.createElement("div",{className:"col-span-3"},a?"boolean"===r?e.createElement(Ld,{value:t.value,onValueChange:function(e){return h(t.id,{value:e})}},e.createElement(Id,{className:"h-10"},e.createElement(Bd,{placeholder:"值"})),e.createElement(Fd,null,e.createElement(zd,{value:"true"},"true"),e.createElement(zd,{value:"false"},"false"))):e.createElement(lt,{className:"h-10",placeholder:"in"===t.operator?"多个值用逗号分隔":"值",type:"integer"===r||"float"===r?"number":"date"===r?"date":"datetime"===r?"datetime-local":"text",value:t.value,onChange:function(e){return h(t.id,{value:e.target.value})}}):e.createElement("div",{className:"h-10 flex items-center text-sm text-muted-foreground"},"无需填写")),e.createElement("div",{className:"col-span-1 flex justify-end"},e.createElement(at,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 p-0",onClick:function(){return e=t.id,void c(function(t){return t.filter(function(t){return t.id!==e})});var e}},e.createElement(K,{className:"h-4 w-4"}))))})),e.createElement("div",{className:"flex items-center justify-end gap-2"},e.createElement(at,{type:"button",variant:"outline",onClick:function(){c([]),t.onChange([])},disabled:0===l.length&&0===((null===(r=t.value)||void 0===r?void 0:r.length)||0)},"清空"),e.createElement(at,{type:"button",onClick:function(){var e=function(e,t){var n,r,i=[],o=u(e);try{for(o.s();!(r=o.n()).done;){var s=r.value,a=t.get(s.column);if(a&&s.operator)if("isNull"!==s.operator){var l=null!==(n=s.value)&&void 0!==n?n:"",c=String(l).trim();if(c)if("contains"!==s.operator)if("startsWith"!==s.operator)if("endsWith"!==s.operator)if("in"!==s.operator)i.push({column:a.column,operator:s.operator,value:c});else{var h=c.split(",").map(function(e){return e.trim()}).filter(Boolean);i.push({column:a.column,operator:"in",value:h})}else i.push({column:a.column,operator:"ilike",value:"%".concat(c)});else i.push({column:a.column,operator:"ilike",value:"".concat(c,"%")});else i.push({column:a.column,operator:"ilike",value:"%".concat(c,"%")})}else i.push({column:a.column,operator:"is",value:null})}}catch(e){o.e(e)}finally{o.f()}return i}(l,o);t.onChange(e)},disabled:0===l.length},"应用")))}function LT(){var t,n=m(e.useState([]),2),r=n[0],o=n[1],s=m(e.useState(null),2),a=s[0],l=s[1],c=m(e.useState([]),2),u=c[0],p=c[1],g=m(e.useState(!1),2),v=g[0],b=g[1],y=m(e.useState(!1),2),w=y[0],x=y[1],k=m(e.useState(null),2),S=k[0],E=k[1],N=m(e.useState({}),2),A=N[0],T=N[1],M=m(e.useState(1),2),D=M[0],P=M[1],B=m(e.useState(10),2),I=B[0];B[1];var j=m(e.useState(0),2),_=j[0],z=j[1],V=m(e.useState(""),2),U=V[0],$=V[1],K=m(e.useState(!1),2),Y=K[0],G=K[1],X=m(e.useState(null),2),J=X[0],Q=X[1],Z=m(e.useState(!0),2),ee=Z[0],te=Z[1],ne=m(e.useState([]),2),re=ne[0],ie=ne[1],oe=m(e.useState(!1),2),se=oe[0],ae=oe[1],le=function(e){return Array.isArray(e)?e:Array.isArray(null==e?void 0:e.models)?e.models:Array.isArray(null==e?void 0:e.data)?e.data:Array.isArray(null==e?void 0:e.items)?e.items:[]},ce=function(e){var t;if(e&&Array.isArray(e.data)){var n="number"==typeof e.total?e.total:"number"==typeof(null===(t=e.pagination)||void 0===t?void 0:t.total)?e.pagination.total:e.data.length;return{rows:e.data,total:n}}if(e&&Array.isArray(e.rows)){var r="number"==typeof e.total?e.total:e.rows.length;return{rows:e.rows,total:r}}return Array.isArray(e)?{rows:e,total:e.length}:{rows:[],total:0}};e.useEffect(function(){he()},[]),e.useEffect(function(){a&&ue()},[a,D,I,U,re]);var he=function(){var e=h(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return te(!0),e.p=1,e.n=2,sh();case 2:t=e.v,o(le(t.data)),e.n=4;break;case 3:e.p=3,e.v,Fa.error("加载模型列表失败");case 4:return e.p=4,te(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),ue=function(){var e=h(f().m(function e(){var t,n,r;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a){e.n=1;break}return e.a(2);case 1:return b(!0),e.p=2,t={page:D,limit:I},U&&(t.search=U),re.length>0&&(t.filters=re),e.n=3,mh(a.table_name,t);case 3:if((n=e.v).success){e.n=4;break}return Fa.error(n.message||"加载数据失败"),p([]),z(0),e.a(2);case 4:r=ce(n.data),p(r.rows),z(r.total),e.n=6;break;case 5:e.p=5,e.v,Fa.error("加载数据失败"),p([]),z(0);case 6:return e.p=6,b(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),de=function(){var e=h(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return Q(t.id),e.p=2,e.n=3,yh(null==a?void 0:a.table_name,t.id);case 3:(n=e.v).success?(Fa.success("删除成功"),ue()):Fa.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Fa.error("删除失败");case 5:return e.p=5,Q(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),fe=function(){var e=h(f().m(function e(){var t,n,r,i,o;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a){e.n=1;break}return e.a(2);case 1:if(G(!0),e.p=2,t={},a.json_schema.fields.forEach(function(e){if("id"!==e.name){var n=A[e.name];if("date"!==e.type&&"datetime"!==e.type||(n=n?new Date(n).toISOString():null),"json"===e.type||"jsonb"===e.type){var r=(n||"").toString().trim();if(r){var i=Bf(r);if(!i.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(i.message));n=i.value}else n=null}t[e.name]=n}}),!S){e.n=4;break}return e.n=3,bh(a.table_name,Object.assign(Object.assign({},t),{id:S.id}));case 3:(n=e.v).success?(Fa.success("更新成功"),x(!1),ue()):Fa.error(n.message||"更新失败"),e.n=6;break;case 4:return e.n=5,vh(a.table_name,t);case 5:(r=e.v).success?(Fa.success("创建成功"),x(!1),ue()):Fa.error(r.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,o=e.v,i=o instanceof Error?o.message:"操作失败",Fa.error(i);case 8:return e.p=8,G(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-8 space-y-6"},e.createElement("div",{className:"space-y-2"},e.createElement("h1",{className:"text-3xl font-bold tracking-tight"},"数据列表"),e.createElement("p",{className:"text-muted-foreground"},"选择模型查看和管理数据")),e.createElement(wa,{className:"border-2 shadow-lg"},e.createElement(xa,{className:"bg-muted/30"},e.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},e.createElement("div",null,e.createElement(ka,null,"数据管理"),e.createElement(Sa,null,"选择数据模型进行查看和管理")),a&&e.createElement(at,{onClick:function(){E(null),T({}),x(!0)},className:"w-full md:w-auto"},e.createElement(F,{className:"h-4 w-4 mr-2"}),"新建数据"))),e.createElement(Ea,{className:"space-y-6 pt-6"},e.createElement("div",{className:"flex flex-col md:flex-row gap-4"},e.createElement("div",{className:"flex-1 space-y-2"},e.createElement(ya,{htmlFor:"model",className:"text-base font-medium flex items-center gap-2"},e.createElement(R,{className:"h-4 w-4"}),"选择数据模型"),e.createElement(Ld,{value:(null===(t=null==a?void 0:a.id)||void 0===t?void 0:t.toString())||"",onValueChange:function(e){var t=r.find(function(t){return t.id.toString()===e});l(t||null),P(1),$(""),ie([])},disabled:ee},e.createElement(Id,{className:"h-11"},ee?e.createElement("div",{className:"flex items-center gap-2"},e.createElement(L,{className:"h-4 w-4 animate-spin"}),e.createElement("span",null,"加载中...")):e.createElement(Bd,{placeholder:"请选择模型"})),e.createElement(Fd,null,r.map(function(t){return e.createElement(zd,{key:t.id,value:t.id.toString()},t.name," (",t.table_name,")")})))),a&&e.createElement("div",{className:"flex-1 space-y-2"},e.createElement(ya,{htmlFor:"search",className:"text-base font-medium flex items-center gap-2"},e.createElement(W,{className:"h-4 w-4"}),"搜索"),e.createElement("div",{className:"relative"},e.createElement(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.createElement(lt,{id:"search",placeholder:"搜索数据...",value:U,onChange:function(e){return $(e.target.value)},className:"pl-10 h-11"})))),a&&e.createElement(e.Fragment,null,e.createElement("div",{className:"flex items-center justify-end"},e.createElement(at,{type:"button",variant:"outline",className:"h-10",onClick:function(){return ae(!0)}},e.createElement(R,{className:"h-4 w-4 mr-2"}),"筛选",re.length>0?"(".concat(re.length,")"):"")),e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",e.createElement("span",{className:"font-semibold text-foreground"},_)," 条数据"),e.createElement(MT,{variant:"outline"},a.name)),e.createElement("div",{className:"rounded-lg border overflow-hidden"},e.createElement("div",{className:"overflow-x-auto"},e.createElement(xT,null,e.createElement(kT,null,e.createElement(CT,{className:"bg-muted/50"},e.createElement(OT,{className:"font-semibold w-20"},"ID"),a.json_schema.fields.map(function(t){return e.createElement(OT,{key:t.name,className:"font-semibold"},t.comment||t.name)}),e.createElement(OT,{className:"font-semibold"},"创建时间"),e.createElement(OT,{className:"font-semibold"},"更新时间"),e.createElement(OT,{className:"font-semibold w-32 text-center"},"操作"))),e.createElement(ST,null,v?Array.from({length:3}).map(function(t,n){return e.createElement(CT,{key:n},e.createElement(NT,{colSpan:a.json_schema.fields.length+4},e.createElement("div",{className:"flex items-center gap-2 py-4"},e.createElement(L,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===u.length?e.createElement(CT,null,e.createElement(NT,{colSpan:a.json_schema.fields.length+4,className:"text-center py-12"},e.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},e.createElement(W,{className:"h-8 w-8"}),e.createElement("p",null,"暂无数据")))):u.map(function(t,n){return e.createElement(CT,{key:t.id,className:n%2==0?"bg-muted/20":""},e.createElement(NT,{className:"font-mono font-medium"},t.id),a.json_schema.fields.map(function(n){return e.createElement(NT,{key:n.name},function(t,n){return"boolean"===t.type?e.createElement(MT,{variant:n?"default":"secondary"},n?"是":"否"):"date"===t.type||"datetime"===t.type?n?i(n).format("YYYY-MM-DD HH:mm:ss"):"-":"text"===t.type&&n&&n.length>50?e.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"..."):"json"===t.type||"jsonb"===t.type?e.createElement(yT,{value:n,title:t.comment||t.name}):n||"-"}(n,t[n.name]))}),e.createElement(NT,{className:"text-sm text-muted-foreground"},i(t.created_at).format("YYYY-MM-DD HH:mm")),e.createElement(NT,{className:"text-sm text-muted-foreground"},i(t.updated_at).format("YYYY-MM-DD HH:mm")),e.createElement(NT,null,e.createElement("div",{className:"flex items-center justify-center gap-2"},e.createElement(at,{variant:"ghost",size:"sm",onClick:function(){return function(e){E(e);var t={};null==a||a.json_schema.fields.forEach(function(n){if("id"!==n.name){var r=e[n.name];"date"!==n.type&&"datetime"!==n.type||(r=r?i(r).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(r=null==r||""===r?"":"string"==typeof r?r:JSON.stringify(r,null,2)),t[n.name]=r}}),T(t),x(!0)}(t)},className:"h-8 w-8 p-0"},e.createElement(H,{className:"h-4 w-4"})),e.createElement(at,{variant:"ghost",size:"sm",onClick:function(){return de(t)},disabled:J===t.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},J===t.id?e.createElement(L,{className:"h-4 w-4 animate-spin"}):e.createElement(q,{className:"h-4 w-4"})))))}))))),_>I&&e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",e.createElement("span",{className:"font-semibold text-foreground"},D)," 页, 共 ",e.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(_/I))," 页"),e.createElement("div",{className:"flex gap-2"},e.createElement(at,{variant:"outline",size:"sm",onClick:function(){return P(Math.max(1,D-1))},disabled:1===D||v},e.createElement(C,{className:"h-4 w-4 mr-1"}),"上一页"),e.createElement(at,{variant:"outline",size:"sm",onClick:function(){return P(Math.min(Math.ceil(_/I),D+1))},disabled:D>=Math.ceil(_/I)||v},"下一页",e.createElement(O,{className:"h-4 w-4 ml-1"}))))))),a&&e.createElement(lf,{open:se,onOpenChange:ae},e.createElement(df,{className:"max-w-3xl"},e.createElement(ff,null,e.createElement(mf,{className:"text-xl"},"筛选"),e.createElement(vf,{className:"text-sm"},a.name," - ",a.table_name)),e.createElement("div",{className:"py-2"},e.createElement(PT,{fields:a.json_schema.fields,value:re,onChange:function(e){ie(e),P(1)}})),e.createElement(pf,{className:"gap-2"},e.createElement(at,{variant:"outline",onClick:function(){return ae(!1)}},"关闭")))),e.createElement(lf,{open:w,onOpenChange:x},e.createElement(df,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},e.createElement(ff,null,e.createElement(mf,{className:"text-2xl"},S?"编辑数据":"新建数据"),e.createElement(vf,{className:"text-base"},null==a?void 0:a.name," - ",null==a?void 0:a.table_name)),e.createElement("div",{className:"space-y-4 py-4"},null==a?void 0:a.json_schema.fields.map(function(t){return function(t){if("id"===t.name)return null;switch(t.type){case"boolean":return e.createElement("div",{key:t.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},e.createElement(sf,{id:t.name,checked:A[t.name]||!1,onCheckedChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e)))}}),e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium cursor-pointer"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"date",value:A[t.name]||"",onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"datetime":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"datetime-local",value:A[t.name]||"",onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"text":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(af,{id:t.name,rows:4,value:A[t.name]||"",onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"resize-none"}));case"json":case"jsonb":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(wT,{id:t.name,value:A[t.name]||"",required:t.required,onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e)))}}));case"integer":case"float":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"number",value:A[t.name]||"",onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));default:return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"email"===t.type?"email":"text",maxLength:t.maxLength,value:A[t.name]||"",onChange:function(e){return T(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}))}}(t)})),e.createElement(pf,{className:"gap-2"},e.createElement(at,{variant:"outline",onClick:function(){return x(!1)},disabled:Y},"取消"),e.createElement(at,{onClick:fe,disabled:Y},Y?e.createElement(e.Fragment,null,e.createElement(L,{className:"h-4 w-4 mr-2 animate-spin"}),S?"更新中...":"创建中..."):S?"更新":"创建"))))))}function BT(t){var n=m(e.useState(t||null),2),r=n[0],o=n[1],s=m(e.useState([]),2),a=s[0],l=s[1],c=m(e.useState(!1),2),u=c[0],p=c[1],g=m(e.useState(!1),2),v=g[0],b=g[1],y=m(e.useState(!1),2),w=y[0],x=y[1],k=m(e.useState(null),2),S=k[0],E=k[1],N=m(e.useState({}),2),A=N[0],M=N[1],D=m(e.useState(1),2),P=D[0],B=D[1],I=m(e.useState(10),2),j=I[0];I[1];var _=m(e.useState(0),2),z=_[0],V=_[1],U=m(e.useState(""),2),$=U[0],K=U[1],Y=m(e.useState(!1),2),G=Y[0],X=Y[1],J=m(e.useState(null),2),Q=J[0],Z=J[1],ee=m(e.useState({}),2),te=ee[0],ne=ee[1],re=m(e.useState([]),2),ie=re[0],oe=re[1];e.useEffect(function(){r&&ae()},[r,P,j,$,ie]),e.useEffect(function(){t&&(o(t),B(1),K(""),oe([]))},[t]);var se=function(){var e=h(f().m(function e(t){var n,r,i,o,s;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if("relation"===t.type&&t.relation){e.n=1;break}return e.a(2);case 1:if(n=t.relation,r=n.target,i=n.displayField,o="".concat(r,"_").concat(i||"name"),!te[o]){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,gh(r,{displayField:i||"name",limit:200});case 3:(s=e.v).success&&s.data&&ne(function(e){return Object.assign(Object.assign({},e),d({},o,s.data))}),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}();e.useEffect(function(){v&&r&&r.json_schema.fields.filter(function(e){return"relation"===e.type&&e.relation}).forEach(function(e){return se(e)})},[v,r]);var ae=function(){var e=h(f().m(function e(){var t,n,i,o;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:return p(!0),e.p=2,i={page:P,limit:j},$&&(i.search=$),ie.length>0&&(i.filters=ie),e.n=3,mh(r.table_name,i);case 3:if((o=e.v).success){e.n=4;break}return Fa.error(o.message||"加载数据失败"),l([]),V(0),e.a(2);case 4:l((null===(t=o.data)||void 0===t?void 0:t.data)||[]),V((null===(n=o.data)||void 0===n?void 0:n.total)||0),e.n=6;break;case 5:e.p=5,e.v,Fa.error("加载数据失败"),l([]),V(0);case 6:return e.p=6,p(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),le=function(){var e=h(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm("确定要删除这条数据吗?此操作不可撤销。")){e.n=1;break}return e.a(2);case 1:return Z(t.id),e.p=2,e.n=3,yh(null==r?void 0:r.table_name,t.id);case 3:(n=e.v).success?(Fa.success("删除成功"),ae()):Fa.error(n.message||"删除失败"),e.n=5;break;case 4:e.p=4,e.v,Fa.error("删除失败");case 5:return e.p=5,Z(null),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),ce=function(){var e=h(f().m(function e(){var t,n,i,o,s,a;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r){e.n=1;break}return e.a(2);case 1:if(X(!0),e.p=2,t={},r.json_schema.fields.forEach(function(e){if("id"!==e.name)if("relation"===e.type&&e.relation){var n=e.relation.foreignKey||"".concat(e.relation.target,"_id");t[n]=A[n]}else{var r=A[e.name];if("date"!==e.type&&"datetime"!==e.type||(r=r?new Date(r).toISOString():null),"json"===e.type||"jsonb"===e.type){var i=(r||"").toString().trim();if(i){var o=Bf(i);if(!o.ok)throw new Error("字段 ".concat(e.comment||e.name,":").concat(o.message));r=o.value}else r=null}t[e.name]=r}}),!S){e.n=4;break}return n=Object.assign(Object.assign({},t),{id:S.id}),e.n=3,bh(r.table_name,n);case 3:(i=e.v).success?(Fa.success("更新成功"),b(!1),ae()):Fa.error(i.message||"更新失败"),e.n=6;break;case 4:return e.n=5,vh(r.table_name,t);case 5:(o=e.v).success?(Fa.success("创建成功"),b(!1),ae()):Fa.error(o.message||"创建失败");case 6:e.n=8;break;case 7:e.p=7,a=e.v,s=a instanceof Error?a.message:"操作失败",Fa.error(s);case 8:return e.p=8,X(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return r?e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-4 space-y-4"},e.createElement("div",{className:"space-y-1"},e.createElement("div",{className:"flex items-center gap-3"},e.createElement("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-lg bg-primary/10 text-primary"},e.createElement(T,{className:"h-4 w-4"})),e.createElement("div",null,e.createElement("h1",{className:"text-2xl font-bold tracking-tight leading-tight"},r.name),e.createElement("p",{className:"text-sm text-muted-foreground"},"表名: ",r.table_name)))),e.createElement(wa,{className:"border-2 shadow-lg"},e.createElement(xa,{className:"bg-muted/30"},e.createElement("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4"},e.createElement("div",null,e.createElement(ka,null,"数据管理"),e.createElement(Sa,null,"查看和管理 ",r.name," 的数据")),e.createElement(at,{onClick:function(){E(null),M({}),b(!0)},className:"w-full md:w-auto"},e.createElement(F,{className:"h-4 w-4 mr-2"}),"新建数据"))),e.createElement(Ea,{className:"space-y-4 pt-4"},e.createElement("div",{className:"flex flex-col md:flex-row md:items-center gap-3"},e.createElement("div",{className:"flex-1"},e.createElement(ya,{htmlFor:"search",className:"sr-only"},"搜索"),e.createElement("div",{className:"relative"},e.createElement(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.createElement(lt,{id:"search",placeholder:"搜索数据...",value:$,onChange:function(e){return K(e.target.value)},className:"pl-10 h-10"}))),e.createElement(at,{type:"button",variant:"outline",className:"h-10",onClick:function(){return x(!0)}},e.createElement(R,{className:"h-4 w-4 mr-2"}),"筛选",ie.length>0?"(".concat(ie.length,")"):"")),e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"共 ",e.createElement("span",{className:"font-semibold text-foreground"},z)," 条数据"),e.createElement(MT,{variant:"outline"},r.name)),e.createElement("div",{className:"rounded-lg border overflow-hidden"},e.createElement("div",{className:"overflow-x-auto"},e.createElement(xT,null,e.createElement(kT,null,e.createElement(CT,{className:"bg-muted/50"},e.createElement(OT,{className:"font-semibold w-20"},"ID"),r.json_schema.fields.map(function(t){return e.createElement(OT,{key:t.name,className:"font-semibold"},t.comment||t.name)}),e.createElement(OT,{className:"font-semibold"},"创建时间"),e.createElement(OT,{className:"font-semibold"},"更新时间"),e.createElement(OT,{className:"font-semibold w-32 text-center"},"操作"))),e.createElement(ST,null,u?Array.from({length:3}).map(function(t,n){return e.createElement(CT,{key:n},e.createElement(NT,{colSpan:r.json_schema.fields.length+4},e.createElement("div",{className:"flex items-center gap-2 py-4"},e.createElement(L,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.createElement("span",{className:"text-sm text-muted-foreground"},"加载中..."))))}):0===a.length?e.createElement(CT,null,e.createElement(NT,{colSpan:r.json_schema.fields.length+4,className:"text-center py-12"},e.createElement("div",{className:"flex flex-col items-center gap-2 text-muted-foreground"},e.createElement(W,{className:"h-8 w-8"}),e.createElement("p",null,"暂无数据")))):a.map(function(t,n){return e.createElement(CT,{key:t.id,className:n%2==0?"bg-muted/20":""},e.createElement(NT,{className:"font-mono font-medium"},t.id),r.json_schema.fields.map(function(n){return e.createElement(NT,{key:n.name},function(t,n,r){if("boolean"===t.type)return e.createElement(MT,{variant:n?"default":"secondary"},n?"是":"否");if("date"===t.type||"datetime"===t.type)return n?i(n).format("YYYY-MM-DD HH:mm:ss"):"-";if("text"===t.type&&n&&n.length>50)return e.createElement("span",{className:"max-w-xs truncate block",title:n},n.substring(0,50),"...");if("json"===t.type||"jsonb"===t.type)return e.createElement(yT,{value:n,title:t.comment||t.name});if("relation"===t.type&&t.relation&&r){var o=t.relation.displayField,s=void 0===o?"name":o,a=r["".concat(t.name,"_data")];if(a)return e.createElement(MT,{variant:"outline"},a[s]||"ID: ".concat(a.id));var l=r[t.relation.foreignKey||"".concat(t.relation.target,"_id")];return l?"ID: ".concat(l):"-"}return n||"-"}(n,t[n.name],t))}),e.createElement(NT,{className:"text-sm text-muted-foreground"},i(t.created_at).format("YYYY-MM-DD HH:mm")),e.createElement(NT,{className:"text-sm text-muted-foreground"},i(t.updated_at).format("YYYY-MM-DD HH:mm")),e.createElement(NT,null,e.createElement("div",{className:"flex items-center justify-center gap-2"},e.createElement(at,{variant:"ghost",size:"sm",onClick:function(){return function(e){E(e);var t={};null==r||r.json_schema.fields.forEach(function(n){if("id"!==n.name)if("relation"===n.type&&n.relation){var r=n.relation.foreignKey||"".concat(n.relation.target,"_id");t[r]=e[r]}else{var o=e[n.name];"date"!==n.type&&"datetime"!==n.type||(o=o?i(o).format("YYYY-MM-DDTHH:mm"):""),"json"!==n.type&&"jsonb"!==n.type||(o=null==o||""===o?"":"string"==typeof o?o:JSON.stringify(o,null,2)),t[n.name]=o}}),M(t),b(!0)}(t)},className:"h-8 w-8 p-0"},e.createElement(H,{className:"h-4 w-4"})),e.createElement(at,{variant:"ghost",size:"sm",onClick:function(){return le(t)},disabled:Q===t.id,className:"h-8 w-8 p-0 text-destructive hover:text-destructive"},Q===t.id?e.createElement(L,{className:"h-4 w-4 animate-spin"}):e.createElement(q,{className:"h-4 w-4"})))))}))))),z>j&&e.createElement("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 border"},e.createElement("div",{className:"text-sm text-muted-foreground"},"第 ",e.createElement("span",{className:"font-semibold text-foreground"},P)," 页, 共 ",e.createElement("span",{className:"font-semibold text-foreground"},Math.ceil(z/j))," 页"),e.createElement("div",{className:"flex gap-2"},e.createElement(at,{variant:"outline",size:"sm",onClick:function(){return B(Math.max(1,P-1))},disabled:1===P||u},e.createElement(C,{className:"h-4 w-4 mr-1"}),"上一页"),e.createElement(at,{variant:"outline",size:"sm",onClick:function(){return B(Math.min(Math.ceil(z/j),P+1))},disabled:P>=Math.ceil(z/j)||u},"下一页",e.createElement(O,{className:"h-4 w-4 ml-1"})))))),e.createElement(lf,{open:w,onOpenChange:x},e.createElement(df,{className:"max-w-3xl"},e.createElement(ff,null,e.createElement(mf,{className:"text-xl"},"筛选"),e.createElement(vf,{className:"text-sm"},r.name," - ",r.table_name)),e.createElement("div",{className:"py-2"},e.createElement(PT,{fields:r.json_schema.fields,value:ie,onChange:function(e){oe(e),B(1)}})),e.createElement(pf,{className:"gap-2"},e.createElement(at,{variant:"outline",onClick:function(){return x(!1)}},"关闭")))),e.createElement(lf,{open:v,onOpenChange:b},e.createElement(df,{className:"max-w-3xl max-h-[85vh] overflow-y-auto"},e.createElement(ff,null,e.createElement(mf,{className:"text-2xl"},S?"编辑数据":"新建数据"),e.createElement(vf,{className:"text-base"},r.name," - ",r.table_name)),e.createElement("div",{className:"space-y-4 py-4"},r.json_schema.fields.map(function(t){return function(t){if("id"===t.name)return null;switch(t.type){case"boolean":return e.createElement("div",{key:t.name,className:"flex items-center space-x-3 p-4 rounded-lg border bg-card"},e.createElement(sf,{id:t.name,checked:A[t.name]||!1,onCheckedChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e)))}}),e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium cursor-pointer"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")));case"date":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"date",value:A[t.name]||"",onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"datetime":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"datetime-local",value:A[t.name]||"",onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"text":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(af,{id:t.name,rows:4,value:A[t.name]||"",onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"resize-none"}));case"json":case"jsonb":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(wT,{id:t.name,value:A[t.name]||"",required:t.required,onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e)))}}));case"integer":case"float":return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"number",value:A[t.name]||"",onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}));case"relation":if(!t.relation)return null;var n=t.relation,r=n.target,i=n.displayField,o=void 0===i?"name":i,s="".concat(r,"_").concat(o),a=te[s]||[],l=t.relation.foreignKey||"".concat(r,"_id"),c=void 0!==A[l]&&null!==A[l]?String(A[l]):"",h=a.find(function(e){return String(e.id)===c});return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(Ld,{value:c,onValueChange:function(e){var t=parseInt(e,10),n=!isNaN(t)&&String(t)===e;M(Object.assign(Object.assign({},A),d({},l,n?t:e)))}},e.createElement(Id,{className:"h-11"},e.createElement(Bd,{placeholder:"请选择".concat(t.comment||t.name)},h?h.label:c?"ID: ".concat(c):"请选择".concat(t.comment||t.name))),e.createElement(Fd,null,0===a.length?e.createElement(zd,{value:"_loading",disabled:!0},"加载中..."):a.map(function(t){return e.createElement(zd,{key:t.id,value:String(t.id)},t.label)}))));default:return e.createElement("div",{key:t.name,className:"space-y-2"},e.createElement(ya,{htmlFor:t.name,className:"text-base font-medium"},t.comment||t.name,t.required&&e.createElement("span",{className:"text-destructive ml-1"},"*")),e.createElement(lt,{id:t.name,type:"email"===t.type?"email":"text",maxLength:t.maxLength,value:A[t.name]||"",onChange:function(e){return M(Object.assign(Object.assign({},A),d({},t.name,e.target.value)))},required:t.required,className:"h-11"}))}}(t)})),e.createElement(pf,{className:"gap-2"},e.createElement(at,{variant:"outline",onClick:function(){return b(!1)},disabled:G},"取消"),e.createElement(at,{onClick:ce,disabled:G},G?e.createElement(e.Fragment,null,e.createElement(L,{className:"h-4 w-4 mr-2 animate-spin"}),S?"更新中...":"创建中..."):S?"更新":"创建")))))):e.createElement("div",{className:"min-h-[calc(100vh-4rem)] bg-gradient-to-br from-background via-background to-muted/20"},e.createElement("div",{className:"container mx-auto px-6 py-4"},e.createElement(wa,{className:"border-2"},e.createElement(Ea,{className:"py-16 text-center"},e.createElement(T,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.createElement("p",{className:"text-lg text-muted-foreground"},"请选择数据模型")))))}function IT(t){return t.models.map(function(t){return{path:"/data/list-".concat(t.id),name:t.name,icon:e.createElement(V),component:function(){return n=t,e.createElement(BT,Object.assign({},n));var n}}})}var jT=function(t){return[{path:"/login",name:"登录",icon:e.createElement(I),component:wh},{name:"数据管理",icon:e.createElement(A),path:"/data",component:LT,routes:g(IT(t))}]},_T=z,FT=U,WT=j;function zT(t){var n=t.inputModels,r=t.skipAuth,i=void 0!==r&&r,o=m(e.useState("/data"),2),s=o[0],a=o[1],l=m(e.useState([]),2);l[0],l[1];var c=m(e.useState(!1),2),d=c[0],p=c[1],g=m(e.useState(null),2),v=g[0],b=g[1],y=m(e.useState(!0),2),w=y[0],x=y[1];e.useEffect(function(){if(i)return p(!0),b(null),x(!1),void("/login"===s&&a("/data"));var e=function(){var e=h(f().m(function e(){var t,n;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,fh()){e.n=1;break}return p(!1),a("/login"),x(!1),e.a(2);case 1:return e.p=1,e.n=2,hh();case 2:if(e.v.success){e.n=3;break}throw new Error("token验证失败");case 3:if(!(t=ph())){e.n=4;break}b(t),e.n=6;break;case 4:return e.n=5,uh();case 5:(n=e.v).success&&n.data&&(b(n.data),localStorage.setItem("cms_user",JSON.stringify(n.data)));case 6:p(!0),"/login"===s&&a("/data"),e.n=8;break;case 7:e.p=7,e.v,dh(),p(!1),b(null),a("/login");case 8:e.n=10;break;case 9:e.p=9,e.v,p(!1),b(null),a("/login");case 10:return e.p=10,x(!1),e.f(10);case 11:return e.a(2)}},e,null,[[1,7],[0,9,10,11]])}));return function(){return e.apply(this,arguments)}}();e()},[i]);var k=function(e,t){b(t),p(!0),a("/data"),Fa.success("欢迎回来,".concat(t.username,"!"))},S=function(e,t){var n,r=u(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.path===t)return i;if(i.routes){var o=S(i.routes,t);if(o)return o}}}catch(e){r.e(e)}finally{r.f()}return null};if(w)return e.createElement("div",{className:"flex min-h-screen items-center justify-center bg-background"},e.createElement("div",{className:"space-y-4"},e.createElement(Ue,{className:"h-12 w-48"}),e.createElement(Ue,{className:"h-4 w-64"})));if(!d)return e.createElement(wh,{onLoginSuccess:k});var E=jT(n).filter(function(e){return"/login"!==e.path}),C=function(t){if(!t)return T;if(e.isValidElement(t)){var n=t.type;if(n&&"function"==typeof n){var r=n.name||"";if(r.includes("Home"))return D;if(r.includes("Table"))return V;if(r.includes("Database"))return T;if(r.includes("File"))return M}}return T},O=E.flatMap(function(e){return e.routes&&e.routes.length>0?e.routes.map(function(e){return{title:e.name,icon:C(e.icon),path:e.path}}):[{title:e.name,icon:C(e.icon),path:e.path}]});return e.createElement(ta,null,e.createElement(na,{variant:"inset"},e.createElement(oa,{className:"border-b border-sidebar-border"},e.createElement("div",{className:"flex items-center gap-2 px-2 py-1"},e.createElement("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-primary"},e.createElement(_T,{className:"w-4 h-4 text-primary-foreground"})),e.createElement("span",{className:"font-semibold text-lg"},"WE0-CMS"))),e.createElement(aa,null,e.createElement(la,null,e.createElement(ca,null,"Navigation"),e.createElement(ha,null,e.createElement(ua,null,O.map(function(t){return e.createElement(da,{key:t.path},e.createElement(pa,{onClick:function(){return a(t.path)},isActive:(n=t.path,s===n||s.startsWith(n+"/")),tooltip:t.title},e.createElement(t.icon,{className:"w-4 h-4"}),e.createElement("span",null,t.title)));var n}))))),e.createElement(sa,{className:"border-t border-sidebar-border"},e.createElement(ua,null,!i&&v&&e.createElement(e.Fragment,null,e.createElement(da,null,e.createElement(pa,{tooltip:v.username||"User"},e.createElement(FT,{className:"w-4 h-4"}),e.createElement("span",{className:"truncate"},v.username))),e.createElement(da,null,e.createElement(pa,{onClick:function(){window.confirm("确定要登出系统吗?")&&(dh(),localStorage.removeItem("cms_token"),localStorage.removeItem("cms_user"),p(!1),b(null),a("/login"),Fa.success("已成功登出"))},tooltip:"Logout"},e.createElement(WT,{className:"w-4 h-4"}),e.createElement("span",null,"Logout"))))))),e.createElement(ia,null,e.createElement("header",{className:"flex h-14 items-center gap-4 border-b bg-background px-6"},e.createElement(ra,null),e.createElement("h1",{className:"text-lg font-semibold"},function(){if("/login"===s)return"Login";var e=S(jT(n),s);return(null==e?void 0:e.name)||"数据管理"}())),e.createElement("main",{className:"flex-1 p-6"},function(){if(!i&&"/login"===s)return e.createElement(wh,{onLoginSuccess:k});if(i&&"/login"===s)return e.createElement(LT,null);var t=S(jT(n),s);if(t){var r=t.component;return e.createElement(r,null)}return e.createElement(LT,null)}())))}exports.CmsLayoutShadcn=zT,exports.cmsRoutes=jT,exports.default=zT,exports.setSessionId=function(e){eh=e;try{localStorage.setItem("cms_session_id",e)}catch(e){}};
|
|
11
16
|
//# sourceMappingURL=index.js.map
|