@openartifactsai/cli 0.23.0 → 0.24.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.
Files changed (128) hide show
  1. package/SKILL.md +7 -2
  2. package/package.json +1 -1
  3. package/vendor/CHANGELOG.md +1082 -0
  4. package/vendor/artifact-types/page/SKILL.md +3 -1
  5. package/vendor/artifact-types/page/artifact-type/reference/capabilities.d.ts +0 -1
  6. package/vendor/artifact-types/page/artifact-type/reference/capabilities.md +1 -1
  7. package/vendor/frame-host/client/comments.js +20 -19
  8. package/vendor/frame-host/client/page.js +1352 -0
  9. package/vendor/frame-host/client/review.js +279 -0
  10. package/vendor/frame-host/client/runtime.js +8 -6
  11. package/vendor/frame-host/client/sample.js +1 -1
  12. package/vendor/frame-host/client/shell.css +1 -0
  13. package/vendor/frame-host/client/shell.js +206 -6
  14. package/vendor/frame-host/client/translate.js +375 -0
  15. package/vendor/frame-host/frame-host.mjs +91 -30
  16. package/vendor/home/assets/{browser-models-DWkPVHmp.js → browser-models-Ceon9UIN.js} +4 -4
  17. package/vendor/home/assets/library-RBaguEV9.js +397 -0
  18. package/vendor/home/assets/main-BKHYngAm.js +2 -0
  19. package/vendor/home/assets/main-Cw3mY0u9.css +1 -0
  20. package/vendor/home/assets/node.browser-BFrmG6rb.js +1 -0
  21. package/vendor/home/assets/node.browser-CPQVYRMD.js +1 -0
  22. package/vendor/home/assets/react-DQymU5Da.js +47 -0
  23. package/vendor/home/index.html +3 -3
  24. package/vendor/home/library/index.html +2 -2
  25. package/vendor/open-artifacts.mjs +2516 -1072
  26. package/vendor/runtime.json +1 -1
  27. package/vendor/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  28. package/vendor/shell/assets/index-BhxD6amu.js +53 -0
  29. package/vendor/shell/assets/index-Cw3mY0u9.css +1 -0
  30. package/vendor/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  31. package/vendor/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  32. package/vendor/shell/index.html +2 -2
  33. package/vendor/type-server/cli.mjs +87 -26
  34. package/vendor/type-server/editors/data/assets/{index-CX_sn7ZZ.js → index-B0E35R1E.js} +5 -4
  35. package/vendor/type-server/editors/data/index.html +1 -1
  36. package/vendor/type-server/editors/design/assets/{index-BpNUmTVD.js → index-BOc3kd6N.js} +78 -77
  37. package/vendor/type-server/editors/design/index.html +1 -1
  38. package/vendor/type-server/editors/design-system/assets/{index-CP6AEO1P.js → index-B7MtPrtk.js} +5 -4
  39. package/vendor/type-server/editors/design-system/index.html +1 -1
  40. package/vendor/type-server/editors/docs/assets/{abnfDiagram-WEYOIA3C-Do25i7oS.js → abnfDiagram-WEYOIA3C-DcfGbMC9.js} +1 -1
  41. package/vendor/type-server/editors/docs/assets/{architectureDiagram-ZHVYKT53-BLlpboc2.js → architectureDiagram-ZHVYKT53-CfcGFZjM.js} +1 -1
  42. package/vendor/type-server/editors/docs/assets/{blockDiagram-RJAE7QA3-D0rO5p7M.js → blockDiagram-RJAE7QA3-C5s3aXD2.js} +1 -1
  43. package/vendor/type-server/editors/docs/assets/{c4Diagram-XDPPPE54-OoTiysJI.js → c4Diagram-XDPPPE54-BJgchX97.js} +1 -1
  44. package/vendor/type-server/editors/docs/assets/channel-B2TtMfsN.js +1 -0
  45. package/vendor/type-server/editors/docs/assets/{chunk-2E7WHVMD-yBl5BEaI.js → chunk-2E7WHVMD-BgQ4xapY.js} +1 -1
  46. package/vendor/type-server/editors/docs/assets/{chunk-2Q5K7J3B-DHKM5gd6.js → chunk-2Q5K7J3B-B1ktgQTo.js} +1 -1
  47. package/vendor/type-server/editors/docs/assets/{chunk-4EMNKR2T-B-f8WPM6.js → chunk-4EMNKR2T-Co-2oGfa.js} +1 -1
  48. package/vendor/type-server/editors/docs/assets/{chunk-55XCU76K-n8RDJr36.js → chunk-55XCU76K-BqpDaZgl.js} +1 -1
  49. package/vendor/type-server/editors/docs/assets/{chunk-5VM5RSS4-DzLzcqXE.js → chunk-5VM5RSS4-BJPvauTV.js} +1 -1
  50. package/vendor/type-server/editors/docs/assets/{chunk-JWPE2WC7-BLXkUVcK.js → chunk-JWPE2WC7-NCBAl-SW.js} +1 -1
  51. package/vendor/type-server/editors/docs/assets/{chunk-VQ5W62QI-DAGNVD29.js → chunk-VQ5W62QI-DPzloG3R.js} +1 -1
  52. package/vendor/type-server/editors/docs/assets/{chunk-XXDRQBXY-fgVyAbWV.js → chunk-XXDRQBXY-D08KAfXl.js} +1 -1
  53. package/vendor/type-server/editors/docs/assets/{chunk-ZCHMQSOR-D90xHR9n.js → chunk-ZCHMQSOR-CLWESu07.js} +2 -2
  54. package/vendor/type-server/editors/docs/assets/{classDiagram-v2-4MYWR3UA-uk1mPogR.js → classDiagram-v2-4MYWR3UA-BSPsabsn.js} +1 -1
  55. package/vendor/type-server/editors/docs/assets/{core-BMv5rGOd.js → core-Cqu2ilBr.js} +1 -1
  56. package/vendor/type-server/editors/docs/assets/{cose-bilkent-JH36ORCC-BJdqW8l3.js → cose-bilkent-JH36ORCC-D6at9M78.js} +1 -1
  57. package/vendor/type-server/editors/docs/assets/{cynefin-EF2NZ3EQ-BCce_ZhK.js → cynefin-EF2NZ3EQ-BTylb97F.js} +1 -1
  58. package/vendor/type-server/editors/docs/assets/{cynefinDiagram-WF24UDRP-DxD-4yjR.js → cynefinDiagram-WF24UDRP-Din3pKvL.js} +1 -1
  59. package/vendor/type-server/editors/docs/assets/{dagre-NK4GIZVX-B3VAS51Y.js → dagre-NK4GIZVX-5qfRwQnt.js} +1 -1
  60. package/vendor/type-server/editors/docs/assets/{diagram-CBK3MWTC-B0kHeUdr.js → diagram-CBK3MWTC-BnrAjIhJ.js} +1 -1
  61. package/vendor/type-server/editors/docs/assets/{diagram-I5XIIV2D-BCRvsLAu.js → diagram-I5XIIV2D-CH_xkoKv.js} +1 -1
  62. package/vendor/type-server/editors/docs/assets/{diagram-ODIL2UCW-DFOTsSuA.js → diagram-ODIL2UCW-D5dns2KC.js} +1 -1
  63. package/vendor/type-server/editors/docs/assets/{diagram-PFBEJUXE-_DT3jk0i.js → diagram-PFBEJUXE-D-3cnWXB.js} +1 -1
  64. package/vendor/type-server/editors/docs/assets/{diagram-RJA3I4VV-UFrdnTgs.js → diagram-RJA3I4VV-DImejfKM.js} +1 -1
  65. package/vendor/type-server/editors/docs/assets/{diagram-TYUNFSNR-DrbWyZOX.js → diagram-TYUNFSNR-DscxSG0M.js} +1 -1
  66. package/vendor/type-server/editors/docs/assets/{ebnfDiagram-V4P3TTPT-M-DCWgZM.js → ebnfDiagram-V4P3TTPT-C4wwb0NC.js} +1 -1
  67. package/vendor/type-server/editors/docs/assets/{elk-QONTBCTQ-l6XmbRQj.js → elk-QONTBCTQ-O05tgWzI.js} +1 -1
  68. package/vendor/type-server/editors/docs/assets/{erDiagram-KYQIGQAA-CHqbnmEE.js → erDiagram-KYQIGQAA-D171V8gY.js} +1 -1
  69. package/vendor/type-server/editors/docs/assets/{flowDiagram-IUGLLWBU-BzkFyGCL.js → flowDiagram-IUGLLWBU-DcvtJsgJ.js} +1 -1
  70. package/vendor/type-server/editors/docs/assets/{ganttDiagram-R7GPNTJY-BcNaSXNv.js → ganttDiagram-R7GPNTJY-DcuQ9a5m.js} +1 -1
  71. package/vendor/type-server/editors/docs/assets/{gitGraphDiagram-PDYL7XHY-JaNdSZbv.js → gitGraphDiagram-PDYL7XHY-iQoh6Yen.js} +1 -1
  72. package/vendor/type-server/editors/docs/assets/{index-BMNUnwXE.js → index-BNk_Jpgl.js} +49 -48
  73. package/vendor/type-server/editors/docs/assets/{infoDiagram-MVDRKAX5-Cl2Q_Ylf.js → infoDiagram-MVDRKAX5-DECkmgI6.js} +1 -1
  74. package/vendor/type-server/editors/docs/assets/{ishikawaDiagram-HPEHV2GE-umirqIpN.js → ishikawaDiagram-HPEHV2GE-CK0mATvD.js} +1 -1
  75. package/vendor/type-server/editors/docs/assets/{journeyDiagram-BOSHW7O7-HMtvkXvq.js → journeyDiagram-BOSHW7O7-Dz1u7rfA.js} +1 -1
  76. package/vendor/type-server/editors/docs/assets/{kanban-definition-FNSA4HC5-CYouTBUM.js → kanban-definition-FNSA4HC5-B1-0Mp0R.js} +1 -1
  77. package/vendor/type-server/editors/docs/assets/{mermaid.core-BEcbgpI8.js → mermaid.core-DhXbeevr.js} +4 -4
  78. package/vendor/type-server/editors/docs/assets/{mindmap-definition-6OY57UG3-BnwugHtV.js → mindmap-definition-6OY57UG3-Czy5C8sa.js} +1 -1
  79. package/vendor/type-server/editors/docs/assets/{pegDiagram-ECIUJNBX-DqT6jxo7.js → pegDiagram-ECIUJNBX-C97juwaO.js} +1 -1
  80. package/vendor/type-server/editors/docs/assets/{pieDiagram-GNMPY74T-CBKjnr1W.js → pieDiagram-GNMPY74T-rrh7flvh.js} +1 -1
  81. package/vendor/type-server/editors/docs/assets/{quadrantDiagram-D57K4MC3-CdTG11Ff.js → quadrantDiagram-D57K4MC3-D3xBy1ZX.js} +1 -1
  82. package/vendor/type-server/editors/docs/assets/{railroadDiagram-Y72NRBL7-BZgG8r2y.js → railroadDiagram-Y72NRBL7-B3r2jnFu.js} +1 -1
  83. package/vendor/type-server/editors/docs/assets/{requirementDiagram-EQYSW5RA-CutdnAmY.js → requirementDiagram-EQYSW5RA-BQ47C1Ra.js} +1 -1
  84. package/vendor/type-server/editors/docs/assets/{sankeyDiagram-SY24JHO5-DBaoPDhR.js → sankeyDiagram-SY24JHO5-CzPG7mjJ.js} +1 -1
  85. package/vendor/type-server/editors/docs/assets/{sequenceDiagram-BLEHNHQU-B6YZp-Wu.js → sequenceDiagram-BLEHNHQU-Bg7XKU4E.js} +1 -1
  86. package/vendor/type-server/editors/docs/assets/{sizeCapture-INFHLROL-xATlK6Zl.js → sizeCapture-INFHLROL-CKrHufer.js} +1 -1
  87. package/vendor/type-server/editors/docs/assets/{stateDiagram-v2-A6IESKWZ-C7BND5vv.js → stateDiagram-v2-A6IESKWZ-CW9zsuBs.js} +1 -1
  88. package/vendor/type-server/editors/docs/assets/{swimlanes-B3ENRKFQ-WYLzM6hb.js → swimlanes-B3ENRKFQ-ucM-4idg.js} +1 -1
  89. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-DuNOy5jj.js +8 -0
  90. package/vendor/type-server/editors/docs/assets/{timeline-definition-JXYKGLGB-BXC0F4xE.js → timeline-definition-JXYKGLGB-D__Vd4zC.js} +1 -1
  91. package/vendor/type-server/editors/docs/assets/{usecaseDiagram-WPOLBNNX-Cx58jkEj.js → usecaseDiagram-WPOLBNNX-MvJGETnL.js} +1 -1
  92. package/vendor/type-server/editors/docs/assets/{vennDiagram-Q3Y3IDCW-DhdwpApW.js → vennDiagram-Q3Y3IDCW-DqUtQLGR.js} +1 -1
  93. package/vendor/type-server/editors/docs/assets/{wardleyDiagram-IVAIDKWA-CBdbPWVr.js → wardleyDiagram-IVAIDKWA-usWt7-Hk.js} +1 -1
  94. package/vendor/type-server/editors/docs/assets/{xychartDiagram-4URNHDU4-Cb0tcPqs.js → xychartDiagram-4URNHDU4-D2RJz2yB.js} +1 -1
  95. package/vendor/type-server/editors/docs/index.html +1 -1
  96. package/vendor/type-server/editors/motion/assets/{gif-jobs-Bq4rwLBV.js → gif-jobs-Bn-j8izW.js} +1 -1
  97. package/vendor/type-server/editors/motion/assets/{index-BDOqtmcc.js → index-C6NXgLix.js} +7 -6
  98. package/vendor/type-server/editors/motion/assets/{src-8SKXU1IY.js → src-C0eDPv3h.js} +1 -1
  99. package/vendor/type-server/editors/motion/index.html +1 -1
  100. package/vendor/type-server/editors/sheets/assets/{index-BY38EAff.js → index-BzbNSKJF.js} +7 -6
  101. package/vendor/type-server/editors/sheets/assets/{workbook-worker-CRtLrZhP.js → workbook-worker-3zEBX9ep.js} +3 -2
  102. package/vendor/type-server/editors/sheets/index.html +1 -1
  103. package/vendor/type-server/editors/slides/assets/{index-B51oMclO.js → index-BfTA-zoQ.js} +7 -6
  104. package/vendor/type-server/editors/slides/assets/{src-CdsEFSuC.js → src-DPkvzCL6.js} +1 -1
  105. package/vendor/type-server/editors/slides/index.html +1 -1
  106. package/vendor/type-server/editors/whiteboard/assets/{drawing-look-worker-Dd2iYbXC.js → drawing-look-worker-CYqIJdVf.js} +4 -3
  107. package/vendor/type-server/editors/whiteboard/assets/{gif-jobs-DmIqT6gk.js → gif-jobs-CPyG3MAt.js} +1 -1
  108. package/vendor/type-server/editors/whiteboard/assets/{index-B3oRKavi.js → index-BBgN0Gcr.js} +2 -2
  109. package/vendor/type-server/editors/whiteboard/assets/{index-CTf9pd4S.js → index-BKFgBbwk.js} +8 -7
  110. package/vendor/type-server/editors/whiteboard/index.html +1 -1
  111. package/vendor/type-server/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  112. package/vendor/type-server/shell/assets/index-BhxD6amu.js +53 -0
  113. package/vendor/type-server/shell/assets/index-Cw3mY0u9.css +1 -0
  114. package/vendor/type-server/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  115. package/vendor/type-server/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  116. package/vendor/type-server/shell/index.html +2 -2
  117. package/vendor/home/assets/RuntimeUpdate-BwvJ9sYp.js +0 -43
  118. package/vendor/home/assets/library-CyeaNaQo.js +0 -226
  119. package/vendor/home/assets/main-DUyobyFI.js +0 -5
  120. package/vendor/home/assets/main-DXpv3z2x.css +0 -1
  121. package/vendor/home/assets/node.browser-Cy4GM7Yl.js +0 -1
  122. package/vendor/home/assets/node.browser-nUfHL25Z.js +0 -1
  123. package/vendor/shell/assets/index-BIHLxOO6.js +0 -52
  124. package/vendor/shell/assets/index-DXpv3z2x.css +0 -1
  125. package/vendor/type-server/editors/docs/assets/channel-Cgat34ii.js +0 -1
  126. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-Bwh1tnzE.js +0 -8
  127. package/vendor/type-server/shell/assets/index-BIHLxOO6.js +0 -52
  128. package/vendor/type-server/shell/assets/index-DXpv3z2x.css +0 -1
@@ -1,8 +1,8 @@
1
1
  function Ov(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(s){if(s!=="default"&&!(s in e)){var a=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:function(){return n[s]}})}})}),Object.freeze(e)}function oi(e,t,n){let[s,a]=[0,e.length];for(;s<a;){let r=Math.floor((s+a)/2),i=e[r];i!==void 0&&t(i)<=n?s=r+1:a=r}return s}function xv(e,t){let[n,s]=[0,e.length];for(;n<s;){let a=Math.floor((n+s)/2);(e[a]??t)<t?n=a+1:s=a}return n}function um(e){let t=e.lastIndexOf("."),n=e.slice(t+1);return t===-1||!Rv.test(n)?null:{base:e.slice(0,t),first:Number(n),count:1}}function Vn(e){let t=[],n=new Map,s=0;for(let r of e){let i={...r,startIndex:s};t.push(i);let o=n.get(r.base);o===void 0?n.set(r.base,[i]):o.push(i),s+=r.count}for(let r of n.values())r.sort((i,o)=>i.first-o.first);let a=({base:r,first:i,count:o})=>{let l=n.get(r)??[],u=[];for(let c=Math.max(0,oi(l,d=>d.first,i)-1);c<l.length;c+=1){let d=l[c];if(d===void 0||d.first>=i+o)break;let f=Math.max(i,d.first),m=Math.min(i+o,d.first+d.count)-f;m>0&&u.push({firstIndex:d.startIndex+f-d.first,count:m})}return u};return{count:s,idAt(r){if(!Number.isInteger(r)||r<0||r>=s)return null;let i=Ja(t,({startIndex:o})=>o,r);return i===void 0?null:`${i.base}.${i.first+r-i.startIndex}`},indexOf(r){let i=um(r);return i===null?null:a(i)[0]?.firstIndex??null},stretchesOf:a,runsIn({firstIndex:r,count:i}){let o=[];for(let l=Math.max(0,oi(t,u=>u.startIndex,r)-1);l<t.length;l+=1){let u=t[l];if(u===void 0||u.startIndex>=r+i)break;let c=Math.max(r,u.startIndex),d=Math.min(r+i,u.startIndex+u.count)-c;d>0&&o.push({base:u.base,first:u.first+c-u.startIndex,count:d})}return o}}}function Ev(e){let t=Vn(e),n=new Map;return{...t,indexOf(s){let a=n.get(s);if(a!==void 0)return a;let r=t.indexOf(s);return n.set(s,r),r}}}function xu(e,t,n=Vn){let s=e?.runsIn({firstIndex:0,count:e.count}),a=s?.length===t.length&&s.every((r,i)=>{let o=t[i];return o?.base===r.base&&o.first===r.first&&o.count===r.count});return e!==void 0&&a?e:n(t)}function ys(e,t,n){let s=[];for(let a of t[e==="seen"?"stored":"seen"].runsIn(n))for(let r of t[e].stretchesOf(a)){let i=s.at(-1);i!==void 0&&St(i)+1===r.firstIndex?s[s.length-1]={...i,count:i.count+r.count}:s.push(r)}return s}function Es(e){let t=[...e];t.sort((s,a)=>s.firstIndex-a.firstIndex);let n=[];for(let s of t){let a=n.at(-1);a!==void 0&&s.firstIndex<=St(a)+1?n[n.length-1]={...a,count:Math.max(St(a),St(s))-a.firstIndex+1}:n.push(s)}return n}function Tr(e,t,n){if(t===null||!Or(t,n))return[n];if(n.count===1)return ys(e,t,n);let s=Eu.get(t)??new Map;Eu.set(t,s);let a=`${e} ${n.firstIndex} ${n.count}`,r=s.get(a)??Es(ys(e,t,n));return s.size>=Mv&&!s.has(a)&&s.clear(),s.set(a,r),r}function Cr(e,t,n){let[s,...a]=Tr(e,t,n);return a.length>0?null:s??n}function Yt(e,t,n){let s=Tr(e,t,n),[a,r]=[s[0],s.at(-1)];return a===void 0||r===void 0?n:{firstIndex:a.firstIndex,count:St(r)-a.firstIndex+1}}function Sv(e,t,n){let s=t.flatMap(c=>e.stretchesOf(c)),a=Es(s),[r,i]=[a[0],a.at(-1)];if(r===void 0||i===void 0)return null;let o=new Map;for(let[c,d]of a.entries()){let f=a[c+1];if(f===void 0)break;let m=St(d)+1,g=e.runsIn({firstIndex:m,count:f.firstIndex-m});if(g.some(b=>n.stretchesOf(b).length>0))return"givenUp";o.set(St(d),g)}let l=St(i)+1,u=Vn([...e.runsIn({firstIndex:0,count:r.firstIndex}),...s.flatMap(c=>e.runsIn(c).concat(o.get(St(c))??[])),...e.runsIn({firstIndex:l,count:e.count-l})]);return{stored:e,seen:u,firstIndex:r.firstIndex,count:l-r.firstIndex}}const Ja=(e,t,n)=>e[Math.max(0,oi(e,t,n)-1)],Rv=/^(?:0|[1-9]\d*)$/,St=({firstIndex:e,count:t})=>e+t-1,Or=(e,t)=>t.firstIndex<=St(e)&&St(t)>=e.firstIndex&&(t.firstIndex>e.firstIndex||St(t)<St(e)),Mv=16,Eu=new WeakMap,Nv=(e,t,n)=>Yt(e,t,{firstIndex:n,count:1}).firstIndex;function ii(e){let t="";for(let n=e+1;n>0;n=Math.floor((n-1)/Su))t=String.fromCharCode(Lv+(n-1)%Su)+t;return t}function Hv(e,t){let n=Cr("stored",t,cm(e));return n===null?{first:`${Ru(e.topRowIndex,t)}`,last:`${Ru(e.topRowIndex+e.rowCount-1,t)}`}:{first:`${n.firstIndex+1}`,last:`${n.firstIndex+n.count}`}}function _v(e){let[t,n]=[Hv(e,null),Pv(e)],s=`${n.first}${t.first}`,a=`${n.last}${t.last}`;return s===a?s:`${s}:${a}`}function Bv(e,t){let n=Cr("stored",t,cm(e));return n===null?null:_v(Vv(e,n))}function Pn(e,t){let n=/^\$?([a-z]{1,3})\$?(\d*)(?::\$?([a-z]{1,3})\$?(\d*))?$/i.exec(e.trim());if(n===null)return null;let[,s="",a="",r=s,i=a]=n;if(a===""!=(i==="")||a===""&&n[3]===void 0)return null;let o=[Mu(s),Mu(r)],l=a===""?[0,t.rowCount-1]:[Number(a)-1,Number(i)-1],[u,c]=[Math.min(...o),Math.max(...o)],[d,f]=[Math.min(...l),Math.max(...l)];return d<0||f>=t.rowCount||c>=t.columnCount?null:{topRowIndex:d,leftColumnIndex:u,rowCount:f-d+1,columnCount:c-u+1}}function Ji(e){let[t,n]=[1/0,-1/0];for(let s of e)s<t&&(t=s),s>n&&(n=s);return{firstIndex:t,count:n-t+1}}const Lv=65,Su=26,Ru=(e,t)=>Nv("stored",t,e)+1,cm=({topRowIndex:e,rowCount:t})=>({firstIndex:e,count:t}),Vv=(e,{firstIndex:t,count:n})=>({...e,topRowIndex:t,rowCount:n}),Pv=({leftColumnIndex:e,columnCount:t})=>({first:ii(e),last:ii(e+t-1)}),Mu=e=>Array.from(e.toUpperCase()).reduce((t,n)=>t*26+n.charCodeAt(0)-64,0)-1,Dv=(e,t)=>t===null?void 0:e[t];function ln(e,[t,n]){let[s,a]=[e.indexOf(t),e.indexOf(n)];return s===null||a===null?null:Ji([s,a])}function Kt(e,t,n,s){let a=ln(t[Er(e)],n);return a===null?n:Dn(t[e],ws(s(e,t,a)))}function xr(e,t,n){let s=new Map,a=[];for(let r of n){let i=ln(t[Er(e)],[r.topLeft.r,r.bottomRight.r]);if(i===null){a.push(r);continue}let o=`${r.topLeft.c} ${r.bottomRight.c}`,l=s.get(o)??{like:r,rows:[]};s.set(o,{...l,rows:l.rows.concat(Tr(e,t,i))})}return[...s.values()].flatMap(({like:r,rows:i})=>Es(i).map(o=>Zs(r,Dn(t[e],o)))).concat(a)}function Nu(e,t){let n=xr("stored",e,t);return $t(n.length>t.length),Yn(n)}function Va(e,{sheetId:t,oneCorner:n,otherCorner:s},a=Cr){let[r,i]=Kt("stored",e,[n.r,s.r],a);return{sheetId:t,oneCorner:{...n,r},otherCorner:{...s,r:i}}}function dm(e,t,n){let s=[n.firstRowOfBody,n.lastRowOfBody],[a,r]=Kt(e,t,s,Yt),i=n.runs.flatMap(o=>{let l=ln(t[Er(e)],[o.firstRow,o.lastRow]);return l===null?[o]:Tr(e,t,l).map(u=>{let[c,d]=Dn(t[e],u);return{role:o.role,firstRow:c,lastRow:d}})});return{...n,firstRowOfBody:a,lastRowOfBody:r,runs:i}}function fm(e,{headerRows:t,footerRows:n}){for(let s of[t,n]){let a=s===null?null:ln(e.seen,[s.firstRow,s.lastRow]);$t(a!==null&&bn(e,a))}}function Fv(e,t){let n=er(e,t);$t(n!==null&&bn(e,n)&&ys("stored",e,n).length>1)}function Gv(e,t,n){let s=ws(e.seen.indexOf(t)),[a]=ys("stored",e,{firstIndex:s,count:e.seen.count-s}),r=ws(a),i=n?.flatMap(o=>e.stored.stretchesOf(o))??[r];return Yn(i.flatMap(o=>{let l=Math.max(o.firstIndex,r.firstIndex),u=Math.min(o.firstIndex+o.count,r.firstIndex+r.count);return e.stored.runsIn({firstIndex:l,count:Math.max(0,u-l)})}))}function mm(e){return e.kind==="setBorders"?e.cells.sheetId:e.kind==="fillCells"?e.linesToFill.kind==="rows"?e.source.sheetId:null:"selected"in e?e.selected.sheetId:null}function jv(e,t){let n=tl(t),s=(a,r)=>n(a,e,i=>(r(i),e));switch(e.kind){case"moveCells":return s(e.cells.sheetId,a=>Fv(a,e.cells.rows)),n(e.toSheetId,e,a=>({...e,mayLandIn:Gv(a,e.toTopLeft.r,e.mayLandIn)}));case"pasteValuesOfCells":return $t(t(e.cells.sheetId)!==null||t(e.toSheetId)!==null),e;case"importTableIntoSheet":return s(e.table.sheetId,()=>$t(e.table.how.kind!=="addRows"));case"mergeCells":return s(e.cells.sheetId,a=>{let r=er(a,e.cells.rows);$t(r!==null&&r.count>1&&bn(a,r))});case"hideRows":return s(e.sheetId,a=>{let r=er(a,e.rows);$t(r!==null&&bn(a,r))});case"insertRows":return n(e.sheetId,e,a=>{let r=e.afterRow===null?0:(a.seen.indexOf(e.afterRow)??0)+1;if(r>a.firstIndex&&r<a.firstIndex+a.count)return e;let i=o=>o==null?null:el("stored",a,o);return{...e,afterRow:_u(a,e.afterRow),formatsFromRow:i(e.formatsFromRow),groupsFromRow:i(e.groupsFromRow),formulasFromRow:i(e.formulasFromRow)}});case"moveRows":return n(e.sheetId,e,a=>{let[r,i]=Kt("stored",a,[e.oneRow,e.otherRow],lo),o=e.afterRow===null?0:(a.seen.indexOf(e.afterRow)??0)+1;return $t(o>a.firstIndex&&o<a.firstIndex+a.count),{...e,oneRow:r,otherRow:i,afterRow:_u(a,e.afterRow)}});case"sortRows":case"groupRows":case"ungroupRows":return n(e.sheetId,e,a=>{let[r,i]=Kt("stored",a,[e.oneRow,e.otherRow],lo);return{...e,oneRow:r,otherRow:i}});case"sortCells":case"moveColumnsOfCells":return n(e.cells.sheetId,e,a=>({...e,cells:Va(a,e.cells,lo)}));case"addConditionalFormats":return n(e.sheetId,e,a=>({...e,rules:Yn(e.rules.map(r=>({...r,ranges:Nu(a,r.ranges)})))}));case"changeConditionalFormat":{let{ranges:a}=e;return a===void 0?e:n(e.sheetId,e,r=>({...e,ranges:Nu(r,a)}))}case"addPlacedView":{let a=e.inputs.map(r=>n(r.range.sheetId,r,i=>{let{topLeft:o,bottomRight:l}=r.range,u=Kt("stored",i,[o.r,l.r],Cr);return{name:r.name,range:{...r.range,...Zs(r.range,u)}}}));return n(e.sheetId,{...e,inputs:a},r=>({...e,inputs:a,topLeft:li("stored",r,e.topLeft)}))}case"movePlacedView":case"resizePlacedView":case"copyPlacedView":return n("toSheetId"in e?e.toSheetId:e.sheetId,e,a=>({...e,topLeft:li("stored",a,e.topLeft)}));case"declareCellTable":case"changeCellTable":return s(e.sheetId,a=>fm(a,e.cellTable));case"setSheetSettings":{let{lastFrozenRow:a}=e.settings;return a==null?e:s(e.sheetId,r=>{let i=r.seen.indexOf(a)??-1;$t(bn(r,{firstIndex:i,count:1}))})}case"pasteRowsOfTexts":case"pasteCopiedCells":case"pasteValuesOfCopiedCells":case"pasteCellsOfAnotherProgram":case"fillCells":case"setBorders":case"enter":case"addUserToCell":case"removeUserFromCell":case"setListLineChecked":case"enterInCells":case"enterTextWithLooksInCells":case"pasteTexts":case"clearCells":case"unmergeCells":case"formatCells":case"setDefaultValuesAndLimits":case"resetCellsToDefaultValues":case"resetSheetsToDefaultValues":case"setColumnWidths":case"fitColumns":case"setRowHeights":case"insertColumns":case"moveColumns":case"deleteRows":case"deleteColumns":case"groupColumns":case"ungroupColumns":case"setRowGroupsCollapsed":case"setColumnGroupsCollapsed":case"showRowGroupsToDepth":case"showColumnGroupsToDepth":case"hideColumns":case"moveConditionalFormat":case"removeConditionalFormat":case"deletePlacedView":case"replaceWidgetNodeOfPlacedView":case"removeCellTable":case"insertPivotTable":case"changePivotTable":case"saveNamedView":case"removeNamedView":case"setDefaultNamedView":case"saveProtection":case"removeProtection":case"saveNamedRange":case"removeNamedRange":case"addConnectedTable":case"setCallOfConnectedTable":case"addColumnToConnectedTable":case"changeColumnOfConnectedTable":case"addFormulaColumnToConnectedTable":case"setFormulaOfColumnOfConnectedTable":case"addSheet":case"importTableAsNewSheet":case"duplicateSheet":case"deleteSheet":case"moveSheet":case"renameSheet":case"writeFromInteractive":case"resetInteractive":case"saveDefaultsOfInteractive":case"setTimeZone":case"setLocale":case"makeDropdown":case"addDropdownOption":case"setDropdownOptions":return e;default:throw new ra}}function Wv(e,t){let{sheetId:n,oneCorner:s,otherCorner:a}=t.cells,r=ln(e.seen,[s.r,a.r]);if(r===null||ys("stored",e,r).length===1)return t;let i=(t.rowsOutOfView??[]).flatMap(c=>e.seen.stretchesOf(c)),o=r.firstIndex+r.count,l=[],u=r.firstIndex;for(let{firstIndex:c,count:d}of[...Es(i),{firstIndex:o,count:0}]){let f=Math.min(c,o);if(f>u)for(let m of e.seen.runsIn({firstIndex:u,count:f-u}))l.push(m);u=Math.max(u,c+d)}return{kind:"readCellsToCopyInTheOrderOfTheirRows",cells:{sheetId:n,rows:Yn(l),oneColumn:s.c,otherColumn:a.c}}}function Uv(e,t){let n=tl(t);switch(e.kind){case"queueEdit":{let s=l=>({...l,edit:jv(l.edit,t)}),{editsBefore:a,editsThatGoAlong:r}=e,i=[...a??[],e,...r??[]].flatMap(({edit:l})=>{let u=mm(l),c=u===null?null:t(u);return u===null||c===null?[]:[{sheetId:u,order:c}]}),[o]=i;return $t(i.some(({sheetId:l})=>l!==o?.sheetId)),{...s(e),...o!==void 0&&{ownRowOrder:{sheetId:o.sheetId,rows:Yn(o.order.seen.runsIn(o.order))}},...a!==void 0&&{editsBefore:a.map(s)},...r!==void 0&&{editsThatGoAlong:r.map(s)}}}case"readCellsToCopy":return n(e.cells.sheetId,e,s=>Wv(s,e));case"readConditionalFormatSuggestions":case"readCellsThatADropdownWouldClear":return n(e.cells.sheetId,e,s=>({...e,cells:Va(s,e.cells)}));case"readConditionalFormatsAsAgentIsTold":return n(e.cells.sheetId,e,s=>({...e,cells:Va(s,e.cells,Yt)}));case"readDropdownOptionsToOffer":return n(e.sheetId,e,s=>({...e,...Va(s,e,Yt)}));case"readRowsInSortedOrder":return n(e.sheetId,e,s=>{let[a,r]=Kt("stored",s,[e.oneRow,e.otherRow],Yt);return{...e,oneRow:a,otherRow:r}});case"readFilteredRows":case"readValuesOfFilteredColumn":return n(e.table.sheetId,e,s=>({...e,table:dm("stored",s,e.table)}));case"readCellTableDeclaredAs":return n(e.sheetId,e,s=>(fm(s,e.cellTable),e));case"readFormatsGiven":{let{asIf:s}=e;return s===void 0?e:n(e.sheetId,e,a=>({...e,asIf:s.map(r=>fs("stored",a,r))}))}case"readConditionalFormatsByAddress":return n(e.sheetId,e,s=>({...e,rules:e.rules.map(a=>fs("stored",s,a))}));case"readTablesOfSheet":return e;case"queueNextUndo":case"queueNextRedo":case"queueReversalInASitting":case"queueEditsThatTakeBack":case"receiveStreamedEdit":case"receiveSendOutcome":case"receiveServerRevision":case"linesOfLoad":case"receiveLinesOfLoad":case"receiveLinesOfTableFile":case"tableFileIsGone":case"readSnapshotsNotHeld":case"readConnectedTable":case"answerBeforeCalculating":case"calculate":case"receiveClockReading":case"receivePerson":case"readWorkbook":case"readCells":case"readWorkbookWithCellsPacked":case"readRowsWithCellsPacked":case"readCauseOfError":case"readSheetLayout":case"readXlsxFile":case"readTimeZone":case"readViews":case"readNamedRanges":case"readInputsOfView":case"readTableAtCell":case"readCellTables":case"readCellTableAt":case"readPivotTableAt":case"readValuesToFilterPivotTableBy":case"readConditionalFormatsInIds":case"readProposedFormulaValue":case"readWhatATableChanges":case"readCellsOfTheDropdownAt":case"readTypedFormula":case"readTextToEdit":case"readDefaultValueAndLimits":case"readCellsChangedFromTheirDefaults":case"readCellsToCopyInTheOrderOfTheirRows":return e;default:throw new ra}}function zv(e,t){let[n,s]=Kt("seen",e,[t.ends.first,t.ends.last],Yt);return{...t,ends:{first:n,last:s}}}function Hu(e,t){if(t===null)return e;if(t==="givenUp")return{...e,ownRowOrder:t};let{seen:n,firstIndex:s,count:a}=t,{rowHeights:r,conditionalFormats:i,placements:o,rowGroups:l}=e;return{...e,rows:[...n.runsIn({firstIndex:0,count:n.count})],ownRowOrder:{firstIndex:s,count:a,asStored:{rows:e.rows,...r!==void 0&&{rowHeights:r},...i!==void 0&&{conditionalFormats:i},...o!==void 0&&{placements:o},...l!==void 0&&{rowGroups:l}}},...r!==void 0&&{rowHeights:r.flatMap(({rows:u,heightInPixels:c})=>n.stretchesOf(u).flatMap(d=>n.runsIn(d)).map(d=>({rows:d,heightInPixels:c})))},...i!==void 0&&{conditionalFormats:i.map(u=>Kv(t,u))},...o!==void 0&&{placements:o.map(u=>Xv(t,u))},...l!==void 0&&{rowGroups:l.map(u=>zv(t,u))}}}function $v(e,t){let{mergedRanges:n=[],rowGroups:s=[],lastFrozenRow:a}=t,r=a===void 0?null:e.stored.indexOf(a);return(r===null||!bn(e,{firstIndex:r,count:1}))&&n.every(({liveTopLeft:i,liveBottomRight:o})=>{let l=ln(e.stored,[i.r,o.r]);return l===null||l.count===1||!bn(e,l)})&&s.every(({ends:i})=>{let o=ln(e.stored,[i.first,i.last]);return o===null||o.count===1||!Or(e,o)})}function qv(e,t){let n=ln(e.stored,[t.top.r,t.bottom.r]);if(n===null)return[t];let s=Or(e,n)?ys("seen",e,n):null,a=/^[A-Z]+/.exec(t.range)?.[0]??"";return(s??[n]).map(r=>{let[i,o]=Dn(e.seen,r),l=(e.stored.indexOf(i)??0)+1,u=r.count===1?"":`:${a}${l+r.count-1}`;return{range:s===null?t.range:`${a}${l}${u}`,top:{...t.top,r:i},bottom:{...t.bottom,r:o}}})}function io(e,t,n){let s=tl(n),a=(l,u)=>{let c=l?.cells??null;return l===null||c===null?l:s(l.sheetId,l,d=>{if(u!==void 0&&mm(u)!==null)return(d.seen.indexOf(c.topLeft.r)??0)>(d.seen.indexOf(c.bottomRight.r)??1/0)?{...l,cells:Zs(c,[c.bottomRight.r,c.topLeft.r])}:l;let f=u===void 0?null:Zv(u),m=Es(f?.rows.flatMap(h=>d.stored.stretchesOf(h))??[]),[g,b]=[m[0],m.at(-1)],I=g!==void 0&&b!==void 0&&Dn(d.stored,g)[0]===c.topLeft.r&&Dn(d.stored,b)[1]===c.bottomRight.r?er(d,f?.rows??[]):null;return{...l,cells:I===null?Ss(d,c):Zs(c,Dn(d.seen,I))}})},r=l=>({...l,...l.editsOfOthers!==void 0&&{editsOfOthers:l.editsOfOthers.map(u=>({...u,placeChanged:a(u.placeChanged)}))}});if(t.kind==="syncState")return r(t);if(t.kind==="editQueued"){let l=e.kind==="queueEdit"?e:null,u=a(t.placeChanged,l?.edit),{placesChangedBefore:c,editsThatWentAlong:d}=t,f=l?.editsBefore?.filter(({isPointedAt:g})=>g)??[],m=f.length===c?.length?f:[];return{...t,placeChanged:u,...c!==void 0&&{placesChangedBefore:c.map((g,b)=>a(g,m[b]?.edit)??g)},...d!==void 0&&{editsThatWentAlong:d.map((g,b)=>g.kind==="made"?{kind:"made",placeChanged:a(g.placeChanged,l?.editsThatGoAlong?.[b]?.edit)}:g)},syncState:r(t.syncState)}}let i="cells"in e&&"sheetId"in e.cells?e.cells:"table"in e?e.table:e,o="sheetId"in i?n(i.sheetId):null;if(o===null)return t;switch(t.kind){case"formatsGiven":return{...t,colorScales:t.colorScales.map(({ranges:l,stops:u})=>({ranges:xr("seen",o,l),stops:u}))};case"table":return{...t,read:Qi("seen",o,t.read)};case"cellTableAt":return{...t,cellTable:t.cellTable===null?null:Qa("seen",o,t.cellTable)};case"cellTables":return{...t,cellTables:t.cellTables.map(l=>Qa("seen",o,l))};case"filteredRows":{let l=[t.firstRowOfBody,t.lastRowOfBody],[u,c]=Kt("seen",o,l,Yt),d=t.cellsBesideTheTableOutOfView.map(f=>Ss(o,f));return{...t,firstRowOfBody:u,lastRowOfBody:c,cellsBesideTheTableOutOfView:d}}case"conditionalFormatSuggestions":return{...t,about:Ss(o,t.about),ruleToStartFrom:fs("seen",o,t.ruleToStartFrom),suggestions:t.suggestions.map(({rules:l,matches:u})=>({rules:Yn(l.map(c=>fs("seen",o,c))),matches:u})),table:{...t.table,cells:Ss(o,t.table.cells),records:Ss(o,t.table.records)}};case"conditionalFormatsInIds":{let{read:l}=t;return l.kind!=="rules"?t:{...t,read:{...l,rules:l.rules.map(u=>fs("seen",o,u))}}}case"cellsOfDropdown":{let l=t.stretches.map(m=>qv(o,m)),u=l.flat(),c="cell"in e?o.seen.indexOf(e.cell.r):null,d=Dv(l,t.indexOfTheStretchWithTheCell)?.find(({top:m,bottom:g})=>{let b=ln(o.seen,[m.r,g.r]);return b!==null&&c!==null&&bn(b,{firstIndex:c,count:1})}),f=Math.max(0,d===void 0?0:u.indexOf(d));return{...t,stretches:u,indexOfTheStretchWithTheCell:f}}case"nothingToChange":case"toBeShownFirst":case"editBeforeRefused":case"nothingToReverse":case"stepGivenUp":case"workbookContents":case"cellsContents":case"workbookContentsWithCellsPacked":case"rowsWithCellsPacked":case"sheetLayout":case"xlsxFile":case"views":case"namedRanges":case"inputsOfView":case"snapshotsNotHeld":case"connectedTable":case"tablesOfSheet":case"pivotTableAt":case"conditionalFormatsByAddress":case"conditionalFormatsAsAgentIsTold":case"valuesOfFilteredColumn":case"rowsInSortedOrder":case"typedFormula":case"causeOfError":case"proposedFormulaValue":case"textToEdit":case"defaultValueAndLimits":case"cellsChangedFromTheirDefaults":case"cellsToCopy":case"dropdownOptionsToOffer":case"cellsThatADropdownWouldClear":case"sharedCellFormat":case"whatATableChanges":case"timeZone":case"refused":return t}}function Yv(e){let t=new Map,n=new Map,s=u=>{let c=t.get(u.sheetId);if(c===void 0)return null;let d=n.get(u.sheetId);if(d!==void 0)return d;let f=Sv(Vn(u.rows),c.rows,c.storedThen),m=f===null||f==="givenUp"||$v(f,u);return n.set(u.sheetId,m?f:"givenUp"),m?f:"givenUp"},a=u=>{let c=e.answer({kind:"readSheetLayout",sheetId:u});return c.kind==="sheetLayout"?c:null},r=u=>{if(!t.has(u))return null;let c=n.has(u)?null:a(u),d=c===null?n.get(u):s(c);return d===void 0||d==="givenUp"?null:d},i=u=>{let{changes:c}=u;if(c.kind==="nothing")return u;if(c.kind!=="inSheets")return n.clear(),u;let d=c.sheets.map(f=>!f.isLayoutChanged||!t.has(f.sheetId)?f:(n.delete(f.sheetId),Object.assign({},f,{areFormatsGivenChanged:!0})));return{...u,changes:{...c,sheets:d}}},o=(u,c)=>{if(u.kind!=="insertRows"||u.afterRow===null||c===null)return;let d=a(u.sheetId),f=c.firstIndex+c.count,m=(c.seen.indexOf(u.afterRow)??f)+1;if(d===null||m>=f||c.stored.indexOf(u.afterRow)!==f-1)return;let g=[...c.seen.runsIn({firstIndex:c.firstIndex,count:m-c.firstIndex}),...Vn(d.rows).runsIn({firstIndex:f,count:u.count}),...c.seen.runsIn({firstIndex:m,count:f-m})];t.set(u.sheetId,{rows:g,storedThen:c.stored})},l=u=>(n.clear(),{...u,sheets:u.sheets.map(c=>Hu(c,s(c)))});return{seeRowsInOwnOrder(u,c){n.delete(u);let d=c===null?null:a(u);c===null||d===null?t.delete(u):t.set(u,{rows:c,storedThen:Vn(d.rows)})},answer(u){if(t.size===0)return e.answer(u);let c;try{c=Uv(u,r)}catch(g){if(!(g instanceof ra))throw g;return{kind:"refused",refusal:"rowNotNamedInTheWay"}}let d=u.kind==="queueEdit"?u.edit:null,f=d?.kind==="insertRows"?r(d.sheetId):null,m=e.answer(c);if(m.kind==="workbookContents"||m.kind==="workbookContentsWithCellsPacked")return l(m);if(m.kind==="sheetLayout")return Hu(m,s(m));if(m.kind==="syncState")return io(u,i(m),r);if(m.kind==="editQueued"){d!==null&&o(d,f);let g=i(m.syncState);return io(u,{...m,syncState:g},r)}return io(u,m,r)}}}const ra=class extends Error{},ws=e=>{if(e==null)throw new ra;return e},$t=e=>{if(e)throw new ra},Yn=([e,...t])=>[ws(e),...t],Er=e=>e==="seen"?"stored":"seen",Dn=(e,{firstIndex:t,count:n})=>[ws(e.idAt(t)),ws(e.idAt(t+n-1))],lo=(e,t,n)=>Or(t,n)?null:n,Zs=({topLeft:e,bottomRight:t},[n,s])=>({topLeft:{...e,r:n},bottomRight:{...t,r:s}}),Ss=(e,t)=>Zs(t,Kt("seen",e,[t.topLeft.r,t.bottomRight.r],Yt)),fs=(e,t,n)=>({...n,ranges:Yn(xr(e,t,n.ranges))}),Qi=(e,t,n)=>n===null?null:{...n,table:dm(e,t,n.table)},Qa=(e,t,n)=>({...n,table:Qi(e,t,n.table)}),bn=(e,t)=>e.firstIndex<t.firstIndex+t.count&&t.firstIndex<e.firstIndex+e.count,el=(e,t,n)=>t[e].idAt(t[Er(e)].indexOf(n)??-1)??n,li=(e,t,n)=>({...n,r:el(e,t,n.r)}),_u=(e,t)=>t!==null&&e.seen.indexOf(t)===e.firstIndex+e.count-1?el("stored",e,t):t,er=(e,t)=>{let n=Es(t.flatMap(r=>e.seen.stretchesOf(r))),[s,a]=[n[0],n.at(-1)];return s===void 0||a===void 0?null:Ji([s.firstIndex,a.firstIndex+a.count-1])},tl=e=>(t,n,s)=>{let a=e(t);return a===null?n:s(a)},Kv=(e,t)=>({...fs("seen",e,t),liveRanges:xr("seen",e,t.liveRanges)}),Xv=(e,t)=>({...t,liveTopLeft:li("seen",e,t.liveTopLeft)}),Zv=e=>{let t="cells"in e?e.cells:null;return t!==null&&"rows"in t?t:null},Jv=(e,t)=>Kt("seen",e,t,Yt),Qv=8;function ek({store:e,isWanted:t,noteLoaded:n,letOthersRun:s,linesOf:a}){let r=null,i=0,o=0;const l=(u,{revision:c,v:d,lines:f})=>{const m=hm(u,f);return m===null&&(r=null),{revision:c,v:d,lines:f.slice(u,m??void 0),next:m}};return{async loadPage(u){const c=i;if(u>0){if(r===null)throw Error("a later page of a load with no lines");return o+=1,o%Qv===0&&await s(),i===c&&r!==null?l(u,r):"calledOff"}r=null,o=0;const d=await e.loadOps();return d===null||d==="pageOutOfDate"||"busyForMs"in d?d:(n(),i!==c||!t()?"calledOff":(r={revision:d.revision,v:d.v,lines:a(d.ops)},l(0,r)))},drop(){i+=1,r=null}}}const Bu=6;function tk(e){try{const t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<n.length;s+=1)n[s]=t.charCodeAt(s);return n}catch{return null}}async function nk(e){try{const t=new Blob([...e]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(t).text()}catch{return null}}function hm(e,t){const n=t.indexOf(`
2
2
  `,e+262144)+1;return n>0&&n<t.length?n:null}const Lu=e=>({after:null,parts:[],retryCount:e-1,startCount:e});function sk(e){const t=c=>e.wanted().includes(c);async function n(c,{after:d,parts:f,retryCount:m,startCount:g}){if(!t(c))return"calledOff";const b=await e.store.loadSliceOfTableFile(c,d);if(b==="isGone")return"none";if(b==="startOver")return g===Bu?"none":(await e.waitToRetry(g,0),n(c,Lu(g+1)));if(b===null||"busyForMs"in b)return await e.waitToRetry(m,b?.busyForMs??0),n(c,{after:d,parts:f,retryCount:m+1,startCount:g});const I=tk(b.base64);if(I!==null&&f.push(I),I!==null&&b.byteCountHeld<b.byteCountOfBody){const y={bodyName:b.bodyName,byteCountHeld:b.byteCountHeld};return n(c,{after:y,parts:f,retryCount:0,startCount:g})}const h=I===null?null:await nk(f);return h!==null?{lines:h}:(e.reportFault("tableFileNotRead"),"none")}async function s(c,d,f){const m=hm(c,d);if(e.handOver(f,d.slice(c,m??void 0),m===null)!=="read")return e.reportFault("tableFileNotRead"),e.giveUp(f);if(m!==null)return await e.letOthersRun(),s(m,d,f)}async function a(c){const d=await n(c,Lu(1));if(d!=="calledOff")return d==="none"?e.giveUp(c):s(0,d.lines,c)}const r=new Map;function i(){const c=e.wanted();for(const d of r.keys())c.includes(d)||r.delete(d);return c.find(d=>!r.has(d))??c.find(d=>r.get(d)!==Bu)}let o=!1;async function l(){const c=i();if(o=c!==void 0,c===void 0)return;const d=r.get(c)??0;return d>0&&await e.waitToRetry(d-1,0),await a(c),r.set(c,d+1),l()}async function u(){try{await l()}catch{o=!1,e.reportFault("tableFileNotRead")}}return()=>{o||u()}}function uo(e){if(!(e instanceof Error))return"notAnError";let{name:t,message:n}=e;if(e instanceof DOMException)return t==="SyntaxError"?"domSyntaxError":ok.find(s=>s===t)??"domOther";switch(t){case"RuntimeError":return ik.test(n)?"wasmUnreachable":"wasmOtherTrap";case"CompileError":return"wasmCompileError";case"LinkError":return"wasmLinkError";case"ChunkLoadError":return"fileNotFetched";case"RangeError":case"InternalError":return lk.test(n)?"stackOverflow":uk.test(n)?"outOfMemory":t==="RangeError"?t:"otherError";case"TypeError":case"Error":case"SyntaxError":case"ReferenceError":case"URIError":case"EvalError":case"AggregateError":return t;default:return"otherError"}}function ak(e){if(!(e instanceof AggregateError))return uo(e);let{errors:t}=e;return t.length>0?`many_${uo(t[0])}`:uo(e)}function rk(e){try{return ak(e)}catch{return"otherError"}}const ok=["NotFoundError","HierarchyRequestError","InvalidStateError","InvalidCharacterError","IndexSizeError","InvalidNodeTypeError","WrongDocumentError","NotSupportedError","InvalidAccessError","DataCloneError","QuotaExceededError","SecurityError","AbortError","TimeoutError","NetworkError","NotAllowedError","NotReadableError"],ik=/^(?:unreachable|unreachable executed|Unreachable code should not be executed\b.*)$/s,lk=/^(?:Maximum call stack size exceeded\.?|too much recursion)$/,uk=/^(?:(?:WebAssembly\.[\w.]+\(\): )?(?:[Oo]ut of memory\b.*|could not allocate memory)|Array buffer allocation failed)$/s;function pm(e){return e==="overflow"?!1:e==="wrap"?!0:e}function bs(e,t){let n=e.flatMap(a=>t.stretchesOf(a));n.sort((a,r)=>a.firstIndex-r.firstIndex);let s=[];for(let a of n){let r=s.at(-1);r===void 0||a.firstIndex>r.firstIndex+r.count?s.push(a):s[s.length-1]={firstIndex:r.firstIndex,count:Math.max(r.count,a.firstIndex+a.count-r.firstIndex)}}return s}function ck(e,t,n){return e.flatMap(s=>s.format.numberFormat===void 0||Ck(s.format.numberFormat.pattern)?[]:{pattern:s.format.numberFormat.pattern,rows:bs(s.rows,t),columns:bs(s.columns,n)})}function Is(e,t,n){let[s,a]=[0,e.length];for(;s<a;){let i=Math.floor((s+a)/2),o=e[i];o!==void 0&&o.firstIndex+o.count<=t?s=i+1:a=i}let r=[];for(let i=s;i<e.length;i+=1){let o=e[i];if(o===void 0||o.firstIndex>=t+n)break;r.push(o.firstIndex,o.firstIndex+o.count)}return r}function dk(e,t){let n=new Set,s=new Set;for(let a of e){let r=Is(a.rows,t.topRowIndex-1,t.rowCount+2),i=Is(a.columns,t.leftColumnIndex-1,t.columnCount+2);if(!(r.length===0||i.length===0)){for(let o of r)n.add(o);for(let o of i)s.add(o)}}return{rows:[...n],columns:[...s]}}function fk(e,t){let n=e.filter(({rows:s,columns:a})=>Is(s,t.topRowIndex,t.rowCount).length>0&&Is(a,t.leftColumnIndex,t.columnCount).length>0);return[...new Set(n.map(({pattern:s})=>s))]}function tr(e,t,n){let s=Is(e,t,n),a=0;for(let r=0;r+1<s.length;r+=2)a+=Math.min(s[r+1]??0,t+n)-Math.max(s[r]??0,t);return a}function mk(e,t){let n=e.flatMap(({rows:o,columns:l,format:u})=>{let c=tr(l,t.leftColumnIndex,t.columnCount),d=c===0?0:c*tr(o,t.topRowIndex,t.rowCount);return d===0?[]:{format:u,cellCount:d}}),s=(o,l)=>{let u=null,c=0;for(let d of n){let f=o(d.format);if(f===void 0)continue;let m=JSON.stringify(f);if(u??={value:f,written:m},u.written!==m)return null;c+=d.cellCount}return u===null?l:c===t.rowCount*t.columnCount?u.value:null},{alignment:a,border:r,font:i}=pt;return{numberFormat:s(o=>o.numberFormat,pt.numberFormat),alignment:{horizontal:s(o=>o.alignment?.horizontal,a.horizontal),vertical:s(o=>o.alignment?.vertical,a.vertical),wrap:s(sl,a.wrap)},fillColor:s(o=>o.fillColor,pt.fillColor),cellControl:s(o=>o.cellControl,pt.cellControl),defaultValue:s(o=>o.defaultValue,bk),valueLimits:s(o=>o.valueLimits,Ik),border:{top:s(o=>o.border?.top,r.top),right:s(o=>o.border?.right,r.right),bottom:s(o=>o.border?.bottom,r.bottom),left:s(o=>o.border?.left,r.left)},font:{bold:s(o=>o.font?.bold,i.bold),italic:s(o=>o.font?.italic,i.italic),underline:s(o=>o.font?.underline,i.underline),strikethrough:s(o=>o.font?.strikethrough,i.strikethrough),color:s(o=>o.font?.color,i.color),size:s(o=>o.font?.size,i.size)}}}function hk(e){let t=new Set;for(let n of e)if(!(n?.kind!=="rgb"||Sk.has(n.hex))&&(t.add(n.hex),t.size===Ek))break;return[...t]}function*pk(e,t){for(let{format:n}of e){yield*[n.fillColor,n.font?.color];for(let s of wm){let a=n.border?.[s];a?.kind==="line"&&(yield a.color)}}for(let{options:n}of t)for(let{color:s}of n)yield s}function gk(e){let t=new Map;e.forEach((s,a)=>{for(let{base:r,first:i,count:o}of s){let l=t.get(r)??[];l.push({at:i,list:a,isStart:!0},{at:i+o,list:a,isStart:!1}),t.set(r,l)}});let n=new Map;for(let[s,a]of t){a.sort((o,l)=>o.at===l.at?Number(o.isStart)-Number(l.isStart):o.at-l.at);let r=new Set,i=[];a.forEach(({at:o,list:l,isStart:u},c)=>{u?r.add(l):r.delete(l),a[c+1]?.at!==o&&i.push({first:o,heldBy:[...r]})}),n.set(s,i)}return n}function Vu(e){let t=gk(e);return n=>{let s=um(n),a=s===null?void 0:t.get(s.base);if(s===null||a===void 0)return Fu;let r=Ja(a,({first:i})=>i,s.first);return r===void 0||r.first>s.first?Fu:r.heldBy}}function gm(e){let t=Vu(e.map(({columns:a})=>a)),n=new Map,s=(a,r)=>{let i=n.get(a);if(i===void 0){let o=Vu([e[a]?.rows??[]]);i=l=>o(l).length>0,n.set(a,i)}return i(r)};return(a,r)=>t(r).filter(i=>s(i,a))}function ym(e){let t=JSON.stringify(e),n=Du.get(t)??e;return Du.set(t,n),n}function yk(e,t){let n=e.map(({format:r})=>bm(r,t)),s=gm(e),a=new Map;return{formatOf(r,i){let o=s(r,i);if(o.length===0)return pt;let l=o.join(),u=a.get(l);if(u!==void 0)return u;let c=ym(o.reduce((d,f)=>Im(d,n[f]??{}),pt));return a.set(l,c),c}}}function wk(e){if(e.length===0)return Mk;let t=gm(e),n=new Map,s=new WeakMap,a=(r,i)=>{let o=t(r,i);if(o.length===0)return null;let l=o.join(),u=n.get(l);if(u!==void 0)return u;let c=o.map(g=>e[g]?.format??{}),d=c.find(g=>g.fillColor!==void 0)?.fillColor,f={};for(let g of c)Object.assign(f,g.font);let m={...d!==void 0&&{fillColor:d},font:f};return n.set(l,m),m};return{lookGivenTo:a,formatDrawnOf(r,i,o){let l=a(i,o);if(l===null)return r;let u=s.get(r)??new Map;s.set(r,u);let c=u.get(l);if(c!==void 0)return c;let d=ym(Im(r,l));return u.set(l,d),d}}}const wm=["top","bottom","left","right"],pt={font:{bold:!1,italic:!1,underline:"none",strikethrough:!1,color:{kind:"none"},size:10},numberFormat:{kind:"general",pattern:"General"},alignment:{horizontal:"general",vertical:"top",wrap:!1},fillColor:{kind:"none"},cellControl:{kind:"none"},border:{top:{kind:"none"},bottom:{kind:"none"},left:{kind:"none"},right:{kind:"none"}}},bk={kind:"none"},Ik={minimum:null,maximum:null};({...pt});const vk=e=>e.flatMap(t=>{let{defaultValue:n,valueLimits:s,...a}=t.format;return n===void 0&&s===void 0?t:Object.keys(a).length===0?[]:{...t,format:a}}),nl=e=>e.some(({format:t})=>t.defaultValue!==void 0),sl=({alignment:e})=>e?.wrap===void 0?void 0:pm(e.wrap),bm=({numberFormat:e,...t},n)=>e===void 0?t:{...t,numberFormat:{kind:n(e.pattern),pattern:e.pattern}},Im=(e,{alignment:t,border:n,font:s,...a})=>({...e,...a,alignment:{...e.alignment,...t,wrap:pm(t?.wrap??e.alignment.wrap)},border:{...e.border,...n},font:{...e.font,...s}}),kk=e=>e.some(({format:t})=>wm.some(n=>t.border?.[n]?.kind==="line")),vm=(e,t,n)=>e.map(s=>({rows:bs(s.rows,t),columns:bs(s.columns,n)})),Ak=(e,t,n)=>vm(e.filter(({format:s})=>s.border!==void 0),t,n),Tk=(e,t,n)=>vm(e.filter(({format:s})=>sl(s)===!0),t,n),Ck=e=>/^general$/i.test(e),Pu=(e,t,n,s)=>e.map(a=>({rows:bs(a.rows,t),columns:bs(a.columns,n),format:bm(a.format,s)})),Ok=(e,t)=>e.flatMap(({rows:n,format:s},a)=>Object.keys(s).some(r=>r!=="border")&&Is(n,t,1).length>0?[a]:[]).join(),xk=(e,t)=>e.some(({rows:n,columns:s,format:a})=>sl(a)==="clip"&&tr(s,t.leftColumnIndex,t.columnCount)>0&&tr(n,t.topRowIndex,t.rowCount)>0),Ek=8,Sk=new Set(["#ffffff","#f3f3f3","#000000"]),Rk=(e,t)=>hk(pk(e,t)),Du=new Map,Fu=[],Mk={lookGivenTo:()=>null,formatDrawnOf:e=>e};function Gu(e){let t=Object.values(_k).filter(n=>n!==km[e]).join("");return new RegExp(`(?<=\\d)[${t}](?=(?:\\d{2}[${t}])*\\d{3}(?!\\d))`,"g")}function Nk(e,t){let n=0,s=e.length;for(;n<s&&e[n]===" ";)n+=1;for(;s>n&&e[s-1]===" ";)s-=1;let a=e.slice(n,s);if(!Bk[t].test(a))return null;let r=Number(a.replace(",","."));return Number.isFinite(r)?r===0?0:r:null}const Hk=e=>e==="comma"?";":",",km={point:".",comma:","},_k={comma:",",point:".",noBreakSpace:" ",narrowNoBreakSpace:" ",apostrophe:"'"},Sr=(e,t)=>e.replace(".",km[t]);Gu("point"),Gu("comma");const Bk={point:/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,comma:/^[+-]?(?:\d+(?:,\d*)?|,\d+)(?:[eE][+-]?\d+)?$/},Lk=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,Vk="�",Pk=/[^\P{Cc}\t\n\r]/gu,Am=e=>e.replaceAll(Pk,"").replaceAll(Lk,Vk),Rr="'",ju=(e,t)=>e.length>t.length&&e.startsWith(t),Dk=e=>{let t=/^(?:(true)|false)$/i.exec(e);return t===null?null:t[1]!==void 0},Fk=(e,t)=>Nk(e,t)===null&&Dk(e)===null&&!ju(e,Rr)&&!ju(e,"="),al=e=>e?"TRUE":"FALSE",Tm=(e,t)=>Fk(e,t)?e:Rr+e,Gk=e=>Date.parse(`${e}T00:00:00Z`)/864e5+25569,Cm=15;function jk(e,t){let n=e!==null&&"input"in e&&e.input.kind==="number"?e.numberIsEditedAs:void 0;return n!==void 0&&Xk.test(n)&&e?.shown?.kind==="text"&&Kk.test(e.shown.text)&&t()===Yk?n:null}function Wk(e,t,n){let s=Kn(e),[,a]=Zk.exec(t)??[],r=a===void 0?null:n(a);return r!==null&&s?.kind==="number"&&Gk(r)!==Math.floor(s.value)}function Wu(e,t,n){let s=Kn(e);return s?.kind==="text"?ui(t??s.value):s?.kind!=="number"?ci(s,1/0,n):t===null||n0(e)?Sr(String(s.value).toUpperCase(),n):Jk(t)?t:ui(t)}const Uk=/^(?=[^\S\t\n\r]*[=+\-@\uFF1D\uFF0B\uFF0D\uFF20])|[\t\n\r](?='*[^\S\t\n\r]*[=+\-@\uFF1D\uFF0B\uFF0D\uFF20])/g,zk=/[\v\f\x85\u2028\u2029]/g,$k=e=>Am(e.replaceAll(zk,`
3
3
  `)),ui=e=>$k(e).replaceAll(Uk,t=>t+Rr),qk=/^ *[+-](?:[\p{Sc} %]*[\d.,\u00a0\u202f']+(?:(?<=\d)E[+-]?\d+)?)?[\p{Sc} %]*$/u,Yk="m/d h:mm",Kk=/^\d{1,2}[/.-]\d{1,2} \d{1,2}:\d{2}$/,Xk=/^\d+[/.-]\d+[/.-]\d+/,Zk=/^(\d{1,4}[/.-]\d{1,2}[/.-]\d{1,4})(?: \d{1,2}:\d{2}(?::\d{2})?(?: ?[AP]M)?)?$/i,Jk=e=>qk.test(e)||ui(e)===e,Uu=(e,t)=>String(Number(e.toFixed(t))).toUpperCase(),Qk=new Intl.NumberFormat("en-US",{useGrouping:!1,maximumSignificantDigits:Cm});function zu(e){let t=Om(e,rl);return t.includes("E")?Math.abs(e)>=1?Qk.format(e):"0":t}function Om(e,t){if(Uu(e,0).length>t&&$u(e,0).length>t)return zu(e);for(let a=Cm;a>=1;a-=1){let r=e0(e,a);if(r.length<=t)return r}for(let a=s0;a>=0;a-=1){let r=$u(e,a);if(r.length<=t)return r}let n=e<0?3:2,s=Uu(e,Math.max(0,t-n));return s==="0"?zu(e):s}function e0(e,t){let n=Number(e.toPrecision(t));return String(Number.isFinite(n)?n:e).toUpperCase()}function ci(e,t,n){switch(e?.kind){case void 0:return"";case"text":case"error":return e.value;case"boolean":return al(e.value);case"number":return Sr(Om(e.value,Math.min(t,rl)),n)}}function t0(e,t,n,s=()=>!1){let a=e?.shown;if(a?.kind==="text")return{text:a.text,textColor:a.textColor};let r=Math.floor(t);if(a!==void 0&&a.reason!=="notPrintedYet"){let l=Math.max(1,Math.min(r,rl));return{text:a0.repeat(l),textColor:null}}let i=Kn(e),o=ci(i,r,n);if(i?.kind!=="number")return{text:o,textColor:null};for(;o.length<=r&&s(o);)r=o.length-1,o=ci(i,r,n);return{text:o,textColor:null}}function n0(e){let t=Kn(e),n=e?.shown;return n?.kind==="text"&&n.textColor!==null&&t?.kind==="number"&&t.value<0&&/\d/.test(n.text)&&!r0.test(n.text)}const $u=(e,t)=>e.toExponential(t).toUpperCase().replace(/\.?0*E/,"E"),rl=11,s0=5,a0="#",r0=/(?:^|[^Ee])[-\u2212(]/;function xm(e){if(e.value?.kind!=="text")throw Error("a dropdown option was read without its label");return e.value.value}function o0(e){return e===null||!("input"in e)?qu:e.input.kind==="user"?[e.input]:e.input.kind==="users"?e.input.users:qu}function i0(e){if(e.value?.kind!=="text")throw Error("people were read without their labels");return e.value.value}function ol(e){if(e.value?.kind!=="text")throw Error("a rich text was read without its plain text");return e.value.value}function l0(e){if(e?.input.kind!=="richText")return Yu;let t=Ku.get(e);if(t!==void 0)return t;let{paragraphs:n}=e.input,s=t0(e,1/0,"point").text===ol(e)&&n.some(({list:a})=>a.kind!=="none")?n.map(({list:a},r)=>({list:a,number:e.numbersOfListLines?.[r]??null})):Yu;return Ku.set(e,s),s}function u0(e,t){let n=e?.textIsEditedAfterTheMark===!0?Rr:"";switch(e?.input.kind){case void 0:return"";case"number":return e.numberIsEditedAs??Sr(String(e.input.value),t);case"text":return n+e.input.value;case"dropdownOption":return n+xm(e);case"user":case"users":return n+i0(e);case"richText":return n+ol(e);case"boolean":return al(e.input.value);case"formula":return c0(e)}}function c0({formulaText:e}){if(e===void 0)throw Error("a formula was read without its text");return e}function d0(e,t){return e!==null&&"input"in e&&e.input.kind==="dropdownOption"?Tm(xm(e),t):e===null||"input"in e?u0(e,t):Em(e.value,t)}function Em(e,t){switch(e.kind){case"number":return Sr(String(e.value).toUpperCase(),t);case"text":return Tm(Am(e.value),t);case"boolean":return al(e.value);case"error":return e.value}}function f0(e,t){return e===null||"input"in e&&e.input.kind!=="formula"?null:e.value===void 0?"":Em(e.value,t)}function Kn(e){if(e===null)return null;if(!("input"in e))return e.value;if(e.input.kind==="number"||e.input.kind==="text"||e.input.kind==="boolean")return e.input;if(e.value===void 0&&e.input.kind!=="formula")throw Error(`a ${e.input.kind} was read without its value`);return e.value??null}const qu=[],m0=e=>e.kind==="none"?null:e.level,Yu=[],Ku=new WeakMap;function di(e,t,n){let s=[],[a,r]=[0,0],i=(l,u)=>{l!==0&&(s.push({firstIndex:a,count:l,sizeInPixels:u,start:r}),a+=l,r+=l*u)};for(let l of t){if(l.firstIndex<a)throw Error("a row or column was given two sizes");i(l.firstIndex-a,n),i(l.count,l.sizeInPixels)}if(a>e)throw Error("a row or column past the last was given a size");i(e-a,n);let o=l=>Ja(s,({firstIndex:u})=>u,l);return{totalSize:r,startOf(l){let u=o(l);return u===void 0?0:u.start+(l-u.firstIndex)*u.sizeInPixels},sizeOf:l=>o(l)?.sizeInPixels??n,indexAt(l){if(l<0)return-1;let u=Ja(s,({start:c})=>c,l);return u===void 0||l>=r?e:u.firstIndex+Math.floor((l-u.start)/u.sizeInPixels)}}}const h0=2e3;function p0(e){let t=Math.max(0,...e.map(i=>i.length)),n=e.map(()=>new Set),s=new Set,a=0,r=null;for(let i=0;i<t;i+=1){let o=e.map(c=>c[i]);if(o.every(k0)){r??=i;continue}let l=o.some((c=[])=>c.some(({value:d})=>typeof d=="number")),u=o.some((c=[],d)=>c.some(({value:f,text:m},g)=>typeof f=="string"&&m!==""&&d+g>0&&n[d]?.has(g)===!0));if(!l){let c=JSON.stringify(o.map((f=[])=>f.map(({text:m})=>m))),d=!s.has(c);if(r!==null&&a>=2&&u&&d)return r;s.add(c)}r=null,a+=1;for(let[c,d]of o.entries())for(let[f,{value:m}]of(d??[]).entries())typeof m=="number"&&n[c]?.add(f)}return t}function Sm(e,t,n){let s=new Map(n.map(a=>[a.viewId,a]));return new Map(t.map(({viewId:a,view:r})=>{let i=s.get(a),o=i===void 0?e.get(a):O0(r,i);if(o===void 0)throw Error("sheets-core named a view whose inputs the page has not read");return[a,o]}))}function g0(e,t,n){let s=[],a=(l,u)=>{for(let{firstIndex:c,count:d}of l)s.push({at:c,isStart:!0,...u},{at:c+d,isStart:!1,...u})};for(let{rows:l,heightInPixels:u}of t)a(e.stretchesOf(l),{heightInPixels:u});for(let{rows:l,format:u}of n){let c=u.font?.size;if(!(c===void 0||c<=pt.font.size))for(let d of l)a(e.stretchesOf(d),{fontSizeInPoints:c})}s.sort((l,u)=>l.at===u.at?Number(l.isStart)-Number(u.isStart):l.at-u.at);let r=[],i=null,o=new Map;return s.forEach((l,u)=>{if("heightInPixels"in l)i=l.isStart?l.heightInPixels:null;else{let g=l.fontSizeInPoints,b=(o.get(g)??0)+(l.isStart?1:-1);b===0?o.delete(g):o.set(g,b)}let c=s[u+1];if(c===void 0||c.at===l.at)return;let d=Math.max(pt.font.size,...o.keys());if(i===null&&o.size===0)return;let f=r.at(-1),m=f!==void 0&&f.firstIndex+f.count===l.at&&f.heightInPixels===i&&f.largestFontSizeInPoints===d;m&&r.pop(),r.push({firstIndex:m?f.firstIndex:l.at,count:c.at-(m?f.firstIndex:l.at),heightInPixels:i,largestFontSizeInPoints:d})}),r}function co(e,t,n){let s=new Map(e);if(s.size>0)for(let r of t)s.delete(r);let a=new Map;for(let r of n){let i=a.get(r.r)??new Map;a.set(r.r,i.set(r.c,r))}for(let[r,i]of a)s.set(r,i);return s}function Rm(e,t,n,s,a){let r=t==="all"?[...e.rowsAsTheyStand.keys()]:t,i=new Map(e.cellCountByUserId),o=(b,I)=>{for(let{userId:h}of o0(b)){let y=(i.get(h)??0)+I;y===0?i.delete(h):i.set(h,y)}},l=new Map(a?e.columnIndexesOnShowByRow:[]),u=new Map(e.cellsByRow);for(let b of r){for(let I of u.get(b)?.cellsWithUsersARichTextOrASpill()??[])o(I,-1);n.has(b)||u.delete(b),l.delete(b)}let c=[],d=[];for(let[b,I]of n){e.cellsByRow.size>0&&u.get(b)?.goesOnAs(I)!==!0&&u.set(b,I);for(let h of I.cellsWithUsersARichTextOrASpill())o(h,1),h.spill!==void 0&&c.push(h),l0(h).length>0&&d.push(h)}let f=e.cellsByRow.size>0?u:n,m=co(e.spilledCellsByRow,r,s),g=m.size===0?null:new Map(e.rowsAsTheyStand);if(g!==null)for(let b of new Set([...r,...n.keys(),...s.map(({r:I})=>I)])){let[I,h]=[f.get(b),m.get(b)];if(I===e.cellsByRow.get(b)&&h===e.spilledCellsByRow.get(b))continue;let y=I!==void 0&&h!==void 0?{}:I??h;y===void 0?g.delete(b):g.set(b,y)}return{cellsByRow:f,spilledCellsByRow:m,cellsWithSpillByRow:co(e.cellsWithSpillByRow,r,c),cellsWithListsByRow:co(e.cellsWithListsByRow,r,d),rowsAsTheyStand:g??f,cellCountByUserId:i,columnIndexesOnShowByRow:l}}function il(e,t,n,s){let{sheetId:a,name:r,rows:i,columns:o,ownRowOrder:l}=e,{mergedRanges:u=[],columnWidths:c=[],rowHeights:d=[]}=e,{cellFormats:f=[],dropdowns:m=[],rowGroups:g=[],columnGroups:b=[]}=e,{conditionalFormats:I=[],placements:h=[],cellTables:y=_m}=e,w=xu(s?.rows,i),k=xu(s?.columns,o,Ev),O=e.lastFrozenRow===void 0?-1:w.indexOf(e.lastFrozenRow),v=e.lastFrozenColumn===void 0?-1:k.indexOf(e.lastFrozenColumn);if(O===null||v===null)throw Error("sheets-core named a frozen row or column that is not in the sheet");let A=c.map(({columns:G,widthInPixels:z})=>{let W=k.indexOf(`${G.base}.${G.first}`),S=k.indexOf(`${G.base}.${G.first+G.count-1}`);if(W===null||S===null||S-W!==G.count-1)throw Error("sheets-core named sized columns that are not side by side in the sheet");return{firstIndex:W,count:G.count,sizeInPixels:z}}),C=null,M=null,R=null,x=null,_=null,N=null,V=null,H=null,P=vk(f),j=null;return{summary:{sheetId:a,name:r,rowCount:w.count,columnCount:k.count,columnEdges:di(k.count,A,t),frozenRowCount:O+1,frozenColumnCount:v+1,areGridlinesHidden:e.areGridlinesHidden===!0,isHidden:e.isHidden===!0,interactive:e.interactive??null,rowGroups:Zu(g,w),columnGroups:Zu(b,k),ownRowOrder:l===void 0||l==="givenUp"?null:{stored:Vn(l.asStored.rows),seen:w,firstIndex:l.firstIndex,count:l.count},isOwnRowOrderGivenUp:l==="givenUp"},rows:w,columns:k,isLaidOutAsNew:e.lastFrozenRow===void 0&&e.lastFrozenColumn===void 0&&e.areGridlinesHidden!==!0&&e.isHidden!==!0&&e.interactive===void 0&&[u,c,d,f,g,b,I,h].every(({length:G})=>G===0),cellFormats:yk(P,n),rowSizing:()=>C??=g0(w,d,f),hasBorderLine:()=>R??=kk(f),entriesWithBorders:()=>x??=Ak(f,w,k),entriesThatWrapText:()=>_??=Tk(f,w,k),numberFormats:()=>N??=ck(f,w,k),formats:()=>V??=Pu(f,w,k,n),looks:()=>H??=Pu(P,w,k,n),hasDefaultValue:nl(f),hexColors:()=>M??=Rk(f,m),dropdownsById:new Map(m.map(G=>[G.dropdownId,G])),conditionalFormats:I,placements:E0(h,w,k),cellTables:y,namedViews:e.namedViews??Bm,connectedTable:e.connectedTable===void 0||e.howItsTableStands===void 0?null:{...e.connectedTable,...e.howItsTableStands,widthOfUnsizedColumn:t},protections:e.protections??Lm,asStored(){if(l===void 0||l==="givenUp")return null;let{ownRowOrder:G,...z}=e;return j??=il({...z,...l.asStored},t,n)},mergedAreas:u.map(({liveTopLeft:G,liveBottomRight:z})=>{let W=Nm({rows:w,columns:k},G,z);if(W===null)throw Error("sheets-core named merged cells that are not in the sheet");return W})}}function Mm(e,t){let n=e.rows.idAt(t);if(n===null)return[];let s=e.cellsByRow.get(n),a=e.spilledCellsByRow.get(n);if(s===void 0&&a===void 0)return[];let r=e.columnIndexesOnShowByRow.get(n);if(r!==void 0)return r;let i=[...s?.keys()??[],...a?.keys()??[]].map(o=>e.columns.indexOf(o)).filter(o=>o!==null);return i.sort((o,l)=>o-l),e.columnIndexesOnShowByRow.set(n,i),i}function os(e,t,n,s=a=>a.keys()){let{sheetId:a}=e.summary,r=[],i=(o,l)=>{for(let u of s(l)){let c=e.columns.indexOf(u);c!==null&&An(c,n.leftColumnIndex,n.columnCount)&&r.push({sheetId:a,rowId:o,columnId:u})}};if(n.rowCount<t.size){for(let o=0;o<n.rowCount;o+=1){let l=e.rows.idAt(n.topRowIndex+o),u=l===null?void 0:t.get(l);l!==null&&u!==void 0&&i(l,u)}return r}for(let[o,l]of t){let u=e.rows.indexOf(o);u!==null&&An(u,n.topRowIndex,n.rowCount)&&i(o,l)}return r}function y0(e,t){let[n,s,a,r]=[1/0,-1/0,1/0,-1/0],i=o=>{let l=Mm(e,o).filter(d=>An(d,t.leftColumnIndex,t.columnCount)),[u,c]=[l[0],l.at(-1)];u===void 0||c===void 0||([n,s]=[Math.min(n,o),Math.max(s,o)],[a,r]=[Math.min(a,u),Math.max(r,c)])};if(t.rowCount<e.cellsByRow.size+e.spilledCellsByRow.size)for(let o=0;o<t.rowCount;o+=1)i(t.topRowIndex+o);else for(let o of[...e.cellsByRow.keys(),...e.spilledCellsByRow.keys()]){let l=e.rows.indexOf(o);l!==null&&An(l,t.topRowIndex,t.rowCount)&&i(l)}return n===1/0?null:{topRowIndex:n,leftColumnIndex:a,rowCount:s-n+1,columnCount:r-a+1}}function Nm({rows:e,columns:t},n,s){let a=e.indexOf(n.r),r=t.indexOf(n.c),i=e.indexOf(s.r),o=t.indexOf(s.c);return a===null||r===null||i===null||o===null?null:{topRowIndex:a,leftColumnIndex:r,rowCount:i-a+1,columnCount:o-r+1}}function Xu(e,t,n){let[s,a]=[e.indexOf(t),e.indexOf(n)];return s===null||a===null?null:Ji([s,a])}function w0(e,{rowId:t,columnId:n}){let s=e.rows.indexOf(t),a=e.columns.indexOf(n);if(s===null||a===null)return null;let r=e.cellsByRow.get(t)?.get(n),i=e.spilledCellsByRow.get(t)?.get(n)?.from,o=i===void 0?void 0:e.cellsByRow.get(i.r)?.get(i.c),l=(r??o)===void 0?[...e.cellsWithSpillByRow.values()].flatMap(u=>Array.from(u.values())):[r??o];for(let u of l){if(u?.spill?.kind!=="fills"||u.formulaText===void 0)continue;let c=Nm(e,u,u.spill.to);if(c!==null&&An(s,c.topRowIndex,c.rowCount)&&An(a,c.leftColumnIndex,c.columnCount))return{formulaText:u.formulaText,area:c}}return null}function b0({sheets:e,calculationTookTooLong:t,timeZone:n,locale:s,decimalSign:a="point",groupSign:r="comma",sizesOfGroups:i="threes",patternOfATimeOfDay:o=N0,views:l=[]},{defaultColumnWidthInPixels:u,localeOfANewWorkbook:c,limits:{mostBytesOfATableToImport:d,mostOptionsInADropdown:f,longestSheetNameInCharacters:m,mostCells:g,mostNamedViewsInASheet:b,longestNameOfANamedViewInCharacters:I,mostNamedRanges:h,longestNameOfANamedRangeInCharacters:y,mostProtections:w,mostOpenRangesInAProtection:k,mostEditorsOfAProtection:O,mostCellsWithADefaultValue:v,longestDefaultValueInCharacters:A,deepestGroup:C,mostCheckboxesOfOneInsert:M,mostEditsInAStep:R,mostRangesInAConditionalFormat:x,mostTestsInAConditionalFormat:_,longestTextOfAConditionInCharacters:N,largestCountInACondition:V,smallestSideOfAPlacementInPixels:H,largestSideOfAPlacementInPixels:P}},j,G=[],z=[],W=[],S=[]){return{sheets:e.map(B=>({...il(B,u,j),...Rm(Ps,[],B.cells,B.spilledCells??[],!1),formatsGiven:G.find(({sheetId:$})=>$===B.sheetId)?.formatsGiven??Vm,cellsChangedFromDefaults:S.find(({sheetId:$})=>$===B.sheetId)?.cells??ll})),views:Sm(new Map,l,z),calculationTookTooLong:t===!0,timeZone:n??null,locale:s??c,decimalSign:a,signsOfNumbers:{decimalSign:a,groupSign:r,sizesOfGroups:i},patternOfATimeOfDay:o,defaultColumnWidthInPixels:u,mostBytesOfATableToImport:d,mostOptionsInADropdown:f,longestSheetNameInCharacters:m,mostCells:g,limitsOfNamedViews:{mostNamedViewsInASheet:b,longestNameOfANamedViewInCharacters:I},limitsOfNamedRanges:{mostNamedRanges:h,longestNameOfANamedRangeInCharacters:y},namedRanges:W,limitsOfProtections:{mostProtections:w,mostOpenRangesInAProtection:k,mostEditorsOfAProtection:O},limitsOfDefaultValues:{mostCellsWithADefaultValue:v,longestDefaultValueInCharacters:A},deepestGroup:C,mostCheckboxesOfOneInsert:M,mostEditsInAStep:R,limitsOfConditionalFormats:{mostRangesInAConditionalFormat:x,mostTestsInAConditionalFormat:_,longestTextOfAConditionInCharacters:N,largestCountInACondition:V},limitsOfPlacements:{smallestSideOfAPlacementInPixels:H,largestSideOfAPlacementInPixels:P},kindOfPattern:j}}function Hm(e,t,n=null){let{defaultColumnWidthInPixels:s,kindOfPattern:a}=e,r=new Map(t.map(o=>[o.sheetId,o]));if(r.size<t.length)throw Error("sheets-core listed a sheet twice");let i=e.sheets.map(o=>{let l=r.get(o.summary.sheetId);if(l===void 0)return o;r.delete(o.summary.sheetId);let{rowsListed:u,cellsNow:c,spilledCellsNow:d,layoutNow:f,formatsGivenNow:m}=l;return{...f===null?o:il(f,s,a,o),...Rm(o,u,c,d,f===null),formatsGiven:m??o.formatsGiven,cellsChangedFromDefaults:l.cellsChangedFromDefaultsNow??o.cellsChangedFromDefaults}});if(r.size>0)throw Error("sheets-core listed a sheet that the page has not read");return{...e,sheets:i,views:n===null?e.views:Sm(e.views,n.viewsNow,n.inputsNow)}}function fi(e,t){let{sheets:n,calculationTookTooLong:s,timeZone:a,locale:r,decimalSign:i}=e,{signsOfNumbers:o,patternOfATimeOfDay:l}=e,u=new Map(n.map(h=>[h.summary.sheetId,h])),c=n.map(({summary:h})=>h),d=new Set;for(let h of n)for(let y of h.cellCountByUserId.keys())d.add(y);let f=[...d],m=null,g=null,b=c.some(({ownRowOrder:h})=>h!==null),I={listSheets:()=>c,asStored:()=>b?g??=fi({...e,sheets:n.map(h=>({...h,...h.asStored()}))},I0(t,h=>u.get(h)?.summary.ownRowOrder??null)):null,sheetAsItStands:h=>u.get(h)??null,rowsAsTheyStand:h=>(u.get(h)??Ps).rowsAsTheyStand,cellsHeldByRow:h=>(u.get(h)??Ps).cellsByRow,cellsWithSpillIn:h=>[...(u.get(h)??Ps).cellsWithSpillByRow.values()].flatMap(y=>Array.from(y.values())),isSheetAsNew(h){let y=u.get(h);return y!==void 0&&y.isLaidOutAsNew&&y.cellsByRow.size===0},mostBytesOfATableToImport:()=>e.mostBytesOfATableToImport,mostOptionsInADropdown:()=>e.mostOptionsInADropdown,longestSheetNameInCharacters:()=>e.longestSheetNameInCharacters,mostFilledCells:()=>e.mostCells,limitsOfNamedViews:()=>e.limitsOfNamedViews,limitsOfNamedRanges:()=>e.limitsOfNamedRanges,namedRanges:()=>e.namedRanges,limitsOfProtections:()=>e.limitsOfProtections,limitsOfDefaultValues:()=>e.limitsOfDefaultValues,deepestGroup:()=>e.deepestGroup,mostCheckboxesOfOneInsert:()=>e.mostCheckboxesOfOneInsert,mostEditsInAStep:()=>e.mostEditsInAStep,limitsOfConditionalFormats:()=>e.limitsOfConditionalFormats,limitsOfPlacements:()=>e.limitsOfPlacements,positionOfCell({sheetId:h,rowId:y,columnId:w}){let k=u.get(h),O=k?.rows.indexOf(y)??null,v=k?.columns.indexOf(w)??null;return O===null||v===null?null:{rowIndex:O,columnIndex:v}},rowIndexOf:(h,y)=>u.get(h)?.rows.indexOf(y)??null,columnIndexOf:(h,y)=>u.get(h)?.columns.indexOf(y)??null,cellIdAt(h,y,w){let k=u.get(h),O=k?.rows.idAt(y)??null,v=k?.columns.idAt(w)??null;return O===null||v===null?null:{sheetId:h,rowId:O,columnId:v}},linesOf:h=>u.get(h)??null,cellOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.cellsByRow.get(y)?.get(w)??null,spilledCellOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.spilledCellsByRow.get(y)?.get(w)??null,cellOnShowIn({sheetId:h,rowId:y,columnId:w}){let k=u.get(h);return k?.cellsByRow.get(y)?.get(w)??k?.spilledCellsByRow.get(y)?.get(w)??null},formatOf:({sheetId:h,rowId:y,columnId:w})=>u.get(h)?.cellFormats.formatOf(y,w)??pt,sharedFormatBetween(h,y){let w=u.get(h.sheetId);if(w===void 0||h.sheetId!==y.sheetId)return null;let k=Xu(w.rows,h.rowId,y.rowId),O=Xu(w.columns,h.columnId,y.columnId);return k===null||O===null?null:mk(w.formats(),{topRowIndex:k.firstIndex,leftColumnIndex:O.firstIndex,rowCount:k.count,columnCount:O.count})},lookOfRow:(h,y)=>Ok(u.get(h)?.looks()??[],y),conditionalFormatsOf:h=>u.get(h)?.conditionalFormats??[],formatsGivenIn:h=>u.get(h)?.formatsGiven??Vm,placementsIn:h=>u.get(h)?.placements??R0,cellTablesDeclaredIn:h=>u.get(h)?.cellTables??_m,namedViewsIn:h=>u.get(h)?.namedViews??Bm,connectedTableIn:h=>u.get(h)?.connectedTable??null,protectionsIn:h=>u.get(h)?.protections??Lm,cellsChangedFromDefaultsIn:h=>u.get(h)?.cellsChangedFromDefaults??ll,viewAsItStands:h=>e.views.get(h)??null,rowSizingOf:h=>u.get(h)?.rowSizing()??[],whereTextWraps:h=>u.get(h)?.entriesThatWrapText()??[],cellsWithListsIn:h=>u.get(h)?.cellsWithListsByRow??Ps.cellsWithListsByRow,hasBorderLine:h=>u.get(h)?.hasBorderLine()??!1,bordersMayChangeBefore:(h,y)=>dk(u.get(h)?.entriesWithBorders()??[],y),isTextClippedIn:(h,y)=>xk(u.get(h)?.looks()??[],y),numberFormatPatternsIn:(h,y)=>fk(u.get(h)?.numberFormats()??[],y),hexColorsOf:h=>u.get(h)?.hexColors()??[],dropdownOf({sheetId:h,rowId:y,columnId:w}){let k=u.get(h),O=k?.cellFormats.formatOf(y,w).cellControl;if(k===void 0||O?.kind!=="dropdown")return null;let v=k.dropdownsById.get(O.dropdownId);if(v===void 0)throw Error("sheets-core named a dropdown that is not among the sheet’s");return v},spillOver(h){let y=`${h.sheetId} ${h.rowId} ${h.columnId}`;if(m?.key===y)return m.over;let w=u.get(h.sheetId),k=w?.summary.ownRowOrder??null,O=k===null?null:I.asStored()?.spillOver(h)??null,v=O===null?null:Yt("seen",k,{firstIndex:O.area.topRowIndex,count:O.area.rowCount}),A=O===null||v===null?null:{...O,area:{...O.area,topRowIndex:v.firstIndex,rowCount:v.count}},C=w===void 0||k!==null?A:w0(w,h);return m={key:y,over:C},C},filledCellsIn(h,y){let w=u.get(h);return w===void 0?[]:os(w,w.cellsByRow,y)},cellsOnShowIn(h,y){let w=u.get(h);if(w===void 0)return[];let k=os(w,w.cellsByRow,y);return w.spilledCellsByRow.size===0?k:[...k,...os(w,w.spilledCellsByRow,y)]},formulasAndSpillsIn(h,y){let w=u.get(h);return w===void 0?[]:[...os(w,w.cellsByRow,y,k=>k.columnsWithAFormula()),...os(w,w.spilledCellsByRow,y)]},cellsEditedAfterTheMarkIn(h,y){let w=u.get(h);return w===void 0?[]:os(w,w.cellsByRow,y,k=>k.columnsWithATextEditedAfterTheMark())},areaOnShowIn(h,y){let w=u.get(h);return w===void 0?null:y0(w,y)},columnIndexesOnShowIn(h,y){let w=u.get(h);return w===void 0?[]:Mm(w,y)},mergedAreaAt:(h,{rowIndex:y,columnIndex:w})=>u.get(h)?.mergedAreas.find(k=>An(y,k.topRowIndex,k.rowCount)&&An(w,k.leftColumnIndex,k.columnCount))??null,mergedAreasIn:(h,y)=>u.get(h)?.mergedAreas.filter(w=>M0(w,y))??[],userIds:()=>f,isEveryCellBlank:n.every(({cellsByRow:h})=>h.size===0),filledCellCount(){let h=0;for(let{cellsByRow:y}of n)for(let w of y.values())h+=w.size;return h},calculationTookTooLong:s,timeZone:a,locale:r,decimalSign:i,signsOfNumbers:o,patternOfATimeOfDay:l,...t,...H0(r,t)};return I}function I0(e,t){return{...e,tableAtCell(n){let[s,a]=[e.tableAtCell(n),t(n.sheetId)];return a===null||s==="nowhere"?s:Qi("stored",a,s)},cellTableAt(n){let[s,a]=[e.cellTableAt(n),t(n.sheetId)];return a===null||s===null?s:Qa("stored",a,s)},cellTables(n){let[s,a]=[e.cellTables(n),t(n)];return a===null||s===null||s==="tookTooLong"?s:s.map(r=>Qa("stored",a,r))},conditionalFormatsAsAgentIsTold(n,s){let[a,r]=[[n.rowId,s.rowId],t(n.sheetId)],[i,o]=r===null?a:Jv(r,a);return e.conditionalFormatsAsAgentIsTold({...n,rowId:i},{...s,rowId:o})}}}function v0(e,t){let n=e.cellOnShowIn(t);if(n?.shown?.kind!=="text")return null;let s=Kn(n),{pattern:a}=Pm(e,t);return s?.kind==="number"&&_0.test(a)?e.shownWithRoomForAll(s,a)??n.shown.text:n.shown.text}const k0=e=>e===void 0||e.every(({value:t,text:n})=>n===""&&(t===null||t==="")),A0=({range:{sheetId:e,topLeft:t,bottomRight:n}})=>JSON.stringify([e,...t.r<n.r?[t.r,n.r]:[n.r,t.r]]),T0=e=>Object.fromEntries(e.map(({name:t,rows:n})=>[t,n])),C0=({answer:e},t)=>"refusal"in e?e:{byElement:new Map(e.elements.map(({elementId:n,inputs:s})=>{let a=t.elements.find(o=>o.elementId===n);if(a?.kind==="interactive")return[n,T0(s)];let r=a?.inputs,i=s.map(({name:o})=>{let l=r?.find(u=>u.name===o);return l===void 0?JSON.stringify(o):A0(l)});return[n,Object.fromEntries(s.map(({name:o,rows:l},u)=>{let c=s.filter((f,m)=>i[m]===i[u]),d=p0(c.map(f=>f.rows));return[o,d<l.length?l.slice(0,d):l]}))]}))},O0=(e,t)=>({view:e,inputs:C0(t,e),..."countOfCellsToReset"in t.answer&&{countOfCellsToReset:t.answer.countOfCellsToReset},..."hasDefaultsToSave"in t.answer&&{hasDefaultsToSave:!0}}),x0={xInPixels:0,yInPixels:0},E0=(e,t,n)=>e.map(({placementId:s,placement:a,liveTopLeft:r})=>{let[i,o]=[t.indexOf(r.r),n.indexOf(r.c)];if(i===null||o===null)throw Error("sheets-core placed a view at a cell that is not in the sheet");let{shows:l,widthInPixels:u,heightInPixels:c}=a;return{placementId:s,viewId:l.viewId,rowIndex:i,columnIndex:o,offsetFromAnchorCell:a.offsetFromAnchorCell??x0,widthInPixels:u,heightInPixels:c}}),en=({rowId:e,columnId:t})=>({r:e,c:t}),Rs=(e,t)=>({sheetId:e.sheetId,oneCorner:en(e),otherCorner:en(t)}),S0={currency:"$#,##0.00",roundedCurrency:"$#,##0",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",monthAndDay:"mmm d",monthAndYear:"mmm yyyy"},R0=[],_m=[],Bm=[],Lm=[],ll=[],Vm={notWorkedOut:null,formats:[],colorScales:[],matches:[]},Ps={cellsByRow:new Map,spilledCellsByRow:new Map,cellsWithSpillByRow:new Map,cellsWithListsByRow:new Map,rowsAsTheyStand:new Map,cellCountByUserId:new Map,columnIndexesOnShowByRow:new Map},Zu=(e,t)=>e.map(({groupId:n,ends:s,depth:a,isCollapsed:r})=>{let[i,o]=[t.indexOf(s.first),t.indexOf(s.last)];if(i===null||o===null||o<i)throw Error("sheets-core named a group whose ends are not in the sheet in that order");return{groupId:n,firstIndex:i,count:o-i+1,depth:a,isCollapsed:r}}),An=(e,t,n)=>e>=t&&e<t+n,M0=(e,t)=>e.topRowIndex<t.topRowIndex+t.rowCount&&t.topRowIndex<e.topRowIndex+e.rowCount&&e.leftColumnIndex<t.leftColumnIndex+t.columnCount&&t.leftColumnIndex<e.leftColumnIndex+e.columnCount,N0="h:mm AM/PM",H0=(e,{dayTypedInLocaleAs:t,shownInLocaleWithRoomForAll:n,patternReadInLocale:s,formulaInLocale:a,patternsOfLocale:r,fitOfColumnReadingsInLocale:i,textsUnderAColumnReadingInLocale:o})=>({dayTypedAs:(...l)=>t(e,...l),shownWithRoomForAll:(...l)=>n(e,...l),patternRead:(...l)=>s(e,...l),formulaAsTyped:l=>a(e,l),patternsOfItsLocale:r(e)??S0,fitOfColumnReadings:(...l)=>i(e,...l),textsUnderAColumnReading:(...l)=>o(e,...l)}),_0=/general|@/i,Pm=(e,t)=>e.cellOnShowIn(t)?.numberFormatBrought??e.formatOf(t).numberFormat;function B0(e){let t=new Map;return(n,s)=>{let a=`${n.sheetId}/${n.rowId}/${n.columnId}`,r=e(n,s);if(r!=="yetToCome"&&r!=="neverToCome"){t.delete(a),t.set(a,{cellNow:s,said:r});for(let l of[...t.keys()].slice(0,-29))t.delete(l);return{said:r,isLatest:!0}}let i=t.get(a),o=i?.cellNow===s?i.said:null;return r==="neverToCome"?{said:o??Dm,isLatest:!0}:o===null?null:{said:o,isLatest:!1}}}const Dm={cause:null,passedOnFrom:null},L0=({editsBefore:e=[],edit:t,editsThatGoAlong:n=[]})=>[...e.map(s=>s.edit),t,...n];function mi(e,t){if(Array.isArray(e))return e.map(s=>mi(s,t));if(typeof e!="object"||e===null)return e;let n={};for(let s in e)n[s]=s==="r"&&e.r===null?t:mi(e[s],t);return n}function Ju(e,t,n){let s=n.get(t);return s===void 0&&(s=JSON.parse(e),n.size<64&&n.set(t,s)),s}function V0(e,t){for(let n of e){let s=new D0(n),a=0;s.rowIds().forEach((r,i)=>{let o=s.rowEnds[i];t(r,new F0(s,r,a,o)),a=o})}}function Fm(e){let t=new Map;return V0(e,(n,s)=>t.set(n,s)),t}const fo=Object.freeze([]),P0=e=>JSON.parse(JSON.stringify(e)),mo=[];let cs,Ds,Pa;[cs,Ds,Pa]=[0,0,0];const D0=class hi{#e=new WeakRef(this);#s=new Map;#t=new Map;#n;#r;#i;#l;#o;#u;#c;#d;#f=new Map;#m=new Map;constructor({lists:t,texts:n}){let[s,a,r,i]=new Uint32Array(t,0,4),o=4*Uint32Array.BYTES_PER_ELEMENT,l=(d,f)=>{let m=new d(t,o,f);return o+=m.byteLength,m};this.#n=n,this.#r=l(Float64Array,r),this.#i=l(Uint32Array,s),this.rowEnds=l(Uint32Array,s);let u=l(Uint32Array,a),c=l(Uint32Array,a);this.#l=l(Uint32Array,i),this.columns=l(Uint32Array,r),this.#o=l(Uint32Array,r),this.#u=l(Uint32Array,r),this.#c=l(Uint32Array,r),this.#d=l(Uint32Array,r),this.forms=l(Uint8Array,r),this.#h(u).forEach((d,f)=>{this.#f.set(c[f],d),this.#m.set(d,c[f])})}#a(t){let n=t===1?0:this.#l[t-2];return this.#n.substring(n,this.#l[t-1])}#h(t){return P0(Array.from(t,n=>this.#a(n)))}rowIds(){return this.#h(this.#i)}#y(t,n){let[s,a]=[this.#a(t),this.#t],r;return{kind:"formula",get formula(){if(r===void 0){let{textBetweenReferences:i,references:o}=Ju(s,t,a);r={textBetweenReferences:i,references:mi(o,n)}}return r}}}columnIdAt(t){return this.#f.get(this.columns[t])}indexOf(t,n,s){let a=this.#m.get(t);if(a===void 0)return-1;let{columns:r}=this,i=n+a-r[n];if(i<n)return-1;if(i<s&&r[i]===a)return i;let[o,l]=[n,s-1];for(;o<=l;){let u=o+l>>>1;if(r[u]===a)return u;r[u]<a?o=u+1:l=u-1}return-1}keptCellAt(t,n){return this.#s.get(n)?.cells[t-n]}static#p(){let{block:t,startOfRow:n,count:s}=mo[cs],a=t.deref();a!==void 0&&a.#s.delete(n),mo[cs]=void 0,cs=(cs+1)%4096,Ds-=1,Pa-=s.ofCells}keepCell(t,n,s){for(;Pa>=65536;)hi.#p();let a=this.#s.get(s);return a===void 0&&(Ds===4096&&hi.#p(),a={cells:[],count:{ofCells:0}},this.#s.set(s,a),mo[(cs+Ds)%4096]={block:this.#e,startOfRow:s,count:a.count},Ds+=1),a.cells[n-s]=t,a.count.ofCells+=1,Pa+=1,t}#g(t,n,s){return t===0||s===0?t===s:this.#a(t)===n.#a(s)}isCellAsIn(t,n,s){let a=this.forms[t];if(a!==n.forms[s])return!1;let r=this.#r[t],i=n.#r[s],o=(a&7)===1||(a&24)===16,l=(u,c)=>this.#g(u[t],n,c[s]);return(o?this.#g(r,n,i):Object.is(r,i))&&l(this.#o,n.#o)&&l(this.#u,n.#u)&&l(this.#c,n.#c)&&l(this.#d,n.#d)}newCellAt(t,n){let s=this.forms[t],a=this.#r[t],r=this.#u[t],i=this.columnIdAt(t),o;switch(s&7){case 0:o={r:n,c:i,input:{kind:"number",value:a}},r!==0&&(o.numberIsEditedAs=this.#a(r));break;case 1:o={r:n,c:i,input:{kind:"text",value:this.#a(a)}};break;case 2:o={r:n,c:i,input:{kind:"boolean",value:a===1}};break;case 3:o={r:n,c:i,input:this.#y(this.#c[t],n)},r!==0&&(o.formulaText=this.#a(r));break;default:o={r:n,c:i}}switch((s&32)!==0&&(o.textIsEditedAfterTheMark=!0),s&24){case 8:o.value={kind:"number",value:a};break;case 16:o.value={kind:"text",value:this.#a(a)};break;case 24:o.value={kind:"boolean",value:a===1};break}let[l,u]=[this.#o[t],this.#d[t]];if(l!==0&&(o.shown={kind:"text",text:this.#a(l),textColor:null}),u===0)return o;let c=Ju(this.#a(u),u,this.#t);return Object.assign(o,c)}},F0=class{#e;#s;#t;#n;constructor(t,n,s,a){this.#e=t,this.#s=n,this.#t=s,this.#n=a}#r(t){return this.#e.keptCellAt(t,this.#t)??this.#e.newCellAt(t,this.#s)}#i(t){let n=[];for(let s=this.#t;s<this.#n;s+=1)n.push(t(s));return n}#l(t){let{forms:n}=this.#e;for(let s=this.#t;s<this.#n;s+=1)if((n[s]&t)!==0)return!0;return!1}get size(){return this.#n-this.#t}get(t){let n=this.#e.indexOf(t,this.#t,this.#n);if(n!==-1)return this.#e.keptCellAt(n,this.#t)??this.#e.keepCell(this.#e.newCellAt(n,this.#s),n,this.#t)}has(t){return this.#e.indexOf(t,this.#t,this.#n)!==-1}keys(){return this.#i(t=>this.#e.columnIdAt(t)).values()}values(){return this.#i(t=>this.#r(t)).values()}entries(){return Array.from(this.values(),t=>[t.c,t]).values()}[Symbol.iterator](){return this.entries()}forEach(t,n){for(let[s,a]of this)t.call(n,a,s,this)}hasAnError(){return this.#l(128)}#o(t,n){let{forms:s}=this.#e,a=fo;for(let r=this.#t;r<this.#n;r+=1)(s[r]&t)===n&&(a===fo&&(a=[]),a.push(this.#e.columnIdAt(r)));return a}columnsWithAFormula(){return this.#o(7,3)}columnsWithATextEditedAfterTheMark(){return this.#o(32,32)}cellsWithUsersARichTextOrASpill(){if(!this.#l(64))return fo;let{forms:t}=this.#e,n=s=>(t[s]&64)!==0;return this.#i(s=>s).filter(n).map(s=>this.#r(s))}columnsThatReadOtherwiseIn(t){if(!(#e in t)||t.#s!==this.#s)return[...this.keys()];let n=[];for(let s=this.#t;s<this.#n;s+=1){let a=this.#e.columnIdAt(s),r=t.#e.indexOf(a,t.#t,t.#n);(r===-1||!this.#e.isCellAsIn(s,t.#e,r))&&n.push(a)}return n}goesOnAs(t){let n=this.size===t.size&&this.columnsThatReadOtherwiseIn(t).length===0;return n&&(this.#e=t.#e,this.#t=t.#t,this.#n=t.#n),n}};function Gm(e,t){let n=e.answer({kind:"readTableAtCell",sheetId:t.sheetId,cell:en(t)});if(n.kind==="table")return n.read??"nowhere";if(n.kind==="refused")return null;throw Error("sheets-core did not say where a table is")}function G0(e,t){let n=e.answer({kind:"readTablesOfSheet",sheetId:t});if(n.kind==="tablesOfSheet")return n.tables;if(n.kind==="refused")return null;throw Error("sheets-core did not list the tables of a sheet")}function Qu(e){if(e.kind==="cellTableAt")return e.cellTable;if(e.kind==="refused")return null;throw Error("sheets-core did not say where a cell table is")}function jm(e,t){let n=e.answer({kind:"readXlsxFile",...t});if(n.kind==="xlsxFile")return n;if(n.kind!=="refused")throw Error("sheets-core did not write the workbook as a file");return(t.charts??[]).length>0?jm(e,{...t,charts:[]}):null}function Wm(e){let t=e.answer({kind:"readLocales"});if(t.kind!=="locales")throw Error("sheets-core did not list the locales");return t}function j0(e){let t=(s,a)=>{let r=e.answer({kind:"readTypedDay",text:a,locale:s});if(r.kind==="typedDay")return r.day;if(r.kind==="refused")return null;throw Error("sheets-core did not say which day a text spells")},n=(s,a,r)=>{let i={kind:"asText"},o={pattern:r},l=e.answer({kind:"readShownValue",value:a,numberFormat:o,room:i,locale:s});if(l.kind!=="shownValue")throw Error("sheets-core did not say what a cell shows");return l.shown};return{dayTypedInLocaleAs:t,shownInLocaleWithRoomForAll:(s,a,r)=>{let i=n(s,a,r);return i.kind==="text"?i.text:null},patternReadInLocale:(s,a,r)=>{let i=e.answer({kind:"readKindOfPattern",pattern:a});if(i.kind==="refused")return i;if(i.kind!=="kindOfPattern")throw Error("sheets-core did not read a pattern");let o={kind:"number",value:r(i.numberFormatKind)},l=n(s,o,a);return{kind:"numberFormat",numberFormat:{pattern:a},shown:l}},formulaInLocale:(s,a)=>{let r=e.answer({kind:"readFormulaTextInLocale",text:a,locale:s});if(r.kind==="formulaTextInLocale")return r.text;if(r.kind==="refused")return null;throw Error("sheets-core did not write a formula in a locale")},patternsOfLocale:s=>{let a=e.answer({kind:"readPatternsOfMoney",locale:s});if(a.kind!=="patternsOfMoney")throw Error("sheets-core did not say how a locale writes its money");let r=e.answer({kind:"readPatternsOfDatesWithTheMonthNamed",locale:s});if(r.kind!=="patternsOfDatesWithTheMonthNamed")throw Error("sheets-core did not say how a locale writes a date with the month named");return{currency:a.withTwoDecimals,roundedCurrency:a.withNoDecimals,mediumDate:r.withTheMonthForShort,longDate:r.withTheMonthInFull,monthAndDay:r.monthAndDay,monthAndYear:r.monthAndYear}},fitOfColumnReadingsInLocale:(s,a,r)=>{let i=e.answer({kind:"readFitOfColumnReadings",readings:a,texts:r,locale:s});if(i.kind==="fitOfColumnReadings")return i.fits;if(i.kind==="refused")return null;throw Error("sheets-core did not say how a column takes its readings")},textsUnderAColumnReadingInLocale:(s,a,r)=>{let i=e.answer({kind:"readTextsUnderAColumnReading",reading:a,texts:r,locale:s});if(i.kind==="textsUnderAColumnReading")return i;if(i.kind==="refused")return null;throw Error("sheets-core did not read the texts of a column")},labelsOfADropdownColumn:s=>{let a=e.answer({kind:"readLabelsOfADropdownColumn",texts:s});if(a.kind!=="labelsOfADropdownColumn")throw Error("sheets-core did not say what the options of a column would say");return a.labels},listLinesAsKept:s=>{let a=e.answer({kind:"readListLinesAsKept",lists:[...s]});if(a.kind!=="listLinesAsKept")throw Error("sheets-core did not say how a cell keeps the lines of lists");return a.lines},timeZones:()=>{let s=e.answer({kind:"readTimeZones"});if(s.kind!=="timeZones")throw Error("sheets-core did not list the time zones");return s.timeZones},timeZoneNamed:s=>{let a=e.answer({kind:"readTimeZoneNamed",name:s});if(a.kind==="timeZoneNamed")return a.timeZone;if(a.kind==="refused")return null;throw Error("sheets-core did not say which time zone a name stands for")},locales:()=>Wm(e).locales}}function W0(e,t,n){let s=(R,x,_)=>{if(R.sheetId!==x.sheetId)return null;let N=e.answer({kind:"readCellsToCopy",cells:Rs(R,x),..._.length>0&&{rowsOutOfView:[..._]}});if(N.kind==="cellsToCopy")return N;if(N.kind==="refused")return null;throw Error("sheets-core did not write cells for a copy")},a=(R,x)=>{if(R.sheetId!==x.sheetId)return null;let _=e.answer({kind:"readDropdownOptionsToOffer",...Rs(R,x)});if(_.kind==="dropdownOptionsToOffer")return _.options;if(_.kind==="refused")return null;throw Error("sheets-core did not say which options to offer")},r=(R,x,_)=>{if(R.sheetId!==x.sheetId)return null;let N=e.answer({kind:"readCellsThatADropdownWouldClear",cells:Rs(R,x),dropdown:_});if(N.kind==="cellsThatADropdownWouldClear")return N;if(N.kind==="refused")return null;throw Error("sheets-core did not say what a dropdown would clear")},i=R=>{let{sheetId:x}=R,_=e.answer({kind:"readDefaultValueAndLimits",sheetId:x,cell:en(R)});if(_.kind==="defaultValueAndLimits")return _;if(_.kind==="refused")return null;throw Error("sheets-core did not read the default value and the limits of a cell")},o=R=>{let x=e.answer({kind:"readCellsOfTheDropdownAt",sheetId:R.sheetId,cell:en(R)});if(x.kind==="cellsOfDropdown")return x;if(x.kind==="refused")return null;throw Error("sheets-core did not say where the cells of a dropdown are")},l=R=>{let x=e.answer({kind:"readWhatATableChanges",table:R,newIdCode:t()});if(x.kind==="whatATableChanges"||x.kind==="refused")return x;throw Error("sheets-core did not say what a table changes in a sheet")},u=(R,x)=>{let _=e.answer({kind:"readFormatsGiven",sheetId:R,asIf:[...x]});if(_.kind==="formatsGiven")return _.notWorkedOut===null?_:null;if(_.kind==="refused")return null;throw Error("sheets-core did not say what conditional formats would give")},c=(R,x)=>{if(R.sheetId!==x.sheetId)return null;let _=Rs(R,x),N=e.answer({kind:"readConditionalFormatSuggestions",cells:_});if(N.kind==="conditionalFormatSuggestions")return N;if(N.kind==="refused")return null;throw Error("sheets-core did not suggest conditional formats")},d=R=>Gm(e,R),f=R=>{let[{sheetId:x},_]=[R,en(R)];return Qu(e.answer({kind:"readCellTableAt",sheetId:x,cell:_}))},m=(R,x)=>{let _=e.answer({kind:"readCellTableDeclaredAs",sheetId:R,cellTable:x});return _.kind==="refused"&&_.refusal==="readTookTooLong"?"tookTooLong":Qu(_)??"nowhere"},g=R=>{let x=e.answer({kind:"readCellTables",sheetId:R});if(x.kind==="cellTables")return x.cellTables;if(x.kind==="refused")return x.refusal==="readTookTooLong"?"tookTooLong":null;throw Error("sheets-core did not list the cell tables of a sheet")},b=(R,x)=>{if(R.sheetId!==x.sheetId)return null;let _=Rs(R,x),N=e.answer({kind:"readConditionalFormatsAsAgentIsTold",cells:_});if(N.kind==="conditionalFormatsAsAgentIsTold")return N.told;if(N.kind==="refused")return null;throw Error("sheets-core did not say what Agent is told of conditional formats")},I=(R,x)=>{let _=e.answer({kind:"readConditionalFormatsInIds",sheetId:R,written:x});if(_.kind==="conditionalFormatsInIds")return _.read;if(_.kind==="refused")return null;throw Error("sheets-core did not read conditional formats in ids")},h=(R,x)=>{let _=e.answer({kind:"readConditionalFormatsByAddress",sheetId:R,rules:[...x]});if(_.kind==="conditionalFormatsByAddress")return _.rules;if(_.kind==="refused")return null;throw Error("sheets-core did not read conditional formats by address")},y=(R,x)=>{let _=e.answer({kind:"readProposedFormulaValue",sheetId:R.sheetId,cell:en(R),text:x});if(_.kind==="proposedFormulaValue")return{cell:_.cell};if(_.kind==="refused")return null;throw Error("sheets-core did not say what an entry comes to")},w=(R,x)=>{let _=e.answer({kind:"readFilteredRows",table:R,filter:x});if(_.kind==="filteredRows"||_.kind==="refused")return _;throw Error("sheets-core did not say which rows a filter takes out of view")},k=(R,x,_)=>{let N=e.answer({kind:"readValuesOfFilteredColumn",table:R,filter:x,c:_});if(N.kind==="valuesOfFilteredColumn"||N.kind==="refused")return N;throw Error("sheets-core did not say what a column of a filtered table holds")},O=R=>{let x=e.answer({kind:"readRowsInSortedOrder",...R});if(x.kind==="rowsInSortedOrder"||x.kind==="refused")return x;throw Error("sheets-core did not say in which order a sort would put rows")},v=R=>{let x=e.answer({kind:"readTablesOfSheet",sheetId:R});if(x.kind==="tablesOfSheet"||x.kind==="refused")return x;throw Error("sheets-core did not say which tables a sheet has")},A=R=>{let[{sheetId:x},_]=[R,en(R)],N=e.answer({kind:"readPivotTableAt",sheetId:x,cell:_});if(N.kind==="pivotTableAt"||N.kind==="refused")return N;throw Error("sheets-core did not say which pivot table a cell is part of")},C=(R,x,_,N)=>{let V=e.answer({kind:"readValuesToFilterPivotTableBy",source:R,c:x,keeps:_,listed:[...N]});if(V.kind==="valuesOfFilteredColumn"||V.kind==="refused")return V;throw Error("sheets-core did not say what a pivot table can be filtered by")},M=({sheetId:R,cell:x})=>{let _=e.answer({kind:"readCauseOfError",sheetId:R,cell:x});if(_.kind==="causeOfError")return _.cause;if(_.kind!=="refused")throw Error("sheets-core did not say why a formula comes to an error")};return{filteredRows:w,valuesOfFilteredColumn:k,rowsInSortedOrder:O,tablesOfSheet:v,pivotTableAt:A,valuesToFilterPivotTableBy:C,proposedFormulaValue:y,causeOfError:R=>{let x=M({sheetId:R.sheetId,cell:en(R)});if(x===void 0)return{said:Dm,isLatest:!0};let _=n()+Q0,N=null,V=x;for(let P=J0;P>0&&V?.kind==="showsTheSameError"&&n()<_;P-=1)N=V.cell,V=M(N);let H=V?.kind!=="showsTheSameError";return{said:{cause:x,passedOnFrom:H?N:null},isLatest:!0}},formatsGivenAsIf:u,conditionalFormatSuggestions:c,tableAtCell:d,cellTableAt:f,cellTables:g,cellTableDeclaredAs:m,conditionalFormatsAsAgentIsTold:b,conditionalFormatsInIds:I,conditionalFormatsByAddress:h,cellsToCopy:s,dropdownOptionsToOffer:a,cellsThatADropdownWouldClear:r,cellsOfTheDropdownAt:o,defaultValueAndLimitsOf:i,whatATableChanges:l}}function Um(e,t){let n=e.answer({kind:"readFormatsGiven",sheetId:t});if(n.kind!=="formatsGiven")throw Error("sheets-core did not say what conditional formats give");return n}function zm(e,t){let n=e.answer({kind:"readCellsChangedFromTheirDefaults",sheetId:t});if(n.kind!=="cellsChangedFromTheirDefaults")throw Error("sheets-core did not say which cells are changed from their defaults");return n.cells}function $m(e){let t=e.answer({kind:"readNamedRanges"});if(t.kind!=="namedRanges")throw Error("sheets-core did not read the named ranges");return t.namedRanges}function qm(e,t){if(t.connectedTable===void 0)return t;let n=e.answer({kind:"readConnectedTable",sheetId:t.sheetId});if(n.kind!=="connectedTable")throw Error("sheets-core did not read a connected table");return{...t,howItsTableStands:n}}function Ym(e,t){let n=e.answer({kind:"readInputsOfView",viewId:t});if(n.kind!=="inputsOfView"&&n.kind!=="refused")throw Error("sheets-core did not read the inputs of a view");return{viewId:t,answer:n}}function U0(e,t){let n=t.answer({kind:"describeSharedCode"});if(n.kind!=="sharedCodeDescription")throw Error("sheets-core did not describe itself");let s=e.answer({kind:"readWorkbookWithCellsPacked"});if(s.kind!=="workbookContentsWithCellsPacked")throw Error("sheets-core did not read the workbook");let a=s.sheets.flatMap(o=>o.conditionalFormats===void 0?[]:[{sheetId:o.sheetId,formatsGiven:Um(e,o.sheetId)}]),r=(s.views??[]).map(({viewId:o})=>Ym(e,o)),{localeOfANewWorkbook:i}=Wm(t);return{kind:"everything",description:n,localeOfANewWorkbook:i,contents:{...s,sheets:s.sheets.map(o=>qm(e,o))},given:a,inputsOfViews:r,namedRanges:s.namedRanges===void 0?[]:$m(e),changedFromDefaults:s.sheets.flatMap(({sheetId:o,cellFormats:l=[]})=>nl(l)?[{sheetId:o,cells:zm(e,o)}]:[])}}function z0(e,t){let n=e.answer({kind:"readViews"});if(n.kind!=="views")throw Error("sheets-core did not read the views");let s=new Set(n.views.map(({viewId:a})=>a));return{viewsNow:n.views,inputsNow:t.filter(a=>s.has(a)).map(a=>Ym(e,a))}}function Km(e,t,n,s){if(n.length===0)return{rowsListed:n,cellsNow:[],spilledCellsNow:[]};let a=n==="all"?null:n,r=e.answer({kind:"readRowsWithCellsPacked",sheetId:t,rows:a,columns:s});if(r.kind==="refused")return null;if(r.kind!=="rowsWithCellsPacked")throw Error("sheets-core did not read rows");return{rowsListed:n,cellsNow:r.cells,spilledCellsNow:r.spilledCells??[]}}function $0(e,t,n,s,a,r){let i=({sheetId:l,cells:u,isLayoutChanged:c,areFormatsGivenChanged:d})=>{let f=c?e.answer({kind:"readSheetLayout",sheetId:l}):null;if(f!==null&&f.kind!=="sheetLayout")throw Error("sheets-core did not read the layout of a sheet");let m=f===null?null:qm(e,f),g=a(l,m)?"all":[...new Set(u.map(({r:h})=>h))],b=Km(e,l,g,null);if(b===null)throw Error("sheets-core did not read rows");let I=m===null?r(l):nl(m.cellFormats??[]);return{sheetId:l,...b,layoutNow:m,formatsGivenNow:d===!0?Um(e,l):null,cellsChangedFromDefaultsNow:I?zm(e,l):ll}},o=s?e.answer({kind:"readTimeZone"}):null;if(o!==null&&o.kind!=="timeZone")throw Error("sheets-core did not read the time zone");return{kind:"changed",sheets:t.map(i),views:n.length===0?null:z0(e,n),timeZone:o,namedRanges:t.some(({isLayoutChanged:l})=>l)?$m(e):null}}function q0(e,t,n){if(t.kind==="everything"){let{contents:a}=t;return b0({...a,sheets:a.sheets.map(nA)},{...t.description,localeOfANewWorkbook:t.localeOfANewWorkbook},Z0(n),t.given,t.inputsOfViews,t.namedRanges,t.changedFromDefaults)}if(e===null)throw Error("changes were listed to a page that has read nothing");let s=Hm(e,t.sheets.map(Jm),t.views);return{...s,timeZone:t.timeZone===null?s.timeZone:t.timeZone.timeZone,namedRanges:t.namedRanges??s.namedRanges}}function Y0(){let e=new Map;return{note(t){if(t.kind==="everything"){let{sheets:n}=t.contents;e=new Map(n.map(({sheetId:s,cells:a})=>[s,{whole:nc(a),since:0}]));return}for(let{sheetId:n,rowsListed:s,cellsNow:a}of t.sheets){let{whole:r=0,since:i=0}=e.get(n)??{},o=nc(a);e.set(n,s==="all"?{whole:o,since:0}:{whole:r,since:i+o})}},mayBeTwiceWhatIsNeededIn(t){let{whole:n=0,since:s=0}=e.get(t)??{};return s>Math.max(n,aA)}}}function ec({connectedTable:e,howItsTableStands:t}){return e===void 0?null:JSON.stringify([e.snapshot?.snapshotId,e.columns,t?.rows])}function K0(){let e=new Map;return{note(t){let n=t.kind==="everything"?t.contents.sheets:t.sheets.flatMap(({layoutNow:s})=>s??[]);for(let s of n)e.set(s.sheetId,ec(s))},differIn:t=>ec(t)!==(e.get(t.sheetId)??null)}}function X0(e,t,n=Zm(e,t),s){let a=null,[r,i]=[Y0(),K0()],o=(u,c)=>r.mayBeTwiceWhatIsNeededIn(u)||c!==null&&i.differIn(c),l=u=>{r.note(u),i.note(u);let c=s===void 0?u:tA(u);return a=q0(a,c,t),s?.(u),fi(a,n)};return{readEverything:()=>l(U0(e,t)),readChanged(u,c,d){if(a===null)throw Error("changes were listed to a page that has read nothing");let{sheets:f}=a;return l($0(e,u,c,d,o,m=>f.some(g=>g.summary.sheetId===m&&g.hasDefaultValue)))},readWithCellsIn(u,c,d){let f=Km(e,u,c,d);if(a===null||f===null)return null;let m=Jm({sheetId:u,...f,layoutNow:null,formatsGivenNow:null,cellsChangedFromDefaultsNow:null});return fi(Hm(a,[m]),n)}}}const Xm=()=>[...crypto.getRandomValues(new Uint8Array(10))].map(e=>"abcdefghijkmnpqrstuvwxyz23456789"[e%32]).join(""),tc=new Map,Z0=e=>t=>{let n=tc.get(t);if(n!==void 0)return n;let s=e.answer({kind:"readKindOfPattern",pattern:t});if(s.kind!=="kindOfPattern")throw Error("sheets-core did not read the pattern of a number format that a cell has");return tc.set(t,s.numberFormatKind),s.numberFormatKind},J0=39,Q0=50,Zm=(e,t,n=Xm,s=()=>performance.now())=>({...j0(t),...W0(e,n,s)}),eA=(e,t)=>e.kind==="everything"?{...e,contents:{...e.contents,sheets:e.contents.sheets.map(n=>({...n,cells:t()}))}}:{...e,sheets:e.sheets.map(n=>({...n,cellsNow:t()}))},tA=e=>e.kind==="everything"?{...e,contents:{...e.contents,sheets:e.contents.sheets.map(t=>({...t,cells:[],spilledCells:[]}))}}:{...e,sheets:e.sheets.map(t=>({...t,rowsListed:[],cellsNow:[],spilledCellsNow:[]}))},Jm=e=>({...e,cellsNow:Fm(e.cellsNow)}),nA=e=>({...e,cells:Fm(e.cells)}),sA=1500,nc=e=>e.reduce((t,{lists:n,texts:s})=>t+sA+n.byteLength+s.length,0),aA=8388608;let Qm=1;const Mr=e=>e*Qm,rA=e=>e,oA=e=>e/Qm,iA=48,lA="comfortable",Xn=e=>13*e/10,uA=1.3,cA=18,Zn=e=>Math.max(cA,Math.ceil(uA*Xn(e))),dA=1.2,eh=e=>Math.round((Zn(e)-dA*Xn(e))/2),th=e=>Zn(e)-2*eh(e),jn={comfortable:{over:5,under:4,beside:6,besideBox:3,besideBoxAtRight:4,afterMark:5,markIntoWords:2},compact:{over:2,under:2,beside:4,besideBox:4,besideBoxAtRight:4,afterMark:3,markIntoWords:0}},nh=1,fA=(e,t,{over:n,under:s})=>Math.min(h0,n+rA(Zn(t)+(e-1)*th(t))+s+nh),mA=(e,t,n)=>fA(e,t,jn[n]),sh=(e,t)=>mA(1,e,t),hA=e=>sh(pt.font.size,e);hA(lA);const pi=(e,t,n)=>Math.max(t,Math.min(e,n)),sc=(e,t,n)=>e>=t&&e<t+n;function pA(e,t,n,s,a=0,r=!1){let[i,o]=[jn.compact,jn[n]],l=e-IA(t),u=pi(a,0,l),c=pi(l-u,0,o.over-i.over+o.under-i.under),d=s==="right"?o.besideBoxAtRight:o.besideBox,f=r?d:o.beside,m={left:1,center:0,right:-1}[s]*(f-i.beside);return{over:i.over+Math.ceil(c/2),under:i.under+Math.floor(c/2)+u,left:Js/2+m,right:Js/2-m}}function gA({left:e,right:t},n){let s=e-(t-oh);return n==="right"?{atLeft:Math.max(0,-s),atRight:0}:{atLeft:0,atRight:Math.max(0,s)}}const ac=13;function yA(e){let t=(iA-2)/(vA.plain*e.length),n=Math.max(ac,t);return Mr(ac)>n?oA(n):void 0}const wA=1.8461538461538463,bA=(e,t)=>e===null?0:(e+1)*wA*Xn(t),rc=e=>({after:jn[e].afterMark,intoWords:jn[e].markIntoWords}),IA=e=>sh(e,"compact"),ah=4,rh=({over:e})=>pi(2*(e-3),0,ah),oh=1,Js=8;2*jn.comfortable.beside;Js-jn.comfortable.beside-oh;const vA={plain:.64};di(0,[],0),di(0,[],0);function gi(e){switch(e.kind){case"standard":return`${e.hue} ${e.shade}`;case"rgb":return e.hex;case"none":return e.kind}}const kA={kind:"none"},AA={hex:"#f3f3f3"};function ih(e){let[t,n,s]=lh(e);return[ho(t),ho(n),ho(s)]}function vt(e){let[t,n,s]=ih(e),a=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*s),r=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*s),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*s),o=1.9779984951*a-2.428592205*r+.4505937099*i,l=.0259040371*a+.7827717662*r-.808675766*i;return{lightness:.2104542553*a+.793617785*r-.0040720468*i,chroma:Math.hypot(o,l),hue:Math.atan2(l,o)}}function vs({lightness:e,chroma:t,hue:n}){let s=t*Math.cos(n),a=t*Math.sin(n),r=(e+.3963377774*s+.2158037573*a)**3,i=(e-.1055613458*s-.0638541728*a)**3,o=(e-.0894841775*s-1.291485548*a)**3;return[po(4.0767416621*r-3.3077115913*i+.2309699292*o),po(-1.2684380046*r+2.6097574011*i-.3413193965*o),po(-.0041960863*r-.7034186147*i+1.707614701*o)]}function nr(e,t){let n=0,s=CA;for(let a=0;a<12;a+=1){let r=(n+s)/2;TA({lightness:e,chroma:r,hue:t})?n=r:s=r}return n}function ks(e,t){if(e.chroma<uh)return Ts(vs({lightness:t,chroma:0,hue:0}));let n=nr(e.lightness,e.hue),s=(n===0?0:Math.min(1,e.chroma/n))*nr(t,e.hue);return Ts(vs({lightness:t,chroma:s,hue:e.hue}))}function As(e){let[t,n,s]=ih(e);return .2126*t+.7152*n+.0722*s}function Lt(e,t){let[n,s]=[As(e),As(t)];return(Math.max(n,s)+.05)/(Math.min(n,s)+.05)}const lh=e=>{let t=Number.parseInt(e.slice(1),16);return[(t>>16)/255,(t>>8&255)/255,(t&255)/255]},Ts=e=>`#${e.map(t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0")).join("")}`,ho=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,po=e=>e<=.0031308?12.92*e:1.055*e**.4166666666666667-.055,oc=.00196078431372549,TA=e=>vs(e).every(t=>t>=-oc&&t<=1+oc),CA=.4,uh=.012;function OA(e){let t=vt(e),n=Lt(e,nn.onLight),s=vt(nn.onDark).lightness,a=1;for(let r=0;r<16;r+=1){let i=(s+a)/2;Lt(ks(t,i),nn.onDark)<n?s=i:a=i}return ks(t,a)}function xA(e,t){let[n,s]=mh[t],a=tn[e];return{onLight:a[t],onDark:n===s?a[n]:ar(a[n],a[s],.5)}}function sr(e){switch(e.kind){case"none":return null;case"standard":return xA(e.hue,e.shade);case"rgb":return{onLight:e.hex,onDark:EA(e.hex)}}}function ch(e){switch(e.kind){case"none":return null;case"standard":return PA(e.hue,e.shade);case"rgb":return{onLight:e.hex,onDark:OA(e.hex)}}}function ul(e,t=FA){let n=DA;for(let s of t){if(e>s.onLight){let a=(n.onLight-e)/(n.onLight-s.onLight);return n.onDark+a*(s.onDark-n.onDark)}n=s}return n.onDark}function dh(e,t,n){let s=ks(e,t),a=Object.values(tn).map(i=>vt(i[n]).chroma),r=Math.max(e.chroma,...a);return vt(s).chroma<=r?s:Ts(vs({...e,lightness:t,chroma:r}))}function EA(e){let t=vt(e),n=ul(t.lightness,jA);return dh(t,n,500)}function SA(e,t){let{lightness:n,chroma:s,hue:a}=vt(e),r=vt(t);if(Lt(e,nn.onLight)<Wn||s<uh||r.chroma>=s)return t;let i=ul(n),{lightness:o}=r;for(;o>i&&nr(o,a)<s;)o=Math.max(i,o-or);return Ts(vs({lightness:o,chroma:Math.min(s,nr(o,a)),hue:a}))}function RA(e,t,n){let s=vt(t);for(let a=or;a<=1;a+=or)for(let r of[s.lightness+a,s.lightness-a]){if(r<0||r>1)continue;let i=ks(s,r);if(Lt(i,e)>=n)return i}return null}function MA(e,t,n){if(n<1.01)return e;let s=vt(t);for(let{lightness:a}=vt(e);a<=1;a+=or){let r=ks(s,a);if(Lt(r,e)>=n)return r}return ks(s,1)}function ic(e){let t=lc(e,rr.onLight,rr.onDark);return Lt(t,e)>=Wn?t:lc(e,"#000000","#ffffff")}function cl(e,t){if(e.kind==="none")return t===null?null:{onLight:ic(t.onLight),onDark:ic(t.onDark)};let n=ch(e);if(n===null)return null;let s=t??nn,a=Lt(n.onLight,s.onLight);if(a<Wn)return t===null?n:{onLight:n.onLight,onDark:MA(t.onDark,n.onLight,a)};let r=e.kind==="rgb"?SA(e.hex,n.onDark):n.onDark;return{onLight:n.onLight,onDark:hh(r,s.onDark)}}function NA(e){let t=uc.get(e);if(t!==void 0)return t;let n=HA(e.fillColor,e.font.color);return uc.set(e,n),n}function HA(e,t){let[n,s]=[sr(e),ch(t)];if(!(n!==null&&s!==null&&As(s.onLight)>As(n.onLight)&&Lt(s.onLight,n.onLight)>=Wn))return{fill:n,text:cl(t,n)};let a=_A(e,n.onLight);return{fill:{onLight:n.onLight,onDark:a},text:{onLight:s.onLight,onDark:hh(s.onLight,a)}}}function _A(e,t){if(e.kind==="standard"&&e.shade===600)return tn[e.hue][700];if(e.kind==="standard"&&e.shade===800)return ar(tn[e.hue][700],tn[e.hue][800],.5);let n=vt(t),s=ul(n.lightness,WA);return dh(n,s,700)}function BA({fill:e,text:t}){if(e===null||t===null)return!1;let[n,s,a]=lh(e.onLight),r=Ts([go(n),go(s),go(a)]);return As(t.onLight)>As(e.onLight)&&Lt(t.onLight,r)>=Wn}function ar(e,t,n){let[[s,a,r],[i,o,l]]=[cc(e),cc(t)],[u,c]=[Da(a,o,n),Da(r,l,n)];return Ts(vs({lightness:Da(s,i,n),chroma:Math.hypot(u,c),hue:Math.atan2(c,u)}))}function LA([e,...t],n){let[s,a]=[e,e];for(let o of t)if([s,a]=[a,o],n<=o.at)break;let r=a.at===s.at?n<s.at?0:1:(n-s.at)/(a.at-s.at),i=Math.round(Math.min(1,Math.max(0,r))*ph);return{from:s.color,to:a.color,step:i}}function VA({from:e,to:t,step:n},s){let a=[e,t,s].map(gi).join("|")+`|${n}`,r=dc.get(a);if(r!==void 0)return r;let[i,o]=[sr(e)??nn,sr(t)??nn],l=n/ph,u={onLight:ar(i.onLight,o.onLight,l),onDark:ar(i.onDark,o.onDark,l)},c={fill:u,text:cl(s,u)};return dc.set(a,c),c}const tn={gray:{100:"#e0e0e0",200:"#c2c2c2",300:"#a4a4a4",400:"#878787",500:"#6b6b6b",600:"#515151",700:"#383838",800:"#202020"},red:{100:"#fad6d6",200:"#f4abab",300:"#ec7e7e",400:"#e34948",500:"#b93535",600:"#8e2626",700:"#641919",800:"#3c0e0e"},orange:{100:"#f7d8cb",200:"#f4ae94",300:"#ec835a",400:"#d95926",500:"#ae461c",600:"#863311",700:"#5d230b",800:"#371407"},yellow:{100:"#f9dca4",200:"#fab219",300:"#db9300",400:"#b77700",500:"#945d00",600:"#734500",700:"#512e00",800:"#311a00"},green:{100:"#caeac7",200:"#91d68b",300:"#55bf50",400:"#0ca30c",500:"#008300",600:"#006300",700:"#074506",800:"#11260f"},teal:{100:"#bfebdb",200:"#7ad7b4",300:"#3bbd8c",400:"#199e70",500:"#0f7e5c",600:"#065f49",700:"#034235",800:"#022720"},blue:{100:"#cde2fb",200:"#9ec5f4",300:"#6da7ec",400:"#3987e5",500:"#256abf",600:"#184f95",700:"#0d366b",800:"#032042"},purple:{100:"#dfdbfd",200:"#bfb9f5",300:"#a096eb",400:"#8173e3",500:"#6250d6",600:"#4a3aa7",700:"#322777",800:"#1d1649"},magenta:{100:"#f9d4e2",200:"#f3a8c3",300:"#e87ba4",400:"#d55181",500:"#ad3d66",600:"#862a4c",700:"#5e1c34",800:"#390f1f"}},nn={onLight:"#ffffff",onDark:"#1a1a19"},rr={onLight:"#0b0b0b",onDark:"#f0efec"},fh={100:800,200:700,300:600,400:500,600:400,800:100},PA=(e,t)=>({onLight:tn[e][t],onDark:tn[e][fh[t]]}),mh={100:[700,800],200:[700,700],300:[600,700],400:[600,600],600:[500,600],800:[500,500]},Wn=4.5,or=.005,It=e=>vt(tn.gray[e]).lightness,DA={onLight:1,onDark:vt(nn.onDark).lightness},FA=[...[100,200,300,400,600,800].map(e=>({onLight:It(e),onDark:It(fh[e])})),{onLight:0,onDark:1}],GA="#252525",jA=[{onLight:vt(AA.hex).lightness,onDark:vt(GA).lightness},...[100,200,300,400,600,800].map(e=>{let[t,n]=mh[e];return{onLight:It(e),onDark:(It(t)+It(n))/2}}),{onLight:0,onDark:It(500)}],WA=[{onLight:It(300),onDark:(It(600)+It(700))/2},{onLight:It(600),onDark:It(700)},{onLight:It(800),onDark:(It(700)+It(800))/2},{onLight:0,onDark:(It(700)+3*It(800))/4}],hh=(e,t)=>Lt(e,t)>=Wn?e:RA(t,e,Wn)??e,lc=(e,t,n)=>Lt(t,e)>=Lt(n,e)?t:n,UA=(e,t)=>cl(e,sr(t)),uc=new WeakMap,zA=.15,go=e=>Da(e,1,zA),cc=e=>{let{lightness:t,chroma:n,hue:s}=vt(e);return[t,n*Math.cos(s),n*Math.sin(s)]},Da=(e,t,n)=>e+(t-e)*n,ph=32,dc=new Map;function $A(e,t){return e.kind==="none"?t.kind==="none"?null:t:t.kind==="none"?e:fc(t.style)>fc(e.style)?t:e}function qA({color:e}){let t=mc.get(gi(e));if(t!==void 0)return t;let n=UA(e,kA);return mc.set(gi(e),n),n}const YA=["dotted","dashed","thin","medium","double","thick"],fc=e=>YA.indexOf(e),Ms=e=>({width:e,strokeWidth:e,strokes:[0],dashes:null}),gh={thin:Ms(1),medium:Ms(2),thick:Ms(3),dashed:{...Ms(1),dashes:"4 3"},dotted:{...Ms(1),dashes:"1 2"},double:{width:3,strokeWidth:1,strokes:[-1,1],dashes:null}},KA=e=>gh[e].width;Math.max(...Object.values(gh).map(({width:e})=>e));const mc=new Map;function XA(e){let t=[...e.join("").matchAll(yh)],n=0;return e.map(s=>{let[a,r]=[n,n+s.length];n=r;let[i,o]=["",a];for(let{0:l,index:u}of t){let c=u+l.length;c<=a||u>=r||(i+=s.slice(o-a,Math.max(u,a)-a)+(u>=a?" ":""),o=Math.min(c,r))}return i+s.slice(o-a)})}function ZA(e){return e==="clip"?e:e?"wrap":"overflow"}const yh=/(?<![ \t])[ \t]*[\r\n][ \t\r\n]*/g,JA=e=>e.replaceAll(yh," "),QA=({cellControl:e})=>e?.kind==="checkbox",eT=e=>e?.kind==="boolean"?e.value:null;function tT(e){try{return new URL(e)}catch{return null}}function wh(e){let t=e.trim(),n=sT.test(t),s=n?`https://${t}`:t;if(s.length>yi||!/^https?:\/\/\S+$/i.test(s))return null;let a=tT(s);if(a===null)return null;let{href:r,hostname:i,username:o,password:l}=a;return r.length>yi||o!==""||l!==""||i.endsWith(".")||i.length>nT||n&&!aT.test(i)||`.${i}`.endsWith(".agentusercontent.com")?null:r}function dl(e,t){let{origin:n}=new URL(t),s=t.slice(n.length);if(s.length<=e)return t;let a=Math.floor(e/3);return`${n}${s.slice(0,e-a)}…${s.slice(-a)}`}const yi=2048,nT=253,sT=/^[Ww]{3}\.[!-~]*$/,aT=/^www(?:\.[a-z\d-]+){2,}$/,fl=240;function rT(e){let t=new Map;for(let s of e)t.set(s,(t.get(s)??0)+1);let n=e.length;for(;n>0;n-=1){let s=e.charAt(n-1);if(pT.includes(s))continue;let[a,r]=[t.get(s)??0,t.get(hc[s]??"")];if(hc[s]===void 0||a<=(r??0))break;t.set(s,a-1)}return e.slice(0,n)}function oT(e){if(gT.test(e))return null;let t=wh(e);if(t===null)return null;let n=e.replace(/^https?:\/\//i,"");if(n.split("/",1)[0]?.includes("@")===!0)return null;let[s=""]=n.split(/[/?#]/),a=s.replace(/:\d*$/,"").replaceAll(/[A-Z]/g,r=>r.toLowerCase());return yT.test(a)&&a===new URL(t).hostname?t:null}function bh(e){let t=[],n=new Set,[s,a,r]=[0,0,0];for(let{0:i,index:o}of e.matchAll(fT)){if(a===ml||s===dT)break;if(s+=1,i.length>2*yi)continue;let l=e.charAt(o-1);if(mT.test(l)||hT.test(l)&&/^www\./i.test(i))continue;let u=rT(i),c=oT(u);c===null||dl(fl,c)!==c||(o>r&&t.push({text:e.slice(r,o),startsAt:r,url:null,...yo}),t.push({text:u,startsAt:o,url:c,...yo}),n.add(c),a+=1,r=o+u.length)}return r<e.length&&t.push({text:e.slice(r),startsAt:r,url:null,...yo}),a===0?Fa:{parts:t,addresses:[...n]}}function iT(e){let t=wh(e);return t!==null&&dl(fl,t)===t?t:null}function lT({paragraphs:e},t){let n=vh.test(t)?bh(t).parts:[],s=new Set,a=l=>l===null||!s.has(l)&&s.size===ml?null:(s.add(l),l),r=e.flatMap(({runs:l},u)=>[...u===0?[]:[{text:`
4
- `,marks:Ih,link:null}],...l]),i=[];r.reduce((l,u,c)=>(i[c]=l,l+u.text.length),0);let o=(l,u)=>r.some(({text:c,link:d},f)=>d!==null&&(i[f]??0)<u&&(i[f]??0)+c.length>l);return{parts:r.flatMap(({text:l,marks:u,link:c},d)=>{let[f,m]=[i[d]??0,(i[d]??0)+l.length];if(c!==null||n.length===0){let g=c===null?null:a(iT(c));return[{text:l,startsAt:f,url:g,isLinkOnWords:g!==null,marks:u}]}return n.flatMap(({text:g,startsAt:b,url:I})=>{let[h,y]=[Math.max(f,b),Math.min(m,b+g.length)];if(h>=y)return[];let w=!o(b,b+g.length);return[{text:t.slice(h,y),startsAt:h,url:w?a(I):null,isLinkOnWords:!1,marks:u}]})}),addresses:[...s]}}function uT(e){let t=[];for(let n of e){let s=t.at(-1)?.at(-1);s!==void 0&&n.url!==null&&n.url===s.url&&!n.isLinkOnWords&&!s.isLinkOnWords&&n.startsAt===s.startsAt+s.text.length?t.at(-1)?.push(n):t.push([n])}return t}function cT(e,{cellControl:t},n,s){if(e===null||t.kind==="dropdown"||s!==null)return Fa;let{input:a}=e,r=a.kind==="richText"?ol(e):null;if(!(a.kind==="text"?a.value===n:r!==null&&r===n)||a.kind!=="richText"&&!vh.test(n))return Fa;let i=pc.get(e);if(i?.text===n)return i.links;let o=a.kind==="richText"?lT(a,n):bh(n);return pc.set(e,{text:n,links:o}),o}const Ih=[],yo={isLinkOnWords:!1,marks:Ih},ml=10,dT=30,fT=/https?:\/\/[^\s<>"'`。,、;:!?]+|\bwww\.[^\s<>"'`。,、;:!?]+/gi,mT=/[A-Za-z\d@.-]/,hT=/[/:=?&#%]/,pT=".,;:!?\f\r\uFEFF*_",hc={")":"(","]":"[","}":"{"},gT=/[\p{C}\\]/u,yT=/^[a-z\d-]+(?:\.[a-z\d-]+)+$/,Fa={parts:[],addresses:[]},vh=/https?:\/\/|www\./i,pc=new WeakMap;function wT(e,t,n){let s=Mr(Zn(t)),a=kT+rh(n),r=e-n.over-n.under-nh;return Math.max(1,Math.floor((r+a)/(s+a)))}const bT=12,kh=8,IT=4,Ah=16,gc=4,vT=e=>Math.ceil((Mr(Zn(e))+ah-Ah)/2),yc=(e,t)=>vT(t)+Ah+gc+(e?gc+bT+IT:kh),Th=4,kT=4,Ch=(e,t,n)=>yc(t,n)+(e-1)*(Th+yc(!1,n));function AT(e,t){let[n,s]=[1,0];for(let[a,r]of e.entries()){let i=s+Th+r;a===0?s=r:i<=t?s=i:[n,s]=[n+1,r]}return n}function TT(e,t,n){let{cellWidth:s,nameWidths:a,widthOfCount:r,fontSizeInPoints:i,opensList:o}=t,l=a.slice(0,e).map((f,m)=>f+Ch(1,m===0&&o,i)),u=a.length-e,c=u===0?[]:[2*kh+r(u)],d=s-Js-(n?0:1);return AT([...l,...c],d)}function CT({lineCount:e,...t}){for(let n=t.nameWidths.length;n>1;n-=1)if(TT(n,t,e===1)<=e)return n;return 1}const OT=16,xT=(e,t)=>e-Js>=Ch(1,!0,t)+OT,hl=(e,t)=>e.listSheets().find(n=>n.sheetId===t),ET=Object.freeze(["quick","default","complex"]),ST=Object.freeze(["cancelled","invalid_request","prompt_too_large","transform_error","queue_overflow","not_granted","sampling_disabled","not_declared","capability_disabled","capability_removed","images_unavailable","tools_unavailable","rate_limited","session_expired","image_rejected","refused","empty_completion","invalid_json","upstream_error"]),RT=Object.freeze({modelsList:"models.list",modelsSet:"models.set",modelsCatalog:"models.catalog",modelsRemove:"models.remove",modelsTest:"models.test",grantsList:"grants.list",grantsAnswer:"grants.answer",grantsRevoke:"grants.revoke",usageSummary:"usage.summary"});new TextEncoder;[...ET];new Set(ST);new TextEncoder;new TextEncoder;({...RT});const MT="[Artifact comment sent to agent]",NT="[Artifact edit request sent to agent]",HT="[Artifact task finished]",_T="[Open Artifacts] ",BT=["quickstart","list","publish","read","open","call","adopt","delete","share"],LT=["get","list","query","set","update","delete","str_replace","batch"],VT=["read","reply","resolve","reopen","wait"],PT=["share","export"],DT={type:"object",properties:{action:{type:"string",enum:BT,description:"What to do: quickstart, list, publish, read, open, call, adopt, delete or share. Omitted: publish."},intent:{type:"string",description:"quickstart: what is being made (design, design-system, slides, whiteboard, document, data, sheets, motion, page, other), or a few words about it."},scope:{type:"string",enum:["types","mine","all"],description:"list: types (the installed types), mine (this session's and this project's artifacts; the default) or all (every artifact)."},type:{type:"string",description:"list: only artifacts of this type (an id, or open-artifacts://type/<id>). quickstart: the type already chosen (an id), to get its create call and steps without matching."},query:{type:"string",description:"list: only artifacts whose title contains this text."},limit:{type:"integer",description:"list: how many to return (default 50, at most 200). read (file list): how many files (default and at most 400)."},cursor:{type:"string",description:"list / read (file list): the next_cursor of the previous page."},type_url:{type:"string",description:"publish without url: the type to create from (open-artifacts://type/<id>, from quickstart). read without url: the type to describe."},title:{type:"string",description:"publish without url: the new artifact's name. quickstart: the name it will have, to find similar ones."},folder:{type:"string",description:"publish without url: the exact folder for the new artifact (absolute, or relative to the workspace), only when the person named one. Omitted: Open Artifacts chooses the folder and its name. adopt: the folder to add."},location:{type:"string",enum:["home","workspace"],description:"publish without url: where the new artifact's folder goes when the person asked: workspace (in the project, under the working folder) or home (the person's Open Artifacts folder). Omitted: what the person's settings say. The folder is named from the title either way."},url:{type:"string",description:"An artifact: open-artifacts://artifact/<id>, as publish returned it."},files:{type:"object",additionalProperties:!0,description:'publish with url: files to write under the artifact root, as {"rel/path": "text"} or {"rel/path": {"content": "...", "encoding": "base64"}}; null deletes.'},if_match:{type:"object",additionalProperties:!0,description:'publish with url: {"rel/path": sha256 | null | "*"}. Write only while the file still has the sha256 you read, does not exist (null), or anyway ("*"). One mismatch writes nothing and returns the current versions.'},check:{type:"boolean",description:"publish with url: run the type's check action after writing; its result comes back as check."},capabilities:{type:"object",additionalProperties:!0,description:'publish, page artifacts only: the runtime capabilities the page may use, as {"db": true, "assets": true, ...}. Omitted: kept; {}: none; otherwise the whole set. With url it may be given without files.'},open:{type:"string",enum:["after_first_write","now","never"],description:"publish without url: after_first_write (the default) opens the page in your app once your first write lands; now opens it at once; never leaves it closed. Where your app cannot show pages by itself the result says so: open view_url in your app's built-in browser, if you have one."},related:{type:"boolean",description:"quickstart: list existing artifacts the recommended type can build on, such as design systems (default true)."},path:{type:"string",description:"read: one file or folder under the root (omitted: the record and the file list)."},paths:{type:"array",items:{type:"string"},description:"read: several files under the root at once."},name:{type:"string",description:"call: the action's name (check, upload, ...; read with url lists them)."},args:{type:"object",additionalProperties:!0,description:"call: the action's arguments. upload: {file: absolute path, name?, group?}."},panel:{type:"string",enum:PT,description:"open: also open the page's Share panel (share), for the person to share it on the network, or its Export tab (export), for them to download a file."},cloud:{type:"string",description:"share: publish the artifact to this cloud remote (its name, as `open-artifacts remote list` shows it). It works only on a remote the person set up and let agents publish to (agentMayPublish); otherwise the person publishes it, from the Share panel or with `open-artifacts publish <id> --remote <name>`."}}},FT={type:"object",properties:{action:{type:"string",enum:LT,description:"What to do: get, list, query, set, update, delete, str_replace or batch."},url:{type:"string",description:"The artifact (open-artifacts://artifact/<id>)."},collection:{type:"string",description:"The collection: alone for list / query (query needs it), with doc_id for one document."},doc_id:{type:"string",description:"With collection: the document to get / set / update / delete / str_replace."},path:{type:"string",description:"collection/doc_id, instead of the two."},data:{type:"object",additionalProperties:!0,description:"set / update: the document's fields."},file_path:{type:"string",description:"set / update: a JSON file holding the fields, instead of data."},if_match:{description:'set / update / delete / str_replace: the sha256 get returned (write only if unchanged), null (only if it does not exist) or "*" (replace whatever is there).'},field:{type:"string",description:"str_replace: the text field, as a dot path (body, notes.text)."},old:{type:"string",description:"str_replace: the passage to replace; it must occur exactly once."},new:{type:"string",description:"str_replace: the passage that replaces it."},where:{type:"array",items:{type:"object",additionalProperties:!0},description:"query: [{field, op, value}], all must hold. op: ==, !=, <, <=, >, >=, in, not-in (up to 30 values), array-contains."},order_by:{type:"object",additionalProperties:!0,description:'query: {field, dir: "asc" | "desc"}.'},limit:{type:"integer",description:"list / query: how many documents (default 100, at most 1000)."},cursor:{type:"string",description:"list / query: the next_cursor of the previous page."},out_file:{type:"string",description:"get / list / query: write the result to this JSON file (absolute, or relative to the workspace) and return only its path and counts."},writes:{type:"array",items:{type:"object",additionalProperties:!0},description:"batch: [{op: set|update|delete|str_replace, path | collection+doc_id, data | file_path, if_match?, field?, old?, new?}], at most 500."}},required:["action","url"]},GT={type:"object",properties:{action:{type:"string",enum:VT,description:"What to do: read, reply, resolve, reopen or wait."},url:{type:"string",description:"The artifact (open-artifacts://artifact/<id>). wait: optional."},thread_id:{type:"string",description:'read / reply / resolve / reopen: the full thread ID (after ";thread=" in the message), or a unique prefix of at least three characters.'},text:{type:"string",description:"reply: the answer."},resolve:{type:"boolean",description:"reply: resolve the thread too."},all:{type:"boolean",description:"read: resolved threads too."},since:{type:"string",description:"read: only threads with a message at or after this time (ISO 8601)."},acknowledge_duplicate:{type:"boolean",description:"reply: send the same text as your last reply in this thread again, on purpose."},timeout_ms:{type:"number",description:"wait: how long (default 600000)."}},required:["action"]},wc={Artifact:DT,ArtifactData:FT,ArtifactComments:GT},jT={Artifact:["Make and change artifacts: typed folders of files that open as live pages the person can view, edit, comment on and export. Actions:","- quickstart {intent, type?}: call first for a new artifact; recommends a type (or takes the one given) and returns the call that creates it, the steps for this app and similar artifacts that already exist.",'- list {scope: "mine" | "all" | "types", type?, query?}: find existing artifacts, or the installed types.',"- publish {type_url, title, folder?, open?}: create an artifact; the result carries its root folder and the type's instructions. publish {url, files, if_match?, check?}: write files when you have no file tools of your own. A page artifact also takes capabilities (on create or write): the runtime capabilities its page may use.","- read {url, path? | paths?, limit?, cursor?}: the artifact's record, files and actions, or some of its files with their sha256 (file listings page with limit and cursor). read {type_url}: a type's instructions, before creating.",`- open {url, panel?}: show it to the person in the computer's browser (or the app, when it shows pages), once its content is written. When your app has a built-in browser, open view_url there instead. panel "share" or "export" opens its Share panel or Export tab for them.`,"- call {url, name, args?}: run one of the type's actions (check, upload, ...). A long one answers {task, pending: true}; its result comes later as a message.","- adopt {url | folder}: take over an artifact, or add an existing folder. Only when the person asks.","- share {url}: whether it is shared on the local network, and its links. Only the person changes that, in the page's Share panel.","- delete {url}: forget an artifact; its folder stays. Only when the person asks."].join(`
5
- `),ArtifactData:'Read and write the document store of an artifact whose type keeps one (its instructions say so). get, list and query read documents with their sha256; set, update, delete, str_replace and batch write them. update merges fields, and {"__delete__": true} removes one; str_replace changes one passage of a long text field. Replacing or deleting an existing document needs if_match: the sha256 you read, or "*". Your writes show live on open pages.',ArtifactComments:`Comments the person leaves on their artifact's page, kept in the artifact's own folder on this computer (no outside service). read lists the threads; reply answers one (thread_id is after ";thread=" in the message), with resolve: true when it is done; resolve and reopen change a thread's state. A thread sent to you is the person asking for your answer in it, so replying there is what they asked for. Answer only threads sent to you, in one or two lines. wait blocks until the next message for this session: use it only when nothing else can wake you.`},bc={Artifact:{title:"Artifact",openWorldHint:!1},ArtifactData:{title:"Artifact data",openWorldHint:!1},ArtifactComments:{title:"Artifact comments",destructiveHint:!1,openWorldHint:!1}},WT={Artifact:{quickstart:"read",list:"read",read:"read",publish:"write",call:"write",open:"ui",delete:"remove",adopt:"remove",share:"person"},ArtifactData:{get:"read",list:"read",query:"read",set:"write",update:"write",str_replace:"write",batch:"write",delete:"write"},ArtifactComments:{read:"read",wait:"read",reply:"write",resolve:"write",reopen:"write"}},UT={Artifact:["publish","open","call","share"],ArtifactData:["get","list","query","set","update","str_replace","batch","delete"],ArtifactComments:["read","reply","resolve","reopen"]};function zT(e={any:!1,actions:!1}){return Object.keys(wc).map(t=>{const n=t==="Artifact"?e.any:e.actions;return{name:t,description:jT[t],inputSchema:wc[t],annotations:n?{...bc[t],openWorldHint:!0}:bc[t],actions:WT[t],remoteActions:[...UT[t]]}})}zT();const $T=300,qT=12,Ic=["Artifact","ArtifactData","ArtifactComments"];function In(e,t=$T){const n=String(e??"").replace(/[<>]/g,"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function YT(e){const t=In(e,Number.MAX_SAFE_INTEGER),n=t.search(/[.!?。!?](\s|$)/);return n>=0?t.slice(0,n+1):t}function KT(e){const t=In(e,24);return/^[a-z0-9]{1,5}$/i.test(t)?t.toUpperCase():t}const vc=e=>!e||/[.!?。!?…]$/.test(e)?e:`${e}.`;function XT(e,t=!1){const n=In(e.title,80)||e.id;if(t)return`- ${e.id}: ${n}`;const s=In(e.when)||In(YT(e.description)),a=(e.exports??[]).map(KT).filter(Boolean),r=[vc(n),vc(s),a.length?`Exports: ${a.join(", ")}.`:""].filter(Boolean);return`- ${e.id}: ${r.join(" ")}`}const ZT="Open Artifacts lets you make artifacts: typed folders of files (a slide deck, a design canvas, a whiteboard, a data dashboard, a spreadsheet, a doc, an animated motion piece, a free HTML page and more) that open as live pages the person can view, edit, comment on and export. You make and change them with the Artifact, ArtifactData and ArtifactComments tools.",JT=`<where_output_goes>
4
+ `,marks:Ih,link:null}],...l]),i=[];r.reduce((l,u,c)=>(i[c]=l,l+u.text.length),0);let o=(l,u)=>r.some(({text:c,link:d},f)=>d!==null&&(i[f]??0)<u&&(i[f]??0)+c.length>l);return{parts:r.flatMap(({text:l,marks:u,link:c},d)=>{let[f,m]=[i[d]??0,(i[d]??0)+l.length];if(c!==null||n.length===0){let g=c===null?null:a(iT(c));return[{text:l,startsAt:f,url:g,isLinkOnWords:g!==null,marks:u}]}return n.flatMap(({text:g,startsAt:b,url:I})=>{let[h,y]=[Math.max(f,b),Math.min(m,b+g.length)];if(h>=y)return[];let w=!o(b,b+g.length);return[{text:t.slice(h,y),startsAt:h,url:w?a(I):null,isLinkOnWords:!1,marks:u}]})}),addresses:[...s]}}function uT(e){let t=[];for(let n of e){let s=t.at(-1)?.at(-1);s!==void 0&&n.url!==null&&n.url===s.url&&!n.isLinkOnWords&&!s.isLinkOnWords&&n.startsAt===s.startsAt+s.text.length?t.at(-1)?.push(n):t.push([n])}return t}function cT(e,{cellControl:t},n,s){if(e===null||t.kind==="dropdown"||s!==null)return Fa;let{input:a}=e,r=a.kind==="richText"?ol(e):null;if(!(a.kind==="text"?a.value===n:r!==null&&r===n)||a.kind!=="richText"&&!vh.test(n))return Fa;let i=pc.get(e);if(i?.text===n)return i.links;let o=a.kind==="richText"?lT(a,n):bh(n);return pc.set(e,{text:n,links:o}),o}const Ih=[],yo={isLinkOnWords:!1,marks:Ih},ml=10,dT=30,fT=/https?:\/\/[^\s<>"'`。,、;:!?]+|\bwww\.[^\s<>"'`。,、;:!?]+/gi,mT=/[A-Za-z\d@.-]/,hT=/[/:=?&#%]/,pT=".,;:!?\f\r\uFEFF*_",hc={")":"(","]":"[","}":"{"},gT=/[\p{C}\\]/u,yT=/^[a-z\d-]+(?:\.[a-z\d-]+)+$/,Fa={parts:[],addresses:[]},vh=/https?:\/\/|www\./i,pc=new WeakMap;function wT(e,t,n){let s=Mr(Zn(t)),a=kT+rh(n),r=e-n.over-n.under-nh;return Math.max(1,Math.floor((r+a)/(s+a)))}const bT=12,kh=8,IT=4,Ah=16,gc=4,vT=e=>Math.ceil((Mr(Zn(e))+ah-Ah)/2),yc=(e,t)=>vT(t)+Ah+gc+(e?gc+bT+IT:kh),Th=4,kT=4,Ch=(e,t,n)=>yc(t,n)+(e-1)*(Th+yc(!1,n));function AT(e,t){let[n,s]=[1,0];for(let[a,r]of e.entries()){let i=s+Th+r;a===0?s=r:i<=t?s=i:[n,s]=[n+1,r]}return n}function TT(e,t,n){let{cellWidth:s,nameWidths:a,widthOfCount:r,fontSizeInPoints:i,opensList:o}=t,l=a.slice(0,e).map((f,m)=>f+Ch(1,m===0&&o,i)),u=a.length-e,c=u===0?[]:[2*kh+r(u)],d=s-Js-(n?0:1);return AT([...l,...c],d)}function CT({lineCount:e,...t}){for(let n=t.nameWidths.length;n>1;n-=1)if(TT(n,t,e===1)<=e)return n;return 1}const OT=16,xT=(e,t)=>e-Js>=Ch(1,!0,t)+OT,hl=(e,t)=>e.listSheets().find(n=>n.sheetId===t),ET=Object.freeze(["quick","default","complex"]),ST=Object.freeze(["cancelled","invalid_request","prompt_too_large","transform_error","queue_overflow","not_granted","sampling_disabled","not_declared","capability_disabled","capability_removed","images_unavailable","tools_unavailable","rate_limited","session_expired","image_rejected","refused","empty_completion","invalid_json","upstream_error"]),RT=Object.freeze({modelsList:"models.list",modelsSet:"models.set",modelsCatalog:"models.catalog",modelsRemove:"models.remove",modelsTest:"models.test",grantsList:"grants.list",grantsAnswer:"grants.answer",grantsRevoke:"grants.revoke",usageSummary:"usage.summary"});new TextEncoder;[...ET];new Set(ST);new TextEncoder;new TextEncoder;({...RT});const MT="[Artifact comment sent to agent]",NT="[Artifact edit request sent to agent]",HT="[Artifact task finished]",_T="[Open Artifacts] ",BT=["quickstart","list","publish","read","open","call","adopt","import","delete","share"],LT=["get","list","query","set","update","delete","str_replace","batch"],VT=["read","reply","resolve","reopen","wait"],PT=["share","export"],DT={type:"object",properties:{action:{type:"string",enum:BT,description:"What to do: quickstart, list, publish, read, open, call, adopt, import, delete or share. Omitted: publish."},intent:{type:"string",description:"quickstart: what is being made (design, design-system, slides, whiteboard, document, data, sheets, motion, page, other), or a few words about it."},scope:{type:"string",enum:["types","mine","all"],description:"list: types (the installed types), mine (this session's and this project's artifacts; the default) or all (every artifact)."},type:{type:"string",description:"list: only artifacts of this type (an id, or open-artifacts://type/<id>). quickstart: the type already chosen (an id), to get its create call and steps without matching."},query:{type:"string",description:"list: only artifacts whose title contains this text."},limit:{type:"integer",description:"list: how many to return (default 50, at most 200). read (file list): how many files (default and at most 400)."},cursor:{type:"string",description:"list / read (file list): the next_cursor of the previous page."},type_url:{type:"string",description:"publish without url: the type to create from (open-artifacts://type/<id>, from quickstart). read without url: the type to describe."},title:{type:"string",description:"publish without url: the new artifact's name. quickstart: the name it will have, to find similar ones."},folder:{type:"string",description:"publish without url, import: the exact folder for the new artifact (absolute, or relative to the workspace; for import, one that does not exist yet), only when the person named one. Omitted: Open Artifacts chooses the folder and its name. adopt: the folder to add."},location:{type:"string",enum:["home","workspace"],description:"publish without url, import: where the new artifact's folder goes when the person asked: workspace (in the project, under the working folder) or home (the person's Open Artifacts folder). Omitted: what the person's settings say. The folder is named from the title either way."},source:{type:"string",description:"import: the copy link of an artifact shared to the web (https://<host>/a/<id>/copy), or its share page link (https://<host>/a/<id>); or the link of a design canvas shared on claude.ai (https://claude.ai/artifact/<id>)."},url:{type:"string",description:"An artifact: open-artifacts://artifact/<id>, as publish returned it."},files:{type:"object",additionalProperties:!0,description:'publish with url: files to write under the artifact root, as {"rel/path": "text"} or {"rel/path": {"content": "...", "encoding": "base64"}}; null deletes.'},if_match:{type:"object",additionalProperties:!0,description:'publish with url: {"rel/path": sha256 | null | "*"}. Write only while the file still has the sha256 you read, does not exist (null), or anyway ("*"). One mismatch writes nothing and returns the current versions.'},check:{type:"boolean",description:"publish with url: run the type's check action after writing; its result comes back as check."},capabilities:{type:"object",additionalProperties:!0,description:'publish, page artifacts only: the runtime capabilities the page may use, as {"db": true, "assets": true, ...}. Omitted: kept; {}: none; otherwise the whole set. With url it may be given without files.'},open:{type:"string",enum:["after_first_write","now","never"],description:"publish without url: after_first_write (the default) opens the page in your app once your first write lands; now opens it at once; never leaves it closed. import: now (the default) opens the copy once it is made; never leaves it closed. Where your app cannot show pages by itself the result says so: open view_url in your app's built-in browser, if you have one."},related:{type:"boolean",description:"quickstart: list existing artifacts the recommended type can build on, such as design systems (default true)."},path:{type:"string",description:"read: one file or folder under the root (omitted: the record and the file list)."},paths:{type:"array",items:{type:"string"},description:"read: several files under the root at once."},name:{type:"string",description:"call: the action's name (check, upload, ...; read with url lists them)."},args:{type:"object",additionalProperties:!0,description:"call: the action's arguments. upload: {file: absolute path, name?, group?}."},panel:{type:"string",enum:PT,description:"open: also open the page's Share panel (share), for the person to share it on the network, or its Export tab (export), for them to download a file."},cloud:{type:"string",description:"share: publish the artifact to this cloud remote (its name, as `open-artifacts remote list` shows it). It works only on a remote the person set up and let agents publish to (agentMayPublish); otherwise the person publishes it, from the Share panel or with `open-artifacts publish <id> --remote <name>`."}}},FT={type:"object",properties:{action:{type:"string",enum:LT,description:"What to do: get, list, query, set, update, delete, str_replace or batch."},url:{type:"string",description:"The artifact (open-artifacts://artifact/<id>)."},collection:{type:"string",description:"The collection: alone for list / query (query needs it), with doc_id for one document."},doc_id:{type:"string",description:"With collection: the document to get / set / update / delete / str_replace."},path:{type:"string",description:"collection/doc_id, instead of the two."},data:{type:"object",additionalProperties:!0,description:"set / update: the document's fields."},file_path:{type:"string",description:"set / update: a JSON file holding the fields, instead of data."},if_match:{description:'set / update / delete / str_replace: the sha256 get returned (write only if unchanged), null (only if it does not exist) or "*" (replace whatever is there).'},field:{type:"string",description:"str_replace: the text field, as a dot path (body, notes.text)."},old:{type:"string",description:"str_replace: the passage to replace; it must occur exactly once."},new:{type:"string",description:"str_replace: the passage that replaces it."},where:{type:"array",items:{type:"object",additionalProperties:!0},description:"query: [{field, op, value}], all must hold. op: ==, !=, <, <=, >, >=, in, not-in (up to 30 values), array-contains."},order_by:{type:"object",additionalProperties:!0,description:'query: {field, dir: "asc" | "desc"}.'},limit:{type:"integer",description:"list / query: how many documents (default 100, at most 1000)."},cursor:{type:"string",description:"list / query: the next_cursor of the previous page."},out_file:{type:"string",description:"get / list / query: write the result to this JSON file (absolute, or relative to the workspace) and return only its path and counts."},writes:{type:"array",items:{type:"object",additionalProperties:!0},description:"batch: [{op: set|update|delete|str_replace, path | collection+doc_id, data | file_path, if_match?, field?, old?, new?}], at most 500."}},required:["action","url"]},GT={type:"object",properties:{action:{type:"string",enum:VT,description:"What to do: read, reply, resolve, reopen or wait."},url:{type:"string",description:"The artifact (open-artifacts://artifact/<id>). wait: optional."},thread_id:{type:"string",description:'read / reply / resolve / reopen: the full thread ID (after ";thread=" in the message), or a unique prefix of at least three characters.'},text:{type:"string",description:"reply: the answer."},resolve:{type:"boolean",description:"reply: resolve the thread too."},all:{type:"boolean",description:"read: resolved threads too."},since:{type:"string",description:"read: only threads with a message at or after this time (ISO 8601)."},acknowledge_duplicate:{type:"boolean",description:"reply: send the same text as your last reply in this thread again, on purpose."},timeout_ms:{type:"number",description:"wait: how long (default 600000)."}},required:["action"]},wc={Artifact:DT,ArtifactData:FT,ArtifactComments:GT},jT={Artifact:["Make and change artifacts: typed folders of files that open as live pages the person can view, edit, comment on and export. Actions:","- quickstart {intent, type?}: call first for a new artifact; recommends a type (or takes the one given) and returns the call that creates it, the steps for this app and similar artifacts that already exist.",'- list {scope: "mine" | "all" | "types", type?, query?}: find existing artifacts, or the installed types.',"- publish {type_url, title, folder?, open?}: create an artifact; the result carries its root folder and the type's instructions. publish {url, files, if_match?, check?}: write files when you have no file tools of your own. A page artifact also takes capabilities (on create or write): the runtime capabilities its page may use.","- read {url, path? | paths?, limit?, cursor?}: the artifact's record, files and actions, or some of its files with their sha256 (file listings page with limit and cursor). read {type_url}: a type's instructions, before creating.",`- open {url, panel?}: show it to the person in the computer's browser (or the app, when it shows pages), once its content is written. When your app has a built-in browser, open view_url there instead. panel "share" or "export" opens its Share panel or Export tab for them.`,"- call {url, name, args?}: run one of the type's actions (check, upload, ...). A long one answers {task, pending: true}; its result comes later as a message.","- adopt {url | folder}: take over an artifact, or add an existing folder. Only when the person asks.","- import {source}: make a local copy of an artifact shared to the web, from its copy link (https://…/a/<id>/copy) or its page link, or of a design canvas shared on claude.ai (https://claude.ai/artifact/<id>), as a design.","- share {url}: whether it is shared on the local network, and its links. Only the person changes that, in the page's Share panel.","- delete {url}: forget an artifact; its folder stays. Only when the person asks."].join(`
5
+ `),ArtifactData:'Read and write the document store of an artifact whose type keeps one (its instructions say so). get, list and query read documents with their sha256; set, update, delete, str_replace and batch write them. update merges fields, and {"__delete__": true} removes one; str_replace changes one passage of a long text field. Replacing or deleting an existing document needs if_match: the sha256 you read, or "*". Your writes show live on open pages.',ArtifactComments:`Comments the person leaves on their artifact's page, kept in the artifact's own folder on this computer (no outside service). read lists the threads; reply answers one (thread_id is after ";thread=" in the message), with resolve: true when it is done; resolve and reopen change a thread's state. A thread sent to you is the person asking for your answer in it, so replying there is what they asked for. Answer only threads sent to you, in one or two lines. wait blocks until the next message for this session: use it only when nothing else can wake you.`},bc={Artifact:{title:"Artifact",openWorldHint:!1},ArtifactData:{title:"Artifact data",openWorldHint:!1},ArtifactComments:{title:"Artifact comments",destructiveHint:!1,openWorldHint:!1}},WT={Artifact:{quickstart:"read",list:"read",read:"read",publish:"write",call:"write",import:"write",open:"ui",delete:"remove",adopt:"remove",share:"person"},ArtifactData:{get:"read",list:"read",query:"read",set:"write",update:"write",str_replace:"write",batch:"write",delete:"write"},ArtifactComments:{read:"read",wait:"read",reply:"write",resolve:"write",reopen:"write"}},UT={Artifact:["publish","open","call","share"],ArtifactData:["get","list","query","set","update","str_replace","batch","delete"],ArtifactComments:["read","reply","resolve","reopen"]};function zT(e={any:!1,actions:!1}){return Object.keys(wc).map(t=>{const n=t==="Artifact"?e.any:e.actions;return{name:t,description:jT[t],inputSchema:wc[t],annotations:n?{...bc[t],openWorldHint:!0}:bc[t],actions:WT[t],remoteActions:[...UT[t]]}})}zT();const $T=300,qT=12,Ic=["Artifact","ArtifactData","ArtifactComments"];function In(e,t=$T){const n=String(e??"").replace(/[<>]/g,"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function YT(e){const t=In(e,Number.MAX_SAFE_INTEGER),n=t.search(/[.!?。!?](\s|$)/);return n>=0?t.slice(0,n+1):t}function KT(e){const t=In(e,24);return/^[a-z0-9]{1,5}$/i.test(t)?t.toUpperCase():t}const vc=e=>!e||/[.!?。!?…]$/.test(e)?e:`${e}.`;function XT(e,t=!1){const n=In(e.title,80)||e.id;if(t)return`- ${e.id}: ${n}`;const s=In(e.when)||In(YT(e.description)),a=(e.exports??[]).map(KT).filter(Boolean),r=[vc(n),vc(s),a.length?`Exports: ${a.join(", ")}.`:""].filter(Boolean);return`- ${e.id}: ${r.join(" ")}`}const ZT="Open Artifacts lets you make artifacts: typed folders of files (a slide deck, a design canvas, a whiteboard, a data dashboard, a spreadsheet, a doc, an animated motion piece, a free HTML page and more) that open as live pages the person can view, edit, comment on and export. You make and change them with the Artifact, ArtifactData and ArtifactComments tools.",JT=`<where_output_goes>
6
6
  Decide where your output will live before you make anything.
7
7
  - Something the person will read once and move on from (an answer, an explanation, a summary, a short report) goes in your reply, however long it is. A diagram or chart that explains your answer goes in the reply too, when you can show one there.
8
8
  - Something the person will keep, come back to, change themselves, comment on or show to others goes into an artifact when an installed type fits it. A request for a design, a deck or a board asks for the deliverable itself, even when it is phrased as "show me what it could look like".
@@ -14,6 +14,7 @@ Decide where your output will live before you make anything.
14
14
  </where_output_goes>`,QT=`<making_artifacts>
15
15
  - Continuing earlier work: find the artifact with Artifact {action: "list"} and change that one. Do not make a second artifact for a new version.
16
16
  - A new artifact: call Artifact {action: "quickstart", intent} once, before reading a type's skill or writing any file, unless you already hold the type's type_url. Then create it with the create call that quickstart returns.
17
+ - A copy link (https://…/a/<id>/copy) is an artifact someone shared to the web: Artifact {action: "import", source: "<the link>"} makes a local copy of it. A design canvas shared on claude.ai (https://claude.ai/artifact/<id>) is copied the same way, as a design.
17
18
  - Create the artifact once you have the material: its folder starts empty. By default (open: "after_first_write"), the page opens for the person after your first write and shows the rest as it lands, when your app shows pages by itself; open: "never" keeps it closed.
18
19
  - The create result carries the type's instructions. Read them before writing and follow them: they are the type's own guide to its files.
19
20
  - Write the files into root with your own file tools. Then, when the type has a check (the create result's next names it), run it (Artifact {action: "call", url, name: "check"}) and fix what it reports; a type without one, such as page, says how to look at the result instead.
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
6
  <title>Sheets</title>
7
- <script type="module" crossorigin src="./assets/index-BY38EAff.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-BzbNSKJF.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-_bba9qkH.css">
9
9
  </head>
10
10
  <body>