planche 0.8.8 → 0.8.10

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.
Files changed (67) hide show
  1. package/app/assets/{DmnLfXty.js → -hNDclQL.js} +1 -1
  2. package/app/assets/{rcI4Fmt0.js → 1XwwL8xu.js} +1 -1
  3. package/app/assets/3z4eHGF-.js +1 -0
  4. package/app/assets/{Ca4g4XbM.js → B49XtolG.js} +1 -1
  5. package/app/assets/{CoElGuoC.js → B4Yy1mj_.js} +1 -1
  6. package/app/assets/{fDSXGLmI.js → BAZqI8g_.js} +2 -2
  7. package/app/assets/{C5SHWmPn.js → BHsXOlR9.js} +1 -1
  8. package/app/assets/{Dc-epzIX.js → B_zZh5dR.js} +1 -1
  9. package/app/assets/{CRr_nYUE.js → BbdU8Zop.js} +1 -1
  10. package/app/assets/{BwrB7xZ-.js → BeiubXnY.js} +1 -1
  11. package/app/assets/{B_UAjgBr.js → Bg6u9htc.js} +185 -185
  12. package/app/assets/{ZjgMfDAG.js → BjkAHEsD.js} +1 -1
  13. package/app/assets/{XzPc-eVf.js → BkIkgVK5.js} +1 -1
  14. package/app/assets/{9U3RO0MO.js → Bn-kznw7.js} +1 -1
  15. package/app/assets/{RCiVSH3E.js → BoonIczC.js} +1 -1
  16. package/app/assets/{B7ofUN9Z.js → Bp0UhSMs.js} +1 -1
  17. package/app/assets/{CCcRP83D.js → ByHW6Lyi.js} +1 -1
  18. package/app/assets/{DprcmWG4.js → BzhSva5M.js} +1 -1
  19. package/app/assets/{CKOS5Y-e.js → C0O3rJzW.js} +1 -1
  20. package/app/assets/{Baj0YiGk.js → C5VVaHNf.js} +1 -1
  21. package/app/assets/{CKDAL3sp.js → C9rqYcV-.js} +1 -1
  22. package/app/assets/{DouS7NHO.js → CC5k5YaI.js} +1 -1
  23. package/app/assets/{BxdVjvjj.js → CGvlSihl.js} +1 -1
  24. package/app/assets/{Cni8dWDa.js → CPX5LuC-.js} +1 -1
  25. package/app/assets/{Bz1cma8F.js → CUQISMvX.js} +1 -1
  26. package/app/assets/{BfSKVZnY.js → CYMzEa4j.js} +1 -1
  27. package/app/assets/{CZQ1r4zz.js → CaoceGhm.js} +1 -1
  28. package/app/assets/CdUXbAKF.js +1 -0
  29. package/app/assets/{CQLuUHsS.js → Cf8o-5U6.js} +1 -1
  30. package/app/assets/{DxuXBECK.js → Cg4DfVr4.js} +1 -1
  31. package/app/assets/{9YYClKHB.js → ClUjvL-2.js} +1 -1
  32. package/app/assets/{CFzRFS2A.js → CnInyuhK.js} +1 -1
  33. package/app/assets/{C8pwHENI.js → CoI4rONw.js} +1 -1
  34. package/app/assets/{CytzrZ6l.js → CpZOnYKF.js} +1 -1
  35. package/app/assets/{DUi2bIfW.js → CtU21VEz.js} +1 -1
  36. package/app/assets/{40YxirOy.js → D6tNbIL6.js} +1 -1
  37. package/app/assets/{D8QuNkWm.js → DBHRzz66.js} +1 -1
  38. package/app/assets/{B3nhMsGp.js → DC8XCjJ3.js} +1 -1
  39. package/app/assets/{D7TzN7zW.js → DERfOWZ5.js} +1 -1
  40. package/app/assets/{COuEjUso.js → DInfC28p.js} +1 -1
  41. package/app/assets/{8DjNs_2Q.js → DM33HLij.js} +1 -1
  42. package/app/assets/{BBSxV90W.js → DP94Ond0.js} +1 -1
  43. package/app/assets/{CcgrsKRV.js → DSx167Dy.js} +1 -1
  44. package/app/assets/{BjlaUaDI.js → DYuA_YQr.js} +1 -1
  45. package/app/assets/{CtXRSNHU.js → Dd9quIZg.js} +1 -1
  46. package/app/assets/{Cr6Fx4T5.js → Dht5Mpyb.js} +1 -1
  47. package/app/assets/DjDcAaBy.js +8 -0
  48. package/app/assets/{CCQZjXae.js → DnJeTfn9.js} +2 -2
  49. package/app/assets/{DnMHkY8_.js → DqoiWQxk.js} +1 -1
  50. package/app/assets/{BVrYyQUV.js → G6EbcZKg.js} +1 -1
  51. package/app/assets/{COkWw8gt.js → GwHHKhHq.js} +1 -1
  52. package/app/assets/{CYAMmigV.js → Ik6Uk6MY.js} +1 -1
  53. package/app/assets/KuSp3gJs.css +2 -0
  54. package/app/assets/{BteHmqJi.js → Svdye2Hc.js} +1 -1
  55. package/app/assets/{xc6SHidZ.js → aP_gLLGt.js} +1 -1
  56. package/app/assets/{BNkgLUl5.js → dMlgA_r1.js} +1 -1
  57. package/app/assets/{HtYgLQZp.js → lui9VgkF.js} +1 -1
  58. package/app/assets/{KZSCUzXE.js → mIcOy4nG.js} +1 -1
  59. package/app/assets/{AiAiN2FW.js → p4yYbMPY.js} +1 -1
  60. package/app/assets/{zrrdltej.js → ufiABG3J.js} +1 -1
  61. package/app/assets/{BFDfeOJg.js → zspOy9D_.js} +1 -1
  62. package/app/index.html +19 -19
  63. package/package.json +1 -1
  64. package/app/assets/4_c4BD6i.js +0 -1
  65. package/app/assets/CgWXabLX.js +0 -8
  66. package/app/assets/CmJ3siBN.js +0 -1
  67. package/app/assets/MJ9qDdN_.css +0 -2
package/app/index.html CHANGED
@@ -50,30 +50,30 @@
50
50
  "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }
51
51
  }
52
52
  </script>
53
- <script type="module" crossorigin src="/assets/B_UAjgBr.js"></script>
53
+ <script type="module" crossorigin src="/assets/Bg6u9htc.js"></script>
54
54
  <link rel="modulepreload" crossorigin href="/assets/hePW80VL.js">
55
- <link rel="modulepreload" crossorigin href="/assets/XzPc-eVf.js">
56
- <link rel="modulepreload" crossorigin href="/assets/CKOS5Y-e.js">
57
- <link rel="modulepreload" crossorigin href="/assets/fDSXGLmI.js">
58
- <link rel="modulepreload" crossorigin href="/assets/CZQ1r4zz.js">
59
- <link rel="modulepreload" crossorigin href="/assets/CytzrZ6l.js">
60
- <link rel="modulepreload" crossorigin href="/assets/BVrYyQUV.js">
55
+ <link rel="modulepreload" crossorigin href="/assets/BkIkgVK5.js">
56
+ <link rel="modulepreload" crossorigin href="/assets/C0O3rJzW.js">
57
+ <link rel="modulepreload" crossorigin href="/assets/BAZqI8g_.js">
58
+ <link rel="modulepreload" crossorigin href="/assets/CaoceGhm.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/CpZOnYKF.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/G6EbcZKg.js">
61
61
  <link rel="modulepreload" crossorigin href="/assets/eFSiW0Lh.js">
62
- <link rel="modulepreload" crossorigin href="/assets/BBSxV90W.js">
63
- <link rel="modulepreload" crossorigin href="/assets/B3nhMsGp.js">
62
+ <link rel="modulepreload" crossorigin href="/assets/DP94Ond0.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/DC8XCjJ3.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/Bit0Kfog.js">
65
- <link rel="modulepreload" crossorigin href="/assets/Ca4g4XbM.js">
66
- <link rel="modulepreload" crossorigin href="/assets/BNkgLUl5.js">
67
- <link rel="modulepreload" crossorigin href="/assets/CtXRSNHU.js">
68
- <link rel="modulepreload" crossorigin href="/assets/BfSKVZnY.js">
69
- <link rel="modulepreload" crossorigin href="/assets/Cr6Fx4T5.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/B49XtolG.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/dMlgA_r1.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/Dd9quIZg.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/CYMzEa4j.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/Dht5Mpyb.js">
70
70
  <link rel="modulepreload" crossorigin href="/assets/DAFA-E1-.js">
71
- <link rel="modulepreload" crossorigin href="/assets/D8QuNkWm.js">
72
- <link rel="modulepreload" crossorigin href="/assets/CgWXabLX.js">
73
- <link rel="modulepreload" crossorigin href="/assets/CCQZjXae.js">
74
- <link rel="modulepreload" crossorigin href="/assets/4_c4BD6i.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/DBHRzz66.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/DjDcAaBy.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/DnJeTfn9.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/3z4eHGF-.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/Bs5VSn0X.js">
76
- <link rel="stylesheet" crossorigin href="/assets/MJ9qDdN_.css">
76
+ <link rel="stylesheet" crossorigin href="/assets/KuSp3gJs.css">
77
77
  </head>
78
78
  <body>
79
79
  <div id="boot">Loading…</div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planche",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "description": "Local agent for Planche — lets the browser-based Planche SQL client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases and local Durable Object storage from your machine.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://planche.dev",
@@ -1 +0,0 @@
1
- import{c as e}from"./B3nhMsGp.js";import{y as t}from"./Ca4g4XbM.js";function n(n){t(n),e(n)}export{n as t};
@@ -1,8 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/R93pYE1w.js","assets/hePW80VL.js","assets/DeB5sJfy.js","assets/DOeLCbYG.js","assets/5E2RYjEs.js","assets/eRZ39OKr.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./hePW80VL.js";import{i as t}from"./fDSXGLmI.js";import{t as n}from"./B3nhMsGp.js";import{n as r}from"./BNkgLUl5.js";import{S as i,a}from"./CtXRSNHU.js";import{n as o}from"./Cr6Fx4T5.js";import{i as s,r as c}from"./D8QuNkWm.js";var l=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function u(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function d(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function f(e){return e>=`0`&&e<=`9`}function p(e){return e===` `||e===` `||e===`
3
- `||e===`\r`||e===`\f`||e===`\v`}var m=class{input;syntax;pos=0;delimiter;significantInStatement=0;constructor(e,t,n=`;`){this.input=e,this.syntax=t,this.delimiter=n}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.next();t.kind===`terminator`||t.kind===`delimiter_command`?this.significantInStatement=0:t.kind!==`space`&&t.kind!==`comment`&&this.significantInStatement++,e.push(t)}return e}atLineStart(e){let t=e-1;for(;t>=0&&(this.input[t]===` `||this.input[t]===` `);)t--;return t<0||this.input[t]===`
4
- `}make(e,t,n){let r=this.input.slice(t,n),i={kind:e,value:r,start:t,end:n};return e===`identifier`&&(i.upper=r.toUpperCase()),i}next(){let e=this.input,t=this.pos,n=e[t];if(p(n)){let n=t+1;for(;n<e.length&&p(e[n]);)n++;return this.pos=n,this.make(`space`,t,n)}if(e.startsWith(this.delimiter,t))return this.pos=t+this.delimiter.length,this.make(`terminator`,t,this.pos);if(n===`#`&&this.syntax.hashComments)return this.lineComment(t);if(n===`-`&&e[t+1]===`-`){let n=e[t+2];if(!this.syntax.dashCommentNeedsSpace||n===void 0||p(n))return this.lineComment(t)}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return this.pos=n===-1?e.length:n+2,this.make(`comment`,t,this.pos)}if(n===`$`&&this.syntax.dollarQuotes){let n=/^\$([A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF]*)?\$/.exec(e.slice(t,t+64));if(n){let r=e.indexOf(n[0],t+n[0].length);return this.pos=r===-1?e.length:r+n[0].length,this.make(`string`,t,this.pos)}}if((n===`e`||n===`E`)&&e[t+1]===`'`&&this.syntax.dollarQuotes){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,!0);return this.make(`string`,t,e.end)}if(n===`'`)return this.quoted(t,`'`,`string`,this.syntax.backslashEscapes);if(n===`"`)return this.syntax.doubleQuoteIsIdentifier?this.quoted(t,`"`,`quoted_identifier`,!1):this.quoted(t,`"`,`string`,this.syntax.backslashEscapes);if((n===`x`||n===`X`||n===`b`||n===`B`||n===`n`||n===`N`)&&e[t+1]===`'`){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,this.syntax.backslashEscapes);return this.make(`string`,t,e.end)}if(n==="`")return this.quoted(t,"`",`quoted_identifier`,!1);if(n===`[`&&this.syntax.bracketIdentifiers){let n=e.indexOf(`]`,t+1);return this.pos=n===-1?e.length:n+1,this.make(`quoted_identifier`,t,this.pos)}if(f(n)||n===`.`&&f(e[t+1]??``))return this.number(t);if(n===`@`){let n=t+1;if(e[n]===`@`&&n++,e[n]===`'`||e[n]===`"`||e[n]==="`"){let r=e[n];this.pos=n;let i=this.quoted(n,r,`string`,this.syntax.backslashEscapes);return this.make(`variable`,t,i.end)}for(;n<e.length&&(d(e[n])||e[n]===`.`);)n++;return this.pos=n,this.make(`variable`,t,n)}if((n===`:`||n===`$`)&&u(e[t+1]??``)&&e[t+1]!==`$`){let n=t+1;for(;n<e.length&&d(e[n]);)n++;return this.pos=n,this.make(`variable`,t,n)}if(n===`?`){let n=t+1;for(;n<e.length&&f(e[n]);)n++;return this.pos=n,this.make(`placeholder`,t,n)}if(u(n)){let n=t+1;for(;n<e.length&&d(e[n])&&!e.startsWith(this.delimiter,n);)n++;let r=e.slice(t,n).toUpperCase();if(r===`DELIMITER`&&this.syntax.delimiterCommand&&this.significantInStatement===0){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;let i=r;for(;i<e.length&&!p(e[i]);)i++;if(i>r)return this.delimiter=e.slice(r,i),this.pos=i,this.make(`delimiter_command`,t,i)}if(r===`GO`&&this.syntax.goBatchSeparator&&this.atLineStart(t)){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;for(;r<e.length&&f(e[r]);)r++;for(;r<e.length&&(e[r]===` `||e[r]===` `||e[r]===`\r`);)r++;if(r>=e.length||e[r]===`
5
- `)return this.pos=r,this.make(`delimiter_command`,t,r)}return this.pos=n,this.make(`identifier`,t,n)}if(n===`/`&&this.syntax.plsqlBlocks&&this.atLineStart(t)){let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n++;if(n>=e.length||e[n]===`
6
- `)return this.pos=n,this.make(`delimiter_command`,t,n)}if(n===`(`)return this.pos=t+1,this.make(`lparen`,t,this.pos);if(n===`)`)return this.pos=t+1,this.make(`rparen`,t,this.pos);for(let n of l)if(e.startsWith(n,t))return this.pos=t+n.length,this.make(`operator`,t,this.pos);return`=<>!+-*/%^~&|`.includes(n)?(this.pos=t+1,this.make(`operator`,t,this.pos)):`,.;:[]{}`.includes(n)?(this.pos=t+1,this.make(`punct`,t,this.pos)):(this.pos=t+1,this.make(`unknown`,t,this.pos))}lineComment(e){let t=this.input,n=e;for(;n<t.length&&t[n]!==`
7
- `;)n++;return this.pos=n,this.make(`comment`,e,n)}quoted(e,t,n,r){let i=this.input,a=e+1;for(;a<i.length;){let e=i[a];if(r&&e===`\\`){a+=2;continue}if(e===t){if(i[a+1]===t){a+=2;continue}a++;break}a++}return this.pos=Math.min(a,i.length),this.make(n,e,this.pos)}number(e){let t=this.input,n=e;if(t[n]===`0`&&(t[n+1]===`x`||t[n+1]===`X`))for(n+=2;n<t.length&&/[0-9A-Fa-f]/.test(t[n]);)n++;else if(t[n]===`0`&&(t[n+1]===`b`||t[n+1]===`B`)&&(t[n+2]===`0`||t[n+2]===`1`))for(n+=2;n<t.length&&(t[n]===`0`||t[n]===`1`);)n++;else{for(;n<t.length&&f(t[n]);)n++;if(t[n]===`.`)for(n++;n<t.length&&f(t[n]);)n++;if((t[n]===`e`||t[n]===`E`)&&(f(t[n+1]??``)||(t[n+1]===`+`||t[n+1]===`-`)&&f(t[n+2]??``)))for(n+=2;n<t.length&&f(t[n]);)n++}return this.pos=n,this.make(`number`,e,n)}},h=new Set([`BEGIN`,`CASE`,`IF`,`LOOP`,`WHILE`,`REPEAT`]);function g(e){return e.kind!==`space`&&e.kind!==`comment`}function ee(e,t){let n=[],r=[],i=[],a=0,o=!1,s=t=>{for(let n=t+1;n<e.length;n++)if(g(e[n]))return e[n]},c=e=>{r.length!==0&&(n.push({tokens:r,start:r[0].start,end:r[r.length-1].end,terminated:e}),r=[],i=[],a=0,o=!1)};for(let n=0;n<e.length;n++){let l=e[n];if(l.kind===`delimiter_command`){i.length>0?c(!1):r=[];continue}if(l.kind===`terminator`){if(a>0&&l.value===`;`){r.push({...l,kind:`punct`}),i.push(l);continue}r.push(l),c(!0);continue}if(r.push(l),g(l)){if(l.kind===`identifier`){let e=l.upper,r=i.length===0;if(o&&(o=!1,h.has(e))){i.push(l);continue}if(e===`END`)a>0&&a--,o=!0;else if(e===`BEGIN`){let e=s(n),o=i[i.length-1];r?(t.plsqlBlocks||e?.kind===`identifier`&&e.upper===`NOT`)&&a++:!(e=>e!==void 0&&(e.kind===`operator`||e.kind===`rparen`||e.kind===`punct`&&(e.value===`,`||e.value===`.`)||e.kind===`identifier`&&e.upper===`FROM`))(e)&&!(o&&(o.kind===`operator`||o.kind===`punct`&&(o.value===`,`||o.value===`.`)))&&a++}else if(e===`CASE`)a++;else if(a>0&&(e===`IF`||e===`LOOP`||e===`WHILE`||e===`REPEAT`)){let e=s(n);e?.kind!==`lparen`&&(e?.kind!==`identifier`||e.upper!==`EXISTS`&&e.upper!==`NOT`)&&a++}}i.push(l)}}return c(!1),n}var te=new Set([`SELECT`,`VALUES`,`TABLE`,`WITH`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`CHECK`,`CHECKSUM`,`ANALYZE`,`OPTIMIZE`,`REPAIR`,`PRAGMA`]),ne=new Set([`SELECT`,`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`VALUES`,`TABLE`,`MERGE`]),re=new Set([`TABLE`,`DATABASE`,`SCHEMA`,`TABLESPACE`]),ie=new Set([`WHERE`,`SET`,`USING`,`ORDER`,`LIMIT`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`CROSS`,`NATURAL`,`STRAIGHT_JOIN`,`ON`,`PARTITION`,`AS`,`RETURNING`,`INDEXED`,`NOT`]);function _(e){if(e.kind!==`quoted_identifier`)return e.value;let t=e.value[0],n=t===`[`?`]`:t,r=e.value.slice(1,e.value.endsWith(n)?-1:void 0);return t!==`[`&&(r=r.replaceAll(n+n,n)),r}function v(e){return e.kind===`identifier`||e.kind===`quoted_identifier`}function y(e,t,n=ie){let r=[];for(;t<e.length;){let i=e[t];if(!v(i)||i.kind===`identifier`&&n.has(i.upper))break;let a=[_(i)];for(t++;t+1<e.length&&e[t].kind===`punct`&&e[t].value===`.`&&v(e[t+1]);)a.push(_(e[t+1])),t+=2;if(r.push(a.join(`.`)),e[t]?.kind===`punct`&&e[t].value===`,`){t++;continue}break}return{names:r,next:t}}function b(e,t,n=0){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n.kind===`lparen`)r++;else if(n.kind===`rparen`)r=Math.max(0,r-1);else if(r===0&&n.kind===`identifier`&&n.upper===t)return i}return-1}function ae(e){let t=0;for(;t<e.length&&e[t].kind===`lparen`;)t++;if(t>=e.length||e[t].kind!==`identifier`)return{kind:``,index:t};if(e[t].upper!==`WITH`)return{kind:e[t].upper,index:t};let n=0,r=!1;for(let i=t+1;i<e.length;i++){let t=e[i];if(t.kind===`lparen`){n++,r=!1;continue}if(t.kind===`rparen`){n--,r=n===0;continue}if(n===0&&r&&t.kind===`identifier`&&ne.has(t.upper))return{kind:t.upper,index:i};r=!1}return{kind:`WITH`,index:t}}function oe(e,t){let n=b(e,`LIMIT`,t);if(n===-1)return null;let r=e[n+1];if(!r||r.kind!==`number`)return null;let i=e[n+2],a=e[n+3];return i?.kind===`punct`&&i.value===`,`&&a?.kind===`number`?{offset:Number(r.value),count:Number(a.value)}:i?.kind===`identifier`&&i.upper===`OFFSET`&&a?.kind===`number`?{offset:Number(a.value),count:Number(r.value)}:{offset:0,count:Number(r.value)}}function se(e,t,n){let r=t=>e[t]?.kind===`identifier`?e[t].upper:void 0;switch(t){case`DROP`:{let t=n+1;r(t)===`TEMPORARY`&&t++;let i=r(t);if(!i)return null;t++,r(t)===`IF`&&(t+=2);let{names:a}=y(e,t,new Set([`ON`,`RESTRICT`,`CASCADE`]));return{action:`DROP`,objectType:i,names:a,dataLoss:re.has(i)}}case`TRUNCATE`:{let t=n+1;r(t)===`TABLE`&&t++;let{names:i}=y(e,t);return{action:`TRUNCATE`,objectType:`TABLE`,names:i,dataLoss:!0}}case`DELETE`:{if(b(e,`WHERE`,n)!==-1)return null;let t=n+1;for(;r(t)===`LOW_PRIORITY`||r(t)===`QUICK`||r(t)===`IGNORE`;)t++;return{action:`DELETE_ALL`,names:r(t)===`FROM`?y(e,t+1).names:y(e,t,new Set([`FROM`])).names,dataLoss:!0}}case`UPDATE`:{if(b(e,`WHERE`,n)!==-1)return null;let t=n+1;for(;r(t)===`LOW_PRIORITY`||r(t)===`IGNORE`||r(t)===`OR`;)t+=r(t)===`OR`?2:1;let{names:i}=y(e,t);return{action:`UPDATE_ALL`,names:i,dataLoss:!0}}case`ALTER`:{if(r(n+1)!==`TABLE`)return null;let{names:t}=y(e,n+2,new Set([`ADD`,`DROP`,`MODIFY`,`CHANGE`,`RENAME`,`ALTER`])),i=[],a=0;for(let t=n+2;t<e.length;t++){let n=e[t];if(n.kind===`lparen`){a++;continue}if(n.kind===`rparen`){a--;continue}if(a!==0||n.kind!==`identifier`||n.upper!==`DROP`)continue;let r=e[t+1],o=r?.kind===`identifier`?r.upper:``;if(o===`COLUMN`){let n=e[t+2];n&&v(n)&&i.push(_(n))}else o===`PARTITION`?i.push(`PARTITION ${y(e,t+2).names.join(`, `)}`):r&&v(r)&&![`PRIMARY`,`FOREIGN`,`INDEX`,`KEY`,`CONSTRAINT`,`CHECK`,`DEFAULT`,`TABLESPACE`].includes(o)&&i.push(_(r))}return i.length===0?null:{action:`ALTER_DROP`,objectType:`TABLE`,names:t.map(e=>`${e} (${i.join(`, `)})`),dataLoss:!0}}default:return null}}function ce(e,t){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=e.terminated?e.tokens.slice(0,-1):e.tokens,i=r.length?r[r.length-1].end:e.start,a=t.slice(e.start,i).trim(),{kind:o,index:s}=ae(n),c=te.has(o)||b(n,`RETURNING`,s)!==-1,l=c?oe(n,s):null,u=se(n,o,s);return{sql:a,raw:t.slice(e.start,e.end),start:e.start,end:e.end,tokens:e.tokens,kind:o,isEmpty:n.length===0,returnsRows:c,limit:l,destructive:u}}function le(e,t){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=n.findIndex(e=>e.kind!==`lparen`);return b(n,t.toUpperCase(),Math.max(0,r))!==-1}function x(e){return e.start+e.raw.indexOf(e.sql)}function ue(e){let t=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),n=0;for(;n<t.length&&t[n].kind===`lparen`;)n++;let r=t[n];if(!r||r.kind!==`identifier`||r.upper!==`SELECT`)return-1;let i=r,a=t[n+1];return a?.kind===`identifier`&&(a.upper===`DISTINCT`||a.upper===`ALL`)&&(i=a),i.end-x(e)}var S=class{syntax;constructor(e){this.syntax=`syntax`in e?e.syntax:e}tokenize(e,t=`;`){return new m(e,this.syntax,t).tokenize()}parse(e,t=`;`){return ee(this.tokenize(e,t),this.syntax).map(t=>ce(t,e))}statements(e,t=`;`){return this.parse(e,t).filter(e=>!e.isEmpty)}},de=new Set([`ORDER`,`LIMIT`,`RETURNING`,`OUTPUT`,`OPTION`]);function C(e,t,n,r){return n?e.slice(n.start-t,(r?r.start:2**53-1)-t).trim():``}function w(e,t,n){let r=t;for(;r<n&&e[r].kind===`identifier`&&(e[r].upper===`ONLY`||e[r].upper===`LOW_PRIORITY`||e[r].upper===`IGNORE`||e[r].upper===`QUICK`);)r++;if(r>=n||!v(e[r]))return null;let i=_(e[r]),a=e[r].kind===`quoted_identifier`;for(r++;r+1<n&&e[r].kind===`punct`&&e[r].value===`.`&&v(e[r+1]);)i=_(e[r+1]),a=e[r+1].kind===`quoted_identifier`,r+=2;return r<n&&e[r].kind===`identifier`&&e[r].upper===`AS`&&r++,r<n&&v(e[r])&&!(e[r].kind===`identifier`&&[`SET`,`WHERE`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`CROSS`,`USING`,`FROM`,`ON`,`NATURAL`,`STRAIGHT_JOIN`,`WITH`,`OUTPUT`].includes(e[r].upper))?(e[r].kind,e[r].value):a?`"${i.replaceAll(`"`,`""`)}"`:i}function fe(e,t=`"`){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=x(e),i=e.sql,a=e=>(e.startsWith(t)||e.startsWith(`"`)||e.startsWith("`")||e.startsWith(`[`),e),o=n[0];if(!o||o.kind!==`identifier`||o.upper!==`UPDATE`&&o.upper!==`DELETE`)return null;let s=b(n,`WHERE`),c=-1;for(let e of de){let t=b(n,e,s===-1?1:s);t!==-1&&(c===-1||t<c)&&(c=t)}let l=e=>e===-1?n.length:e,u=s===-1?``:` `+C(i,r,n[s],n[l(c)]),d=``;if(c!==-1&&(n[c].upper===`ORDER`||n[c].upper===`LIMIT`)){let e=[`RETURNING`,`OUTPUT`,`OPTION`].map(e=>b(n,e,c)).filter(e=>e!==-1);d=` `+C(i,r,n[c],e.length?n[Math.min(...e)]:void 0)}let f,p,m;if(o.upper===`UPDATE`){let e=b(n,`SET`);if(e===-1)return null;let t=b(n,`FROM`,e),a=e,o=C(i,r,n[1],n[a]);if(!o||n[1].kind===`lparen`)return null;if(p=w(n,1,a),m=o,t!==-1&&(s===-1||t<s)){let e=C(i,r,n[t+1],n[l(s===-1?c:s)]);f=p!==null&&RegExp(`(^|[\\s,])${p.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}(\\s|$|,)`,`i`).test(e)?e:`${o}, ${e}`}else f=o}else{let e=b(n,`FROM`);if(e===-1)return null;let t=b(n,`USING`,e),a=l(t===-1?s===-1?c:s:t),o=C(i,r,n[e+1],n[a]);if(!o||n[e+1]?.kind===`lparen`)return null;let u=C(i,r,n[1],n[e]),d=u?u.split(`,`)[0].trim().replace(/^(LOW_PRIORITY|QUICK|IGNORE)\s+/i,``):``;p=d||w(n,e+1,a),m=d||o;let h=t===-1?``:C(i,r,n[t+1],n[l(s===-1?c:s)]);f=h?`${o}, ${h}`:o}return p?{select:`SELECT ${a(p)}.* FROM ${f}${u}${d}`,count:d?`SELECT COUNT(*) AS affected FROM (SELECT 1 AS one FROM ${f}${u}${d}) planche_preview`:`SELECT COUNT(*) AS affected FROM ${f}${u}`,table:m,limited:/\bLIMIT\b/i.test(d)}:null}var pe={mysql:`mysql`,maria:`mariadb`,postgres:`postgresql`,neon:`postgresql`,supabase:`postgresql`,mssql:`transactsql`,sqlite:`transactsql`,d1:`transactsql`,do:`transactsql`,oracle:null},me={mysql:()=>t(()=>import(`./R93pYE1w.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1,2])),mariadb:()=>t(()=>import(`./DOeLCbYG.js`).then(t=>e(t.default,1)),__vite__mapDeps([3,1,2])),postgresql:()=>t(()=>import(`./5E2RYjEs.js`).then(t=>e(t.default,1)),__vite__mapDeps([4,1,2])),transactsql:()=>t(()=>import(`./eRZ39OKr.js`).then(t=>e(t.default,1)),__vite__mapDeps([5,1,2]))},T=new Map;function he(e){return pe[e]??null}async function ge(e){let t=T.get(e);if(t)return t;let n=new(await(me[e]())).Parser;return T.set(e,n),n}function E(e){return typeof e==`object`&&!!e}function D(e){return E(e)&&e.type===`select`}function _e(e){return E(e)&&D(e.ast)?e.ast:null}function ve(e){let t=e.name;return typeof t==`string`?t:t?.value??`cte`}function ye(e){let t=e.stmt;return E(t)?D(t.ast)?t.ast:D(t)?t:null:null}function be(e){if(!e)return null;let t=e.toUpperCase();return t===`JOIN`?`INNER JOIN`:t}function xe(e){let t=e.db??e.schema??null;return t?`${t}.${e.table}`:String(e.table)}function O(e){if(!E(e))return!1;if(e.type===`star`)return!0;let t=e.column;return!!(t===`*`||E(t)&&E(t.expr)&&t.expr.value===`*`)}function k(e){return O(e)?!E(e)||e.table===null||e.table===void 0:!1}function Se(e){let t=e.columns;return t===`*`?{count:null,expandsSources:!0}:Array.isArray(t)?t.filter(e=>O(e)||O(e.expr)).length===0?{count:t.length,expandsSources:!1}:{count:null,expandsSources:t.length===1&&(k(t[0])||k(t[0].expr))}:{count:null,expandsSources:!1}}function A(e,t){if(Array.isArray(e)){for(let n of e)A(n,t);return}if(!E(e))return;let n=_e(e);if(n){t.push(n);return}for(let[n,r]of Object.entries(e))n!==`loc`&&A(r,t)}var Ce=class{nodes=[];edges=[];groups=[];warnings=[];seq=0;nextId(e){return this.seq+=1,`${e}${this.seq}`}addGroup(e,t,n){let r={id:this.nextId(`g`),kind:e,label:t,parentId:n};return this.groups.push(r),r.id}addNode(e){let t={id:this.nextId(`n`),...e};return this.nodes.push(t),t}addEdge(e,t,n,r){this.edges.push({id:this.nextId(`e`),from:e,to:t,kind:n,label:r})}visitQuery(e,t,n,r,i,a){let o=[];for(let t=e;t;t=t._next)o.push(t);if(o.length===1)return this.visitSelect(e,t,n,r,i,a);let s=this.addGroup(`query`,r,t),c=(e.set_op??`union`).toUpperCase(),l=new Map(n);this.declareCtes(e,s,l);let u=o.map((e,t)=>this.visitSelect(e,s,new Map(l),`${c} (${t+1})`,`result`,`result`,t===0)),d=this.addNode({kind:i===`result`?`setop`:i,label:i===`result`?c:a,alias:null,qualifier:null,columnCount:u[0]?.columnCount??null,expandsSources:!1,groupId:s,range:null});for(let e of u)this.addEdge(e.id,d.id,`setop`,c);return d}declareCtes(e,t,n){if(Array.isArray(e.with))for(let r of e.with){let e=ve(r),i=ye(r);if(!i){this.warnings.push(`CTE ${e}: body not understood`);continue}let a=this.visitQuery(i,t,new Map(n),`WITH ${e}`,`cte`,e);n.set(e.toLowerCase(),a)}}visitSelect(e,t,n,r,i,a,o=!1){let s=this.addGroup(`query`,r,t),c=new Map(n);o||this.declareCtes(e,s,c);let l=[];if(Array.isArray(e.from)&&e.from.length>0){let t=this.addGroup(`from`,`FROM`,s);e.from.forEach((e,n)=>{let r=be(e.join),i=n===0&&!r?`from`:`join`,a=e.expr?.ast;if(a){let n=e.as??`subquery`,o=this.visitQuery(a,t,new Map(c),`FROM ${n}`,`derived`,n);l.push({node:o,kind:i,label:r});return}if(!e.table){this.warnings.push(`FROM entry not understood (function call or table expression)`);return}let o=c.get(e.table.toLowerCase()),s=this.addNode({kind:o?`cte-ref`:`table`,label:xe(e),alias:e.as??null,qualifier:e.db??e.schema??null,columnCount:o?o.columnCount:null,expandsSources:!1,groupId:t,range:null});o&&this.addEdge(o.id,s.id,`cte`,null),l.push({node:s,kind:i,label:r})})}let u=[];for(let[t,n]of[[`SELECT`,e.columns],[`WHERE`,e.where],[`GROUP BY`,e.groupby],[`HAVING`,e.having],[`ORDER BY`,e.orderby]]){let e=[];A(n,e),e.forEach((n,r)=>{let i=e.length>1?`${t} (${r+1})`:t;u.push(this.visitQuery(n,s,new Map(c),i,`scalar`,`subquery`))})}let{count:d,expandsSources:f}=Se(e),p=this.addNode({kind:i,label:a,alias:null,qualifier:null,columnCount:d,expandsSources:f,groupId:s,range:null});for(let e of l)this.addEdge(e.node.id,p.id,e.kind,e.label);for(let e of u)this.addEdge(e.id,p.id,`scalar`,null);return p}};function we(e){let t=Array.isArray(e)?e[0]:e;if(!D(t))return null;let n=new Ce;return n.visitQuery(t,null,new Map,`query`,`result`,`result`),Array.isArray(e)&&e.length>1&&n.warnings.push(`only the first of ${e.length} statements is drawn`),{nodes:n.nodes,edges:n.edges,groups:n.groups,warnings:n.warnings}}var j=new Set([`WHERE`,`GROUP`,`HAVING`,`ORDER`,`CONNECT`,`START`,`MODEL`,`FETCH`,`OFFSET`,`FOR`,`UNION`,`INTERSECT`,`MINUS`,`EXCEPT`,`WITH`]),Te=new Set([`UNION`,`INTERSECT`,`MINUS`,`EXCEPT`]),M=new Set([...j,`ON`,`USING`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`FULL`,`CROSS`,`NATURAL`,`OUTER`,`AND`,`OR`,`NOT`,`AS`,`PARTITION`,`PIVOT`,`UNPIVOT`,`SAMPLE`]),N=new Set([`INNER`,`LEFT`,`RIGHT`,`FULL`,`CROSS`,`NATURAL`,`OUTER`]);function P(e){return e?.kind===`identifier`?e.upper??e.value.toUpperCase():``}function F(e){return e!==void 0&&(e.kind===`identifier`||e.kind===`quoted_identifier`)}function I(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r].kind===`lparen`)n++;else if(e[r].kind===`rparen`&&--n===0)return r+1;return e.length}function L(e,t,n){let r=[];for(let i=t;i<n;i++){if(e[i].kind!==`lparen`)continue;let t=P(e[i+1]),a=Math.min(I(e,i),n);(t===`SELECT`||t===`WITH`)&&(r.push(B(e,i+1,a-1)),i=a-1)}return r}function R(e,t,n,r){let i=[],a=0;for(let o=t;o<n;o++)e[o].kind===`lparen`?a++:e[o].kind===`rparen`?a--:a===0&&r(e[o])&&i.push(o);return i}function z(e,t,n,r){let i=0;for(let a=t;a<n;a++)if(e[a].kind===`lparen`)i++;else if(e[a].kind===`rparen`)i--;else if(i===0&&r(e[a]))return a;return n}function Ee(e,t){let n=[_(e[t])],r=t+1;for(;e[r]?.kind===`punct`&&e[r].value===`.`&&F(e[r+1]);)n.push(_(e[r+1])),r+=2;return{parts:n,next:r}}function De(e,t,n,r){let i=t;if(e[i]?.kind===`lparen`&&(P(e[i+1])===`SELECT`||P(e[i+1])===`WITH`)){let t=I(e,i),n=B(e,i+1,t-1),a=null,o=t;return P(e[o])===`AS`&&o++,F(e[o])&&!M.has(P(e[o]))&&(a=_(e[o])),{db:null,table:null,as:a,expr:{ast:n},...r?{join:r}:{}}}if(!F(e[i]))return null;let{parts:a,next:o}=Ee(e,i);if(i=o,e[i]?.kind===`lparen`)return null;let s=null;P(e[i])===`AS`&&i++,i<n&&F(e[i])&&!M.has(P(e[i]))&&(s=_(e[i]));let c=a[a.length-1];return{db:a.length>1?a.slice(0,-1).join(`.`):null,table:c,as:s,...r?{join:r}:{}}}function Oe(e,t,n){let r=[],i=e=>e.kind===`punct`&&e.value===`,`,a=e=>P(e)===`JOIN`||N.has(P(e)),o=R(e,t,n,e=>i(e)||a(e)),s=[{at:t,join:null}];for(let t=0;t<o.length;t++){let r=o[t];if(i(e[r])){s.push({at:r+1,join:null});continue}let a=[],c=r;for(;c<n&&(N.has(P(e[c]))||P(e[c])===`JOIN`);){if(a.push(P(e[c])),P(e[c])===`JOIN`){c++;break}c++}for(;t+1<o.length&&o[t+1]<c;)t++;s.push({at:c,join:a.join(` `)||`JOIN`})}for(let t=0;t<s.length;t++){let i=s[t],a=t+1<s.length?s[t+1].at:n,o=De(e,i.at,a,i.join);o&&r.push(o)}return r}function B(e,t,n){let r={type:`select`,with:null,columns:`*`,from:[],where:[]},i=t;if(P(e[i])===`WITH`)for(i++,P(e[i])===`RECURSIVE`&&i++,r.with=[];i<n&&F(e[i]);){let t=_(e[i]);if(i++,e[i]?.kind===`lparen`&&P(e[i+1])!==`SELECT`&&(i=I(e,i)),P(e[i])!==`AS`||(i++,(P(e[i])===`MATERIALIZED`||P(e[i])===`NOT`&&P(e[i+1])===`MATERIALIZED`)&&(i+=P(e[i])===`NOT`?2:1),e[i]?.kind!==`lparen`))break;let n=I(e,i);if(r.with.push({name:{value:t},stmt:{ast:B(e,i+1,n-1)}}),i=n,e[i]?.kind===`punct`&&e[i].value===`,`){i++;continue}break}if(P(e[i])!==`SELECT`)return r;i++,[`DISTINCT`,`ALL`,`UNIQUE`].includes(P(e[i]))&&i++;let a=z(e,i,n,e=>P(e)===`FROM`),o=R(e,i,a,e=>e.kind===`punct`&&e.value===`,`),s=[],c=i;for(let e of o)s.push([c,e]),c=e+1;s.push([c,a]);let l=e=>e.kind===`operator`&&e.value===`*`,u=s.filter(([t,n])=>z(e,t,n,l)<n);if(r.columns=s.length===1&&u.length===1&&s[0][1]-s[0][0]===1?`*`:u.length>0?[{expr:{type:`star`}},...s.slice(1).map(()=>({}))]:s.map(([t,n])=>{let r=L(e,t,n);return r.length>0?{expr:{ast:r[0]}}:{}}),a>=n)return r;let d=z(e,a+1,n,e=>j.has(P(e)));r.from=Oe(e,a+1,d);let f=z(e,d,n,e=>Te.has(P(e)));if(r.where=L(e,d,f).map(e=>({ast:e})),f<n){let t=P(e[f]),i=P(e[f+1])===`ALL`;r.set_op=`${t.toLowerCase()}${i?` all`:``}`,r._next=B(e,f+(i?2:1),n)}return r}function ke(e,t){let n=new S(t).tokenize(e).filter(e=>e.kind!==`space`&&e.kind!==`comment`&&e.kind!==`terminator`);if(n.length===0)return null;let r=P(n[0]);return r!==`SELECT`&&r!==`WITH`?null:B(n,0,n.length)}var Ae=new Set(`ON.USING.WHERE.GROUP.ORDER.HAVING.LIMIT.OFFSET.FETCH.WINDOW.JOIN.INNER.LEFT.RIGHT.FULL.CROSS.NATURAL.OUTER.STRAIGHT_JOIN.APPLY.UNION.INTERSECT.EXCEPT.MINUS.SELECT.FROM.WITH.AND.OR.NOT.SET.VALUES.WHEN.THEN.ELSE.END.FOR.INTO.START.CONNECT.PIVOT.AS.BY.DISTINCT.ALL.ANY.CASE.IS.NULL.IN.EXISTS.BETWEEN.LIKE.ASC.DESC.RECURSIVE.TOP.PERCENT.TIES.ROW.ROWS.ONLY.NEXT.FIRST.PARTITION.OVER.LATERAL.RETURNING.OUTPUT.PRIOR.MATERIALIZED.FILTER.INSERT.UPDATE.DELETE.CREATE.TABLE.VIEW.EXPLAIN.PRAGMA.MERGE`.split(`.`));function V(e){return e?.kind===`identifier`&&Ae.has(e.upper??e.value.toUpperCase())}function H(e){return e!==void 0&&(e.kind===`identifier`||e.kind===`quoted_identifier`)}function je(e){let t=e.filter(e=>e.kind!==`space`&&e.kind!==`comment`),n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!H(r)||V(r))continue;let i=[_(r)],a=r;for(;H(t[e+2])&&t[e+1]?.kind===`punct`&&t[e+1].value===`.`;)a=t[e+2],i.push(_(a)),e+=2;let o=null,s=t[e+1];s?.kind===`identifier`&&s.upper===`AS`?(s=t[e+2],H(s)&&!V(s)&&(o=_(s),e+=2)):H(s)&&!V(s)&&(o=_(s),e+=1),n.push({name:i.join(`.`),alias:o,start:r.start,end:a.end,used:!1})}return n}function Me(e){switch(e.kind){case`table`:case`cte-ref`:case`cte`:case`derived`:return e.label;default:return null}}function Ne(e,t,n){let r=je(new S(n).tokenize(t)),i=e.nodes.map(e=>{let t=Me(e);if(!t)return e;let n=t.toLowerCase(),i=e.alias?.toLowerCase()??null,a=r.find(e=>!e.used&&e.name.toLowerCase()===n&&(!i||e.alias?.toLowerCase()===i))??r.find(e=>!e.used&&e.alias?.toLowerCase()===n);return a?(a.used=!0,{...e,range:[a.start,a.end]}):e});return{...e,nodes:i}}function U(e){return e.label.toLowerCase()}function W(e){let t=new Map;for(let n of e.nodes){if(n.kind!==`table`)continue;let e=U(n);if(t.has(e))continue;let r=n.label.split(`.`);t.set(e,{key:e,qualifier:r.length>1?r.slice(0,-1).join(`.`):null,table:r[r.length-1]})}return[...t.values()]}function Pe(e,t){let n=new Map,r=e.nodes.map(e=>{let r=e.kind===`table`&&e.columnCount===null&&t.has(U(e))?{...e,columnCount:t.get(U(e))??null}:{...e};return n.set(r.id,r),r}),i=new Set([`from`,`join`,`cte`,`setop`]);for(let t=0;t<r.length;t++){let t=!1;for(let a of r){if(a.columnCount!==null)continue;let r=e.edges.filter(e=>e.to===a.id&&i.has(e.kind)).map(e=>n.get(e.from)).filter(e=>e!==void 0),o=r.filter(e=>e.columnCount!==null);r.length!==0&&o.length===r.length&&(a.expandsSources?(a.columnCount=o.reduce((e,t)=>e+(t.columnCount??0),0),t=!0):r.length===1&&(a.columnCount=o[0].columnCount,t=!0))}if(!t)break}return{...e,nodes:r}}async function G(e,t){let n=he(t.id),r;if(n)try{r=(await ge(n)).astify(e,{database:n})}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message.split(`
8
- `)[0]:String(e)}}else if(t.id===`oracle`)r=ke(e,t.syntax);else return{ok:!1,reason:`unsupported-engine`,message:`No SQL grammar for ${t.label}`};let i=we(r);return i?{ok:!0,graph:Ne(i,e,t.syntax)}:{ok:!1,reason:`not-a-query`,message:`Only SELECT statements have a structure graph`}}var Fe=8,Ie=3,Le=[{kind:`column`,re:/unknown column '([^']+)'/i},{kind:`table`,re:/(?:unknown table|table) '([^']+)'(?: doesn't exist)?/i},{kind:`column`,re:/column "([^"]+)" does not exist/i},{kind:`table`,re:/relation "([^"]+)" does not exist/i},{kind:`column`,re:/no such column:\s*(\S+)/i},{kind:`table`,re:/no such table:\s*(\S+)/i},{kind:`column`,re:/invalid column name '([^']+)'/i},{kind:`table`,re:/invalid object name '([^']+)'/i},{kind:`column`,re:/ORA-00904:\s*"?([^":]+)"?:\s*invalid identifier/i}];function K(e){for(let{kind:t,re:n}of Le){let r=n.exec(e);if(!r)continue;let i=r[1].trim().replace(/[`"'[\]]/g,``),a=i.split(`.`).pop()??i;if(a)return{kind:t,name:a}}return null}function q(e){return e.toLowerCase().replace(/[_\s-]/g,``)}function Re(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1,c=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s);a.push(c),c<o&&(o=c)}if(o>n)return n+1;r=a}return r[t.length]}function ze(e){return e.length<=4?1:e.length<=8?2:3}function J(e,t,n=Ie){let r=q(e);if(!r)return[];let i=ze(r),a=[];for(let n of t){let t=q(n);if(!t||t===r){t===r&&n!==e&&a.push({name:n,d:0,prefix:!0});continue}let o=Re(r,t,i);o>i||a.push({name:n,d:o,prefix:t.startsWith(r)||r.startsWith(t)})}a.sort((e,t)=>e.d-t.d||Number(t.prefix)-Number(e.prefix)||e.name.localeCompare(t.name));let o=a.filter(e=>e.d===0);return(o.length>0?o:a).slice(0,n).map(e=>e.name)}function Be(e){return e.filter(e=>e.kind!==`space`&&e.kind!==`comment`)}function Y(e,t){let n=[],r;try{r=Be(new S(t).tokenize(e))}catch{return n}let i=t.quoteIdentifier(`x`).startsWith("`");for(let e=0;e<r.length;e++){let a=r[e];if(a.kind===`quoted_identifier`&&a.value.startsWith("`")&&!i){let e=a.value.slice(1,-1);n.push({code:`syntaxSwap`,params:{engine:t.label,found:a.value,expected:t.quoteIdentifier(e)}});break}}for(let e=1;e<r.length;e++){let i=r[e];if(i.kind===`quoted_identifier`&&i.value.startsWith(`"`)&&t.syntax.doubleQuoteIsIdentifier){let a=r[e-1];if(a.kind===`operator`&&/^(=|<>|!=|<|>|<=|>=)$/.test(a.value)){n.push({code:`doubleQuotedLiteral`,params:{engine:t.label,value:i.value.slice(1,-1)}});break}}}let a=t.syntax.limitStyle;for(let e=0;e<r.length;e++){let i=r[e];if(i.kind!==`identifier`)continue;let o=r[e+1],s=o?.kind===`number`?o.value:`n`;if(i.upper===`LIMIT`&&a!==`limit`&&o?.kind===`number`){n.push({code:`syntaxSwap`,params:{engine:t.label,found:`LIMIT ${s}`,expected:a===`top`?`SELECT TOP ${s}`:`FETCH FIRST ${s} ROWS ONLY`}});break}if(i.upper===`TOP`&&a!==`top`&&o?.kind===`number`&&r[e-1]?.upper===`SELECT`){n.push({code:`syntaxSwap`,params:{engine:t.label,found:`TOP ${s}`,expected:a===`limit`?`LIMIT ${s}`:`FETCH FIRST ${s} ROWS ONLY`}});break}}return n}function Ve(e){let{message:t,sql:n,engine:r,columns:i,tables:a}=e,o=[],s=K(t);if(s?.kind===`column`){let e=i.size>1,t=[],n=new Map;for(let[e,r]of i)for(let i of r)t.push(i),n.has(i)||n.set(i,e);let r=J(s.name,[...new Set(t)]);r.length>0&&o.push({code:`unknownColumn`,params:{name:s.name,suggestions:r.map(t=>e?`${n.get(t)}.${t}`:t).join(`, `)}})}if(s?.kind===`table`){let e=J(s.name,a);e.length>0&&o.push({code:`unknownTable`,params:{name:s.name,suggestions:e.join(`, `)}})}return[...o,...Y(n,r)]}var X=new Map,Z=new Map;function Q(e){let t=i.getState(),n=t.trees[e];return n?s(n,t.selectedNodeId[e])??c(n)[0]??null:null}function He(e,t){let r=o(e),i=n.getState().activeConnections.find(t=>t.id===e),a=r.capabilities.schemas?null:i?.database;return t||a||Q(e)}async function $(e,t){let i=r.getState().tabs[e]?.find(e=>e.id===t);if(!i?.error||!i.errorSql)return null;let s=o(e),c={engine:s,sql:i.errorSql,message:i.error,tables:new Map},l=n.getState().activeConnections.find(t=>t.id===e),u=s.capabilities.schemas?null:l?.database,d=i.database||u||Q(e);if(!l?.serverConnectionId||!d)return c;let f=a(l.serverConnectionId),p=await G(c.sql,s).catch(()=>null),m=p?.ok?W(p.graph).slice(0,Fe):[];return await Promise.all(m.map(async({qualifier:e,table:t})=>{let n=e??d,r=`${l.serverConnectionId}|${n}|${t}`,i=X.get(r);if(i){c.tables.set(t,i);return}try{let e=await s.introspect.listColumns(f,n,t);e.length>0&&(X.set(r,e),c.tables.set(t,e))}catch{}})),c}async function Ue(e,t){let i=r.getState().tabs[e]?.find(e=>e.id===t);if(!i?.error)return[];let s=i.errorSql??``,c=o(e),l=K(i.error);if(!s)return[];if(!l)return Y(s,c);let u=n.getState().activeConnections.find(t=>t.id===e),d=c.capabilities.schemas?null:u?.database,f=i.database||d||Q(e),p=new Map,m=[];if(u?.serverConnectionId&&f){let n=a(u.serverConnectionId);if(l.kind===`column`){let n=await $(e,t);for(let[e,t]of n?.tables??[])p.set(e,t.map(e=>e.name))}if(l.kind===`table`){let e=`${u.serverConnectionId}|${f}`,t=Z.get(e);if(t)m=t;else try{m=(await c.introspect.listTables(n,f)).map(e=>e.name);let t=await c.introspect.listViews(n,f).catch(()=>[]);m=[...m,...t],Z.set(e,m)}catch{}}}return Ve({message:i.error,sql:s,engine:c,columns:p,tables:m})}function We(e,t){let r=n.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;if(!r)return;let i=t?`${r}|${t}|`:`${r}|`;for(let e of[...X.keys()])e.startsWith(i)&&X.delete(e);if(t){Z.delete(`${r}|${t}`);return}for(let e of[...Z.keys()])e.startsWith(`${r}|`)&&Z.delete(e)}export{G as a,S as c,le as d,x as f,$ as i,fe as l,He as n,Pe as o,ue as p,Ue as r,W as s,We as t,_ as u};
@@ -1 +0,0 @@
1
- import{a as e}from"./CKOS5Y-e.js";var t=e(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]);export{t};