studiograph 1.2.0-beta.9 → 1.2.0
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/README.md +13 -18
- package/dist/agent/orchestrator.d.ts +56 -0
- package/dist/agent/orchestrator.js +167 -22
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/prompts/system.md +51 -63
- package/dist/agent/skill-loader.js +8 -0
- package/dist/agent/skill-loader.js.map +1 -1
- package/dist/agent/skills/entity-schema.md +4 -19
- package/dist/agent/skills/gather-context.md +1 -1
- package/dist/agent/tools/graph-tools.d.ts +41 -1
- package/dist/agent/tools/graph-tools.js +133 -57
- package/dist/agent/tools/graph-tools.js.map +1 -1
- package/dist/agent/tools/ops-tools.js +82 -0
- package/dist/agent/tools/ops-tools.js.map +1 -1
- package/dist/agent/tools/permission-tools.d.ts +90 -0
- package/dist/agent/tools/permission-tools.js +207 -0
- package/dist/agent/tools/permission-tools.js.map +1 -0
- package/dist/agent/tools/sync-tools.js +2 -2
- package/dist/agent/tools/sync-tools.js.map +1 -1
- package/dist/auth/github.d.ts +1 -1
- package/dist/auth/github.js +21 -13
- package/dist/auth/github.js.map +1 -1
- package/dist/cli/commands/access.d.ts +11 -0
- package/dist/cli/commands/access.js +156 -0
- package/dist/cli/commands/access.js.map +1 -0
- package/dist/cli/commands/app.js +25 -2
- package/dist/cli/commands/app.js.map +1 -1
- package/dist/cli/commands/clear.d.ts +5 -0
- package/dist/cli/commands/clear.js +36 -0
- package/dist/cli/commands/clear.js.map +1 -0
- package/dist/cli/commands/clone.js +3 -3
- package/dist/cli/commands/clone.js.map +1 -1
- package/dist/cli/commands/collection.d.ts +10 -0
- package/dist/cli/commands/collection.js +187 -0
- package/dist/cli/commands/collection.js.map +1 -0
- package/dist/cli/commands/commit.js +2 -1
- package/dist/cli/commands/commit.js.map +1 -1
- package/dist/cli/commands/config.d.ts +100 -0
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/deploy.js +10 -1
- package/dist/cli/commands/deploy.js.map +1 -1
- package/dist/cli/commands/index.js +1 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.js +32 -40
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/join.d.ts +0 -6
- package/dist/cli/commands/join.js +26 -111
- package/dist/cli/commands/join.js.map +1 -1
- package/dist/cli/commands/lint.js +1 -2
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mcp.js +6 -5
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/org.d.ts +10 -0
- package/dist/cli/commands/org.js +132 -0
- package/dist/cli/commands/org.js.map +1 -0
- package/dist/cli/commands/orphans.js +1 -2
- package/dist/cli/commands/orphans.js.map +1 -1
- package/dist/cli/commands/provision.js +3 -3
- package/dist/cli/commands/provision.js.map +1 -1
- package/dist/cli/commands/resolve.d.ts +8 -0
- package/dist/cli/commands/resolve.js +85 -0
- package/dist/cli/commands/resolve.js.map +1 -0
- package/dist/cli/commands/serve.js +55 -25
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/start.js +22 -205
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/sync.js +53 -8
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/commands/team.d.ts +12 -0
- package/dist/cli/commands/team.js +185 -0
- package/dist/cli/commands/team.js.map +1 -0
- package/dist/cli/index.js +41 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/scaffolding.d.ts +5 -3
- package/dist/cli/scaffolding.js +191 -97
- package/dist/cli/scaffolding.js.map +1 -1
- package/dist/cli/setup-wizard.js +20 -10
- package/dist/cli/setup-wizard.js.map +1 -1
- package/dist/cli/sync-review-interactive.js +1 -1
- package/dist/cli/sync-review-interactive.js.map +1 -1
- package/dist/core/graph.d.ts +5 -10
- package/dist/core/graph.js +84 -85
- package/dist/core/graph.js.map +1 -1
- package/dist/core/migration-runner.d.ts +42 -0
- package/dist/core/migration-runner.js +232 -0
- package/dist/core/migration-runner.js.map +1 -0
- package/dist/core/migration-types.d.ts +101 -0
- package/dist/core/migration-types.js +21 -0
- package/dist/core/migration-types.js.map +1 -0
- package/dist/core/migrations/20260219-formalize-memory-location.d.ts +2 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js +35 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.d.ts +12 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js +65 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-readme.d.ts +11 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js +82 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js.map +1 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.d.ts +9 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js +64 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js.map +1 -0
- package/dist/core/migrations/index.d.ts +11 -0
- package/dist/core/migrations/index.js +23 -0
- package/dist/core/migrations/index.js.map +1 -0
- package/dist/core/types.d.ts +19 -34
- package/dist/core/types.js +3 -21
- package/dist/core/types.js.map +1 -1
- package/dist/core/user-config.d.ts +27 -0
- package/dist/core/user-config.js +51 -0
- package/dist/core/user-config.js.map +1 -1
- package/dist/core/validation.d.ts +978 -2182
- package/dist/core/validation.js +242 -397
- package/dist/core/validation.js.map +1 -1
- package/dist/core/workspace-manager.d.ts +32 -31
- package/dist/core/workspace-manager.js +171 -186
- package/dist/core/workspace-manager.js.map +1 -1
- package/dist/core/workspace.d.ts +0 -5
- package/dist/core/workspace.js +33 -101
- package/dist/core/workspace.js.map +1 -1
- package/dist/lib/lib/utils.d.ts +2 -0
- package/dist/lib/lib/utils.js +6 -0
- package/dist/lib/lib/utils.js.map +1 -0
- package/dist/mcp/tools.js +13 -13
- package/dist/mcp/tools.js.map +1 -1
- package/dist/server/chrome/chrome.css +562 -0
- package/dist/server/chrome/chrome.js +540 -0
- package/dist/server/index.js +163 -10
- package/dist/server/index.js.map +1 -1
- package/dist/server/plugin-loader.d.ts +7 -0
- package/dist/server/plugin-loader.js +9 -1
- package/dist/server/plugin-loader.js.map +1 -1
- package/dist/server/routes/chat.d.ts +3 -2
- package/dist/server/routes/chat.js +67 -16
- package/dist/server/routes/chat.js.map +1 -1
- package/dist/server/routes/git-api.d.ts +9 -0
- package/dist/server/routes/git-api.js +82 -0
- package/dist/server/routes/git-api.js.map +1 -0
- package/dist/server/routes/graph-api.d.ts +2 -2
- package/dist/server/routes/graph-api.js +267 -3
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/permissions-api.d.ts +9 -0
- package/dist/server/routes/permissions-api.js +176 -0
- package/dist/server/routes/permissions-api.js.map +1 -0
- package/dist/server/routes/workspace-api.d.ts +9 -0
- package/dist/server/routes/workspace-api.js +283 -0
- package/dist/server/routes/workspace-api.js.map +1 -0
- package/dist/services/assets/base.d.ts +2 -2
- package/dist/services/assets/base.js +4 -4
- package/dist/services/assets/base.js.map +1 -1
- package/dist/services/assets/index.d.ts +6 -6
- package/dist/services/assets/index.js +12 -12
- package/dist/services/assets/index.js.map +1 -1
- package/dist/services/git.d.ts +35 -0
- package/dist/services/git.js +93 -0
- package/dist/services/git.js.map +1 -1
- package/dist/services/github-provisioner.js +1 -2
- package/dist/services/github-provisioner.js.map +1 -1
- package/dist/services/github-service.d.ts +99 -0
- package/dist/services/github-service.js +310 -0
- package/dist/services/github-service.js.map +1 -0
- package/dist/services/markdown.js +4 -9
- package/dist/services/markdown.js.map +1 -1
- package/dist/services/memory-service.d.ts +4 -0
- package/dist/services/memory-service.js +13 -1
- package/dist/services/memory-service.js.map +1 -1
- package/dist/services/sync/commit.d.ts +2 -0
- package/dist/services/sync/commit.js +21 -6
- package/dist/services/sync/commit.js.map +1 -1
- package/dist/services/sync/graphrag-indexer.js +2 -2
- package/dist/services/sync/graphrag-indexer.js.map +1 -1
- package/dist/utils/git.d.ts +5 -0
- package/dist/utils/git.js +10 -0
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/merge-resolver.d.ts +33 -8
- package/dist/utils/merge-resolver.js +157 -55
- package/dist/utils/merge-resolver.js.map +1 -1
- package/dist/utils/preflight.d.ts +1 -1
- package/dist/utils/preflight.js +1 -1
- package/dist/web/_app/env.js +1 -0
- package/dist/web/_app/immutable/assets/0.CDbX4Cwz.css +1 -0
- package/dist/web/_app/immutable/assets/2.DRHi7ABa.css +1 -0
- package/dist/web/_app/immutable/assets/3.BJy7pVXi.css +1 -0
- package/dist/web/_app/immutable/assets/4.Ad16uh9o.css +1 -0
- package/dist/web/_app/immutable/assets/5.BhKgiXd2.css +1 -0
- package/dist/web/_app/immutable/assets/6.CeHKR5ZY.css +1 -0
- package/dist/web/_app/immutable/assets/AppShell.CXdE5aqF.css +1 -0
- package/dist/web/_app/immutable/assets/ChatPanel.RFD5GGYI.css +1 -0
- package/dist/web/_app/immutable/assets/editor.CPAf2SRV.css +1 -0
- package/dist/web/_app/immutable/chunks/3_5VIr68.js +1 -0
- package/dist/web/_app/immutable/chunks/4QY4j-jX.js +1 -0
- package/dist/web/_app/immutable/chunks/B0nldqWF.js +23 -0
- package/dist/web/_app/immutable/chunks/BB_5th5W.js +3383 -0
- package/dist/web/_app/immutable/chunks/BButMJ6M.js +1 -0
- package/dist/web/_app/immutable/chunks/BiubvAUI.js +2 -0
- package/dist/web/_app/immutable/chunks/CAXuTUkp.js +1 -0
- package/dist/web/_app/immutable/chunks/CUzqHQY_.js +1 -0
- package/dist/web/_app/immutable/chunks/CYrVHOHA.js +1 -0
- package/dist/web/_app/immutable/chunks/CqkleIqs.js +1 -0
- package/dist/web/_app/immutable/chunks/DPmdIe6Y.js +1 -0
- package/dist/web/_app/immutable/chunks/Dh_H7Owr.js +18 -0
- package/dist/web/_app/immutable/chunks/DnlgZ_Tk.js +5 -0
- package/dist/web/_app/immutable/chunks/DsERsGWg.js +64 -0
- package/dist/web/_app/immutable/chunks/DtVH--hH.js +6 -0
- package/dist/web/_app/immutable/chunks/F20aIBpJ.js +1 -0
- package/dist/web/_app/immutable/chunks/PPVm8Dsz.js +1 -0
- package/dist/web/_app/immutable/chunks/WSUKABI_.js +1 -0
- package/dist/web/_app/immutable/chunks/YFT1281h.js +2 -0
- package/dist/web/_app/immutable/chunks/aosHekRC.js +1 -0
- package/dist/web/_app/immutable/chunks/fwnBoL5x.js +1 -0
- package/dist/web/_app/immutable/chunks/hHxe9oXh.js +1 -0
- package/dist/web/_app/immutable/chunks/nZKqDQ0w.js +6 -0
- package/dist/web/_app/immutable/entry/app.B6Ngvu5P.js +2 -0
- package/dist/web/_app/immutable/entry/start.NykKAKQv.js +1 -0
- package/dist/web/_app/immutable/nodes/0.DQ5KdeNU.js +1 -0
- package/dist/web/_app/immutable/nodes/1.BR6DZ9ov.js +1 -0
- package/dist/web/_app/immutable/nodes/2.COSjVZ_C.js +1 -0
- package/dist/web/_app/immutable/nodes/3.B9r1XIlO.js +1 -0
- package/dist/web/_app/immutable/nodes/4.p-c6hlFf.js +16 -0
- package/dist/web/_app/immutable/nodes/5.CPc-Bqal.js +4 -0
- package/dist/web/_app/immutable/nodes/6.jJ67YnBc.js +2 -0
- package/dist/web/_app/version.json +1 -0
- package/dist/web/index.html +43 -0
- package/package.json +21 -3
- package/dist/agent/skills/bundled/enrich-entities.md +0 -124
- package/dist/agent/skills/bundled/gather-context.md +0 -46
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{Facet as v,EditorState as Ct,Transaction as ps,EditorSelection as w,Prec as Ci,Text as j,ChangeSet as ki,RangeSet as N,StateEffect as Re,Annotation as ms,codePointAt as bs,codePointSize as ys,RangeValue as Ee,findClusterBreak as st,findColumn as Ss,MapMode as kt,CharCategory as ws}from"./DnlgZ_Tk.js";const ge="ͼ",_e=typeof Symbol>"u"?"__"+ge:Symbol.for(ge),pe=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ut{constructor(t,e){this.rules=[];let{finish:i}=e||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,h,a){let f=[],c=/^@(\w+)\b/.exec(o[0]),d=c&&c[1]=="keyframes";if(c&&l==null)return h.push(o[0]+";");for(let u in l){let g=l[u];if(/&/.test(u))r(u.split(/,\s*/).map(p=>o.map(b=>p.replace(/&/,b))).reduce((p,b)=>p.concat(b)),g,h);else if(g&&typeof g=="object"){if(!c)throw new RangeError("The value of a property ("+u+") should be a primitive value.");r(s(u),g,f,d)}else g!=null&&f.push(u.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+g+";")}(f.length||d)&&h.push((i&&!c&&!a?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in t)r(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
|
|
2
|
+
`)}static newName(){let t=je[_e]||1;return je[_e]=t+1,ge+t.toString(36)}static mount(t,e,i){let s=t[pe],r=i&&i.nonce;s?r&&s.setNonce(r):s=new xs(t,r),s.mount(Array.isArray(e)?e:[e],t)}}let Ue=new Map;class xs{constructor(t,e){let i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let r=Ue.get(i);if(r)return t[pe]=r;this.sheet=new s.CSSStyleSheet,Ue.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[pe]=this}mount(t,e){let i=this.sheet,s=0,r=0;for(let o=0;o<t.length;o++){let l=t[o],h=this.modules.indexOf(l);if(h<r&&h>-1&&(this.modules.splice(h,1),r--,h=-1),h==-1){if(this.modules.splice(r++,0,l),i)for(let a=0;a<l.rules.length;a++)i.insertRule(l.rules[a],s++)}else{for(;r<h;)s+=this.modules[r++].rules.length;s+=l.rules.length,r++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let o="";for(let h=0;h<this.modules.length;h++)o+=this.modules[h].getRules()+`
|
|
3
|
+
`;this.styleTag.textContent=o;let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var tt={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:"'"},Tt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Cs=typeof navigator<"u"&&/Mac/.test(navigator.platform),ks=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var R=0;R<10;R++)tt[48+R]=tt[96+R]=String(R);for(var R=1;R<=24;R++)tt[R+111]="F"+R;for(var R=65;R<=90;R++)tt[R]=String.fromCharCode(R+32),Tt[R]=String.fromCharCode(R);for(var re in tt)Tt.hasOwnProperty(re)||(Tt[re]=tt[re]);function vs(n){var t=Cs&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ks&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?Tt:tt)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}let E=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},me=typeof document<"u"?document:{documentElement:{style:{}}};const be=/Edge\/(\d+)/.exec(E.userAgent),vi=/MSIE \d/.test(E.userAgent),ye=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E.userAgent),te=!!(vi||ye||be),Ge=!te&&/gecko\/(\d+)/i.test(E.userAgent),oe=!te&&/Chrome\/(\d+)/.exec(E.userAgent),Ms="webkitFontSmoothing"in me.documentElement.style,Se=!te&&/Apple Computer/.test(E.vendor),$e=Se&&(/Mobile\/\w+/.test(E.userAgent)||E.maxTouchPoints>2);var y={mac:$e||/Mac/.test(E.platform),windows:/Win/.test(E.platform),linux:/Linux|X11/.test(E.platform),ie:te,ie_version:vi?me.documentMode||6:ye?+ye[1]:be?+be[1]:0,gecko:Ge,gecko_version:Ge?+(/Firefox\/(\d+)/.exec(E.userAgent)||[0,0])[1]:0,chrome:!!oe,chrome_version:oe?+oe[1]:0,ios:$e,android:/Android\b/.test(E.userAgent),webkit_version:Ms?+(/\bAppleWebKit\/(\d+)/.exec(E.userAgent)||[0,0])[1]:0,safari:Se,safari_version:Se?+(/\bVersion\/(\d+(\.\d+)?)/.exec(E.userAgent)||[0,0])[1]:0,tabSize:me.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function We(n,t){for(let e in n)e=="class"&&t.class?t.class+=" "+n.class:e=="style"&&t.style?t.style+=";"+n.style:t[e]=n[e];return t}const Ut=Object.create(null);function Pe(n,t,e){if(n==t)return!0;n||(n=Ut),t||(t=Ut);let i=Object.keys(n),s=Object.keys(t);if(i.length-0!=s.length-0)return!1;for(let r of i)if(r!=e&&(s.indexOf(r)==-1||n[r]!==t[r]))return!1;return!0}function As(n,t){for(let e=n.attributes.length-1;e>=0;e--){let i=n.attributes[e].name;t[i]==null&&n.removeAttribute(i)}for(let e in t){let i=t[e];e=="style"?n.style.cssText=i:n.getAttribute(e)!=i&&n.setAttribute(e,i)}}function Ye(n,t,e){let i=!1;if(t)for(let s in t)e&&s in e||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(e)for(let s in e)t&&t[s]==e[s]||(i=!0,s=="style"?n.style.cssText=e[s]:n.setAttribute(s,e[s]));return i}function Ts(n){let t=Object.create(null);for(let e=0;e<n.attributes.length;e++){let i=n.attributes[e];t[i.name]=i.value}return t}class Lt{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var F=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(F||(F={}));class W extends Ee{constructor(t,e,i,s){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new Rt(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new rt(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,s;if(t.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Mi(t,e);i=(r?e?-3e8:-1:5e8)-1,s=(o?e?2e8:1:-6e8)+1}return new rt(t,i,s,e,t.widget||null,!0)}static line(t){return new Et(t)}static set(t,e=!1){return N.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}W.none=N.empty;class Rt extends W{constructor(t){let{start:e,end:i}=Mi(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?We(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Ut}eq(t){return this==t||t instanceof Rt&&this.tagName==t.tagName&&Pe(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Rt.prototype.point=!1;class Et extends W{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Et&&this.spec.class==t.spec.class&&Pe(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Et.prototype.mapMode=kt.TrackBefore;Et.prototype.point=!0;class rt extends W{constructor(t,e,i,s,r,o){super(e,i,r,t),this.block=s,this.isReplace=o,this.mapMode=s?e<=0?kt.TrackBefore:kt.TrackAfter:kt.TrackDel}get type(){return this.startSide!=this.endSide?F.WidgetRange:this.startSide<=0?F.WidgetBefore:F.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof rt&&Ds(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}rt.prototype.point=!0;function Mi(n,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=n;return e==null&&(e=n.inclusive),i==null&&(i=n.inclusive),{start:e??t,end:i??t}}function Ds(n,t){return n==t||!!(n&&t&&n.compare(t))}function ft(n,t,e,i=0){let s=e.length-1;s>=0&&e[s]+i>=n?e[s]=Math.max(e[s],t):e.push(n,t)}class gt extends Ee{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof gt&&this.tagName==t.tagName&&Pe(this.attributes,t.attributes)}static create(t){return new gt(t.tagName,t.attributes||Ut)}static set(t,e=!1){return N.of(t,e)}}gt.prototype.startSide=gt.prototype.endSide=-1;function Dt(n){let t;return n.nodeType==11?t=n.getSelection?n:n.ownerDocument:t=n,t.getSelection()}function we(n,t){return t?n==t||n.contains(t.nodeType!=1?t.parentNode:t):!1}function vt(n,t){if(!t.anchorNode)return!1;try{return we(n,t.anchorNode)}catch{return!1}}function _t(n){return n.nodeType==3?Ot(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Mt(n,t,e,i){return e?Xe(n,t,e,i,-1)||Xe(n,t,e,i,1):!1}function et(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t}function Gt(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Xe(n,t,e,i,s){for(;;){if(n==e&&t==i)return!0;if(t==(s<0?0:J(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;t=et(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[t+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;t=s<0?J(n):0}else return!1}}function J(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $t(n,t){let e=t?n.left:n.right;return{left:e,right:e,top:n.top,bottom:n.bottom}}function Os(n){let t=n.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ai(n,t){let e=t.width/n.offsetWidth,i=t.height/n.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-n.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-n.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Bs(n,t,e,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView||window;for(let f=n,c=!1;f&&!c;)if(f.nodeType==1){let d,u=f==h.body,g=1,p=1;if(u)d=Os(a);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:g,scaleY:p}=Ai(f,S)),d={left:S.left,right:S.left+f.clientWidth*g,top:S.top,bottom:S.top+f.clientHeight*p}}let b=0,m=0;if(s=="nearest")t.top<d.top?(m=t.top-(d.top+o),e>0&&t.bottom>d.bottom+m&&(m=t.bottom-d.bottom+o)):t.bottom>d.bottom&&(m=t.bottom-d.bottom+o,e<0&&t.top-m<d.top&&(m=t.top-(d.top+o)));else{let S=t.bottom-t.top,x=d.bottom-d.top;m=(s=="center"&&S<=x?t.top+S/2-x/2:s=="start"||s=="center"&&e<0?t.top-o:t.bottom-x+o)-d.top}if(i=="nearest"?t.left<d.left?(b=t.left-(d.left+r),e>0&&t.right>d.right+b&&(b=t.right-d.right+r)):t.right>d.right&&(b=t.right-d.right+r,e<0&&t.left<d.left+b&&(b=t.left-(d.left+r))):b=(i=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:i=="start"==l?t.left-r:t.right-(d.right-d.left)+r)-d.left,b||m)if(u)a.scrollBy(b,m);else{let S=0,x=0;if(m){let A=f.scrollTop;f.scrollTop+=m/p,x=(f.scrollTop-A)*p}if(b){let A=f.scrollLeft;f.scrollLeft+=b/g,S=(f.scrollLeft-A)*g}t={left:t.left-S,top:t.top-x,right:t.right-S,bottom:t.bottom-x},S&&Math.abs(S-b)<1&&(i="nearest"),x&&Math.abs(x-m)<1&&(s="nearest")}if(u)break;(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)&&(t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Ls(n){let t=n.ownerDocument,e,i;for(let s=n.parentNode;s&&!(s==t.body||e&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!e&&s.scrollWidth>s.clientWidth&&(e=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:e,y:i}}class Rs{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?J(e):0),i,Math.min(t.focusOffset,i?J(i):0))}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let it=null;y.safari&&y.safari_version>=26&&(it=!1);function Ti(n){if(n.setActive)return n.setActive();if(it)return n.focus(it);let t=[];for(let e=n;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(n.focus(it==null?{get preventScroll(){return it={preventScroll:!0},!0}}:void 0),!it){it=!1;for(let e=0;e<t.length;){let i=t[e++],s=t[e++],r=t[e++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let Qe;function Ot(n,t,e=t){let i=Qe||(Qe=document.createRange());return i.setEnd(n,e),i.setStart(n,t),i}function ct(n,t,e,i){let s={key:t,code:t,keyCode:e,which:e,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,n.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,n.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function Es(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function Ws(n,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(i=Math.min(i,J(e));;)if(i){if(e.nodeType!=1)return!1;let s=e.childNodes[i-1];s.contentEditable=="false"?i--:(e=s,i=J(e))}else{if(e==n)return!0;i=et(e),e=e.parentNode}}function Di(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function Oi(n,t){for(let e=n,i=t;;){if(e.nodeType==3&&i>0)return{node:e,offset:i};if(e.nodeType==1&&i>0){if(e.contentEditable=="false")return null;e=e.childNodes[i-1],i=J(e)}else if(e.parentNode&&!Gt(e))i=et(e),e=e.parentNode;else return null}}function Bi(n,t){for(let e=n,i=t;;){if(e.nodeType==3&&i<e.nodeValue.length)return{node:e,offset:i};if(e.nodeType==1&&i<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[i],i=0}else if(e.parentNode&&!Gt(e))i=et(e)+1,e=e.parentNode;else return null}}class q{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new q(t.parentNode,et(t),e)}static after(t,e){return new q(t.parentNode,et(t)+1,e)}}var O=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(O||(O={}));const ot=O.LTR,He=O.RTL;function Li(n){let t=[];for(let e=0;e<n.length;e++)t.push(1<<+n[e]);return t}const Ps=Li("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Hs=Li("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),xe=Object.create(null),G=[];for(let n of["()","[]","{}"]){let t=n.charCodeAt(0),e=n.charCodeAt(1);xe[t]=e,xe[e]=-t}function Ri(n){return n<=247?Ps[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?Hs[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const Ns=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _{get dir(){return this.level%2?He:ot}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,s){let r=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==i)return o;(r<0||(s!=0?s<0?l.from<e:l.to>e:t[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Ei(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++){let i=n[e],s=t[e];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!Ei(i.inner,s.inner))return!1}return!0}const k=[];function Vs(n,t,e,i,s){for(let r=0;r<=i.length;r++){let o=r?i[r-1].to:t,l=r<i.length?i[r].from:e,h=r?256:s;for(let a=o,f=h,c=h;a<l;a++){let d=Ri(n.charCodeAt(a));d==512?d=f:d==8&&c==4&&(d=16),k[a]=d==4?2:d,d&7&&(c=d),f=d}for(let a=o,f=h,c=h;a<l;a++){let d=k[a];if(d==128)a<l-1&&f==k[a+1]&&f&24?d=k[a]=f:k[a]=256;else if(d==64){let u=a+1;for(;u<l&&k[u]==64;)u++;let g=a&&f==8||u<e&&k[u]==8?c==1?1:8:256;for(let p=a;p<u;p++)k[p]=g;a=u-1}else d==8&&c==1&&(k[a]=1);f=d,d&7&&(c=d)}}}function Fs(n,t,e,i,s){let r=s==1?2:1;for(let o=0,l=0,h=0;o<=i.length;o++){let a=o?i[o-1].to:t,f=o<i.length?i[o].from:e;for(let c=a,d,u,g;c<f;c++)if(u=xe[d=n.charCodeAt(c)])if(u<0){for(let p=l-3;p>=0;p-=3)if(G[p+1]==-u){let b=G[p+2],m=b&2?s:b&4?b&1?r:s:0;m&&(k[c]=k[G[p]]=m),l=p;break}}else{if(G.length==189)break;G[l++]=c,G[l++]=d,G[l++]=h}else if((g=k[c])==2||g==1){let p=g==s;h=p?0:1;for(let b=l-3;b>=0;b-=3){let m=G[b+2];if(m&2)break;if(p)G[b+2]|=2;else{if(m&4)break;G[b+2]|=4}}}}}function Is(n,t,e,i){for(let s=0,r=i;s<=e.length;s++){let o=s?e[s-1].to:n,l=s<e.length?e[s].from:t;for(let h=o;h<l;){let a=k[h];if(a==256){let f=h+1;for(;;)if(f==l){if(s==e.length)break;f=e[s++].to,l=s<e.length?e[s].from:t}else if(k[f]==256)f++;else break;let c=r==1,d=(f<t?k[f]:i)==1,u=c==d?c?1:2:i;for(let g=f,p=s,b=p?e[p-1].to:n;g>h;)g==b&&(g=e[--p].from,b=p?e[p-1].to:n),k[--g]=u;h=f}else r=a,h++}}}function Ce(n,t,e,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let h=t,a=0;h<e;){let f=!0,c=!1;if(a==r.length||h<r[a].from){let p=k[h];p!=l&&(f=!1,c=p==16)}let d=!f&&l==1?[]:null,u=f?i:i+1,g=h;t:for(;;)if(a<r.length&&g==r[a].from){if(c)break t;let p=r[a];if(!f)for(let b=p.to,m=a+1;;){if(b==e)break t;if(m<r.length&&r[m].from==b)b=r[m++].to;else{if(k[b]==l)break t;break}}if(a++,d)d.push(p);else{p.from>h&&o.push(new _(h,p.from,u));let b=p.direction==ot!=!(u%2);ke(n,b?i+1:i,s,p.inner,p.from,p.to,o),h=p.to}g=p.to}else{if(g==e||(f?k[g]!=l:k[g]==l))break;g++}d?Ce(n,h,g,i+1,s,d,o):h<g&&o.push(new _(h,g,u)),h=g}else for(let h=e,a=r.length;h>t;){let f=!0,c=!1;if(!a||h>r[a-1].to){let p=k[h-1];p!=l&&(f=!1,c=p==16)}let d=!f&&l==1?[]:null,u=f?i:i+1,g=h;t:for(;;)if(a&&g==r[a-1].to){if(c)break t;let p=r[--a];if(!f)for(let b=p.from,m=a;;){if(b==t)break t;if(m&&r[m-1].to==b)b=r[--m].from;else{if(k[b-1]==l)break t;break}}if(d)d.push(p);else{p.to<h&&o.push(new _(p.to,h,u));let b=p.direction==ot!=!(u%2);ke(n,b?i+1:i,s,p.inner,p.from,p.to,o),h=p.from}g=p.from}else{if(g==t||(f?k[g-1]!=l:k[g-1]==l))break;g--}d?Ce(n,g,h,i+1,s,d,o):g<h&&o.push(new _(g,h,u)),h=g}}function ke(n,t,e,i,s,r,o){let l=t%2?2:1;Vs(n,s,r,i,l),Fs(n,s,r,i,l),Is(s,r,i,l),Ce(n,s,r,t,e,i,o)}function Ks(n,t,e){if(!n)return[new _(0,0,t==He?1:0)];if(t==ot&&!e.length&&!Ns.test(n))return Wi(n.length);if(e.length)for(;n.length>k.length;)k[k.length]=256;let i=[],s=t==ot?0:1;return ke(n,s,s,e,0,n.length,i),i}function Wi(n){return[new _(0,n,0)]}let Pi="";function zs(n,t,e,i,s){var r;let o=i.head-n.from,l=_.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),h=t[l],a=h.side(s,e);if(o==a){let d=l+=s?1:-1;if(d<0||d>=t.length)return null;h=t[l=d],o=h.side(!s,e),a=h.side(s,e)}let f=st(n.text,o,h.forward(s,e));(f<h.from||f>h.to)&&(f=a),Pi=n.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return c&&f==a&&c.level+(s?0:1)<h.level?w.cursor(c.side(!s,e)+n.from,c.forward(s,e)?1:-1,c.level):w.cursor(f+n.from,h.forward(s,e)?-1:1,h.level)}function qs(n,t,e){for(let i=t;i<e;i++){let s=Ri(n.charCodeAt(i));if(s==1)return ot;if(s==2||s==4)return He}return ot}const Hi=v.define(),Ni=v.define(),Vi=v.define(),Fi=v.define(),ve=v.define(),Ii=v.define(),Ki=v.define(),Ne=v.define(),Ve=v.define(),zi=v.define({combine:n=>n.some(t=>t)}),_s=v.define({combine:n=>n.some(t=>t)}),qi=v.define();class dt{constructor(t,e="nearest",i="nearest",s=5,r=5,o=!1){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new dt(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new dt(w.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ht=Re.define({map:(n,t)=>n.map(t)}),_i=Re.define();function Y(n,t,e){let i=n.facet(Fi);i.length?i[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}const X=v.define({combine:n=>n.length?n[0]:!0});let js=0;const at=v.define({combine(n){return n.filter((t,e)=>{for(let i=0;i<e;i++)if(n[i].plugin==t.plugin)return!1;return!0})}});class pt{constructor(t,e,i,s,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(at.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(at.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:i,eventObservers:s,provide:r,decorations:o}=e||{};return new pt(js++,t,i,s,l=>{let h=[];return o&&h.push(ee.of(a=>{let f=a.plugin(l);return f?o(f):W.none})),r&&h.push(r(l)),h})}static fromClass(t,e){return pt.define((i,s)=>new t(i,s),e)}}class le{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(Y(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){Y(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){Y(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ji=v.define(),Fe=v.define(),ee=v.define(),Ui=v.define(),Ie=v.define(),Wt=v.define(),Gi=v.define();function Je(n,t){let e=n.state.facet(Gi);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(n):r),s=[];return N.spans(i,t.from,t.to,{point(){},span(r,o,l,h){let a=r-t.from,f=o-t.from,c=s;for(let d=l.length-1;d>=0;d--,h--){let u=l[d].spec.bidiIsolate,g;if(u==null&&(u=qs(t.text,a,f)),h>0&&c.length&&(g=c[c.length-1]).to==a&&g.direction==u)g.to=f,c=g.inner;else{let p={from:a,to:f,direction:u,inner:[]};c.push(p),c=p.inner}}}}),s}const $i=v.define();function Yi(n){let t=0,e=0,i=0,s=0;for(let r of n.state.facet($i)){let o=r(n);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:e,top:i,bottom:s}}const St=v.define();class K{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new K(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(e.length==0)return t;let i=[];for(let s=0,r=0,o=0;;){let l=s<t.length?t[s].fromB:1e9,h=r<e.length?e[r]:1e9,a=Math.min(l,h);if(a==1e9)break;let f=a+o,c=a,d=f;for(;;)if(r<e.length&&e[r]<=c){let u=e[r+1];r+=2,c=Math.max(c,u);for(let g=s;g<t.length&&t[g].fromB<=c;g++)o=t[g].toA-t[g].toB;d=Math.max(d,u+o)}else if(s<t.length&&t[s].fromB<=c){let u=t[s++];c=Math.max(c,u.toB),d=Math.max(d,u.toA),o=u.toA-u.toB}else break;i.push(new K(f,d,a,c))}return i}}class Bt{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=ki.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,h)=>s.push(new K(r,o,l,h))),this.changedRanges=s}static create(t,e,i){return new Bt(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Us=[];class T{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Us}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&As(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let s of this.children){if(s==t)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let i=et(this.dom),s=this.length?t>0:e>0;return new q(this.parent.dom,i+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof se)return t;return null}static get(t){return t.cmTile}}class ie extends T{constructor(t){super(t,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(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,i=null,s,r=t?.node==e?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,s=i?i.nextSibling:e.firstChild,r&&s!=l.dom&&(r.written=!0),l.dom.parentNode==e)for(;s&&s!=l.dom;)s=Ze(s);else e.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:e.firstChild,r&&s&&(r.written=!0);s;)s=Ze(s);this.length=o}}function Ze(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class se extends ie{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=T.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,s=0,r=0;;)if(s==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&r++,s=e.pop()}else{let o=i.children[s++];if(o instanceof Q)e.push(s),i=o,s=0;else{let l=r+o.length,h=t(o,r);if(h!==void 0)return h;r=l+o.breakAfter}}}resolveBlock(t,e){let i,s=-1,r,o=-1;if(this.blockTiles((l,h)=>{let a=h+l.length;if(t>=h&&t<=a){if(l.isWidget()&&e>=-1&&e<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(h<t||t==a&&(e<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,s=t-h),(a>t||t==h&&(e>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=t-h)}}),!i&&!r)throw new Error("No tile at position "+t);return i&&e<0||!r?{tile:i,offset:s}:{tile:r,offset:o}}}class Q extends ie{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let i=new Q(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}}class mt extends ie{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,i){let s=new mt(e||document.createElement("div"),t);return(!e||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,e,i){let s=null,r=-1,o=null,l=-1;function h(f,c){for(let d=0,u=0;d<f.children.length&&u<=c;d++){let g=f.children[d],p=u+g.length;p>=c&&(g.isComposite()?h(g,c-u):(!o||o.isHidden&&(e>0||i&&$s(o,g)))&&(p>c||g.flags&32)?(o=g,l=c-u):(u<c||g.flags&16&&!g.isHidden)&&(s=g,r=c-u)),u=p}}h(this,t);let a=(e<0?s:o)||s||o;return a?{tile:a,offset:a==s?r:l}:null}coordsIn(t,e){let i=this.resolveInline(t,e,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),e):Gs(this)}domIn(t,e){let i=this.resolveInline(t,e);if(i){let{tile:s,offset:r}=i;if(this.dom.contains(s.dom))return s.isText()?new q(s.dom,Math.min(s.dom.nodeValue.length,r)):s.domPosFor(r,s.flags&16?1:s.flags&32?-1:e);let o=i.tile.parent,l=!1;for(let h of o.children){if(l)return new q(h.dom,0);h==i.tile&&(l=!0)}}return new q(this.dom,0)}}function Gs(n){let t=n.dom.lastChild;if(!t)return n.dom.getBoundingClientRect();let e=_t(t);return e[e.length-1]||null}function $s(n,t){let e=n.coordsIn(0,1),i=t.coordsIn(0,1);return e&&i&&i.top<e.bottom}class H extends ie{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let i=new H(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}}class nt extends T{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let i=this.dom.nodeValue.length;t>i&&(t=i);let s=t,r=t,o=0;t==0&&e<0||t==i&&e>=0?y.chrome||y.gecko||(t?(s--,o=1):r<i&&(r++,o=-1)):e<0?s--:r<i&&r++;let l=Ot(this.dom,s,r).getClientRects();if(!l.length)return null;let h=l[(o?o<0:e>=0)?0:l.length-1];return y.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?$t(h,o<0):h||null}static of(t,e){let i=new nt(e||document.createTextNode(t),t);return e||(i.flags|=2),i}}class lt extends T{constructor(t,e,i,s){super(t,e,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let s=this.widget.coordsAt(this.dom,t,e);if(s)return s;if(i)return $t(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let h=l?r.length-1:0;o=r[h],!(t>0?h==0:h==r.length-1||o.top<o.bottom);h+=l?-1:1);return $t(o,!l)}}get overrideDOMText(){if(!this.length)return j.empty;let{root:t}=this;if(!t)return j.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,i,s,r){return r||(r=t.toDOM(e),t.editable||(r.contentEditable="false")),new lt(r,i,t,s)}}class Yt extends T{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return j.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Ys{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,i){let{tile:s,index:r,beforeBreak:o,parents:l}=this;for(;t||e>0;)if(s.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(r==s.children.length){if(!t&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++}else{let h=s.children[r],a=h.breakAfter;(e>0?h.length<=t:h.length<t)&&(!i||i.skip(h,0,h.length)!==!1||!h.isComposite)?(o=!!a,r++,t-=h.length):(l.push({tile:s,index:r}),s=h,r=0,i&&h.isComposite()&&i.enter(h))}else if(r==s.length)o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++;else if(t){let h=Math.min(t,s.length-r);i&&i.skip(s,r,r+h),t-=h,r+=h}else break;return this.tile=s,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Xs{constructor(t,e,i,s){this.from=t,this.to=e,this.wrapper=i,this.rank=s}}class Qs{constructor(t,e,i){this.cache=t,this.root=e,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,i,s){var r;this.flushBuffer();let o=this.ensureMarks(e,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+t.length<512){this.cache.reused.set(l,2);let h=o.children[o.children.length-1]=new nt(l.dom,l.text+t);h.parent=o}else o.append(s||nt.of(t,(r=this.cache.find(nt))===null||r===void 0?void 0:r.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let i=this.curLine;i.dom!=e.line.dom&&(i.setDOM(this.cache.reused.has(e.line)?he(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let s=i;for(let l=e.marks.length-1;l>=0;l--){let h=e.marks[l],a=s.lastChild;if(a instanceof H&&a.mark.eq(h.mark))a.dom!=h.dom&&a.setDOM(he(h.dom)),s=a;else{if(this.cache.reused.get(h)){let c=T.get(h.dom);c&&c.setDOM(he(h.dom))}let f=H.of(h.mark,h.dom);s.append(f),s=f}this.cache.reused.set(h,2)}let r=T.get(t.text);r&&this.cache.reused.set(r,2);let o=new nt(t.text,t.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(t,e,i){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let r=this.ensureMarks(e,i);!s&&!(t.flags&16)&&r.append(this.getBuffer(1)),r.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=Xi);let s=mt.start(t,e||((i=this.cache.find(mt))===null||i===void 0?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let s=this.curLine;for(let r=t.length-1;r>=0;r--){let o=t[r],l;if(e>0&&(l=s.lastChild)&&l instanceof H&&l.mark.eq(o))s=l,e--;else{let h=H.of(o,(i=this.cache.find(H,a=>a.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(h),s=h,e=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!ti(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(y.ios&&ti(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ae,0,32)||new lt(ae.toDOM(),0,ae,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new Xs(t.from,t.to,t.value,t.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-e.rank||this.wrappers[i-1].to-e.to)<0;)i--;this.wrappers.splice(i,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let s=e.lastChild;if(i.from<this.pos&&s instanceof Q&&s.wrapper.eq(i.wrapper))e=s;else{let r=Q.of(i.wrapper,(t=this.cache.find(Q,o=>o.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);e.append(r),e=r}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(Yt,void 0,1);return i&&(i.flags=e),i||new Yt(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Js{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(t,s.length);return r?null:s.slice(0,l)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}}const Xt=[lt,mt,nt,H,Yt,Q,se];for(let n=0;n<Xt.length;n++)Xt[n].bucket=n;class Zs{constructor(t){this.view=t,this.buckets=Xt.map(()=>[]),this.index=Xt.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let s=t.bucket,r=this.buckets[s],o=this.index[s];for(let l=r.length-1;l>=0;l--){let h=(l+o)%r.length,a=r[h];if((!e||e(a))&&!this.reused.has(a))return r.splice(h,1),h<o&&this.index[s]--,this.reused.set(a,i),a}return null}findWidget(t,e,i){let s=this.buckets[0];if(s.length)for(let r=0,o=0;;r++){if(r==s.length){if(o)return null;o=1,r=0}let l=s[r];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view)))return s.splice(r,1),r<this.index[0]&&this.index[0]--,l.widget==t&&l.length==e&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new lt(l.dom,e,t,l.flags&-498|i))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class tn{constructor(t,e,i,s,r){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new Zs(t),this.text=new Js(t.state.doc),this.builder=new Qs(this.cache,new se(t,t.contentDOM),N.iter(i)),this.cache.reused.set(e,2),this.old=new Ys(e),this.reuseWalker={skip:(o,l,h)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let s=0,r=0,o=0;;){let l=o<t.length?t[o++]:null,h=l?l.fromA:this.old.root.length;if(h>s){let a=h-s;this.preserve(a,!o,!l),s=h,r+=a}if(!l)break;e&&l.fromA<=e.range.fromA&&l.toA>=e.range.toA?(this.forward(l.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(r,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,i),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,l.toA),this.emit(e.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(r,l.toB)),r=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,i){let s=nn(this.old),r=this.openMarks;this.old.advance(t,i?1:-1,{skip:(o,l,h)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(h-l);else{let a=h>0||l<o.length?lt.of(o.widget,this.view,h-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,s,r),r=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&h==o.length?this.builder.addText(o.text,s,r,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,h),s,r)),r=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Yt)this.cache.add(o);else if(o instanceof H)this.builder.ensureLine(null),this.builder.addMark(o,s,r),this.cache.reused.set(o,1),r=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof H&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=r=0):o instanceof H&&(s.shift(),r=Math.min(r,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,s=this.builder,r=0,o=N.spans(this.decorations,t,e,{point:(l,h,a,f,c,d)=>{if(a instanceof rt){if(this.disallowBlockEffectsFor[d]){if(a.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=f.length,c>f.length)s.continueWidget(h-l);else{let u=a.widget||(a.block?bt.block:bt.inline),g=en(a),p=this.cache.findWidget(u,h-l,g)||lt.of(u,this.view,h-l,g);a.block?(a.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(p)):(s.ensureLine(i),s.addInlineWidget(p,f,c))}i=null}else i=sn(i,a);h>l&&this.text.skip(h-l)},span:(l,h,a,f)=>{for(let c=l;c<h;){let d=this.text.next(Math.min(512,h-c));d==null?(s.addLineStartIfNotCovered(i),s.addBreak(),c++):(s.ensureLine(i),s.addText(d,a,c==l?f:a.length),c+=d.length),i=null}}});s.addLineStartIfNotCovered(i),this.openWidget=o>r,this.openMarks=o}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let s=t.parentNode;;s=s.parentNode){let r=T.get(s);if(s==this.view.contentDOM)break;r instanceof H?e.push(r):r?.isLine()?i=r:r instanceof Q||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new mt(s,Xi):i||e.push(H.of(new Rt({tagName:s.nodeName.toLowerCase(),attributes:Ts(s)}),s)))}return{line:i,marks:e}}}function ti(n,t){let e=i=>{for(let s of i.children)if((t?s.isText():s.length)||e(s))return!0;return!1};return e(n)}function en(n){let t=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(t|=256),t}const Xi={class:"cm-line"};function sn(n,t){let e=t.spec.attributes,i=t.spec.class;return!e&&!i||(n||(n={class:"cm-line"}),e&&We(e,n),i&&(n.class+=" "+i)),n}function nn(n){let t=[];for(let e=n.parents.length;e>1;e--){let i=e==n.parents.length?n.tile:n.parents[e].tile;i instanceof H&&t.push(i.mark)}return t}function he(n){let t=T.get(n);return t&&t.setDOM(n.cloneNode()),n}class bt extends Lt{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}bt.inline=new bt("span");bt.block=new bt("div");const ae=new class extends Lt{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class ei{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=W.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 se(t,t.contentDOM),this.updateInner([new K(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:f,toA:c})=>c<this.minWidthFrom||f>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?s=this.domChanged.newSel.head:!un(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let r=s>-1?on(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:f,to:c}=this.hasComposition;i=new K(f,c,t.changes.mapPos(f,-1),t.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(y.ie||y.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let h=an(o,this.decorations,t.changes);h.length&&(i=K.extendWithRanges(i,h));let a=cn(l,this.blockWrappers,t.changes);return a.length&&(i=K.extendWithRanges(i,a)),r&&!i.some(f=>f.fromA<=r.range.fromA&&f.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let o=this.tile,l=new tn(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=l.run(t,e),Me(o,l.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=y.chrome||y.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.tile.children)r.isWidget()&&r.widget instanceof fe&&s.push(r.dom);i.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(_i)&&(this.editContextFormatting=i.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,s=this.view.root.activeElement,r=s==i,o=!r&&!(this.view.state.facet(X)||i.tabIndex>-1)&&vt(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(r||e||o))return;let l=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,a,f;if(h.empty?f=a=this.inlineDOMNearPos(h.anchor,h.assoc||1):(f=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),a=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),y.gecko&&h.empty&&!this.hasComposition&&rn(a)){let d=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(d,a.node.childNodes[a.offset]||null)),a=f=new q(d,0),l=!0}let c=this.view.observer.selectionRange;(l||!c.focusNode||(!Mt(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Mt(f.node,f.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,h))&&(this.view.observer.ignore(()=>{y.android&&y.chrome&&i.contains(c.focusNode)&&dn(c.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let d=Dt(this.view.root);if(d)if(h.empty){if(y.gecko){let u=ln(a.node,a.offset);if(u&&u!=3){let g=(u==1?Oi:Bi)(a.node,a.offset);g&&(a=new q(g.node,g.offset))}}d.collapse(a.node,a.offset),h.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=h.bidiLevel)}else if(d.extend){d.collapse(a.node,a.offset);try{d.extend(f.node,f.offset)}catch{}}else{let u=document.createRange();h.anchor>h.head&&([a,f]=[f,a]),u.setEnd(f.node,f.offset),u.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(u)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(a,f)),this.impreciseAnchor=a.precise?null:new q(c.anchorNode,c.anchorOffset),this.impreciseHead=f.precise?null:new q(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Mt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Dt(t.root),{anchorNode:s,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let h=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!h||!a||h.bottom>a.top)return;let f=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(f.node,f.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(s,r)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let r;if(t==i.dom)r=i.dom.childNodes[e];else{let o=J(t)==0?0:e==0?-1:1;for(;;){let l=t.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?r=t:r=t.nextSibling}if(r==i.dom.firstChild)return s;for(;r&&!T.get(r);)r=r.nextSibling;if(!r)return s+i.length;for(let o=0,l=s;;o++){let h=i.children[o];if(h.dom==r)return l;l+=h.length+h.breakAfter}}else return i.isText()?t==i.dom?s+e:s+(e?i.length:0):s}domAtPos(t,e){let{tile:i,offset:s}=this.tile.resolveBlock(t,e);return i.isWidget()?i.domPosFor(t,e):i.domIn(s,e)}inlineDOMNearPos(t,e){let i,s=-1,r=!1,o,l=-1,h=!1;return this.tile.blockTiles((a,f)=>{if(a.isWidget()){if(a.flags&32&&f>=t)return!0;a.flags&16&&(r=!0)}else{let c=f+a.length;if(f<=t&&(i=a,s=t-f,r=c<t),c>=t&&!o&&(o=a,l=t-f,h=f>t),f>t&&o)return!0}}),!i&&!o?this.domAtPos(t,e):(r&&o?i=null:h&&i&&(o=null),i&&e<0||!o?i.domIn(s,e):o.domIn(l,e))}coordsAt(t,e){let{tile:i,offset:s}=this.tile.resolveBlock(t,e);return i.isWidget()?i.widget instanceof fe?null:i.coordsInWidget(s,e,!0):i.coordsIn(s,e)}lineAt(t,e){let{tile:i}=this.tile.resolveBlock(t,e);return i.isLine()?i:null}coordsForChar(t){let{tile:e,offset:i}=this.tile.resolveBlock(t,1);if(!e.isLine())return null;function s(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let h=s(l,o);if(h)return h}if(o-=l.length,o<0)break}else if(r.isText()&&o<r.length){let l=st(r.text,o);if(l==o)return null;let h=Ot(r.dom,o,l).getClientRects();for(let a=0;a<h.length;a++){let f=h[a];if(a==h.length-1||f.top<f.bottom&&f.left<f.right)return f}}return null}return s(e,i)}measureVisibleLineHeights(t){let e=[],{from:i,to:s}=t,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==O.LTR,a=0,f=(c,d,u)=>{for(let g=0;g<c.children.length&&!(d>s);g++){let p=c.children[g],b=d+p.length,m=p.dom.getBoundingClientRect(),{height:S}=m;if(u&&!g&&(a+=m.top-u.top),p instanceof Q)b>i&&f(p,d,m);else if(d>=i&&(a>0&&e.push(-a),e.push(S+a),a=0,o)){let x=p.dom.lastChild,A=x?_t(x):[];if(A.length){let B=A[A.length-1],D=h?B.right-m.left:m.right-B.left;D>l&&(l=D,this.minWidth=r,this.minWidthFrom=d,this.minWidthTo=b)}}u&&g==c.children.length-1&&(a+=u.bottom-m.bottom),d=b+p.breakAfter}};return f(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return getComputedStyle(e.dom).direction=="rtl"?O.RTL:O.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,h;for(let a of o.children){if(!a.isText()||/[^ -~]/.test(a.text))return;let f=_t(a.dom);if(f.length!=1)return;l+=f[0].width,h=f[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:h}}});if(t)return t;let e=document.createElement("div"),i,s,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(e);let o=_t(e.firstChild)[0];i=e.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,e.remove()}),{lineHeight:i,charWidth:s,textHeight:r}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let r=s==e.viewports.length?null:e.viewports[s],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(W.replace({widget:new fe(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return W.set(t)}updateDeco(){let t=1,e=this.view.state.facet(ee).map(r=>(this.dynamicDecorationMap[t++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(Ie).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(N.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(Ui).map(r=>typeof r=="function"?r(this.view):r)}scrollIntoView(t){if(t.isSnapshot){let a=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=a.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let a of this.view.state.facet(qi))try{if(a(this.view,t.range,t))return!0}catch(f){Y(this.view.state,f,"scroll handler")}let{range:e}=t,i=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Yi(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:h}=this.view.scrollDOM;if(Bs(this.view.scrollDOM,o,e.head<e.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,h),-h),this.view.textDirection==O.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let a=this.view.docView.lineAt(e.head,1);a&&a.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let e=i=>i.isWidget()||i.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){Me(this.tile)}}function Me(n,t){let e=t?.get(n);if(e!=1){e==null&&n.destroy();for(let i of n.children)Me(i,t)}}function rn(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function Qi(n,t){let e=n.observer.selectionRange;if(!e.focusNode)return null;let i=Oi(e.focusNode,e.focusOffset),s=Bi(e.focusNode,e.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=T.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let h=T.get(i.node);!h||h.isText()&&h.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=t-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function on(n,t,e){let i=Qi(n,e);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let h=t.invertedDesc;return{range:new K(h.mapPos(r),h.mapPos(o),r,o),text:s}}function ln(n,t){return n.nodeType!=1?0:(t&&n.childNodes[t-1].contentEditable=="false"?1:0)|(t<n.childNodes.length&&n.childNodes[t].contentEditable=="false"?2:0)}let hn=class{constructor(){this.changes=[]}compareRange(t,e){ft(t,e,this.changes)}comparePoint(t,e){ft(t,e,this.changes)}boundChange(t){ft(t,t,this.changes)}};function an(n,t,e){let i=new hn;return N.compare(n,t,e,i),i.changes}class fn{constructor(){this.changes=[]}compareRange(t,e){ft(t,e,this.changes)}comparePoint(){}boundChange(t){ft(t,t,this.changes)}}function cn(n,t,e){let i=new fn;return N.compare(n,t,e,i),i.changes}function dn(n,t){for(let e=n;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function un(n,t){let e=!1;return t&&n.iterChangedRanges((i,s)=>{i<t.to&&s>t.from&&(e=!0)}),e}class fe extends Lt{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function gn(n,t,e=1){let i=n.charCategorizer(t),s=n.doc.lineAt(t),r=t-s.from;if(s.length==0)return w.cursor(t);r==0?e=1:r==s.length&&(e=-1);let o=r,l=r;e<0?o=st(s.text,r,!1):l=st(s.text,r);let h=i(s.text.slice(o,l));for(;o>0;){let a=st(s.text,o,!1);if(i(s.text.slice(a,o))!=h)break;o=a}for(;l<s.length;){let a=st(s.text,l);if(i(s.text.slice(l,a))!=h)break;l=a}return w.range(o+s.from,l+s.from)}function pn(n,t,e,i,s){let r=Math.round((i-t.left)*n.defaultCharacterWidth);if(n.lineWrapping&&e.height>n.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,h=Math.floor((s-e.top-(n.defaultLineHeight-l)*.5)/l);r+=h*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(e.from,e.to);return e.from+Ss(o,r,n.state.tabSize)}function mn(n,t,e){let i=n.lineBlockAt(t);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;(!s||r.type==F.Text&&(s.type!=r.type||(e<0?r.from<t:r.to>t)))&&(s=r)}}return s||i}return i}function bn(n,t,e,i){let s=mn(n,t.head,t.assoc||-1),r=!i||s.type!=F.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),h=n.posAtCoords({x:e==(l==O.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(h!=null)return w.cursor(h,e?-1:1)}return w.cursor(e?s.to:s.from,e?-1:1)}function ii(n,t,e,i){let s=n.state.doc.lineAt(t.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=t,h=null;;){let a=zs(s,r,o,l,e),f=Pi;if(!a){if(s.number==(e?n.state.doc.lines:1))return l;f=`
|
|
4
|
+
`,s=n.state.doc.line(s.number+(e?1:-1)),r=n.bidiSpans(s),a=n.visualLineSide(s,!e)}if(h){if(!h(f))return l}else{if(!i)return a;h=i(f)}l=a}}function yn(n,t,e){let i=n.state.charCategorizer(t),s=i(e);return r=>{let o=i(r);return s==ws.Space&&(s=o),s==o}}function Sn(n,t,e,i){let s=t.head,r=e?1:-1;if(s==(e?n.state.doc.length:0))return w.cursor(s,t.assoc);let o=t.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s,(t.empty?t.assoc:0)||(e?1:-1)),f=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let g=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-g.from))),l=(r<0?g.top:g.bottom)+f}let c=h.left+o,d=i??n.viewState.heightOracle.textHeight>>1,u=Ae(n,{x:c,y:l+d*r},!1,r);return w.cursor(u.pos,u.assoc,void 0,o)}function At(n,t,e){for(;;){let i=0;for(let s of n)s.between(t-1,t+1,(r,o,l)=>{if(t>r&&t<o){let h=i||e||(t-r<o-t?-1:1);t=h<0?r:o,i=h}});if(!i)return t}}function Ji(n,t){let e=null;for(let i=0;i<t.ranges.length;i++){let s=t.ranges[i],r=null;if(s.empty){let o=At(n,s.from,0);o!=s.from&&(r=w.cursor(o,-1))}else{let o=At(n,s.from,-1),l=At(n,s.to,1);(o!=s.from||l!=s.to)&&(r=w.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}r&&(e||(e=t.ranges.slice()),e[i]=r)}return e?w.create(e,t.mainIndex):t}function ce(n,t,e){let i=At(n.state.facet(Wt).map(s=>s(n)),e.from,t.head>e.from?-1:1);return i==e.from?e:w.cursor(i,i<e.from?1:-1)}class ${constructor(t,e){this.pos=t,this.assoc=e}}function Ae(n,t,e,i){let s=n.contentDOM.getBoundingClientRect(),r=s.top+n.viewState.paddingTop,{x:o,y:l}=t,h=l-r,a;for(;;){if(h<0)return new $(0,1);if(h>n.viewState.docHeight)return new $(n.state.doc.length,-1);if(a=n.elementAtHeight(h),i==null)break;if(a.type==F.Text){if(i<0?a.to<n.viewport.from:a.from>n.viewport.to)break;let d=n.docView.coordsAt(i<0?a.from:a.to,i>0?-1:1);if(d&&(i<0?d.top<=h+r:d.bottom>=h+r))break}let c=n.viewState.heightOracle.textHeight/2;h=i>0?a.bottom+c:a.top-c}if(n.viewport.from>=a.to||n.viewport.to<=a.from){if(e)return null;if(a.type==F.Text){let c=pn(n,s,a,o,l);return new $(c,c==a.from?1:-1)}}if(a.type!=F.Text)return h<(a.top+a.bottom)/2?new $(a.from,1):new $(a.to,-1);let f=n.docView.lineAt(a.from,2);return(!f||f.length!=a.length)&&(f=n.docView.lineAt(a.from,-2)),new wn(n,o,l,n.textDirectionAt(a.from)).scanTile(f,a.from)}class wn{constructor(t,e,i,s){this.view=t,this.x=e,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,e){let{line:i,spans:s}=this.bidiSpansAt(t);return s[_.find(s,t-i.from,-1,e)].level==this.baseDir}dirAt(t,e){let{line:i,spans:s}=this.bidiSpansAt(t);return s[_.find(s,t-i.from,-1,e)].dir}bidiIn(t,e){let{spans:i,line:s}=this.bidiSpansAt(t);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from<e)}scan(t,e){let i=0,s=t.length-1,r=new Set,o=this.bidiIn(t[0],t[s]),l,h,a=-1,f=1e9,c;t:for(;i<s;){let u=s-i,g=i+s>>1;e:if(r.has(g)){let b=i+Math.floor(Math.random()*u);for(let m=0;m<u;m++){if(!r.has(b)){g=b;break e}b++,b==s&&(b=i)}break t}r.add(g);let p=e(g);if(p)for(let b=0;b<p.length;b++){let m=p[b],S=0;if(m.bottom<this.y)(!l||l.bottom<m.bottom)&&(l=m),S=1;else if(m.top>this.y)(!h||h.top>m.top)&&(h=m),S=-1;else{let x=m.left>this.x?this.x-m.left:m.right<this.x?this.x-m.right:0,A=Math.abs(x);A<f&&(a=g,f=A,c=m),x&&(S=x<0==(this.baseDir==O.LTR)?-1:1)}S==-1&&(!o||this.baseDirAt(t[g],1))?s=g:S==1&&(!o||this.baseDirAt(t[g+1],-1))&&(i=g+1)}}if(!c){let u=l&&(!h||this.y-l.bottom<h.top-this.y)?l:h;return this.y=(u.top+u.bottom)/2,this.scan(t,e)}let d=(o?this.dirAt(t[a],1):this.baseDir)==O.LTR;return{i:a,after:this.x>(c.left+c.right)/2==d}}scanText(t,e){let i=[];for(let r=0;r<t.length;r=st(t.text,r))i.push(e+r);i.push(e+t.length);let s=this.scan(i,r=>{let o=i[r]-e,l=i[r+1]-e;return Ot(t.dom,o,l).getClientRects()});return s.after?new $(i[s.i+1],-1):new $(i[s.i],1)}scanTile(t,e){if(!t.length)return new $(e,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,e);if(l.isComposite())return this.scanTile(l,e)}let i=[e];for(let l=0,h=e;l<t.children.length;l++)i.push(h+=t.children[l].length);let s=this.scan(i,l=>{let h=t.children[l];return h.flags&48?null:(h.dom.nodeType==1?h.dom:Ot(h.dom,0,h.length)).getClientRects()}),r=t.children[s.i],o=i[s.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):s.after?new $(i[s.i+1],-1):new $(o,1)}}const wt="";class xn{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(Ct.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=wt}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=T.get(s),l=s.nextSibling;if(l==e){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let h=T.get(l);(o&&h?o.breakAfter:(o?o.breakAfter:Gt(s))||Gt(l)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!kn(l,e)&&this.lineBreak(),s=l}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(e))&&(r=l.index,o=l[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let h of this.points)h.node==t&&h.pos>this.text.length&&(h.pos-=o-1);i=r+o}}readNode(t){let e=T.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Cn(t,i.node,i.offset)?e:0))}}function Cn(n,t,e){for(;;){if(!t||e<J(t))return!1;if(t==n)return!0;e=et(t)+1,t=t.parentNode}}function kn(n,t){let e;for(;!(n==t||!n);n=n.nextSibling){let i=T.get(n);if(!i?.isWidget())return!1;i&&(e||(e=[])).push(i)}if(e)for(let i of e){let s=i.overrideDOMText;if(s?.length)return!1}return!0}class si{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class vn{constructor(t,e,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=Zi(t.docView.tile,e,i,0))){let l=r||o?[]:An(t),h=new xn(l,t);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=Tn(l,this.bounds.from)}else{let l=t.observer.selectionRange,h=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!we(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),a=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!we(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((y.ios||y.chrome)&&t.state.selection.main.empty&&h!=a&&(f.from>0||f.to<t.state.doc.length)){let c=Math.min(h,a),d=Math.max(h,a),u=f.from-c,g=f.to-d;(u==0||u==1||c==0)&&(g==0||g==-1||d==t.state.doc.length)&&(h=0,a=t.state.doc.length)}t.inputState.composing>-1&&t.state.selection.ranges.length>1?this.newSel=t.state.selection.replaceRange(w.range(a,h)):this.newSel=w.single(a,h)}}}function Zi(n,t,e,i){if(n.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let h=0,a=i,f=i;h<n.children.length;h++){let c=n.children[h],d=a+c.length;if(a<t&&d>e)return Zi(c,t,e,a);if(d>=t&&s==-1&&(s=h,r=a),a>e&&c.dom.parentNode==n.dom){o=h,l=f;break}f=d,a=d+c.breakAfter}return{from:r,to:l<0?i+n.length:l,startDOM:(s?n.children[s-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function ts(n,t){let e,{newSel:i}=t,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,h=s.from,a=null;(r===8||y.android&&t.text.length<l-o)&&(h=s.to,a="end");let f=es(n.state.doc.sliceString(o,l,wt),t.text,h-o,a);f&&(y.chrome&&r==13&&f.toB==f.from+2&&t.text.slice(f.from,f.toB)==wt+wt&&f.toB--,e={from:o+f.from,to:o+f.toA,insert:j.of(t.text.slice(f.from,f.toB).split(wt))})}else i&&(!n.hasFocus&&n.state.facet(X)||Qt(i,s))&&(i=null);if(!e&&!i)return!1;if(!e&&t.typeOver&&!s.empty&&i&&i.main.empty?e={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,s.to)}:(y.mac||y.android)&&e&&e.from==e.to&&e.from==s.head-1&&/^\. ?$/.test(e.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=w.single(i.main.anchor-1,i.main.head-1)),e={from:e.from,to:e.to,insert:j.of([e.insert.toString().replace("."," ")])}):e&&e.from>=s.from&&e.to<=s.to&&(e.from!=s.from||e.to!=s.to)&&s.to-s.from-(e.to-e.from)<=4?e={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,e.from).append(e.insert).append(n.state.doc.slice(e.to,s.to))}:n.state.doc.lineAt(s.from).to<s.to&&n.docView.lineHasWidget(s.to)&&n.inputState.insertingTextAt>Date.now()-50?e={from:s.from,to:s.to,insert:n.state.toText(n.inputState.insertingText)}:y.chrome&&e&&e.from==e.to&&e.from==s.head&&e.insert.toString()==`
|
|
5
|
+
`&&n.lineWrapping&&(i&&(i=w.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:j.of([" "])}),e)return Ke(n,e,i,r);if(i&&!Qt(i,s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=Ji(n.state.facet(Wt).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Ke(n,t,e,i=-1){if(y.ios&&n.inputState.flushIOSKey(t))return!0;let s=n.state.selection.main;if(y.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&n.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&ct(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&ct(n.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&ct(n.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Mn(n,t,e));return n.state.facet(Ii).some(h=>h(n,t.from,t.to,r,l))||n.dispatch(l()),!0}function Mn(n,t,e){let i,s=n.state,r=s.selection.main,o=-1;if(t.from==t.to&&t.from<r.from||t.from>r.to){let h=t.from<r.from?-1:1,a=h<0?r.from:r.to,f=At(s.facet(Wt).map(c=>c(n)),a,h);t.from==f&&(o=f)}if(o>-1)i={changes:t,selection:w.cursor(t.from+t.insert.length,-1)};else if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let h=r.from<t.from?s.sliceDoc(r.from,t.from):"",a=r.to>t.to?s.sliceDoc(t.to,r.to):"";i=s.replaceSelection(n.state.toText(h+t.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let h=s.changes(t),a=e&&e.main.to<=h.newLength?e.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&t.to<=r.to+10&&t.to>=r.to-10){let f=n.state.sliceDoc(t.from,t.to),c,d=e&&Qi(n,e.main.head);if(d){let g=t.insert.length-(t.to-t.from);c={from:d.from,to:d.to-g}}else c=n.state.doc.lineAt(r.head);let u=r.to-t.to;i=s.changeByRange(g=>{if(g.from==r.from&&g.to==r.to)return{changes:h,range:a||g.map(h)};let p=g.to-u,b=p-f.length;if(n.state.sliceDoc(b,p)!=f||p>=c.from&&b<=c.to)return{range:g};let m=s.changes({from:b,to:p,insert:t.insert}),S=g.to-r.to;return{changes:m,range:a?w.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):g.map(m)}})}else i={changes:h,selection:a&&s.selection.replaceRange(a)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function es(n,t,e,i){let s=Math.min(n.length,t.length),r=0;for(;r<s&&n.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==s&&n.length==t.length)return null;let o=n.length,l=t.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(o,l));e-=o+h-r}if(o<r&&n.length<t.length){let h=e<=r&&e>=o?r-e:0;r-=h,l=r+(l-o),o=r}else if(l<r){let h=e<=r&&e>=l?r-e:0;r-=h,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function An(n){let t=[];if(n.root.activeElement!=n.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return e&&(t.push(new si(e,i)),(s!=e||r!=i)&&t.push(new si(s,r))),t}function Tn(n,t){if(n.length==0)return null;let e=n[0].pos,i=n.length==2?n[1].pos:e;return e>-1&&i>-1?w.single(e+t,i+t):null}function Qt(n,t){return t.head==n.main.head&&t.anchor==n.main.anchor}class Dn{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,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=t.hasFocus,y.safari&&t.contentDOM.addEventListener("input",()=>null),y.gecko&&qn(t.contentDOM.ownerDocument)}handleEvent(t){!Hn(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let s of i.observers)s(this.view,e);for(let s of i.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=On(t),i=this.handlers,s=this.view.contentDOM;for(let r in e)if(r!="scroll"){let o=!e[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!e[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&ss.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),y.android&&y.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return y.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=is.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||Bn.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,ct(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:y.safari&&!y.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ni(n,t){return(e,i)=>{try{return t.call(n,i,e)}catch(s){Y(e.state,s)}}}function On(n){let t=Object.create(null);function e(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let h=r[l];h&&e(l).handlers.push(ni(i.value,h))}if(o)for(let l in o){let h=o[l];h&&e(l).observers.push(ni(i.value,h))}}for(let i in U)e(i).handlers.push(U[i]);for(let i in z)e(i).observers.push(z[i]);return t}const is=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Bn="dthko",ss=[16,17,18,20,91,92,224,225],Nt=6;function Vt(n){return Math.max(0,n)*.7+8}function Ln(n,t){return Math.max(Math.abs(n.clientX-t.clientX),Math.abs(n.clientY-t.clientY))}class Rn{constructor(t,e,i,s){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=Ls(t.contentDOM),this.atoms=t.state.facet(Wt).map(o=>o(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Ct.allowMultipleSelections)&&En(t,e),this.dragging=Pn(t,e)&&os(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Ln(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let h=Yi(this.view);t.clientX-h.left<=s+Nt?e=-Vt(s-t.clientX):t.clientX+h.right>=o-Nt&&(e=Vt(t.clientX-o)),t.clientY-h.top<=r+Nt?i=-Vt(r-t.clientY):t.clientY+h.bottom>=l-Nt&&(i=Vt(t.clientY-l)),this.setScrollSpeed(e,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=Ji(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!i.eq(e.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function En(n,t){let e=n.state.facet(Hi);return e.length?e[0](t):y.mac?t.metaKey:t.ctrlKey}function Wn(n,t){let e=n.state.facet(Ni);return e.length?e[0](t):y.mac?!t.altKey:!t.ctrlKey}function Pn(n,t){let{main:e}=n.state.selection;if(e.empty)return!1;let i=Dt(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let o=s[r];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function Hn(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=n.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=T.get(e))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const U=Object.create(null),z=Object.create(null),ns=y.ie&&y.ie_version<15||y.ios&&y.webkit_version<604;function Nn(n){let t=n.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{n.focus(),e.remove(),rs(n,e.value)},50)}function ne(n,t,e){for(let i of n.facet(t))e=i(e,n);return e}function rs(n,t){t=ne(n.state,Ne,t);let{state:e}=n,i,s=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(Te!=null&&e.selection.ranges.every(h=>h.empty)&&Te==r.toString()){let h=-1;i=e.changeByRange(a=>{let f=e.doc.lineAt(a.from);if(f.from==h)return{range:a};h=f.from;let c=e.toText((o?r.line(s++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:w.cursor(a.from+c.length)}})}else o?i=e.changeByRange(h=>{let a=r.line(s++);return{changes:{from:h.from,to:h.to,insert:a.text},range:w.cursor(h.from+a.length)}}):i=e.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}z.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};U.keydown=(n,t)=>(n.inputState.setSelectionOrigin("select"),t.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);z.touchstart=(n,t)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};z.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};U.mousedown=(n,t)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let i of n.state.facet(Vi))if(e=i(n,t),e)break;if(!e&&t.button==0&&(e=Fn(n,t)),e){let i=!n.hasFocus;n.inputState.startMouseSelection(new Rn(n,t,e,i)),i&&n.observer.ignore(()=>{Ti(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function ri(n,t,e,i){if(i==1)return w.cursor(t,e);if(i==2)return gn(n.state,t,e);{let s=n.docView.lineAt(t,e),r=n.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return l<n.state.doc.length&&l==r.to&&l++,w.range(o,l)}}const Vn=y.ie&&y.ie_version<=11;let oi=null,li=0,hi=0;function os(n){if(!Vn)return n.detail;let t=oi,e=hi;return oi=n,hi=Date.now(),li=!t||e>Date.now()-400&&Math.abs(t.clientX-n.clientX)<2&&Math.abs(t.clientY-n.clientY)<2?(li+1)%3:1}function Fn(n,t){let e=n.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=os(t),s=n.state.selection;return{update(r){r.docChanged&&(e.pos=r.changes.mapPos(e.pos),s=s.map(r.changes))},get(r,o,l){let h=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),a,f=ri(n,h.pos,h.assoc,i);if(e.pos!=h.pos&&!o){let c=ri(n,e.pos,e.assoc,i),d=Math.min(c.from,f.from),u=Math.max(c.to,f.to);f=d<f.from?w.range(d,u):w.range(u,d)}return o?s.replaceRange(s.main.extend(f.from,f.to)):l&&i==1&&s.ranges.length>1&&(a=In(s,h.pos))?a:l?s.addRange(f):w.create([f])}}}function In(n,t){for(let e=0;e<n.ranges.length;e++){let{from:i,to:s}=n.ranges[e];if(i<=t&&s>=t)return w.create(n.ranges.slice(0,e).concat(n.ranges.slice(e+1)),n.mainIndex==e?0:n.mainIndex-(n.mainIndex>e?1:0))}return null}U.dragstart=(n,t)=>{let{selection:{main:e}}=n.state;if(t.target.draggable){let s=n.docView.tile.nearest(t.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=e.to||o<=e.from)&&(e=w.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",ne(n.state,Ve,n.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};U.dragend=n=>(n.inputState.draggedContent=null,!1);function ai(n,t,e,i){if(e=ne(n.state,Ne,e),!e)return;let s=n.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&Wn(n,t)?{from:r.from,to:r.to}:null,l={from:s,insert:e},h=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}U.drop=(n,t)=>{if(!t.dataTransfer)return!1;if(n.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let i=Array(e.length),s=0,r=()=>{++s==e.length&&ai(n,t,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(e[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return ai(n,t,i,!0),!0}return!1};U.paste=(n,t)=>{if(n.state.readOnly)return!0;n.observer.flush();let e=ns?null:t.clipboardData;return e?(rs(n,e.getData("text/plain")||e.getData("text/uri-list")),!0):(Nn(n),!1)};function Kn(n,t){let e=n.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function zn(n){let t=[],e=[],i=!1;for(let s of n.selection.ranges)s.empty||(t.push(n.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(t.push(o.text),e.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:ne(n,Ve,t.join(n.lineBreak)),ranges:e,linewise:i}}let Te=null;U.copy=U.cut=(n,t)=>{if(!vt(n.contentDOM,n.observer.selectionRange))return!1;let{text:e,ranges:i,linewise:s}=zn(n.state);if(!e&&!s)return!1;Te=s?e:null,t.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=ns?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(Kn(n,e),!1)};const ls=ms.define();function hs(n,t){let e=[];for(let i of n.facet(Ki)){let s=i(n,t);s&&e.push(s)}return e.length?n.update({effects:e,annotations:ls.of(!0)}):null}function as(n){setTimeout(()=>{let t=n.hasFocus;if(t!=n.inputState.notifiedFocused){let e=hs(n.state,t);e?n.dispatch(e):n.update([])}},10)}z.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),as(n)};z.blur=n=>{n.observer.clearSelectionRange(),as(n)};z.compositionstart=z.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};z.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,y.chrome&&y.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};z.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};U.beforeinput=(n,t)=>{var e,i;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(n.inputState.insertingText=t.data,n.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&n.observer.editContext){let r=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(r&&o.length){let l=o[0],h=n.posAtDOM(l.startContainer,l.startOffset),a=n.posAtDOM(l.endContainer,l.endOffset);return Ke(n,{from:h,to:a,insert:n.state.toText(r)},null),!0}}let s;if(y.chrome&&y.android&&(s=is.find(r=>r.inputType==t.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return y.ios&&t.inputType=="deleteContentForward"&&n.observer.flushSoon(),y.safari&&t.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>z.compositionend(n,t),20),!1};const fi=new Set;function qn(n){fi.has(n)||(fi.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const ci=["pre-wrap","normal","pre-line","break-spaces"];let yt=!1;function di(){yt=!1}class _n{constructor(t){this.lineWrapping=t,this.doc=j.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return ci.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let s=t[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(e=!0,this.heightSamples[Math.floor(s*10)]=!0)}return e}refresh(t,e,i,s,r,o){let l=ci.indexOf(t)>-1,h=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,h){this.heightSamples={};for(let a=0;a<o.length;a++){let f=o[a];f<0?a++:this.heightSamples[Math.floor(f*10)]=!0}}return h}}class jn{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class I{constructor(t,e,i,s,r){this.from=t,this.length=e,this.top=i,this.height=s,this._content=r}get type(){return typeof this._content=="number"?F.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 rt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new I(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var M=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(M||(M={}));const jt=.001;class P{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>jt&&(yt=!0),this.height=t)}replace(t,e,i){return P.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:h,toA:a,fromB:f,toB:c}=s[l],d=r.lineAt(h,M.ByPosNoHeight,i.setDoc(e),0,0),u=d.to>=a?d:r.lineAt(a,M.ByPosNoHeight,i,0,0);for(c+=u.to-a,a=u.to;l>0&&d.from<=s[l-1].toA;)h=s[l-1].fromA,f=s[l-1].fromB,l--,h<d.from&&(d=r.lineAt(h,M.ByPosNoHeight,i,0,0));f+=d.from-h,h=d.from;let g=ze.build(i.setDoc(o),t,f,c);r=Jt(r,r.replace(h,a,g))}return r.updateHeight(i,0)}static empty(){return new V(0,0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,s=0,r=0;for(;;)if(e==i)if(s>r*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s<r){let l=t[e++];l&&(s+=l.size)}else{let l=t[--i];l&&(r+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,i++),new Gn(P.of(t.slice(0,e)),o,P.of(t.slice(i)))}}function Jt(n,t){return n==t?n:(n.constructor!=t.constructor&&(yt=!0),t)}P.prototype.size=1;const Un=W.replace({});class fs extends P{constructor(t,e,i){super(t,e),this.deco=i,this.spaceAbove=0}mainBlock(t,e){return new I(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,i,s){return this.spaceAbove&&t<i+this.spaceAbove?new I(s,0,i,this.spaceAbove,Un):this.mainBlock(i,s)}lineAt(t,e,i,s,r){let o=this.mainBlock(s,r);return this.spaceAbove?this.blockAt(0,i,s,r).join(o):o}forEachLine(t,e,i,s,r,o){t<=r+this.length&&e>=r&&o(this.lineAt(0,M.ByPos,i,s,r))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class V extends fs{constructor(t,e,i){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,e){return new I(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,i){let s=i[0];return i.length==1&&(s instanceof V||s instanceof L&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof L?s=new V(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):P.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class L extends P{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-i+1,o,l=0;if(t.lineWrapping){let h=Math.min(this.height,t.lineHeight*r);o=h/r,this.length>r+1&&(l=(this.height-h)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(t,e,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:h}=this.heightMetrics(e,s);if(e.lineWrapping){let a=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),f=e.doc.lineAt(a),c=l+f.length*h,d=Math.max(i,t-c/2);return new I(f.from,f.length,d,c,0)}else{let a=Math.max(0,Math.min(o-r,Math.floor((t-i)/l))),{from:f,length:c}=e.doc.line(r+a);return new I(f,c,i+l*a,l,0)}}lineAt(t,e,i,s,r){if(e==M.ByHeight)return this.blockAt(t,i,s,r);if(e==M.ByPosNoHeight){let{from:u,to:g}=i.doc.lineAt(t);return new I(u,g-u,0,0,0)}let{firstLine:o,perLine:l,perChar:h}=this.heightMetrics(i,r),a=i.doc.lineAt(t),f=l+a.length*h,c=a.number-o,d=s+l*c+h*(a.from-r-c);return new I(a.from,a.length,Math.max(s,Math.min(d,s+this.height-f)),f,0)}forEachLine(t,e,i,s,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:l,perLine:h,perChar:a}=this.heightMetrics(i,r);for(let f=t,c=s;f<=e;){let d=i.doc.lineAt(f);if(f==t){let g=d.number-l;c+=h*g+a*(t-r-g)}let u=h+a*d.length;o(new I(d.from,d.length,c,u,0)),c+=u,f=d.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let r=i[i.length-1];r instanceof L?i[i.length-1]=new L(r.length+s):i.push(null,new L(s-1))}if(t>0){let r=i[0];r instanceof L?i[0]=new L(t+r.length):i.unshift(new L(t-1),null)}return P.of(i)}decomposeLeft(t,e){e.push(new L(t-1),null)}decomposeRight(t,e){e.push(null,new L(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let r=e+this.length;if(s&&s.from<=e+this.length&&s.more){let o=[],l=Math.max(e,s.from),h=-1;for(s.from>e&&o.push(new L(s.from-e-1).updateHeight(t,e));l<=r&&s.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=s.heights[s.index++],d=0;c<0&&(d=-c,c=s.heights[s.index++]),h==-1?h=c:Math.abs(c-h)>=jt&&(h=-2);let u=new V(f,c,d);u.outdated=!1,o.push(u),l+=f+1}l<=r&&o.push(null,new L(r-l).updateHeight(t,l));let a=P.of(o);return(h<0||Math.abs(a.height-this.height)>=jt||Math.abs(h-this.heightMetrics(t,e).perLine)>=jt)&&(yt=!0),Jt(this,a)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Gn extends P{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,s){let r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this.break)}lineAt(t,e,i,s,r){let o=s+this.left.height,l=r+this.left.length+this.break,h=e==M.ByHeight?t<o:t<l,a=h?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,o,l);if(this.break||(h?a.to<l:a.from>l))return a;let f=e==M.ByPosNoHeight?M.ByPosNoHeight:M.ByPos;return h?a.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,s,r).join(a)}forEachLine(t,e,i,s,r,o){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)t<h&&this.left.forEachLine(t,e,i,s,r,o),e>=h&&this.right.forEachLine(t,e,i,l,h,o);else{let a=this.lineAt(h,M.ByPos,i,s,r);t<a.from&&this.left.forEachLine(t,a.from-1,i,s,r,o),a.to>=t&&a.from<=e&&o(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,l,h,o)}}replace(t,e,i){let s=this.left.length+this.break;if(e<s)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let l of i)r.push(l);if(t>0&&ui(r,o-1),e<this.length){let l=r.length;this.decomposeRight(e,r),ui(r,l)}return P.of(r)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?P.of(this.break?[t,null,e]:[t,e]):(this.left=Jt(this.left,t),this.right=Jt(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,s){let{left:r,right:o}=this,l=e+r.length+this.break,h=null;return s&&s.from<=e+r.length&&s.more?h=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=l+o.length&&s.more?h=o=o.updateHeight(t,l,i,s):o.updateHeight(t,l,i),h?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ui(n,t){let e,i;n[t]==null&&(e=n[t-1])instanceof L&&(i=n[t+1])instanceof L&&n.splice(t-1,3,new L(e.length+1+i.length))}const $n=5;class ze{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof V?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new V(i-this.pos,-1,0)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let s=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=e-t;i.block?this.addBlock(new fs(o,s,i)):(o||r||s>=$n)&&this.addLineDeco(s,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new V(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new L(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof V)return t;let e=new V(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof V)&&!this.isCovered?this.nodes.push(new V(0,-1,0)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let s of this.nodes)s instanceof V&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(t,e,i,s){let r=new ze(i,t);return N.spans(e,i,s,r,0),r.finish(i)}}function Yn(n,t,e){let i=new Xn;return N.compare(n,t,e,i,0),i.changes}class Xn{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&ft(t,e,this.changes,5)}}function Qn(n,t){let e=n.getBoundingClientRect(),i=n.ownerDocument,s=i.defaultView||window,r=Math.max(0,e.left),o=Math.min(s.innerWidth,e.right),l=Math.max(0,e.top),h=Math.min(s.innerHeight,e.bottom);for(let a=n.parentNode;a&&a!=i.body;)if(a.nodeType==1){let f=a,c=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let d=f.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),h=Math.min(a==n.parentNode?s.innerHeight:h,d.bottom)}a=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(a.nodeType==11)a=a.host;else break;return{left:r-e.left,right:Math.max(r,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,h)-(e.top+t)}}function Jn(n){let t=n.getBoundingClientRect(),e=n.ownerDocument.defaultView||window;return t.left<e.innerWidth&&t.right>0&&t.top<e.innerHeight&&t.bottom>0}function Zn(n,t){let e=n.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class de{constructor(t,e,i,s){this.from=t,this.to=e,this.size=i,this.displaySize=s}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let s=t[i],r=e[i];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(t,e){return W.replace({widget:new tr(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class tr extends Lt{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class gi{constructor(t){this.state=t,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=pi,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=O.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Fe).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new _n(e),this.stateDeco=mi(t),this.heightMap=P.empty().applyChanges(this.stateDeco,j.empty,this.heightOracle.setDoc(t.doc),[new K(0,0,0,t.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=W.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);t.push(new Ft(r,o))}}return this.viewports=t.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?pi:new qe(this.heightOracle,this.heightMap,this.viewports),t.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,t=>{this.viewportLines.push(xt(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=mi(this.state);let s=t.changedRanges,r=K.extendWithRanges(s,Yn(i,this.stateDeco,t?t.changes:ki.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);di(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||yt)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let h=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<h.from||e.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,e));let a=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,t.flags|=this.updateForViewport(),(a||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(_s)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?O.RTL:O.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=e.getBoundingClientRect(),h=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let a=0,f=0;if(l.width&&l.height){let{scaleX:A,scaleY:B}=Ai(e,l);(A>.005&&Math.abs(this.scaleX-A)>.005||B>.005&&Math.abs(this.scaleY-B)>.005)&&(this.scaleX=A,this.scaleY=B,a|=16,o=h=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,d=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=d)&&(this.paddingTop=c,this.paddingBottom=d,a|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=16);let u=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=u&&(this.scrollAnchorHeight=-1,this.scrollTop=u),this.scrolledToBottom=Di(t.scrollDOM);let g=(this.printing?Zn:Qn)(e,this.paddingTop),p=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(h=!0)),!this.inView&&!this.scrollTarget&&!Jn(t.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,a|=16),h){let A=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(A)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:B,charWidth:D,textHeight:Pt}=t.docView.measureTextSize();o=B>0&&s.refresh(r,B,D,Pt,Math.max(5,S/D),A),o&&(t.docView.minWidth=0,a|=16)}p>0&&b>0?f=Math.max(p,b):p<0&&b<0&&(f=Math.min(p,b)),di();for(let B of this.viewports){let D=B.from==this.viewport.from?A:t.docView.measureVisibleLineHeights(B);this.heightMap=(o?P.empty().applyChanges(this.stateDeco,j.empty,this.heightOracle,[new K(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new jn(B.from,D))}yt&&(a|=2)}let x=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(a&2&&(a|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),a|=this.updateForViewport()),(a&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,h=new Ft(s.lineAt(o-i*1e3,M.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,M.ByHeight,r,0,0).to);if(e){let{head:a}=e.range;if(a<h.from||a>h.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=s.lineAt(a,M.ByPos,r,0,0),d;e.y=="center"?d=(c.top+c.bottom)/2-f/2:e.y=="start"||e.y=="nearest"&&a<h.from?d=c.top:d=c.bottom-f,h=new Ft(s.lineAt(d-1e3/2,M.ByHeight,r,0,0).from,s.lineAt(d+f+1e3/2,M.ByHeight,r,0,0).to)}}return h}mapViewport(t,e){let i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new Ft(this.heightMap.lineAt(i,M.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,M.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,M.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,M.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||s<=o-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let s of t)e.touchesRange(s.from,s.to)||i.push(new de(e.mapPos(s.from),e.mapPos(s.to),s.size,s.displaySize));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,o=s<<1;if(this.defaultTextDirection!=O.LTR&&!i)return[];let l=[],h=(f,c,d,u)=>{if(c-f<r)return;let g=this.state.selection.main,p=[g.from];g.empty||p.push(g.to);for(let m of p)if(m>f&&m<c){h(f,m-10,d,u),h(m+10,c,d,u);return}let b=ir(t,m=>m.from>=d.from&&m.to<=d.to&&Math.abs(m.from-f)<r&&Math.abs(m.to-c)<r&&!p.some(S=>m.from<S&&m.to>S));if(!b){if(c<d.to&&e&&i&&e.visibleRanges.some(x=>x.from<=c&&x.to>=c)){let x=e.moveToLineBoundary(w.cursor(c),!1,!0).head;x>f&&(c=x)}let m=this.gapSize(d,f,c,u),S=i||m<2e6?m:2e6;b=new de(f,c,m,S)}l.push(b)},a=f=>{if(f.length<o||f.type!=F.Text)return;let c=er(f.from,f.to,this.stateDeco);if(c.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,u,g;if(i){let p=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,m;if(d!=null){let S=Kt(c,d),x=((this.visibleBottom-this.visibleTop)/2+p)/f.height;b=S-x,m=S+x}else b=(this.visibleTop-f.top-p)/f.height,m=(this.visibleBottom-f.top+p)/f.height;u=It(c,b),g=It(c,m)}else{let p=c.total*this.heightOracle.charWidth,b=s*this.heightOracle.charWidth,m=0;if(p>2e6)for(let D of t)D.from>=f.from&&D.from<f.to&&D.size!=D.displaySize&&D.from*this.heightOracle.charWidth+m<this.pixelViewport.left&&(m=D.size-D.displaySize);let S=this.pixelViewport.left+m,x=this.pixelViewport.right+m,A,B;if(d!=null){let D=Kt(c,d),Pt=((x-S)/2+b)/p;A=D-Pt,B=D+Pt}else A=(S-b)/p,B=(x+b)/p;u=It(c,A),g=It(c,B)}u>f.from&&h(f.from,u,f,c),g<f.to&&h(g,f.to,f,c)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(a):a(f);return l}gapSize(t,e,i,s){let r=Kt(s,i)-Kt(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(t){de.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=W.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];N.spans(e,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r<i.length&&!(s&8);r++){let o=this.visibleRanges[r],l=i[r];(o.from!=l.from||o.to!=l.to)&&(s|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=i,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||xt(this.heightMap.lineAt(t,M.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||xt(this.heightMap.lineAt(this.scaler.fromDOM(t),M.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return xt(this.heightMap.blockAt(this.scaler.fromDOM(t),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 Ft{constructor(t,e){this.from=t,this.to=e}}function er(n,t,e){let i=[],s=n,r=0;return N.spans(e,n,t,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s<t&&(i.push({from:s,to:t}),r+=t-s),{total:r,ranges:i}}function It({total:n,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(n*e);for(let s=0;;s++){let{from:r,to:o}=t[s],l=o-r;if(i<=l)return r+i;i-=l}}function Kt(n,t){let e=0;for(let{from:i,to:s}of n.ranges){if(t<=s){e+=t-i;break}e+=s-i}return e/n.total}function ir(n,t){for(let e of n)if(t(e))return e}const pi={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function mi(n){let t=n.facet(ee).filter(i=>typeof i!="function"),e=n.facet(Ie).filter(i=>typeof i!="function");return e.length&&t.push(N.join(e)),t}class qe{constructor(t,e,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:h})=>{let a=e.lineAt(l,M.ByPos,t,0,0).top,f=e.lineAt(h,M.ByPos,t,0,0).bottom;return s+=f-a,{from:l,to:h,top:a,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return s+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,s=r.domBottom}}fromDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-s)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,s=r.domBottom}}eq(t){return t instanceof qe?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to):!1}}function xt(n,t){if(t.scale==1)return n;let e=t.toDOM(n.top),i=t.toDOM(n.bottom);return new I(n.from,n.length,e,i-e,Array.isArray(n._content)?n._content.map(s=>xt(s,t)):n._content)}const zt=v.define({combine:n=>n.join(" ")}),De=v.define({combine:n=>n.indexOf(!0)>-1}),Oe=ut.newName(),cs=ut.newName(),ds=ut.newName(),us={"&light":"."+cs,"&dark":"."+ds};function Be(n,t,e){return new ut(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):n+" "+i}})}const sr=Be("."+Oe,{"&":{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"}},us),nr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ue=y.ie&&y.ie_version<=11;class rr{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Rs,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=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(y.ie&&y.ie_version<=11||y.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&y.android&&t.constructor.EDIT_CONTEXT!==!1&&!(y.chrome&&y.chrome_version<126)&&(this.editContext=new lr(t),t.state.facet(X)&&(t.contentDOM.editContext=this.editContext.editContext)),ue&&(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")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(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(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(X)?i.root.activeElement!=this.dom:!vt(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(y.ie&&y.ie_version<=11||y.android&&y.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Mt(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Dt(t.root);if(!e)return!1;let i=y.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&or(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let s=vt(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Ws(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(i.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=e)i.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,nr),ue&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ue&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let s=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ct(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,s=!1;for(let r of t){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:s}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&vt(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new vn(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,s=ts(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!Qt(this.view.state.selection,e.newSel.main))&&this.view.update([]),s}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty(t.type=="attributes"),t.type=="childList"){let i=bi(e,t.previousSibling||t.target.previousSibling,-1),s=bi(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(X)!=t.state.facet(X)&&(t.view.contentDOM.editContext=t.state.facet(X)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.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 bi(n,t,e){for(;t;){let i=T.get(t);if(i&&i.parent==n)return i;let s=t.parentNode;t=s!=n.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function yi(n,t){let e=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Mt(o.node,o.offset,s,r)&&([e,i,s,r]=[s,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}}function or(n,t){if(t.getComposedRanges){let s=t.getComposedRanges(n.root)[0];if(s)return yi(n,s)}let e=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),e=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),e?yi(n,e):null}class lr{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let s=t.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),h=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let a=h-l>i.text.length;l==this.from&&r<this.from?l=r:h==this.to&&r>this.to&&(h=r);let f=es(t.state.sliceDoc(l,h),i.text,(a?s.from:s.to)-l,a?"end":null);if(!f){let d=w.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Qt(d,s)||t.dispatch({selection:d,userEvent:"select"});return}let c={from:f.from+l,to:f.toA+l,insert:j.of(i.text.slice(f.from,f.toB).split(`
|
|
6
|
+
`))};if((y.mac||y.android)&&c.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:h,insert:j.of([i.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let d=this.to-this.from+(c.to-c.from+c.insert.length);Ke(t,c,w.single(this.toEditorPos(i.selectionStart,d),this.toEditorPos(i.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),c.from<c.to&&!c.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let h=t.coordsForChar(o);r=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||r||new DOMRect,s.push(r)}e.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let h=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);if(h<a){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(W.mark({attributes:{style:f}}).range(h,a))}}}t.dispatch({effects:_i.of(W.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(t.state)}};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Dt(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,s=this.pendingContextChange;return t.changes.iterChanges((r,o,l,h,a)=>{if(i)return;let f=a.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(a)){s=this.pendingContextChange=null,e+=f,this.to+=f;return}else s=null,this.revertPending(t.state);if(r+=e,o+=e,o<=this.from)this.from+=f,this.to+=f;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+a.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),a.toString()),this.to+=f}e+=f}),s&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class C{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(t={}){var e;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),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||Es(t.parent)||document,this.viewState=new gi(t.state||Ct.create(t)),t.scrollTo&&t.scrollTo.is(Ht)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(at).map(s=>new le(s));for(let s of this.plugins)s.update(this);this.observer=new rr(this),this.inputState=new Dn(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ei(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let e=t.length==1&&t[0]instanceof ps?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,s,r=this.state;for(let d of t){if(d.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=d.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,h=null;t.some(d=>d.annotation(ls))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,h=hs(r,o),h||(l=1));let a=this.observer.delayedAndroidKey,f=null;if(a?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(f=null)):this.observer.clear(),r.facet(Ct.phrases)!=this.state.facet(Ct.phrases))return this.setState(r);s=Bt.create(this,r,t),s.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let d of t){if(c&&(c=c.map(d.changes)),d.scrollIntoView){let{main:u}=d.state.selection;c=new dt(u.empty?u:w.cursor(u.head,u.head>u.anchor?-1:1))}for(let u of d.effects)u.is(Ht)&&(c=u.value.clip(this.state))}this.viewState.update(s,c),this.bidiCache=Zt.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(St)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(zt)!=s.state.facet(zt)&&(this.viewState.mustMeasureContent=!0),(e||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(ve))try{d(s)}catch(u){Y(this.state,u,"update listener")}(h||f)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),f&&!ts(this,f)&&a.force&&ct(this.contentDOM,a.key,a.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new gi(t),this.plugins=t.facet(at).map(i=>new le(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new ei(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(at),i=t.state.facet(at);if(e!=i){let s=[];for(let r of i){let o=e.indexOf(r);if(o<0)s.push(new le(r));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(i){Y(this.state,i,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Di(i))r=-1,o=this.viewState.heightMap.height;else{let u=this.viewState.scrollAnchorAt(s);r=u.from,o=u.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];h&4||([this.measureRequests,a]=[a,this.measureRequests]);let f=a.map(u=>{try{return u.read(this)}catch(g){return Y(this.state,g),Si}}),c=Bt.create(this,this.state,[]),d=!1;c.flags|=h,e?e.flags|=h:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),d=this.docView.update(c),d&&this.docViewUpdate());for(let u=0;u<a.length;u++)if(f[u]!=Si)try{let g=a[u];g.write&&g.write(f[u],this)}catch(g){Y(this.state,g)}if(d&&this.docView.updateSelection(!0),!c.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(g>1||g<-1){s=s+g,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ve))l(e)}get themeClasses(){return Oe+" "+(this.state.facet(De)?ds:cs)+" "+this.state.facet(zt)}updateAttrs(){let t=wi(this,ji,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(X)?"true":"false",class:"cm-content",style:`${y.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),wi(this,Fe,e);let i=this.observer.ignore(()=>{let s=Ye(this.contentDOM,this.contentAttrs,e),r=Ye(this.dom,this.editorAttrs,t);return s||r});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)if(s.is(C.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(St);let t=this.state.facet(C.cspNonce);ut.mount(this.root,this.styleModules.concat(sr).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.plugin==t)||null),e&&e.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(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return ce(this,t,ii(this,t,e,i))}moveByGroup(t,e){return ce(this,t,ii(this,t,e,i=>yn(this,t.head,i)))}visualLineSide(t,e){let i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return w.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,i=!0){return bn(this,t,e,i)}moveVertically(t,e,i){return ce(this,t,Sn(this,t,e,i))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let i=Ae(this,t,e);return i&&i.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),Ae(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),r=this.bidiSpans(s),o=r[_.find(r,t-s.from,-1,e)];return $t(i,o.dir==O.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(zi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>hr)return Wi(t.length);let e=this.textDirectionAt(t.from),i;for(let r of this.bidiCache)if(r.from==t.from&&r.dir==e&&(r.fresh||Ei(r.isolates,i=Je(this,t))))return r.order;i||(i=Je(this,t));let s=Ks(t.text,e,i);return this.bidiCache.push(new Zt(t.from,t.to,e,i,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||y.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ti(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.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(t,e={}){return Ht.of(new dt(typeof t=="number"?w.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return Ht.of(new dt(w.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return pt.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return pt.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=ut.newName(),s=[zt.of(i),St.of(Be(`.${i}`,t))];return e&&e.dark&&s.push(De.of(!0)),s}static baseTheme(t){return Ci.lowest(St.of(Be("."+Oe,t,us)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),s=i&&T.get(i)||T.get(t);return((e=s?.root)===null||e===void 0?void 0:e.view)||null}}C.styleModule=St;C.inputHandler=Ii;C.clipboardInputFilter=Ne;C.clipboardOutputFilter=Ve;C.scrollHandler=qi;C.focusChangeEffect=Ki;C.perLineTextDirection=zi;C.exceptionSink=Fi;C.updateListener=ve;C.editable=X;C.mouseSelectionStyle=Vi;C.dragMovesSelection=Ni;C.clickAddsSelectionRange=Hi;C.decorations=ee;C.blockWrappers=Ui;C.outerDecorations=Ie;C.atomicRanges=Wt;C.bidiIsolatedRanges=Gi;C.scrollMargins=$i;C.darkTheme=De;C.cspNonce=v.define({combine:n=>n.length?n[0]:""});C.contentAttributes=Fe;C.editorAttributes=ji;C.lineWrapping=C.contentAttributes.of({class:"cm-lineWrapping"});C.announce=Re.define();const hr=4096,Si={};class Zt{constructor(t,e,i,s,r,o){this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(t,e){if(e.empty&&!t.some(r=>r.fresh))return t;let i=[],s=t.length?t[t.length-1].dir:O.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let o=t[r];o.dir==s&&!e.touchesRange(o.from,o.to)&&i.push(new Zt(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function wi(n,t,e){for(let i=n.state.facet(t),s=i.length-1;s>=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&We(o,e)}return e}const ar=y.mac?"mac":y.windows?"win":y.linux?"linux":"key";function fr(n,t){const e=n.split(/-(?!$)/);let i=e[e.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let h=0;h<e.length-1;++h){const a=e[h];if(/^(cmd|meta|m)$/i.test(a))l=!0;else if(/^a(lt)?$/i.test(a))s=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))t=="mac"?l=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return s&&(i="Alt-"+i),r&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function qt(n,t,e){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e!==!1&&t.shiftKey&&(n="Shift-"+n),n}const cr=Ci.default(C.domEventHandlers({keydown(n,t){return pr(dr(t.state),n,t,"editor")}})),gs=v.define({enables:cr}),xi=new WeakMap;function dr(n){let t=n.facet(gs),e=xi.get(t);return e||xi.set(t,e=gr(t.reduce((i,s)=>i.concat(s),[]))),e}let Z=null;const ur=4e3;function gr(n,t=ar){let e=Object.create(null),i=Object.create(null),s=(o,l)=>{let h=i[o];if(h==null)i[o]=l;else if(h!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,h,a,f)=>{var c,d;let u=e[o]||(e[o]=Object.create(null)),g=l.split(/ (?!$)/).map(m=>fr(m,t));for(let m=1;m<g.length;m++){let S=g.slice(0,m).join(" ");s(S,!0),u[S]||(u[S]={preventDefault:!0,stopPropagation:!1,run:[x=>{let A=Z={view:x,prefix:S,scope:o};return setTimeout(()=>{Z==A&&(Z=null)},ur),!0}]})}let p=g.join(" ");s(p,!1);let b=u[p]||(u[p]={preventDefault:!1,stopPropagation:!1,run:((d=(c=u._any)===null||c===void 0?void 0:c.run)===null||d===void 0?void 0:d.slice())||[]});h&&b.run.push(h),a&&(b.preventDefault=!0),f&&(b.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let a of l){let f=e[a]||(e[a]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:c}=o;for(let d in f)f[d].run.push(u=>c(u,Le))}let h=o[t]||o.key;if(h)for(let a of l)r(a,h,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(a,"Shift-"+h,o.shift,o.preventDefault,o.stopPropagation)}return e}let Le=null;function pr(n,t,e,i){Le=t;let s=vs(t),r=bs(s,0),o=ys(r)==s.length&&s!=" ",l="",h=!1,a=!1,f=!1;Z&&Z.view==e&&Z.scope==i&&(l=Z.prefix+" ",ss.indexOf(t.keyCode)<0&&(a=!0,Z=null));let c=new Set,d=b=>{if(b){for(let m of b.run)if(!c.has(m)&&(c.add(m),m(e)))return b.stopPropagation&&(f=!0),!0;b.preventDefault&&(b.stopPropagation&&(f=!0),a=!0)}return!1},u=n[i],g,p;return u&&(d(u[l+qt(s,t,!o)])?h=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(y.windows&&t.ctrlKey&&t.altKey)&&!(y.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=tt[t.keyCode])&&g!=s?(d(u[l+qt(g,t,!0)])||t.shiftKey&&(p=Tt[t.keyCode])!=s&&p!=g&&d(u[l+qt(p,t,!1)]))&&(h=!0):o&&t.shiftKey&&d(u[l+qt(s,t,!0)])&&(h=!0),!h&&d(u._any)&&(h=!0)),a&&(h=!0),h&&f&&t.stopPropagation(),Le=null,h}class ht extends Ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}ht.prototype.elementClass="";ht.prototype.toDOM=void 0;ht.prototype.mapMode=kt.TrackBefore;ht.prototype.startSide=ht.prototype.endSide=-1;ht.prototype.point=!0;const yr=Object.freeze(Object.defineProperty({__proto__:null,BidiSpan:_,BlockInfo:I,get BlockType(){return F},BlockWrapper:gt,Decoration:W,get Direction(){return O},EditorView:C,GutterMarker:ht,ViewPlugin:pt,ViewUpdate:Bt,WidgetType:Lt,keymap:gs,logException:Y},Symbol.toStringTag,{value:"Module"}));export{W as D,C as E,ut as S,pt as V,Lt as W,O as a,yr as i,gs as k,Y as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as o,a as v,b as y,E as f,r as l,s as m,c as p,d as i,H as T,e as A}from"./fwnBoL5x.js";import{B as E}from"./3_5VIr68.js";function g(d,_,e){var s;o&&(s=A,v());var r=new E(d);y(()=>{var a=_()??null;if(o){var h=l(s),c=h===T,u=a!==null;if(c!==u){var t=m();p(t),r.anchor=t,i(!1),r.ensure(a,a&&(n=>e(n,a))),i(!0);return}}r.ensure(a,a&&(n=>e(n,a)))},f)}export{g as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p="modulepreload",y=function(u,i){return new URL(u,i).href},v={},w=function(i,a,f){let d=Promise.resolve();if(a&&a.length>0){let E=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const r=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),m=t?.nonce||t?.getAttribute("nonce");d=E(a.map(e=>{if(e=y(e,f),e in v)return;v[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(f)for(let c=r.length-1;c>=0;c--){const l=r[c];if(l.href===e&&(!o||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,m&&n.setAttribute("nonce",m),document.head.appendChild(n),o)return new Promise((c,l)=>{n.addEventListener("load",c),n.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${e}`)))})}))}function h(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&h(t.reason);return i().catch(h)})};export{w as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extensions as i,AccessibilitySystem as t,Container as e,accessibilityTarget as n,EventSystem as s,FederatedContainer as a}from"./BB_5th5W.js";import"./CYrVHOHA.js";i.add(t);i.mixin(e,n);i.add(s);i.mixin(e,a);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as Ce,E as we,aW as oe,g as V,j as ae,au as se,h as k,aX as Ee,aY as me,aZ as Ae,aN as Se,a_ as Te,a$ as _e,b0 as Ie,F as a,b1 as $e,b2 as W,d as z,b3 as Re,b4 as Le,a2 as Oe,b5 as Ue,b6 as Pe,b7 as Fe,P as m,Q as N,T as d,Y as ue,W as ke}from"./fwnBoL5x.js";import{B as Ne}from"./3_5VIr68.js";import{k as je,j as Me,g as Ge,l as Je,n as We,m as Be}from"./hHxe9oXh.js";function St(e,r,...t){var n=new Ne(e);Ce(()=>{const o=r()??null;n.ensure(o,o&&(u=>o(u,...t)))},we)}function He(e,r){var t=void 0,n;oe(()=>{t!==(t=r())&&(n&&(V(n),n=null),t&&(n=ae(()=>{se(()=>t(e))})))})}function le(e){var r,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(r=0;r<o;r++)e[r]&&(t=le(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ye(){for(var e,r,t=0,n="",o=arguments.length;t<o;t++)(e=arguments[t])&&(r=le(e))&&(n&&(n+=" "),n+=r);return n}function De(e){return typeof e=="object"?Ye(e):e??""}const q=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Ke(e,r,t){var n=e==null?"":""+e;if(r&&(n=n?n+" "+r:r),t){for(var o of Object.keys(t))if(t[o])n=n?n+" "+o:o;else if(n.length)for(var u=o.length,c=0;(c=n.indexOf(o,c))>=0;){var h=c+u;(c===0||q.includes(n[c-1]))&&(h===n.length||q.includes(n[h]))?n=(c===0?"":n.substring(0,c))+n.substring(h+1):c=h}}return n===""?null:n}function x(e,r=!1){var t=r?" !important;":";",n="";for(var o of Object.keys(e)){var u=e[o];u!=null&&u!==""&&(n+=" "+o+": "+u+t)}return n}function K(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Qe(e,r){if(r){var t="",n,o;if(Array.isArray(r)?(n=r[0],o=r[1]):n=r,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var u=!1,c=0,h=!1,y=[];n&&y.push(...Object.keys(n).map(K)),o&&y.push(...Object.keys(o).map(K));var v=0,A=-1;const O=e.length;for(var C=0;C<O;C++){var l=e[C];if(h?l==="/"&&e[C-1]==="*"&&(h=!1):u?u===l&&(u=!1):l==="/"&&e[C+1]==="*"?h=!0:l==='"'||l==="'"?u=l:l==="("?c++:l===")"&&c--,!h&&u===!1&&c===0){if(l===":"&&A===-1)A=C;else if(l===";"||C===O-1){if(A!==-1){var L=K(e.substring(v,A).trim());if(!y.includes(L)){l!==";"&&C++;var T=e.substring(v,C).trim();t+=" "+T+";"}}v=C+1,A=-1}}}}return n&&(t+=x(n)),o&&(t+=x(o,!0)),t=t.trim(),t===""?null:t}return e==null?null:String(e)}function Ve(e,r,t,n,o,u){var c=e.__className;if(k||c!==t||c===void 0){var h=Ke(t,n,u);(!k||h!==e.getAttribute("class"))&&(h==null?e.removeAttribute("class"):r?e.className=h:e.setAttribute("class",h)),e.__className=t}else if(u&&o!==u)for(var y in u){var v=!!u[y];(o==null||v!==!!o[y])&&e.classList.toggle(y,v)}return u}function Q(e,r={},t,n){for(var o in t){var u=t[o];r[o]!==u&&(t[o]==null?e.style.removeProperty(o):e.style.setProperty(o,u,n))}}function Xe(e,r,t,n){var o=e.__style;if(k||o!==r){var u=Qe(r,n);(!k||u!==e.getAttribute("style"))&&(u==null?e.removeAttribute("style"):e.style.cssText=u),e.__style=r}else n&&(Array.isArray(n)?(Q(e,t?.[0],n[0]),Q(e,t?.[1],n[1],"important")):Q(e,t,n));return n}function X(e,r,t=!1){if(e.multiple){if(r==null)return;if(!Ee(r))return me();for(var n of e.options)n.selected=r.includes(ee(n));return}for(n of e.options){var o=ee(n);if(Ae(o,r)){n.selected=!0;return}}(!t||r!==void 0)&&(e.selectedIndex=-1)}function Ze(e){var r=new MutationObserver(()=>{X(e,e.__value)});r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Se(()=>{r.disconnect()})}function ee(e){return"__value"in e?e.__value:e.value}const G=Symbol("class"),J=Symbol("style"),fe=Symbol("is custom element"),ce=Symbol("is html"),ze=W?"link":"LINK",qe=W?"input":"INPUT",xe=W?"option":"OPTION",et=W?"select":"SELECT",tt=W?"progress":"PROGRESS";function rt(e){if(k){var r=!1,t=()=>{if(!r){if(r=!0,e.hasAttribute("value")){var n=e.value;H(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var o=e.checked;H(e,"checked",null),e.checked=o}}};e.__on_r=t,Oe(t),Ue()}}function Tt(e,r){var t=Z(e);t.value===(t.value=r??void 0)||e.value===r&&(r!==0||e.nodeName!==tt)||(e.value=r??"")}function nt(e,r){r?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function H(e,r,t,n){var o=Z(e);k&&(o[r]=e.getAttribute(r),r==="src"||r==="srcset"||r==="href"&&e.nodeName===ze)||o[r]!==(o[r]=t)&&(r==="loading"&&(e[Pe]=t),t==null?e.removeAttribute(r):typeof t!="string"&&de(e).includes(r)?e[r]=t:e.setAttribute(r,t))}function it(e,r,t,n,o=!1,u=!1){if(k&&o&&e.nodeName===qe){var c=e,h=c.type==="checkbox"?"defaultChecked":"defaultValue";h in t||rt(c)}var y=Z(e),v=y[fe],A=!y[ce];let C=k&&v;C&&z(!1);var l=r||{},L=e.nodeName===xe;for(var T in r)T in t||(t[T]=null);t.class?t.class=De(t.class):t[G]&&(t.class=null),t[J]&&(t.style??=null);var O=de(e);for(const g in t){let b=t[g];if(L&&g==="value"&&b==null){e.value=e.__value="",l[g]=b;continue}if(g==="class"){var P=e.namespaceURI==="http://www.w3.org/1999/xhtml";Ve(e,P,b,n,r?.[G],t[G]),l[g]=b,l[G]=t[G];continue}if(g==="style"){Xe(e,b,r?.[J],t[J]),l[g]=b,l[J]=t[J];continue}var I=l[g];if(!(b===I&&!(b===void 0&&e.hasAttribute(g)))){l[g]=b;var j=g[0]+g[1];if(j!=="$$")if(j==="on"){const R={},F="$$"+g;let $=g.slice(2);var w=Be($);if(je($)&&($=$.slice(0,-7),R.capture=!0),!w&&I){if(b!=null)continue;e.removeEventListener($,l[F],R),l[F]=null}if(w)Me($,e,b),Ge([$]);else if(b!=null){let Y=function(D){l[g].call(this,D)};l[F]=Je($,e,Y,R)}}else if(g==="style")H(e,g,b);else if(g==="autofocus")Re(e,!!b);else if(!v&&(g==="__value"||g==="value"&&b!=null))e.value=e.__value=b;else if(g==="selected"&&L)nt(e,b);else{var _=g;A||(_=We(_));var B=_==="defaultValue"||_==="defaultChecked";if(b==null&&!v&&!B)if(y[g]=null,_==="value"||_==="checked"){let R=e;const F=r===void 0;if(_==="value"){let $=R.defaultValue;R.removeAttribute(_),R.defaultValue=$,R.value=R.__value=F?$:null}else{let $=R.defaultChecked;R.removeAttribute(_),R.defaultChecked=$,R.checked=F?$:!1}}else e.removeAttribute(g);else B||O.includes(_)&&(v||typeof b!="string")?(e[_]=b,_ in y&&(y[_]=Le)):typeof b!="function"&&H(e,_,b)}}}return C&&z(!0),l}function _t(e,r,t=[],n=[],o=[],u,c=!1,h=!1){Ie(o,t,n,y=>{var v=void 0,A={},C=e.nodeName===et,l=!1;if(oe(()=>{var T=r(...y.map(a)),O=it(e,v,T,u,c,h);l&&C&&"value"in T&&X(e,T.value);for(let I of Object.getOwnPropertySymbols(A))T[I]||V(A[I]);for(let I of Object.getOwnPropertySymbols(T)){var P=T[I];I.description===$e&&(!v||P!==v[I])&&(A[I]&&V(A[I]),A[I]=ae(()=>He(e,()=>P))),O[I]=P}v=O}),C){var L=e;se(()=>{X(L,v.value,!0),Ze(L)})}l=!0})}function Z(e){return e.__attributes??={[fe]:e.nodeName.includes("-"),[ce]:e.namespaceURI===Te}}var te=new Map;function de(e){var r=e.getAttribute("is")||e.nodeName,t=te.get(r);if(t)return t;te.set(r,t=[]);for(var n,o=e,u=Element.prototype;u!==o;){n=Fe(o);for(var c in n)n[c].set&&t.push(c);o=_e(o)}return t}const ot="";class at extends Error{constructor(r,t){super(t),this.status=r,this.name="ApiError"}}async function S(e,r){const t={...r?.headers};r?.body&&(t["Content-Type"]=t["Content-Type"]??"application/json");const n=await fetch(`${ot}${e}`,{...r,headers:t});if(!n.ok){const o=await n.json().catch(()=>({error:n.statusText}));throw new at(n.status,o.error??n.statusText)}return n.json()}function st(){return S("/api/workspace")}function re(){return S("/api/repos")}function ut(e,r,t){return S("/api/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,description:r,...t?{private:!0}:{}})})}function lt(e,r){return S(`/api/repos/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r})})}function ft(e){return S(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}function ct(){return S("/api/apps")}function dt(e){return S(`/api/repos/${encodeURIComponent(e)}/entities`)}function It(e,r,t){return S(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}`)}function pt(e,r,t){return S(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}/contents`)}function $t(e,r,t,n){return fetch(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}/contents/${n}`).then(o=>{if(!o.ok)throw new Error(`Failed to load ${n}`);return o.text()})}function Rt(e,r,t,n,o){return S(`/api/repos/${encodeURIComponent(e)}/entities`,{method:"POST",body:JSON.stringify({entityType:r,entityId:t,data:n,content:o})})}function Lt(e,r,t){return S(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}`,{method:"DELETE"})}function Ot(e,r,t,n){return S(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)})}function Ut(e,r,t,n,o){return S(`/api/repos/${encodeURIComponent(e)}/entities/${encodeURIComponent(r)}/${encodeURIComponent(t)}/contents/${n}`,{method:"PUT",body:JSON.stringify({content:o})})}function gt(e){return e.replace(/-/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function ht(){let e=m(""),r=m(!1),t=m(N([])),n=m(N([])),o=m(!1),u=m(null),c=m(N({})),h=N({}),y=N({}),v=N({}),A=m(0),C=m(null),l=m(""),L=null,T=m(0),O=m(0);async function P(){d(o,!0),d(u,null);try{const[i,s,f]=await Promise.all([re(),ct().catch(()=>[]),st().catch(()=>({name:""}))]);d(n,s,!0),d(e,f.name,!0),d(r,!0),d(t,i.map(p=>({name:p.name,type:p.type,private:p.private,count:null,entities:[],loading:!1,loaded:!1})),!0),await Promise.all(a(t).map(p=>w(p.name)))}catch(i){d(u,i.message,!0)}finally{d(o,!1)}}async function I(i){a(t).find(f=>f.name===i)&&await w(i,!0)}async function j(){d(T,0),d(O,0),await Promise.all(a(t).map(i=>w(i.name,!0)))}async function w(i,s=!1){const f=a(t).find(p=>p.name===i);if(!(!f||f.loading)&&!(!s&&f.loaded)){s||(f.loading=!0);try{const p=await dt(i);let E=0,M=0;for(const U of p)E+=U.document?.wikilinks?.length??0,M+=U.subContentCount??0;d(T,a(T)+E),d(O,a(O)+M),f.entities=p.filter(U=>!U.id.toLowerCase().startsWith("readme")).map(U=>({id:U.id,title:U.data?.name??gt(U.id),entityType:U.entityType,repo:i,hasSubContent:!!U.hasSubContent})).sort((U,be)=>U.title.localeCompare(be.title)),f.count=f.entities.length,f.loaded=!0}catch(p){console.error(`Failed to load entities for ${i}:`,p)}finally{f.loading=!1}}}function _(i){a(c)[i]=!a(c)[i]}function B(i){return a(c)[i]??!1}function g(i,s,f){return`${i}/${s}/${f}`}function b(i,s,f){const p=g(i,s,f),E=h[p]??!1;h[p]=!E,!E&&!y[p]?.loaded&&$(i,s,f)}function R(i,s,f){return h[g(i,s,f)]??!1}function F(i,s,f){return y[g(i,s,f)]??{entries:[],loading:!1,loaded:!1}}async function $(i,s,f){const p=g(i,s,f);y[p]={entries:[],loading:!0,loaded:!1};try{const E=await pt(i,s,f);y[p]={entries:E,loading:!1,loaded:!0}}catch(E){console.error(`Failed to load contents for ${p}:`,E),y[p]={entries:[],loading:!1,loaded:!0}}}function Y(i){const s=a(l).trim().toLowerCase();if(!s)return i;const f=[];for(const p of i){const E=p.entities.filter(M=>M.title.toLowerCase().includes(s)||M.id.toLowerCase().includes(s));E.length>0&&f.push({...p,entities:E,count:E.length})}return f}function D(i){if(i&&!a(l)?L={...a(c)}:!i&&a(l)&&L&&(d(c,L,!0),L=null),d(l,i,!0),i){const s=i.trim().toLowerCase();for(const f of a(t)){const p=f.entities.some(E=>E.title.toLowerCase().includes(s)||E.id.toLowerCase().includes(s));a(c)[f.name]=p}}}function pe(i){const s=i.startsWith("type:");v[i]=!(v[i]??s)}function ge(i){return v[i]??!1}function he(i){return v[i]===!1}const ye=ue(()=>a(t).reduce((i,s)=>i+(s.count??0),0));function ve(i){return a(n).find(s=>s.entityTypes.includes(i))}return{get name(){return a(e)},get nameLoaded(){return a(r)},get repos(){return a(t)},get apps(){return a(n)},get loading(){return a(o)},get error(){return a(u)},get totalEntities(){return a(ye)},get totalLinks(){return a(T)},get totalFiles(){return a(O)},get sortedRepos(){const i=[...a(t)].sort((s,f)=>s.name.localeCompare(f.name));return Y(i)},get filteredIds(){const i=a(l).trim().toLowerCase();if(!i)return null;const s=new Set;for(const f of a(t))for(const p of f.entities)(p.title.toLowerCase().includes(i)||p.id.toLowerCase().includes(i))&&s.add(p.id);return s},get filterQuery(){return a(l)},setFilterQuery:D,get sidebarScrollTop(){return a(A)},set sidebarScrollTop(i){d(A,i,!0)},get lastAutoExpandedFor(){return a(C)},set lastAutoExpandedFor(i){d(C,i,!0)},load:P,loadEntities:w,refreshEntities:I,refreshAll:j,toggleRepo:_,isExpanded:B,toggleEntity:b,isEntityExpanded:R,getEntityContents:F,toggleFolder:pe,isFolderExpanded:ge,isFolderCollapsed:he,getAppForEntityType:ve,async renameCollectionTo(i,s){await lt(i,s);const f=a(t).find(p=>p.name===i);f&&(f.name=s,a(c)[i]&&(a(c)[s]=!0,delete a(c)[i]))},async removeCollection(i){await ft(i),d(t,a(t).filter(s=>s.name!==i),!0),delete a(c)[i]},async addCollection(i,s,f){await ut(i,s,f);const p=await re();d(t,p.map(E=>a(t).find(U=>U.name===E.name)??{name:E.name,type:E.type,private:E.private,count:null,entities:[],loading:!1,loaded:!1}),!0),a(c)[i]=!0,await w(i)}}}const Pt=ht();function yt(){return S("/api/status")}function ne(e){return S("/api/commit",{method:"POST",body:JSON.stringify({message:e})})}function ie(){return S("/api/push",{method:"POST",body:"{}"})}function vt(){return S("/api/pull",{method:"POST",body:"{}"})}function bt(){return S("/api/revert",{method:"POST",body:"{}"})}function Ct(){return S("/api/sync-status")}function wt(){let e=m(N([])),r=m(!1),t=m(!1),n=m(!1),o=m(!1),u=m(!1),c=m(0),h=m(0),y=m(0);const v=ue(()=>a(e).reduce((w,_)=>w+_.changes.length,0));async function A(){d(r,!0);try{d(e,await yt(),!0)}catch(w){console.error("Failed to fetch git status:",w)}finally{d(r,!1),L()}}async function C(){try{const w=await Ct();d(h,w.ahead,!0),d(y,w.behind,!0)}catch(w){console.error("Failed to fetch sync status:",w)}}async function l(){await Promise.all([A(),C()])}function L(){typeof window<"u"&&window.dispatchEvent(new CustomEvent("studiograph:git-refresh"))}async function T(w){d(t,!0);try{await ne(w),await l()}finally{d(t,!1)}}async function O(){d(n,!0);try{await ie(),await C()}finally{d(n,!1)}}async function P(w){d(t,!0);try{await ne(w)}finally{d(t,!1)}d(n,!0);try{await ie()}finally{d(n,!1)}await l()}async function I(){d(o,!0);try{await vt(),await l()}finally{d(o,!1)}}async function j(){d(u,!0);try{const w=await bt();return ke(c),await l(),w}finally{d(u,!1)}}return{get repoStatuses(){return a(e)},get totalChanges(){return a(v)},get loading(){return a(r)},get committing(){return a(t)},get pushing(){return a(n)},get pulling(){return a(o)},get reverting(){return a(u)},get revertCount(){return a(c)},get ahead(){return a(h)},get behind(){return a(y)},refresh:A,refreshSyncStatus:C,refreshAll:l,commit:T,push:O,commitAndPush:P,pull:I,revert:j}}const Ft=wt();export{H as a,Ve as b,De as c,$t as d,Tt as e,It as f,Ft as g,_t as h,S as i,Xe as j,Lt as k,Rt as l,Ye as m,Ut as n,rt as r,St as s,Ot as u,Pt as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as v,V as w,D as a,W as g}from"./DtVH--hH.js";import{syntaxTree as x}from"./4QY4j-jX.js";class b extends g{toDOM(){const r=document.createElement("span");return r.className="cm-bullet-widget",r.textContent="•",r}}class S extends g{constructor(r){super(),this.num=r}eq(r){return this.num===r.num}toDOM(){const r=document.createElement("span");return r.className="cm-ordered-widget",r.textContent=this.num+" ",r}}class C extends g{toDOM(){const r=document.createElement("div");return r.className="cm-hr-widget",r}}function E(n){return n.doc.lineAt(n.selection.main.head).number}function f(n,r,c){const i=n.selection.main.head;return i>=r&&i<=c}function k(n){const r=n.state,c=E(r),i=[];return x(r).iterate({enter(e){const u=r.doc.lineAt(e.from).number;if(e.name.startsWith("ATXHeading")){const h=`cm-live-heading cm-live-heading-${parseInt(e.name.replace("ATXHeading",""),10)||1}`;if(i.push(a.mark({class:h}).range(e.from,e.to)),u!==c){let o=e.node.firstChild;for(;o;){if(o.name==="HeaderMark"){const p=Math.min(o.to+1,e.to);i.push(a.replace({}).range(o.from,p));break}o=o.nextSibling}}return!1}if(e.name==="HorizontalRule"&&u!==c&&i.push(a.replace({widget:new C}).range(e.from,e.to)),e.name==="ListMark"&&u!==c){const t=Math.min(e.to+1,r.doc.lineAt(e.from).to);if(e.node.parent?.parent?.name==="OrderedList"){const o=r.doc.sliceString(e.from,e.to);i.push(a.replace({widget:new S(o)}).range(e.from,t))}else i.push(a.replace({widget:new b}).range(e.from,t))}if(e.name==="StrongEmphasis"){if(i.push(a.mark({class:"cm-live-strong"}).range(e.from,e.to)),!f(r,e.from,e.to)){let t=e.node.firstChild;for(;t;)t.name==="EmphasisMark"&&i.push(a.replace({}).range(t.from,t.to)),t=t.nextSibling}return!1}if(e.name==="Emphasis"){if(i.push(a.mark({class:"cm-live-em"}).range(e.from,e.to)),!f(r,e.from,e.to)){let t=e.node.firstChild;for(;t;)t.name==="EmphasisMark"&&i.push(a.replace({}).range(t.from,t.to)),t=t.nextSibling}return!1}if(e.name==="InlineCode"){if(i.push(a.mark({class:"cm-live-code"}).range(e.from,e.to)),!f(r,e.from,e.to)){let t=e.node.firstChild;for(;t;)t.name==="CodeMark"&&i.push(a.replace({}).range(t.from,t.to)),t=t.nextSibling}return!1}if(e.name==="Link"){const t=r.doc.sliceString(e.from,e.to),h=e.from>0?r.doc.sliceString(e.from-1,e.from):"",o=e.to<r.doc.length?r.doc.sliceString(e.to,e.to+1):"";if(h==="["&&o==="]"){const s=e.from-1,l=e.to+1;return i.push(a.mark({class:"cm-live-wikilink"}).range(s,l)),f(r,s,l)||(i.push(a.replace({}).range(s,s+2)),i.push(a.replace({}).range(l-2,l))),!1}if(t.includes("](")){let s=e.node.firstChild;const l=[];let m=null;for(;s;)s.name==="LinkMark"&&l.push({from:s.from,to:s.to}),s.name==="URL"&&(m={from:s.from,to:s.to}),s=s.nextSibling;const d=m?r.doc.sliceString(m.from,m.to):"";return i.push(a.mark({class:"cm-live-link",attributes:d?{"data-href":d}:{}}).range(e.from,e.to)),f(r,e.from,e.to)||l.length>=2&&m&&(i.push(a.replace({}).range(l[0].from,l[0].to)),i.push(a.replace({}).range(l[1].from,e.to))),!1}}}}),a.set(i,!0)}const D=w.fromClass(class{decorations;constructor(n){this.decorations=k(n)}update(n){(n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=k(n.view))}},{decorations:n=>n.decorations}),L=v.baseTheme({".cm-live-heading":{fontWeight:"600"},".cm-live-heading-1":{fontSize:"1.5em"},".cm-live-heading-2":{fontSize:"1.2em"},".cm-live-heading-3":{fontSize:"1.05em"},".cm-live-strong":{fontWeight:"600"},".cm-live-em":{fontStyle:"italic"},".cm-live-code":{fontFamily:"monospace",fontSize:"0.9em",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(128,128,128,0.12)"},".cm-live-wikilink":{color:"var(--color-link, #8b8bf0)",cursor:"pointer"},".cm-live-wikilink:hover":{textDecoration:"underline"},".cm-live-link":{color:"var(--color-link, #8b8bf0)",textDecoration:"none",cursor:"pointer"},".cm-live-link:hover":{textDecoration:"underline"},".cm-bullet-widget":{color:"var(--color-text-tertiary)",paddingRight:"6px"},".cm-hr-widget":{borderTop:"1px solid var(--color-border, #333)",margin:"8px 0"}});export{D as livePreviewPlugin,L as livePreviewTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Bt=Array.isArray,Gt=Array.prototype.indexOf,ie=Array.prototype.includes,Vn=Array.from,Un=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,Kt=Object.getOwnPropertyDescriptors,zt=Object.prototype,$t=Array.prototype,ot=Object.getPrototypeOf,et=Object.isExtensible;function Bn(e){return typeof e=="function"}const Xt=()=>{};function Gn(e){return e()}function Zt(e){for(var t=0;t<e.length;t++)e[t]()}function ut(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}function Kn(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const m=2,ae=4,le=8,He=1<<24,$=16,L=32,X=64,Wt=128,O=512,E=1024,T=2048,F=4096,P=8192,V=16384,ve=32768,Ae=65536,tt=1<<17,Jt=1<<18,de=1<<19,ct=1<<20,zn=1<<25,re=65536,Me=1<<21,qe=1<<22,U=1<<23,te=Symbol("$state"),$n=Symbol("legacy props"),Xn=Symbol(""),W=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Wn=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Jn=1,ke=3,_t=8;function Ve(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Qt(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qn(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function en(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function tn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function nn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function rn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function er(){throw new Error("https://svelte.dev/e/hydration_failed")}function tr(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function sn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function an(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function fn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function nr(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const rr=1,sr=2,ar=4,fr=8,ir=16,lr=1,or=2,ur=4,cr=8,_r=16,vr=1,dr=2,ln="[",on="[!",hr="[?",un="]",Ue={},b=Symbol(),cn="http://www.w3.org/1999/xhtml",pr="http://www.w3.org/2000/svg",wr="http://www.w3.org/1998/Math/MathML",yr="@attach";function Be(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Er(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function br(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let G=!1;function mr(e){G=e}let S;function oe(e){if(e===null)throw Be(),Ue;return S=e}function gr(){return oe(Z(S))}function Tr(e){if(G){if(Z(S)!==null)throw Be(),Ue;S=e}}function Ar(e=1){if(G){for(var t=e,n=S;t--;)n=Z(n);S=n}}function xr(e=!0){for(var t=0,n=S;;){if(n.nodeType===_t){var r=n.data;if(r===un){if(t===0)return n;t-=1}else(r===ln||r===on||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=Z(n);e&&n.remove(),n=s}}function Sr(e){if(!e||e.nodeType!==_t)throw Be(),Ue;return e.data}function vt(e){return e===this.v}function _n(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function dt(e){return!_n(e,this.v)}let Ee=!1;function Rr(){Ee=!0}let p=null;function xe(e){p=e}function Nr(e){return Oe().get(e)}function kr(e,t){return Oe().set(e,t),t}function Or(e){return Oe().has(e)}function Dr(){return Oe()}function Cr(e,t=!1,n){p={p,i:!1,c:null,e:null,s:e,x:null,l:Ee&&!t?{s:null,u:null,$:[]}:null}}function Ir(e){var t=p,n=t.e;if(n!==null){t.e=null;for(var r of n)Dt(r)}return t.i=!0,p=t.p,{}}function be(){return!Ee||p!==null&&p.l===null}function Oe(e){return p===null&&Ve(),p.c??=new Map(vn(p)||void 0)}function vn(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}let J=[];function ht(){var e=J;J=[],Zt(e)}function Pe(e){if(J.length===0&&!we){var t=J;queueMicrotask(()=>{t===J&&ht()})}J.push(e)}function dn(){for(;J.length>0;)ht()}function hn(e){var t=d;if(t===null)return v.f|=U,e;if((t.f&ve)===0&&(t.f&ae)===0)throw e;Se(e,t)}function Se(e,t){for(;t!==null;){if((t.f&Wt)!==0){if((t.f&ve)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const pn=-7169;function y(e,t){e.f=e.f&pn|t}function Ge(e){(e.f&O)!==0||e.deps===null?y(e,E):y(e,F)}function pt(e){if(e!==null)for(const t of e)(t.f&m)===0||(t.f&re)===0||(t.f^=re,pt(t.deps))}function wn(e,t,n){(e.f&T)!==0?t.add(e):(e.f&F)!==0&&n.add(e),pt(e.deps),y(e,E)}const ge=new Set;let w=null,nt=null,I=null,A=[],De=null,we=!1,ue=null;class fe{current=new Map;previous=new Map;#t=new Set;#s=new Set;#r=0;#a=0;#f=null;#i=new Set;#n=new Set;#e=new Map;is_fork=!1;#l=!1;#o(){return this.is_fork||this.#a>0}skip_effect(t){this.#e.has(t)||this.#e.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#e.get(t);if(n){this.#e.delete(t);for(var r of n.d)y(r,T),Y(r);for(r of n.m)y(r,F),Y(r)}}process(t){A=[],this.apply();var n=ue=[],r=[];for(const s of t)this.#u(s,n,r);if(ue=null,this.#o()){this.#c(r),this.#c(n);for(const[s,a]of this.#e)bt(s,a)}else{nt=this,w=null;for(const s of this.#t)s(this);this.#t.clear(),this.#r===0&&this.#_(),rt(r),rt(n),this.#i.clear(),this.#n.clear(),nt=null,this.#f?.resolve()}I=null}#u(t,n,r){t.f^=E;for(var s=t.first;s!==null;){var a=s.f,l=(a&(L|X))!==0,o=l&&(a&E)!==0,f=o||(a&P)!==0||this.#e.has(s);if(!f&&s.fn!==null){l?s.f^=E:(a&ae)!==0?n.push(s):me(s)&&((a&$)!==0&&this.#n.add(s),_e(s));var i=s.first;if(i!==null){s=i;continue}}for(;s!==null;){var u=s.next;if(u!==null){s=u;break}s=s.parent}}}#c(t){for(var n=0;n<t.length;n+=1)wn(t[n],this.#i,this.#n)}capture(t,n){n!==b&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&U)===0&&(this.current.set(t,t.v),I?.set(t,t.v))}activate(){w=this,this.apply()}deactivate(){w===this&&(w=null,I=null)}flush(){if(A.length>0)w=this,wt();else if(this.#r===0&&!this.is_fork){for(const t of this.#t)t(this);this.#t.clear(),this.#_(),this.#f?.resolve()}this.deactivate()}discard(){for(const t of this.#s)t(this);this.#s.clear()}#_(){if(ge.size>1){this.previous.clear();var t=w,n=I,r=!0;for(const a of ge){if(a===this){r=!1;continue}const l=[];for(const[f,i]of this.current){if(a.current.has(f))if(r&&i!==a.current.get(f))a.current.set(f,i);else continue;l.push(f)}if(l.length===0)continue;const o=[...a.current.keys()].filter(f=>!this.current.has(f));if(o.length>0){var s=A;A=[];const f=new Set,i=new Map;for(const u of l)yt(u,o,f,i);if(A.length>0){w=a,a.apply();for(const u of A)a.#u(u,[],[]);a.deactivate()}A=s}}w=t,I=n}this.#e.clear(),ge.delete(this)}increment(t){this.#r+=1,t&&(this.#a+=1)}decrement(t){this.#r-=1,t&&(this.#a-=1),!this.#l&&(this.#l=!0,Pe(()=>{this.#l=!1,this.#o()?A.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#i)this.#n.delete(t),y(t,T),Y(t);for(const t of this.#n)y(t,F),Y(t);this.flush()}oncommit(t){this.#t.add(t)}ondiscard(t){this.#s.add(t)}settled(){return(this.#f??=ut()).promise}static ensure(){if(w===null){const t=w=new fe;ge.add(w),we||Pe(()=>{w===t&&t.flush()})}return w}apply(){}}function yn(e){var t=we;we=!0;try{for(var n;;){if(dn(),A.length===0&&(w?.flush(),A.length===0))return De=null,n;wt()}}finally{we=t}}function wt(){var e=null;try{for(var t=0;A.length>0;){var n=fe.ensure();if(t++>1e3){var r,s;En()}n.process(A),B.clear()}}finally{A=[],De=null,ue=null}}function En(){try{rn()}catch(e){Se(e,De)}}let j=null;function rt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(V|P))===0&&me(r)&&(j=new Set,_e(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&It(r),j?.size>0)){B.clear();for(const s of j){if((s.f&(V|P))!==0)continue;const a=[s];let l=s.parent;for(;l!==null;)j.has(l)&&(j.delete(l),a.push(l)),l=l.parent;for(let o=a.length-1;o>=0;o--){const f=a[o];(f.f&(V|P))===0&&_e(f)}}j.clear()}}j=null}}function yt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const a=s.f;(a&m)!==0?yt(s,t,n,r):(a&(qe|$))!==0&&(a&T)===0&&Et(s,t,r)&&(y(s,T),Y(s))}}function Et(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(ie.call(t,s))return!0;if((s.f&m)!==0&&Et(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function Y(e){var t=De=e,n=t.b;if(n?.is_pending&&(e.f&(ae|le|He))!==0&&(e.f&ve)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(ue!==null&&t===d&&(e.f&le)===0)return;if((r&(X|L))!==0){if((r&E)===0)return;t.f^=E}}A.push(t)}function bt(e,t){if(!((e.f&L)!==0&&(e.f&E)!==0)){(e.f&T)!==0?t.d.push(e):(e.f&F)!==0&&t.m.push(e),y(e,E);for(var n=e.first;n!==null;)bt(n,t),n=n.next}}function mt(e,t,n,r){const s=be()?Ke:gn;var a=e.filter(c=>!c.settled);if(n.length===0&&a.length===0){r(t.map(s));return}var l=d,o=bn(),f=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(c=>c.promise)):null;function i(c){o();try{r(c)}catch(_){(l.f&V)===0&&Se(_,l)}Fe()}if(n.length===0){f.then(()=>i(t.map(s)));return}function u(){o(),Promise.all(n.map(c=>mn(c))).then(c=>i([...t.map(s),...c])).catch(c=>Se(c,l))}f?f.then(u):u()}function bn(){var e=d,t=v,n=p,r=w;return function(a=!0){ce(e),z(t),xe(n),a&&r?.activate()}}function Fe(e=!0){ce(null),z(null),xe(null),e&&w?.deactivate()}function gt(){var e=d.b,t=w,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function Ke(e){var t=m|T,n=v!==null&&(v.f&m)!==0?v:null;return d!==null&&(d.f|=de),{ctx:p,deps:null,effects:null,equals:vt,f:t,fn:e,reactions:null,rv:0,v:b,wv:0,parent:n??d,ac:null}}function mn(e,t,n){d===null&&Qt();var s=void 0,a=$e(b),l=!v,o=new Map;return Mn(()=>{var f=ut();s=f.promise;try{Promise.resolve(e()).then(f.resolve,f.reject).finally(Fe)}catch(_){f.reject(_),Fe()}var i=w;if(l){var u=gt();o.get(i)?.reject(W),o.delete(i),o.set(i,f)}const c=(_,g=void 0)=>{if(i.activate(),g)g!==W&&(a.f|=U,je(a,g));else{(a.f&U)!==0&&(a.f^=U),je(a,_);for(const[h,C]of o){if(o.delete(h),h===i)break;C.reject(W)}}u&&u()};f.promise.then(c,_=>c(null,_||"unknown"))}),Cn(()=>{for(const f of o.values())f.reject(W)}),new Promise(f=>{function i(u){function c(){u===s?f(a):i(s)}u.then(c,c)}i(s)})}function Mr(e){const t=Ke(e);return Ft(t),t}function gn(e){const t=Ke(e);return t.equals=dt,t}function Tn(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)K(t[n])}}function An(e){for(var t=e.parent;t!==null;){if((t.f&m)===0)return(t.f&V)===0?t:null;t=t.parent}return null}function ze(e){var t,n=d;ce(An(e));try{e.f&=~re,Tn(e),t=Ht(e)}finally{ce(n)}return t}function Tt(e){var t=ze(e);if(!e.equals(t)&&(e.wv=jt(),(!w?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){y(e,E);return}se||(I!==null?(Ot()||w?.is_fork)&&I.set(e,t):Ge(e))}function xn(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(W),t.teardown=Xt,t.ac=null,ye(t,0),We(t))}function At(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&_e(t)}let Le=new Set;const B=new Map;let xt=!1;function $e(e,t){var n={f:0,v:e,reactions:null,equals:vt,rv:0,wv:0};return n}function H(e,t){const n=$e(e);return Ft(n),n}function Pr(e,t=!1,n=!0){const r=$e(e);return t||(r.equals=dt),Ee&&n&&p!==null&&p.l!==null&&(p.l.s??=[]).push(r),r}function q(e,t,n=!1){v!==null&&(!M||(v.f&tt)!==0)&&be()&&(v.f&(m|$|qe|tt))!==0&&(D===null||!ie.call(D,e))&&fn();let r=n?he(t):t;return je(e,r)}function je(e,t){if(!e.equals(t)){var n=e.v;se?B.set(e,t):B.set(e,n),e.v=t;var r=fe.ensure();if(r.capture(e,n),(e.f&m)!==0){const s=e;(e.f&T)!==0&&ze(s),Ge(s)}e.wv=jt(),St(e,T),be()&&d!==null&&(d.f&E)!==0&&(d.f&(L|X))===0&&(k===null?jn([e]):k.push(e)),!r.is_fork&&Le.size>0&&!xt&&Sn()}return t}function Sn(){xt=!1;for(const e of Le)(e.f&E)!==0&&y(e,F),me(e)&&_e(e);Le.clear()}function Fr(e,t=1){var n=ee(e),r=t===1?n++:n--;return q(e,n),r}function Ie(e){q(e,e.v+1)}function St(e,t){var n=e.reactions;if(n!==null)for(var r=be(),s=n.length,a=0;a<s;a++){var l=n[a],o=l.f;if(!(!r&&l===d)){var f=(o&T)===0;if(f&&y(l,t),(o&m)!==0){var i=l;I?.delete(i),(o&re)===0&&(o&O&&(l.f|=re),St(i,F))}else f&&((o&$)!==0&&j!==null&&j.add(l),Y(l))}}}function he(e){if(typeof e!="object"||e===null||te in e)return e;const t=ot(e);if(t!==zt&&t!==$t)return e;var n=new Map,r=Bt(e),s=H(0),a=ne,l=o=>{if(ne===a)return o();var f=v,i=ne;z(null),lt(a);var u=o();return z(f),lt(i),u};return r&&n.set("length",H(e.length)),new Proxy(e,{defineProperty(o,f,i){(!("value"in i)||i.configurable===!1||i.enumerable===!1||i.writable===!1)&&sn();var u=n.get(f);return u===void 0?l(()=>{var c=H(i.value);return n.set(f,c),c}):q(u,i.value,!0),!0},deleteProperty(o,f){var i=n.get(f);if(i===void 0){if(f in o){const u=l(()=>H(b));n.set(f,u),Ie(s)}}else q(i,b),Ie(s);return!0},get(o,f,i){if(f===te)return e;var u=n.get(f),c=f in o;if(u===void 0&&(!c||pe(o,f)?.writable)&&(u=l(()=>{var g=he(c?o[f]:b),h=H(g);return h}),n.set(f,u)),u!==void 0){var _=ee(u);return _===b?void 0:_}return Reflect.get(o,f,i)},getOwnPropertyDescriptor(o,f){var i=Reflect.getOwnPropertyDescriptor(o,f);if(i&&"value"in i){var u=n.get(f);u&&(i.value=ee(u))}else if(i===void 0){var c=n.get(f),_=c?.v;if(c!==void 0&&_!==b)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return i},has(o,f){if(f===te)return!0;var i=n.get(f),u=i!==void 0&&i.v!==b||Reflect.has(o,f);if(i!==void 0||d!==null&&(!u||pe(o,f)?.writable)){i===void 0&&(i=l(()=>{var _=u?he(o[f]):b,g=H(_);return g}),n.set(f,i));var c=ee(i);if(c===b)return!1}return u},set(o,f,i,u){var c=n.get(f),_=f in o;if(r&&f==="length")for(var g=i;g<c.v;g+=1){var h=n.get(g+"");h!==void 0?q(h,b):g in o&&(h=l(()=>H(b)),n.set(g+"",h))}if(c===void 0)(!_||pe(o,f)?.writable)&&(c=l(()=>H(void 0)),q(c,he(i)),n.set(f,c));else{_=c.v!==b;var C=l(()=>he(i));q(c,C)}var Je=Reflect.getOwnPropertyDescriptor(o,f);if(Je?.set&&Je.set.call(u,i),!_){if(r&&typeof f=="string"){var Qe=n.get("length"),Ce=Number(f);Number.isInteger(Ce)&&Ce>=Qe.v&&q(Qe,Ce+1)}Ie(s)}return!0},ownKeys(o){ee(s);var f=Reflect.ownKeys(o).filter(c=>{var _=n.get(c);return _===void 0||_.v!==b});for(var[i,u]of n)u.v!==b&&!(i in o)&&f.push(i);return f},setPrototypeOf(){an()}})}function st(e){try{if(e!==null&&typeof e=="object"&&te in e)return e[te]}catch{}return e}function Lr(e,t){return Object.is(st(e),st(t))}var at,Rn,Nn,Rt,Nt;function jr(){if(at===void 0){at=window,Rn=document,Nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Rt=pe(t,"firstChild").get,Nt=pe(t,"nextSibling").get,et(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),et(n)&&(n.__t=void 0)}}function Re(e=""){return document.createTextNode(e)}function Ne(e){return Rt.call(e)}function Z(e){return Nt.call(e)}function Yr(e,t){if(!G)return Ne(e);var n=Ne(S);if(n===null)n=S.appendChild(Re());else if(t&&n.nodeType!==ke){var r=Re();return n?.before(r),oe(r),r}return t&&Xe(n),oe(n),n}function Hr(e,t=!1){if(!G){var n=Ne(e);return n instanceof Comment&&n.data===""?Z(n):n}if(t){if(S?.nodeType!==ke){var r=Re();return S?.before(r),oe(r),r}Xe(S)}return S}function qr(e,t=1,n=!1){let r=G?S:e;for(var s;t--;)s=r,r=Z(r);if(!G)return r;if(n){if(r?.nodeType!==ke){var a=Re();return r===null?s?.after(a):r.before(a),oe(a),a}Xe(r)}return oe(r),r}function kn(e){e.textContent=""}function Vr(){return!1}function Ur(e,t,n){return document.createElementNS(t??cn,e,void 0)}function Xe(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===ke;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Br(e,t){if(t){const n=document.body;e.autofocus=!0,Pe(()=>{document.activeElement===n&&e.focus()})}}function Gr(e){G&&Ne(e)!==null&&kn(e)}let ft=!1;function On(){ft||(ft=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Ze(e){var t=v,n=d;z(null),ce(null);try{return e()}finally{z(t),ce(n)}}function Kr(e,t,n,r=n){e.addEventListener(t,()=>Ze(n));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),On()}function kt(e){d===null&&(v===null&&nn(),tn()),se&&en()}function Dn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function N(e,t){var n=d;n!==null&&(n.f&P)!==0&&(e|=P);var r={ctx:p,deps:null,nodes:null,f:e|T|O,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},s=r;if((e&ae)!==0)ue!==null?ue.push(r):Y(r);else if(t!==null){try{_e(r)}catch(l){throw K(r),l}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&de)===0&&(s=s.first,(e&$)!==0&&(e&Ae)!==0&&s!==null&&(s.f|=Ae))}if(s!==null&&(s.parent=n,n!==null&&Dn(s,n),v!==null&&(v.f&m)!==0&&(e&X)===0)){var a=v;(a.effects??=[]).push(s)}return r}function Ot(){return v!==null&&!M}function Cn(e){const t=N(le,null);return y(t,E),t.teardown=e,t}function In(e){kt();var t=d.f,n=!v&&(t&L)!==0&&(t&ve)===0;if(n){var r=p;(r.e??=[]).push(e)}else return Dt(e)}function Dt(e){return N(ae|ct,e)}function zr(e){return kt(),N(le|ct,e)}function $r(e){fe.ensure();const t=N(X|de,e);return()=>{K(t)}}function Xr(e){fe.ensure();const t=N(X|de,e);return(n={})=>new Promise(r=>{n.outro?Ln(t,()=>{K(t),r(void 0)}):(K(t),r(void 0))})}function Zr(e){return N(ae,e)}function Mn(e){return N(qe|de,e)}function Wr(e,t=0){return N(le|t,e)}function Jr(e,t=[],n=[],r=[]){mt(r,t,n,s=>{N(le,()=>e(...s.map(ee)))})}function Qr(e,t=[],n=[],r=[]){if(n.length>0||r.length>0)var s=gt();mt(r,t,n,a=>{N(ae,()=>e(...a.map(ee))),s&&s()})}function es(e,t=0){var n=N($|t,e);return n}function ts(e,t=0){var n=N(He|t,e);return n}function ns(e){return N(L|de,e)}function Ct(e){var t=e.teardown;if(t!==null){const n=se,r=v;it(!0),z(null);try{t.call(null)}finally{it(n),z(r)}}}function We(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&Ze(()=>{s.abort(W)});var r=n.next;(n.f&X)!==0?n.parent=null:K(n,t),n=r}}function Pn(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&L)===0&&K(t),t=n}}function K(e,t=!0){var n=!1;(t||(e.f&Jt)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Fn(e.nodes.start,e.nodes.end),n=!0),We(e,t&&!n),ye(e,0),y(e,V);var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)a.stop();Ct(e);var s=e.parent;s!==null&&s.first!==null&&It(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Fn(e,t){for(;e!==null;){var n=e===t?null:Z(e);e.remove(),e=n}}function It(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Ln(e,t,n=!0){var r=[];Mt(e,r,!0);var s=()=>{n&&K(e),t&&t()},a=r.length;if(a>0){var l=()=>--a||s();for(var o of r)o.out(l)}else s()}function Mt(e,t,n){if((e.f&P)===0){e.f^=P;var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)(o.is_global||n)&&t.push(o);for(var s=e.first;s!==null;){var a=s.next,l=(s.f&Ae)!==0||(s.f&L)!==0&&(e.f&$)!==0;Mt(s,t,l?n:!1),s=a}}}function rs(e){Pt(e,!0)}function Pt(e,t){if((e.f&P)!==0){e.f^=P,(e.f&E)===0&&(y(e,T),Y(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Ae)!==0||(n.f&L)!==0;Pt(n,s?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(const l of a)(l.is_global||t)&&l.in()}}function ss(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:Z(n);t.append(n),n=s}}let Te=!1,se=!1;function it(e){se=e}let v=null,M=!1;function z(e){v=e}let d=null;function ce(e){d=e}let D=null;function Ft(e){v!==null&&(D===null?D=[e]:D.push(e))}let x=null,R=0,k=null;function jn(e){k=e}let Lt=1,Q=0,ne=Q;function lt(e){ne=e}function jt(){return++Lt}function me(e){var t=e.f;if((t&T)!==0)return!0;if(t&m&&(e.f&=~re),(t&F)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var a=n[s];if(me(a)&&Tt(a),a.wv>e.wv)return!0}(t&O)!==0&&I===null&&y(e,E)}return!1}function Yt(e,t,n=!0){var r=e.reactions;if(r!==null&&!(D!==null&&ie.call(D,e)))for(var s=0;s<r.length;s++){var a=r[s];(a.f&m)!==0?Yt(a,t,!1):t===a&&(n?y(a,T):(a.f&E)!==0&&y(a,F),Y(a))}}function Ht(e){var t=x,n=R,r=k,s=v,a=D,l=p,o=M,f=ne,i=e.f;x=null,R=0,k=null,v=(i&(L|X))===0?e:null,D=null,xe(e.ctx),M=!1,ne=++Q,e.ac!==null&&(Ze(()=>{e.ac.abort(W)}),e.ac=null);try{e.f|=Me;var u=e.fn,c=u();e.f|=ve;var _=e.deps,g=w?.is_fork;if(x!==null){var h;if(g||ye(e,R),_!==null&&R>0)for(_.length=R+x.length,h=0;h<x.length;h++)_[R+h]=x[h];else e.deps=_=x;if(Ot()&&(e.f&O)!==0)for(h=R;h<_.length;h++)(_[h].reactions??=[]).push(e)}else!g&&_!==null&&R<_.length&&(ye(e,R),_.length=R);if(be()&&k!==null&&!M&&_!==null&&(e.f&(m|F|T))===0)for(h=0;h<k.length;h++)Yt(k[h],e);if(s!==null&&s!==e){if(Q++,s.deps!==null)for(let C=0;C<n;C+=1)s.deps[C].rv=Q;if(t!==null)for(const C of t)C.rv=Q;k!==null&&(r===null?r=k:r.push(...k))}return(e.f&U)!==0&&(e.f^=U),c}catch(C){return hn(C)}finally{e.f^=Me,x=t,R=n,k=r,v=s,D=a,xe(l),M=o,ne=f}}function Yn(e,t){let n=t.reactions;if(n!==null){var r=Gt.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&m)!==0&&(x===null||!ie.call(x,t))){var a=t;(a.f&O)!==0&&(a.f^=O,a.f&=~re),Ge(a),xn(a),ye(a,0)}}function ye(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Yn(e,n[r])}function _e(e){var t=e.f;if((t&V)===0){y(e,E);var n=d,r=Te;d=e,Te=!0;try{(t&($|He))!==0?Pn(e):We(e),Ct(e);var s=Ht(e);e.teardown=typeof s=="function"?s:null,e.wv=Lt;var a}finally{Te=r,d=n}}}async function as(){await Promise.resolve(),yn()}function fs(){return fe.ensure().settled()}function ee(e){var t=e.f,n=(t&m)!==0;if(v!==null&&!M){var r=d!==null&&(d.f&V)!==0;if(!r&&(D===null||!ie.call(D,e))){var s=v.deps;if((v.f&Me)!==0)e.rv<Q&&(e.rv=Q,x===null&&s!==null&&s[R]===e?R++:x===null?x=[e]:x.push(e));else{(v.deps??=[]).push(e);var a=e.reactions;a===null?e.reactions=[v]:ie.call(a,v)||a.push(v)}}}if(se&&B.has(e))return B.get(e);if(n){var l=e;if(se){var o=l.v;return((l.f&E)===0&&l.reactions!==null||Vt(l))&&(o=ze(l)),B.set(l,o),o}var f=(l.f&O)===0&&!M&&v!==null&&(Te||(v.f&O)!==0),i=(l.f&ve)===0;me(l)&&(f&&(l.f|=O),Tt(l)),f&&!i&&(At(l),qt(l))}if(I?.has(e))return I.get(e);if((e.f&U)!==0)throw e.v;return e.v}function qt(e){if(e.f|=O,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&m)!==0&&(t.f&O)===0&&(At(t),qt(t))}function Vt(e){if(e.v===b)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(B.has(t)||(t.f&m)!==0&&Vt(t))return!0;return!1}function Ut(e){var t=M;try{return M=!0,e()}finally{M=t}}function is(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(te in e)Ye(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&te in n&&Ye(n)}}}function Ye(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Ye(e[r],t)}catch{}const n=ot(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=Kt(n);for(let s in r){const a=r[s].get;if(a)try{a.call(e)}catch{}}}}}function Hn(e){p===null&&Ve(),Ee&&p.l!==null?qn(p).m.push(e):In(()=>{const t=Ut(e);if(typeof t=="function")return t})}function ls(e){p===null&&Ve(),Hn(()=>()=>Ut(e))}function qn(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}export{Rn as $,In as A,Ut as B,Zt as C,Gn as D,Ae as E,ee as F,is as G,ln as H,Ke as I,Rr as J,Jt as K,de as L,_t as M,Z as N,Ne as O,H as P,he as Q,kr as R,Hn as S,q as T,Qr as U,Hr as V,Fr as W,at as X,Mr as Y,Ot as Z,Wr as _,gr as a,ot as a$,$e as a0,Ie as a1,Pe as a2,d as a3,Wt as a4,on as a5,hr as a6,fe as a7,y as a8,T as a9,tr as aA,se as aB,V as aC,_r as aD,cr as aE,Ee as aF,or as aG,lr as aH,gn as aI,yn as aJ,Un as aK,Pr as aL,as as aM,Cn as aN,Ze as aO,Ur as aP,Nn as aQ,vr as aR,dr as aS,ve as aT,ke as aU,Xe as aV,ts as aW,Bt as aX,Er as aY,Lr as aZ,cn as a_,Y as aa,F as ab,wn as ac,ce as ad,z as ae,xe as af,hn as ag,v as ah,je as ai,Se as aj,nr as ak,br as al,jr as am,Ue as an,er as ao,kn as ap,Xr as aq,Vn as ar,un as as,Be as at,Zr as au,te as av,ur as aw,Bn as ax,$n as ay,pe as az,es as b,mt as b0,yr as b1,Wn as b2,Br as b3,b as b4,On as b5,Xn as b6,Kt as b7,Fn as b8,pr as b9,wr as ba,Gr as bb,ls as bc,Qn as bd,ar as be,sr as bf,rr as bg,ir as bh,zn as bi,P as bj,L as bk,fr as bl,Jn as bm,Kr as bn,nt as bo,Kn as bp,Xt as bq,be as br,ne as bs,Or as bt,Dr as bu,$r as bv,_n as bw,fs as bx,oe as c,mr as d,S as e,rs as f,K as g,G as h,Re as i,ns as j,w as k,Vr as l,ss as m,Cr as n,Nr as o,Ln as p,Ir as q,Sr as r,xr as s,Yr as t,qr as u,Ar as v,Tr as w,Jr as x,p as y,zr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aN as x,a2 as A,aO as P,aK as C,ae as b,ad as y,ah as I,a3 as g,aP as R,i as m,O as p,aQ as V,aR as D,aS as W,h as d,e as i,aT as $,a as M,M as B,aU as H,c as U,aV as j}from"./fwnBoL5x.js";function re(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const q=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ae(e){return q.includes(e)}const F={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ne(e){return e=e.toLowerCase(),F[e]??e}const G=["touchstart","touchmove"];function oe(e){return G.includes(e)}const X=["textarea","script","style","title"];function se(e){return X.includes(e)}const f=Symbol("events"),z=new Set,K=new Set;function L(e,t,r,o={}){function n(a){if(o.capture||Q.call(t,a),!a.cancelBubble)return P(()=>r?.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?A(()=>{t.addEventListener(e,n,o)}):t.addEventListener(e,n,o),n}function ie(e,t,r,o={}){var n=L(t,e,r,o);return()=>{e.removeEventListener(t,n,o)}}function ue(e,t,r,o,n){var a={capture:o,passive:n},s=L(e,t,r,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&x(()=>{t.removeEventListener(e,s,a)})}function le(e,t,r){(t[f]??={})[e]=r}function ce(e){for(var t=0;t<e.length;t++)z.add(e[t]);for(var r of K)r(e)}let N=null;function Q(e){var t=this,r=t.ownerDocument,o=e.type,n=e.composedPath?.()||[],a=n[0]||e.target;N=e;var s=0,c=N===e&&e[f];if(c){var u=n.indexOf(c);if(u!==-1&&(t===document||t===window)){e[f]=t;return}var w=n.indexOf(t);if(w===-1)return;u<=w&&(s=u)}if(a=n[s]||e.target,a!==t){C(e,"currentTarget",{configurable:!0,get(){return a||r}});var O=I,k=g;b(null),y(null);try{for(var _,E=[];a!==null;){var h=a.assignedSlot||a.parentNode||a.host||null;try{var T=a[f]?.[o];T!=null&&(!a.disabled||e.target===a)&&T.call(a,e)}catch(v){_?E.push(v):_=v}if(e.cancelBubble||h===t||h===null)break;a=h}if(_){for(let v of E)queueMicrotask(()=>{throw v});throw _}}finally{e[f]=t,delete e.currentTarget,b(O),y(k)}}}const J=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Y(e){return J?.createHTML(e)??e}function S(e){var t=R("template");return t.innerHTML=Y(e.replaceAll("<!>","<!---->")),t.content}function l(e,t){var r=g;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function de(e,t){var r=(t&D)!==0,o=(t&W)!==0,n,a=!e.startsWith("<!>");return()=>{if(d)return l(i,null),i;n===void 0&&(n=S(a?e:"<!>"+e),r||(n=p(n)));var s=o||V?document.importNode(n,!0):n.cloneNode(!0);if(r){var c=p(s),u=s.lastChild;l(c,u)}else l(s,s);return s}}function Z(e,t,r="svg"){var o=!e.startsWith("<!>"),n=`<${r}>${o?e:"<!>"+e}</${r}>`,a;return()=>{if(d)return l(i,null),i;if(!a){var s=S(n),c=p(s);a=p(c)}var u=a.cloneNode(!0);return l(u,u),u}}function fe(e,t){return Z(e,t,"svg")}function _e(e=""){if(!d){var t=m(e+"");return l(t,t),t}var r=i;return r.nodeType!==H?(r.before(r=m()),U(r)):j(r),l(r,r),r}function ve(){if(d)return l(i,null),i;var e=document.createDocumentFragment(),t=document.createComment(""),r=m();return e.append(t,r),l(t,r),e}function pe(e,t){if(d){var r=g;((r.f&$)===0||r.nodes.end===null)&&(r.nodes.end=i),M();return}e!==null&&e.before(t)}function he(){if(d&&i&&i.nodeType===B&&i.textContent?.startsWith("$")){const e=i.textContent.substring(1);return M(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}const ee="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(ee);export{pe as a,z as b,l as c,ve as d,ue as e,de as f,ce as g,Q as h,oe as i,le as j,re as k,L as l,ae as m,ne as n,se as o,fe as p,ie as q,K as r,he as s,_e as t};
|