f-docx-editor 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FDocxEditor.common.594.js +688 -0
- package/FDocxEditor.common.817.js +1798 -0
- package/FDocxEditor.common.js +67977 -0
- package/FDocxEditor.css +1 -0
- package/FDocxEditor.umd.828.js +1798 -0
- package/FDocxEditor.umd.844.js +688 -0
- package/FDocxEditor.umd.js +68148 -0
- package/FDocxEditor.umd.min.642.js +1 -0
- package/FDocxEditor.umd.min.947.js +1 -0
- package/FDocxEditor.umd.min.js +2 -0
- package/README.md +22 -3
- package/package.json +58 -99
- package/dist/FDocxEditor.common.js +0 -199743
- package/dist/FDocxEditor.css +0 -1
- package/dist/FDocxEditor.umd.js +0 -199762
- package/dist/FDocxEditor.umd.min.js +0 -16
- package/dist/README.md +0 -112
- package/dist/demo.html +0 -1
- package/dist/package.json +0 -52
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("@tiptap/core"),require("@tiptap/extension-color"),require("@tiptap/extension-highlight"),require("@tiptap/extension-placeholder"),require("@tiptap/extension-table"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/extension-table-row"),require("@tiptap/extension-text-align"),require("@tiptap/extension-text-style"),require("@tiptap/starter-kit"),require("@tiptap/vue-3"),require("docx-preview"),require("docxtemplater"),require("docxtemplater-image-module-free"),require("echarts"),require("pizzip"),require("element-plus"),require("@element-plus/icons-vue"),require("vue")):"function"===typeof define&&define.amd?define(["@tiptap/core","@tiptap/extension-color","@tiptap/extension-highlight","@tiptap/extension-placeholder","@tiptap/extension-table","@tiptap/extension-table-cell","@tiptap/extension-table-header","@tiptap/extension-table-row","@tiptap/extension-text-align","@tiptap/extension-text-style","@tiptap/starter-kit","@tiptap/vue-3","docx-preview","docxtemplater","docxtemplater-image-module-free","echarts","pizzip","element-plus","@element-plus/icons-vue","vue"],t):"object"===typeof exports?exports["FDocxEditor"]=t(require("@tiptap/core"),require("@tiptap/extension-color"),require("@tiptap/extension-highlight"),require("@tiptap/extension-placeholder"),require("@tiptap/extension-table"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/extension-table-row"),require("@tiptap/extension-text-align"),require("@tiptap/extension-text-style"),require("@tiptap/starter-kit"),require("@tiptap/vue-3"),require("docx-preview"),require("docxtemplater"),require("docxtemplater-image-module-free"),require("echarts"),require("pizzip"),require("element-plus"),require("@element-plus/icons-vue"),require("vue")):e["FDocxEditor"]=t(e["@tiptap/core"],e["@tiptap/extension-color"],e["@tiptap/extension-highlight"],e["@tiptap/extension-placeholder"],e["@tiptap/extension-table"],e["@tiptap/extension-table-cell"],e["@tiptap/extension-table-header"],e["@tiptap/extension-table-row"],e["@tiptap/extension-text-align"],e["@tiptap/extension-text-style"],e["@tiptap/starter-kit"],e["@tiptap/vue-3"],e["docx-preview"],e["docxtemplater"],e["docxtemplater-image-module-free"],e["echarts"],e["pizzip"],e["ElementPlus"],e["ElementPlusIconsVue"],e["Vue"])})("undefined"!==typeof self?self:this,function(e,t,n,r,o,i,a,l,s,c,d,u,p,h,f,m,g,v,y,b){return function(){var w={8220:function(e,t,n){n(4114),n(6573),n(8100),n(7936),n(8111),n(2489),n(7588),n(9577),n(6632),n(4226),n(9486),n(456),n(9848),function(t){e.exports=t()}(function(){return function e(t,n,r){function o(a,l){if(!n[a]){if(!t[a]){var s=void 0;if(!l&&s)return require(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[a]={exports:{}};t[a][0].call(d.exports,function(e){var n=t[a][1][e];return o(n||e)},d,d.exports,e,t,n,r)}return n[a].exports}for(var i=void 0,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){"use strict";var r=e("./utils"),o=e("./support"),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,o,a,l,s,c,d=[],u=0,p=e.length,h=p,f="string"!==r.getTypeOf(e);u<e.length;)h=p-u,o=f?(t=e[u++],n=u<p?e[u++]:0,u<p?e[u++]:0):(t=e.charCodeAt(u++),n=u<p?e.charCodeAt(u++):0,u<p?e.charCodeAt(u++):0),a=t>>2,l=(3&t)<<4|n>>4,s=1<h?(15&n)<<2|o>>6:64,c=2<h?63&o:64,d.push(i.charAt(a)+i.charAt(l)+i.charAt(s)+i.charAt(c));return d.join("")},n.decode=function(e){var t,n,r,a,l,s,c=0,d=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var p,h=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===i.charAt(64)&&h--,e.charAt(e.length-2)===i.charAt(64)&&h--,h%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=o.uint8array?new Uint8Array(0|h):new Array(0|h);c<e.length;)t=i.indexOf(e.charAt(c++))<<2|(a=i.indexOf(e.charAt(c++)))>>4,n=(15&a)<<4|(l=i.indexOf(e.charAt(c++)))>>2,r=(3&l)<<6|(s=i.indexOf(e.charAt(c++))),p[d++]=t,64!==l&&(p[d++]=n),64!==s&&(p[d++]=r);return p}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var r=e("./external"),o=e("./stream/DataWorker"),i=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function l(e,t,n,r,o){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=o}l.prototype={getContentWorker:function(){var e=new o(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new o(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(e,t,n){return e.pipe(new i).pipe(new a("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var r=e("./utils"),o=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var i=o,a=r+n;e^=-1;for(var l=r;l<a;l++)e=e>>>8^i[255&(e^t[l])];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var i=o,a=r+n;e^=-1;for(var l=r;l<a;l++)e=e>>>8^i[255&(e^t.charCodeAt(l))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,o=e("pako"),i=e("./utils"),a=e("./stream/GenericWorker"),l=r?"uint8array":"array";function s(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",i.inherits(s,a),s.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(i.transformTo(l,e.data),!1)},s.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},s.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new s("Deflate",e)},n.uncompressWorker=function(){return new s("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function r(e,t){var n,r="";for(n=0;n<t;n++)r+=String.fromCharCode(255&e),e>>>=8;return r}function o(e,t,n,o,a,d){var u,p,h=e.file,f=e.compression,m=d!==l.utf8encode,g=i.transformTo("string",d(h.name)),v=i.transformTo("string",l.utf8encode(h.name)),y=h.comment,b=i.transformTo("string",d(y)),w=i.transformTo("string",l.utf8encode(y)),k=v.length!==h.name.length,x=w.length!==y.length,S="",C="",T="",E=h.dir,_=h.date,M={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(M.crc32=e.crc32,M.compressedSize=e.compressedSize,M.uncompressedSize=e.uncompressedSize);var N=0;t&&(N|=8),m||!k&&!x||(N|=2048);var I=0,R=0;E&&(I|=16),"UNIX"===a?(R=798,I|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(h.unixPermissions,E)):(R=20,I|=function(e){return 63&(e||0)}(h.dosPermissions)),u=_.getUTCHours(),u<<=6,u|=_.getUTCMinutes(),u<<=5,u|=_.getUTCSeconds()/2,p=_.getUTCFullYear()-1980,p<<=4,p|=_.getUTCMonth()+1,p<<=5,p|=_.getUTCDate(),k&&(C=r(1,1)+r(s(g),4)+v,S+="up"+r(C.length,2)+C),x&&(T=r(1,1)+r(s(b),4)+w,S+="uc"+r(T.length,2)+T);var A="";return A+="\n\0",A+=r(N,2),A+=f.magic,A+=r(u,2),A+=r(p,2),A+=r(M.crc32,4),A+=r(M.compressedSize,4),A+=r(M.uncompressedSize,4),A+=r(g.length,2),A+=r(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+A+g+S,dirRecord:c.CENTRAL_FILE_HEADER+r(R,2)+A+r(b.length,2)+"\0\0\0\0"+r(I,4)+r(o,4)+g+S+b}}var i=e("../utils"),a=e("../stream/GenericWorker"),l=e("../utf8"),s=e("../crc32"),c=e("../signature");function d(e,t,n,r){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(d,a),d.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,a.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},d.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=o(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=o(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,o=function(e,t,n,o,a){var l=i.transformTo("string",a(o));return c.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(n,4)+r(l.length,2)+l}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:o,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},d.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(e){var t=this._sources;if(!a.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},d.prototype.lock=function(){a.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){"use strict";var r=e("../compressions"),o=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var i=new o(t.streamFiles,n,t.platform,t.encodeFileName),a=0;try{e.forEach(function(e,n){a++;var o=function(e,t){var n=e||t,o=r[n];if(!o)throw new Error(n+" is not a valid compression method !");return o}(n.options.compression,t.compression),l=n.options.compressionOptions||t.compressionOptions||{},s=n.dir,c=n.date;n._compressWorker(o,l).withStreamInfo("file",{name:e,dir:s,date:c,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(i)}),i.entriesCount=a}catch(e){i.error(e)}return i}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){"use strict";var r=e("./utils"),o=e("./external"),i=e("./utf8"),a=e("./zipEntries"),l=e("./stream/Crc32Probe"),s=e("./nodejsUtils");function c(e){return new o.Promise(function(t,n){var r=e.decompressed.getContentWorker().pipe(new l);r.on("error",function(e){n(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var n=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),s.isNode&&s.isStream(e)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var n=new a(t);return n.load(e),n}).then(function(e){var n=[o.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var i=0;i<r.length;i++)n.push(c(r[i]));return o.Promise.all(n)}).then(function(e){for(var o=e.shift(),i=o.files,a=0;a<i.length;a++){var l=i[a],s=l.fileNameStr,c=r.resolve(l.fileNameStr);n.file(c,l.decompressed,{binary:!0,optimizedBinaryString:!0,date:l.date,dir:l.dir,comment:l.fileCommentStr.length?l.fileCommentStr:null,unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions,createFolders:t.createFolders}),l.dir||(n.file(c).unsafeOriginalName=s)}return o.zipComment.length&&(n.comment=o.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){"use strict";var r=e("../utils"),o=e("../stream/GenericWorker");function i(e,t){o.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(i,o),i.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},i.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){"use strict";var r=e("readable-stream").Readable;function o(e,t,n){r.call(this,t),this._helper=e;var o=this;e.on("data",function(e,t){o.push(e)||o._helper.pause(),n&&n(t)}).on("error",function(e){o.emit("error",e)}).on("end",function(){o.push(null)})}e("../utils").inherits(o,r),o.prototype._read=function(){this._helper.resume()},t.exports=o},{"../utils":32,"readable-stream":16}],14:[function(e,t,n){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){"use strict";function r(e,t,n){var r,o=i.getTypeOf(t),l=i.extend(n||{},s);l.date=l.date||new Date,null!==l.compression&&(l.compression=l.compression.toUpperCase()),"string"==typeof l.unixPermissions&&(l.unixPermissions=parseInt(l.unixPermissions,8)),l.unixPermissions&&16384&l.unixPermissions&&(l.dir=!0),l.dosPermissions&&16&l.dosPermissions&&(l.dir=!0),l.dir&&(e=m(e)),l.createFolders&&(r=f(e))&&g.call(this,r,!0);var u="string"===o&&!1===l.binary&&!1===l.base64;n&&void 0!==n.binary||(l.binary=!u),(t instanceof c&&0===t.uncompressedSize||l.dir||!t||0===t.length)&&(l.base64=!1,l.binary=!0,t="",l.compression="STORE",o="string");var v=null;v=t instanceof c||t instanceof a?t:p.isNode&&p.isStream(t)?new h(e,t):i.prepareContent(e,t,l.binary,l.optimizedBinaryString,l.base64);var y=new d(e,v,l);this.files[e]=y}var o=e("./utf8"),i=e("./utils"),a=e("./stream/GenericWorker"),l=e("./stream/StreamHelper"),s=e("./defaults"),c=e("./compressedObject"),d=e("./zipObject"),u=e("./generate"),p=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:s.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function v(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(r)}),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,n),this;if(v(e)){var o=e;return this.filter(function(e,t){return!t.dir&&o.test(e)})}var i=this.files[this.root+e];return i&&!i.dir?i:null},folder:function(e){if(!e)return this;if(v(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=g.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=i.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");i.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var r=n.comment||this.comment||"";t=u.generateWorker(this,n,r)}catch(e){(t=new a("error")).error(e)}return new l(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){"use strict";var r=e("./DataReader");function o(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(o,r),o.prototype.byteAt=function(e){return this.data[this.zero+e]},o.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),o=e.charCodeAt(3),i=this.length-4;0<=i;--i)if(this.data[i]===t&&this.data[i+1]===n&&this.data[i+2]===r&&this.data[i+3]===o)return i-this.zero;return-1},o.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),o=e.charCodeAt(3),i=this.readData(4);return t===i[0]&&n===i[1]&&r===i[2]&&o===i[3]},o.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=o},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){"use strict";var r=e("../utils");function o(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=o},{"../utils":32}],19:[function(e,t,n){"use strict";var r=e("./Uint8ArrayReader");function o(e){r.call(this,e)}e("../utils").inherits(o,r),o.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var r=e("./DataReader");function o(e){r.call(this,e)}e("../utils").inherits(o,r),o.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},o.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},o.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},o.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=o},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var r=e("./ArrayReader");function o(e){r.call(this,e)}e("../utils").inherits(o,r),o.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){"use strict";var r=e("../utils"),o=e("../support"),i=e("./ArrayReader"),a=e("./StringReader"),l=e("./NodeBufferReader"),s=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||o.uint8array?"nodebuffer"===t?new l(e):o.uint8array?new s(r.transformTo("uint8array",e)):new i(r.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var r=e("./GenericWorker"),o=e("../utils");function i(e){r.call(this,"ConvertWorker to "+e),this.destType=e}o.inherits(i,r),i.prototype.processChunk=function(e){this.push({data:o.transformTo(this.destType,e.data),meta:e.meta})},t.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var r=e("./GenericWorker"),o=e("../crc32");function i(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(i,r),i.prototype.processChunk=function(e){this.streamInfo.crc32=o(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var r=e("../utils"),o=e("./GenericWorker");function i(e){o.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(i,o),i.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}o.prototype.processChunk.call(this,e)},t.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var r=e("../utils"),o=e("./GenericWorker");function i(e){o.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(i,o),i.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,n){"use strict";var r=e("../utils"),o=e("./ConvertWorker"),i=e("./GenericWorker"),a=e("../base64"),l=e("../support"),s=e("../external"),c=null;if(l.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function d(e,t){return new s.Promise(function(n,o){var i=[],l=e._internalType,s=e._outputType,c=e._mimeType;e.on("data",function(e,n){i.push(e),t&&t(n)}).on("error",function(e){i=[],o(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return a.encode(t);default:return r.transformTo(e,t)}}(s,function(e,t){var n,r=0,o=null,i=0;for(n=0;n<t.length;n++)i+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(o=new Uint8Array(i),n=0;n<t.length;n++)o.set(t[n],r),r+=t[n].length;return o;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(l,i),c);n(e)}catch(e){o(e)}i=[]}).resume()})}function u(e,t,n){var a=t;switch(t){case"blob":case"arraybuffer":a="uint8array";break;case"base64":a="string"}try{this._internalType=a,this._outputType=t,this._mimeType=n,r.checkSupport(a),this._worker=e.pipe(new o(a)),e.lock()}catch(e){this._worker=new i("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return d(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,n)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,n){"use strict";if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer="undefined"!=typeof Buffer,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(r),n.blob=0===o.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){"use strict";for(var r=e("./utils"),o=e("./support"),i=e("./nodejsUtils"),a=e("./stream/GenericWorker"),l=new Array(256),s=0;s<256;s++)l[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(){a.call(this,"utf-8 decode"),this.leftOver=null}function d(){a.call(this,"utf-8 encode")}l[254]=l[254]=1,n.utf8encode=function(e){return o.nodebuffer?i.newBufferFrom(e,"utf-8"):function(e){var t,n,r,i,a,l=e.length,s=0;for(i=0;i<l;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<l&&56320==(64512&(r=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=o.uint8array?new Uint8Array(s):new Array(s),i=a=0;a<s;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<l&&56320==(64512&(r=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),n<128?t[a++]=n:(n<2048?t[a++]=192|n>>>6:(n<65536?t[a++]=224|n>>>12:(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63),t[a++]=128|n>>>6&63),t[a++]=128|63&n);return t}(e)},n.utf8decode=function(e){return o.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,o,i,a=e.length,s=new Array(2*a);for(t=n=0;t<a;)if((o=e[t++])<128)s[n++]=o;else if(4<(i=l[o]))s[n++]=65533,t+=i-1;else{for(o&=2===i?31:3===i?15:7;1<i&&t<a;)o=o<<6|63&e[t++],i--;1<i?s[n++]=65533:o<65536?s[n++]=o:(o-=65536,s[n++]=55296|o>>10&1023,s[n++]=56320|1023&o)}return s.length!==n&&(s.subarray?s=s.subarray(0,n):s.length=n),r.applyFromCharCode(s)}(e=r.transformTo(o.uint8array?"uint8array":"array",e))},r.inherits(c,a),c.prototype.processChunk=function(e){var t=r.transformTo(o.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var i=t;(t=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),t.set(i,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var a=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+l[e[n]]>t?n:t}(t),s=t;a!==t.length&&(o.uint8array?(s=t.subarray(0,a),this.leftOver=t.subarray(a,t.length)):(s=t.slice(0,a),this.leftOver=t.slice(a,t.length))),this.push({data:n.utf8decode(s),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(d,a),d.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){"use strict";var r=e("./support"),o=e("./base64"),i=e("./nodejsUtils"),a=e("./external");function l(e){return e}function s(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),n.newBlob=function(t,r){n.checkSupport("blob");try{return new Blob([t],{type:r})}catch(e){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return o.append(t),o.getBlob(r)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var c={stringifyByChunk:function(e,t,n){var r=[],o=0,i=e.length;if(i<=n)return String.fromCharCode.apply(null,e);for(;o<i;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(o,Math.min(o+n,i)))):r.push(String.fromCharCode.apply(null,e.subarray(o,Math.min(o+n,i)))),o+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,i.allocBuffer(1)).length}catch(e){return!1}}()}};function d(e){var t=65536,r=n.getTypeOf(e),o=!0;if("uint8array"===r?o=c.applyCanBeUsed.uint8array:"nodebuffer"===r&&(o=c.applyCanBeUsed.nodebuffer),o)for(;1<t;)try{return c.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return c.stringifyByChar(e)}function u(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.applyFromCharCode=d;var p={};p.string={string:l,array:function(e){return s(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return s(e,new Uint8Array(e.length))},nodebuffer:function(e){return s(e,i.allocBuffer(e.length))}},p.array={string:d,array:l,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return i.newBufferFrom(e)}},p.arraybuffer={string:function(e){return d(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:l,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return i.newBufferFrom(new Uint8Array(e))}},p.uint8array={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:l,nodebuffer:function(e){return i.newBufferFrom(e)}},p.nodebuffer={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return p.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:l},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var r=n.getTypeOf(t);return p[r][e](t)},n.resolve=function(e){for(var t=e.split("/"),n=[],r=0;r<t.length;r++){var o=t[r];"."===o||""===o&&0!==r&&r!==t.length-1||(".."===o?n.pop():n.push(o))}return n.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&i.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,r="";for(n=0;n<(e||"").length;n++)r+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return r},n.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},n.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},n.prepareContent=function(e,t,i,l,c){return a.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new a.Promise(function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){n(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var d=n.getTypeOf(t);return d?("arraybuffer"===d?t=n.transformTo("uint8array",t):"string"===d&&(c?t=o.decode(t):i&&!0!==l&&(t=function(e){return s(e,r.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):a.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){"use strict";var r=e("./reader/readerFor"),o=e("./utils"),i=e("./signature"),a=e("./zipEntry"),l=e("./support");function s(e){this.files=[],this.loadOptions=e}s.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(t)+", expected "+o.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=l.uint8array?"uint8array":"array",n=o.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(e=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=t-n;if(0<r)this.isSignature(t,i.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=s},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){"use strict";var r=e("./reader/readerFor"),o=e("./utils"),i=e("./compressedObject"),a=e("./crc32"),l=e("./utf8"),s=e("./compressions"),c=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&s[t].magic===e)return s[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,o=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<o;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(o)},handleUTF8:function(){var e=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=o.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var i=o.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||a(this.fileName)!==t.readInt(4)?null:l.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||a(this.fileComment)!==t.readInt(4)?null:l.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){"use strict";function r(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var o=e("./stream/StreamHelper"),i=e("./stream/DataWorker"),a=e("./utf8"),l=e("./compressedObject"),s=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!r&&(t=t.pipe(new a.Utf8EncodeWorker)),!i&&r&&(t=t.pipe(new a.Utf8DecodeWorker))}catch(e){(t=new s("error")).error(e)}return new o(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof l&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new a.Utf8EncodeWorker)),l.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof s?this._data:new i(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<c.length;u++)r.prototype[c[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(d),l=e.document.createTextNode("");a.observe(l,{characterData:!0}),n=function(){l.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var s=new e.MessageChannel;s.port1.onmessage=d,n=function(){s.port2.postMessage(0)}}var c=[];function d(){var e,t;r=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}r=!1}t.exports=function(e){1!==c.push(e)||r||n()}}).call(this,"undefined"!=typeof n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){"use strict";var r=e("immediate");function o(){}var i={},a=["REJECTED"],l=["FULFILLED"],s=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){r(function(){var r;try{r=t(n)}catch(r){return i.reject(e,r)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=f(function(){t(o,r)});"error"===a.status&&r(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=c).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===l||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==s?u(n,this.state===l?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){i.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=f(p,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)h(e,r);else{e.state=l,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o);return i.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),l=0,s=-1,c=new this(o);++s<n;)d(e[s],s);return c;function d(e,o){t.resolve(e).then(function(e){a[o]=e,++l!==n||r||(r=!0,i.resolve(c,a))},function(e){r||(r=!0,i.reject(c,e))})}},c.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a,l=-1,s=new this(o);++l<n;)a=e[l],t.resolve(a).then(function(e){r||(r=!0,i.resolve(s,e))},function(e){r||(r=!0,i.reject(s,e))});return s}},{immediate:36}],38:[function(e,t,n){"use strict";var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){"use strict";var r=e("./zlib/deflate"),o=e("./utils/common"),i=e("./utils/strings"),a=e("./zlib/messages"),l=e("./zlib/zstream"),s=Object.prototype.toString,c=0,d=-1,u=0,p=8;function h(e){if(!(this instanceof h))return new h(e);this.options=o.assign({level:d,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==c)throw new Error(a[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var f;if(f="string"==typeof t.dictionary?i.string2buf(t.dictionary):"[object ArrayBuffer]"===s.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=r.deflateSetDictionary(this.strm,f))!==c)throw new Error(a[n]);this._dict_set=!0}}function f(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,l=this.strm,d=this.options.chunkSize;if(this.ended)return!1;a=t===~~t?t:!0===t?4:0,"string"==typeof e?l.input=i.string2buf(e):"[object ArrayBuffer]"===s.call(e)?l.input=new Uint8Array(e):l.input=e,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new o.Buf8(d),l.next_out=0,l.avail_out=d),1!==(n=r.deflate(l,a))&&n!==c)return this.onEnd(n),!(this.ended=!0);0!==l.avail_out&&(0!==l.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(i.buf2binstring(o.shrinkBuf(l.output,l.next_out))):this.onData(o.shrinkBuf(l.output,l.next_out)))}while((0<l.avail_in||0===l.avail_out)&&1!==n);return 4===a?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===c):2!==a||(this.onEnd(c),!(l.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===c&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=h,n.deflate=f,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,f(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){"use strict";var r=e("./zlib/inflate"),o=e("./utils/common"),i=e("./utils/strings"),a=e("./zlib/constants"),l=e("./zlib/messages"),s=e("./zlib/zstream"),c=e("./zlib/gzheader"),d=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==a.Z_OK)throw new Error(l[n]);this.header=new c,r.inflateGetHeader(this.strm,this.header)}function p(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||l[n.err];return n.result}u.prototype.push=function(e,t){var n,l,s,c,u,p,h=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;l=t===~~t?t:!0===t?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof e?h.input=i.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new o.Buf8(f),h.next_out=0,h.avail_out=f),(n=r.inflate(h,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&m&&(p="string"==typeof m?i.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,n=r.inflateSetDictionary(this.strm,p)),n===a.Z_BUF_ERROR&&!0===g&&(n=a.Z_OK,g=!1),n!==a.Z_STREAM_END&&n!==a.Z_OK)return this.onEnd(n),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&n!==a.Z_STREAM_END&&(0!==h.avail_in||l!==a.Z_FINISH&&l!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(s=i.utf8border(h.output,h.next_out),c=h.next_out-s,u=i.buf2string(h.output,s),h.next_out=c,h.avail_out=f-c,c&&o.arraySet(h.output,h.output,s,c,0),this.onData(u)):this.onData(o.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(g=!0)}while((0<h.avail_in||0===h.avail_out)&&n!==a.Z_STREAM_END);return n===a.Z_STREAM_END&&(l=a.Z_FINISH),l===a.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===a.Z_OK):l!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(h.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=u,n.inflate=p,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,p(e,t)},n.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,o){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),o);else for(var i=0;i<r;i++)e[o+i]=t[n+i]},flattenChunks:function(e){var t,n,r,o,i,a;for(t=r=0,n=e.length;t<n;t++)r+=e[t].length;for(a=new Uint8Array(r),t=o=0,n=e.length;t<n;t++)i=e[t],a.set(i,o),o+=i.length;return a}},i={arraySet:function(e,t,n,r,o){for(var i=0;i<r;i++)e[o+i]=t[n+i]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,o)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,i))},n.setTyped(r)},{}],42:[function(e,t,n){"use strict";var r=e("./common"),o=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(e){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){i=!1}for(var a=new r.Buf8(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function s(e,t){if(t<65537&&(e.subarray&&i||!e.subarray&&o))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",a=0;a<t;a++)n+=String.fromCharCode(e[a]);return n}a[254]=a[254]=1,n.string2buf=function(e){var t,n,o,i,a,l=e.length,s=0;for(i=0;i<l;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<l&&56320==(64512&(o=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(o-56320),i++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(s),i=a=0;a<s;i++)55296==(64512&(n=e.charCodeAt(i)))&&i+1<l&&56320==(64512&(o=e.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(o-56320),i++),n<128?t[a++]=n:(n<2048?t[a++]=192|n>>>6:(n<65536?t[a++]=224|n>>>12:(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63),t[a++]=128|n>>>6&63),t[a++]=128|63&n);return t},n.buf2binstring=function(e){return s(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,o=t.length;n<o;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,r,o,i,l=t||e.length,c=new Array(2*l);for(n=r=0;n<l;)if((o=e[n++])<128)c[r++]=o;else if(4<(i=a[o]))c[r++]=65533,n+=i-1;else{for(o&=2===i?31:3===i?15:7;1<i&&n<l;)o=o<<6|63&e[n++],i--;1<i?c[r++]=65533:o<65536?c[r++]=o:(o-=65536,c[r++]=55296|o>>10&1023,c[r++]=56320|1023&o)}return s(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){for(var o=65535&e,i=e>>>16&65535,a=0;0!==n;){for(n-=a=2e3<n?2e3:n;i=i+(o=o+t[r++]|0)|0,--a;);o%=65521,i%=65521}return o|i<<16}},{}],44:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,o){var i=r,a=o+n;e^=-1;for(var l=o;l<a;l++)e=e>>>8^i[255&(e^t[l])];return-1^e}},{}],46:[function(e,t,n){"use strict";var r,o=e("../utils/common"),i=e("./trees"),a=e("./adler32"),l=e("./crc32"),s=e("./messages"),c=0,d=4,u=0,p=-2,h=-1,f=4,m=2,g=8,v=9,y=286,b=30,w=19,k=2*y+1,x=15,S=3,C=258,T=C+S+1,E=42,_=113,M=1,N=2,I=3,R=4;function A(e,t){return e.msg=s[t],t}function B(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function F(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(o.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function P(e,t){i._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function O(e,t){e.pending_buf[e.pending++]=t}function L(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,o=e.max_chain_length,i=e.strstart,a=e.prev_length,l=e.nice_match,s=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,c=e.window,d=e.w_mask,u=e.prev,p=e.strstart+C,h=c[i+a-1],f=c[i+a];e.prev_length>=e.good_match&&(o>>=2),l>e.lookahead&&(l=e.lookahead);do{if(c[(n=t)+a]===f&&c[n+a-1]===h&&c[n]===c[i]&&c[++n]===c[i+1]){i+=2,n++;do{}while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&i<p);if(r=C-(p-i),i=p-C,a<r){if(e.match_start=t,l<=(a=r))break;h=c[i+a-1],f=c[i+a]}}}while((t=u[t&d])>s&&0!=--o);return a<=e.lookahead?a:e.lookahead}function V(e){var t,n,r,i,s,c,d,u,p,h,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-T)){for(o.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=n=e.hash_size;r=e.head[--t],e.head[t]=f<=r?r-f:0,--n;);for(t=n=f;r=e.prev[--t],e.prev[t]=f<=r?r-f:0,--n;);i+=f}if(0===e.strm.avail_in)break;if(c=e.strm,d=e.window,u=e.strstart+e.lookahead,p=i,h=void 0,h=c.avail_in,p<h&&(h=p),n=0===h?0:(c.avail_in-=h,o.arraySet(d,c.input,c.next_in,h,u),1===c.state.wrap?c.adler=a(c.adler,d,h,u):2===c.state.wrap&&(c.adler=l(c.adler,d,h,u)),c.next_in+=h,c.total_in+=h,h),e.lookahead+=n,e.lookahead+e.insert>=S)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+S-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<S)););}while(e.lookahead<T&&0!==e.strm.avail_in)}function $(e,t){for(var n,r;;){if(e.lookahead<T){if(V(e),e.lookahead<T&&t===c)return M;if(0===e.lookahead)break}if(n=0,e.lookahead>=S&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+S-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-T&&(e.match_length=z(e,n)),e.match_length>=S)if(r=i._tr_tally(e,e.strstart-e.match_start,e.match_length-S),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=S){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+S-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(P(e,!1),0===e.strm.avail_out))return M}return e.insert=e.strstart<S-1?e.strstart:S-1,t===d?(P(e,!0),0===e.strm.avail_out?I:R):e.last_lit&&(P(e,!1),0===e.strm.avail_out)?M:N}function j(e,t){for(var n,r,o;;){if(e.lookahead<T){if(V(e),e.lookahead<T&&t===c)return M;if(0===e.lookahead)break}if(n=0,e.lookahead>=S&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+S-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=S-1,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-T&&(e.match_length=z(e,n),e.match_length<=5&&(1===e.strategy||e.match_length===S&&4096<e.strstart-e.match_start)&&(e.match_length=S-1)),e.prev_length>=S&&e.match_length<=e.prev_length){for(o=e.strstart+e.lookahead-S,r=i._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-S),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=o&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+S-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=S-1,e.strstart++,r&&(P(e,!1),0===e.strm.avail_out))return M}else if(e.match_available){if((r=i._tr_tally(e,0,e.window[e.strstart-1]))&&P(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return M}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=i._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<S-1?e.strstart:S-1,t===d?(P(e,!0),0===e.strm.avail_out?I:R):e.last_lit&&(P(e,!1),0===e.strm.avail_out)?M:N}function H(e,t,n,r,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=o}function W(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*k),this.dyn_dtree=new o.Buf16(2*(2*b+1)),this.bl_tree=new o.Buf16(2*(2*w+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(x+1),this.heap=new o.Buf16(2*y+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*y+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function q(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=m,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?E:_,e.adler=2===t.wrap?0:1,t.last_flush=c,i._tr_init(t),u):A(e,p)}function Z(e){var t=q(e);return t===u&&function(e){e.window_size=2*e.w_size,D(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=S-1,e.match_available=0,e.ins_h=0}(e.state),t}function U(e,t,n,r,i,a){if(!e)return p;var l=1;if(t===h&&(t=6),r<0?(l=0,r=-r):15<r&&(l=2,r-=16),i<1||v<i||n!==g||r<8||15<r||t<0||9<t||a<0||f<a)return A(e,p);8===r&&(r=9);var s=new W;return(e.state=s).strm=e,s.wrap=l,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+S-1)/S),s.window=new o.Buf8(2*s.w_size),s.head=new o.Buf16(s.hash_size),s.prev=new o.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new o.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,Z(e)}r=[new H(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(V(e),0===e.lookahead&&t===c)return M;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,P(e,!1),0===e.strm.avail_out))return M;if(e.strstart-e.block_start>=e.w_size-T&&(P(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===d?(P(e,!0),0===e.strm.avail_out?I:R):(e.strstart>e.block_start&&(P(e,!1),e.strm.avail_out),M)}),new H(4,4,8,4,$),new H(4,5,16,8,$),new H(4,6,32,32,$),new H(4,4,16,16,j),new H(8,16,32,32,j),new H(8,16,128,128,j),new H(8,32,128,256,j),new H(32,128,258,1024,j),new H(32,258,258,4096,j)],n.deflateInit=function(e,t){return U(e,t,g,15,8,0)},n.deflateInit2=U,n.deflateReset=Z,n.deflateResetKeep=q,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?p:(e.state.gzhead=t,u):p},n.deflate=function(e,t){var n,o,a,s;if(!e||!e.state||5<t||t<0)return e?A(e,p):p;if(o=e.state,!e.output||!e.input&&0!==e.avail_in||666===o.status&&t!==d)return A(e,0===e.avail_out?-5:p);if(o.strm=e,n=o.last_flush,o.last_flush=t,o.status===E)if(2===o.wrap)e.adler=0,O(o,31),O(o,139),O(o,8),o.gzhead?(O(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),O(o,255&o.gzhead.time),O(o,o.gzhead.time>>8&255),O(o,o.gzhead.time>>16&255),O(o,o.gzhead.time>>24&255),O(o,9===o.level?2:2<=o.strategy||o.level<2?4:0),O(o,255&o.gzhead.os),o.gzhead.extra&&o.gzhead.extra.length&&(O(o,255&o.gzhead.extra.length),O(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(e.adler=l(e.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=69):(O(o,0),O(o,0),O(o,0),O(o,0),O(o,0),O(o,9===o.level?2:2<=o.strategy||o.level<2?4:0),O(o,3),o.status=_);else{var h=g+(o.w_bits-8<<4)<<8;h|=(2<=o.strategy||o.level<2?0:o.level<6?1:6===o.level?2:3)<<6,0!==o.strstart&&(h|=32),h+=31-h%31,o.status=_,L(o,h),0!==o.strstart&&(L(o,e.adler>>>16),L(o,65535&e.adler)),e.adler=1}if(69===o.status)if(o.gzhead.extra){for(a=o.pending;o.gzindex<(65535&o.gzhead.extra.length)&&(o.pending!==o.pending_buf_size||(o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),F(e),a=o.pending,o.pending!==o.pending_buf_size));)O(o,255&o.gzhead.extra[o.gzindex]),o.gzindex++;o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=73)}else o.status=73;if(73===o.status)if(o.gzhead.name){a=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),F(e),a=o.pending,o.pending===o.pending_buf_size)){s=1;break}s=o.gzindex<o.gzhead.name.length?255&o.gzhead.name.charCodeAt(o.gzindex++):0,O(o,s)}while(0!==s);o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),0===s&&(o.gzindex=0,o.status=91)}else o.status=91;if(91===o.status)if(o.gzhead.comment){a=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),F(e),a=o.pending,o.pending===o.pending_buf_size)){s=1;break}s=o.gzindex<o.gzhead.comment.length?255&o.gzhead.comment.charCodeAt(o.gzindex++):0,O(o,s)}while(0!==s);o.gzhead.hcrc&&o.pending>a&&(e.adler=l(e.adler,o.pending_buf,o.pending-a,a)),0===s&&(o.status=103)}else o.status=103;if(103===o.status&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&F(e),o.pending+2<=o.pending_buf_size&&(O(o,255&e.adler),O(o,e.adler>>8&255),e.adler=0,o.status=_)):o.status=_),0!==o.pending){if(F(e),0===e.avail_out)return o.last_flush=-1,u}else if(0===e.avail_in&&B(t)<=B(n)&&t!==d)return A(e,-5);if(666===o.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==o.lookahead||t!==c&&666!==o.status){var f=2===o.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(V(e),0===e.lookahead)){if(t===c)return M;break}if(e.match_length=0,n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(P(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===d?(P(e,!0),0===e.strm.avail_out?I:R):e.last_lit&&(P(e,!1),0===e.strm.avail_out)?M:N}(o,t):3===o.strategy?function(e,t){for(var n,r,o,a,l=e.window;;){if(e.lookahead<=C){if(V(e),e.lookahead<=C&&t===c)return M;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=S&&0<e.strstart&&(r=l[o=e.strstart-1])===l[++o]&&r===l[++o]&&r===l[++o]){a=e.strstart+C;do{}while(r===l[++o]&&r===l[++o]&&r===l[++o]&&r===l[++o]&&r===l[++o]&&r===l[++o]&&r===l[++o]&&r===l[++o]&&o<a);e.match_length=C-(a-o),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=S?(n=i._tr_tally(e,1,e.match_length-S),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(P(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===d?(P(e,!0),0===e.strm.avail_out?I:R):e.last_lit&&(P(e,!1),0===e.strm.avail_out)?M:N}(o,t):r[o.level].func(o,t);if(f!==I&&f!==R||(o.status=666),f===M||f===I)return 0===e.avail_out&&(o.last_flush=-1),u;if(f===N&&(1===t?i._tr_align(o):5!==t&&(i._tr_stored_block(o,0,0,!1),3===t&&(D(o.head),0===o.lookahead&&(o.strstart=0,o.block_start=0,o.insert=0))),F(e),0===e.avail_out))return o.last_flush=-1,u}return t!==d?u:o.wrap<=0?1:(2===o.wrap?(O(o,255&e.adler),O(o,e.adler>>8&255),O(o,e.adler>>16&255),O(o,e.adler>>24&255),O(o,255&e.total_in),O(o,e.total_in>>8&255),O(o,e.total_in>>16&255),O(o,e.total_in>>24&255)):(L(o,e.adler>>>16),L(o,65535&e.adler)),F(e),0<o.wrap&&(o.wrap=-o.wrap),0!==o.pending?u:1)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==E&&69!==t&&73!==t&&91!==t&&103!==t&&t!==_&&666!==t?A(e,p):(e.state=null,t===_?A(e,-3):u):p},n.deflateSetDictionary=function(e,t){var n,r,i,l,s,c,d,h,f=t.length;if(!e||!e.state)return p;if(2===(l=(n=e.state).wrap)||1===l&&n.status!==E||n.lookahead)return p;for(1===l&&(e.adler=a(e.adler,t,f,0)),n.wrap=0,f>=n.w_size&&(0===l&&(D(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new o.Buf8(n.w_size),o.arraySet(h,t,f-n.w_size,n.w_size,0),t=h,f=n.w_size),s=e.avail_in,c=e.next_in,d=e.input,e.avail_in=f,e.next_in=0,e.input=t,V(n);n.lookahead>=S;){for(r=n.strstart,i=n.lookahead-(S-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+S-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--i;);n.strstart=r,n.lookahead=S-1,V(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=S-1,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=s,n.wrap=l,u},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){"use strict";t.exports=function(e,t){var n,r,o,i,a,l,s,c,d,u,p,h,f,m,g,v,y,b,w,k,x,S,C,T,E;n=e.state,r=e.next_in,T=e.input,o=r+(e.avail_in-5),i=e.next_out,E=e.output,a=i-(t-e.avail_out),l=i+(e.avail_out-257),s=n.dmax,c=n.wsize,d=n.whave,u=n.wnext,p=n.window,h=n.hold,f=n.bits,m=n.lencode,g=n.distcode,v=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{f<15&&(h+=T[r++]<<f,f+=8,h+=T[r++]<<f,f+=8),b=m[h&v];t:for(;;){if(h>>>=w=b>>>24,f-=w,0===(w=b>>>16&255))E[i++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=m[(65535&b)+(h&(1<<w)-1)];continue t}if(32&w){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}k=65535&b,(w&=15)&&(f<w&&(h+=T[r++]<<f,f+=8),k+=h&(1<<w)-1,h>>>=w,f-=w),f<15&&(h+=T[r++]<<f,f+=8,h+=T[r++]<<f,f+=8),b=g[h&y];n:for(;;){if(h>>>=w=b>>>24,f-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=g[(65535&b)+(h&(1<<w)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(x=65535&b,f<(w&=15)&&(h+=T[r++]<<f,(f+=8)<w&&(h+=T[r++]<<f,f+=8)),s<(x+=h&(1<<w)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(h>>>=w,f-=w,(w=i-a)<x){if(d<(w=x-w)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(C=p,(S=0)===u){if(S+=c-w,w<k){for(k-=w;E[i++]=p[S++],--w;);S=i-x,C=E}}else if(u<w){if(S+=c+u-w,(w-=u)<k){for(k-=w;E[i++]=p[S++],--w;);if(S=0,u<k){for(k-=w=u;E[i++]=p[S++],--w;);S=i-x,C=E}}}else if(S+=u-w,w<k){for(k-=w;E[i++]=p[S++],--w;);S=i-x,C=E}for(;2<k;)E[i++]=C[S++],E[i++]=C[S++],E[i++]=C[S++],k-=3;k&&(E[i++]=C[S++],1<k&&(E[i++]=C[S++]))}else{for(S=i-x;E[i++]=E[S++],E[i++]=E[S++],E[i++]=E[S++],2<(k-=3););k&&(E[i++]=E[S++],1<k&&(E[i++]=E[S++]))}break}}break}}while(r<o&&i<l);r-=k=f>>3,h&=(1<<(f-=k<<3))-1,e.next_in=r,e.next_out=i,e.avail_in=r<o?o-r+5:5-(r-o),e.avail_out=i<l?l-i+257:257-(i-l),n.hold=h,n.bits=f}},{}],49:[function(e,t,n){"use strict";var r=e("../utils/common"),o=e("./adler32"),i=e("./crc32"),a=e("./inffast"),l=e("./inftrees"),s=1,c=2,d=0,u=-2,p=1,h=852,f=592;function m(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=p,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(h),t.distcode=t.distdyn=new r.Buf32(f),t.sane=1,t.back=-1,d):u}function y(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,v(e)):u}function b(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?u:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,y(e))):u}function w(e,t){var n,r;return e?(r=new g,(e.state=r).window=null,(n=b(e,t))!==d&&(e.state=null),n):u}var k,x,S=!0;function C(e){if(S){var t;for(k=new r.Buf32(512),x=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(l(s,e.lens,0,288,k,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;l(c,e.lens,0,32,x,0,e.work,{bits:5}),S=!1}e.lencode=k,e.lenbits=9,e.distcode=x,e.distbits=5}function T(e,t,n,o){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new r.Buf8(a.wsize)),o>=a.wsize?(r.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(o<(i=a.wsize-a.wnext)&&(i=o),r.arraySet(a.window,t,n-o,i,a.wnext),(o-=i)?(r.arraySet(a.window,t,n-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}n.inflateReset=y,n.inflateReset2=b,n.inflateResetKeep=v,n.inflateInit=function(e){return w(e,15)},n.inflateInit2=w,n.inflate=function(e,t){var n,h,f,g,v,y,b,w,k,x,S,E,_,M,N,I,R,A,B,D,F,P,O,L,z=0,V=new r.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return u;12===(n=e.state).mode&&(n.mode=13),v=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,y=e.avail_in,w=n.hold,k=n.bits,x=y,S=b,P=d;e:for(;;)switch(n.mode){case p:if(0===n.wrap){n.mode=13;break}for(;k<16;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(2&n.wrap&&35615===w){V[n.check=0]=255&w,V[1]=w>>>8&255,n.check=i(n.check,V,2,0),k=w=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&w)<<8)+(w>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&w)){e.msg="unknown compression method",n.mode=30;break}if(k-=4,F=8+(15&(w>>>=4)),0===n.wbits)n.wbits=F;else if(F>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<F,e.adler=n.check=1,n.mode=512&w?10:12,k=w=0;break;case 2:for(;k<16;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(n.flags=w,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=w>>8&1),512&n.flags&&(V[0]=255&w,V[1]=w>>>8&255,n.check=i(n.check,V,2,0)),k=w=0,n.mode=3;case 3:for(;k<32;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.head&&(n.head.time=w),512&n.flags&&(V[0]=255&w,V[1]=w>>>8&255,V[2]=w>>>16&255,V[3]=w>>>24&255,n.check=i(n.check,V,4,0)),k=w=0,n.mode=4;case 4:for(;k<16;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.head&&(n.head.xflags=255&w,n.head.os=w>>8),512&n.flags&&(V[0]=255&w,V[1]=w>>>8&255,n.check=i(n.check,V,2,0)),k=w=0,n.mode=5;case 5:if(1024&n.flags){for(;k<16;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.length=w,n.head&&(n.head.extra_len=w),512&n.flags&&(V[0]=255&w,V[1]=w>>>8&255,n.check=i(n.check,V,2,0)),k=w=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(y<(E=n.length)&&(E=y),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,h,g,E,F)),512&n.flags&&(n.check=i(n.check,h,E,g)),y-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===y)break e;for(E=0;F=h[g+E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E<y;);if(512&n.flags&&(n.check=i(n.check,h,E,g)),y-=E,g+=E,F)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===y)break e;for(E=0;F=h[g+E++],n.head&&F&&n.length<65536&&(n.head.comment+=String.fromCharCode(F)),F&&E<y;);if(512&n.flags&&(n.check=i(n.check,h,E,g)),y-=E,g+=E,F)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;k<16;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(w!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}k=w=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;k<32;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}e.adler=n.check=m(w),k=w=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=v,e.avail_out=b,e.next_in=g,e.avail_in=y,n.hold=w,n.bits=k,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){w>>>=7&k,k-=7&k,n.mode=27;break}for(;k<3;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}switch(n.last=1&w,k-=1,3&(w>>>=1)){case 0:n.mode=14;break;case 1:if(C(n),n.mode=20,6!==t)break;w>>>=2,k-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}w>>>=2,k-=2;break;case 14:for(w>>>=7&k,k-=7&k;k<32;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if((65535&w)!=(w>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&w,k=w=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(E=n.length){if(y<E&&(E=y),b<E&&(E=b),0===E)break e;r.arraySet(f,h,g,E,v),y-=E,g+=E,b-=E,v+=E,n.length-=E;break}n.mode=12;break;case 17:for(;k<14;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(n.nlen=257+(31&w),w>>>=5,k-=5,n.ndist=1+(31&w),w>>>=5,k-=5,n.ncode=4+(15&w),w>>>=4,k-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;k<3;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.lens[$[n.have++]]=7&w,w>>>=3,k-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,O={bits:n.lenbits},P=l(0,n.lens,0,19,n.lencode,0,n.work,O),n.lenbits=O.bits,P){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;I=(z=n.lencode[w&(1<<n.lenbits)-1])>>>16&255,R=65535&z,!((N=z>>>24)<=k);){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(R<16)w>>>=N,k-=N,n.lens[n.have++]=R;else{if(16===R){for(L=N+2;k<L;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(w>>>=N,k-=N,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}F=n.lens[n.have-1],E=3+(3&w),w>>>=2,k-=2}else if(17===R){for(L=N+3;k<L;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}k-=N,F=0,E=3+(7&(w>>>=N)),w>>>=3,k-=3}else{for(L=N+7;k<L;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}k-=N,F=0,E=11+(127&(w>>>=N)),w>>>=7,k-=7}if(n.have+E>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,O={bits:n.lenbits},P=l(s,n.lens,0,n.nlen,n.lencode,0,n.work,O),n.lenbits=O.bits,P){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,O={bits:n.distbits},P=l(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,O),n.distbits=O.bits,P){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=y&&258<=b){e.next_out=v,e.avail_out=b,e.next_in=g,e.avail_in=y,n.hold=w,n.bits=k,a(e,S),v=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,y=e.avail_in,w=n.hold,k=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;I=(z=n.lencode[w&(1<<n.lenbits)-1])>>>16&255,R=65535&z,!((N=z>>>24)<=k);){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(I&&0==(240&I)){for(A=N,B=I,D=R;I=(z=n.lencode[D+((w&(1<<A+B)-1)>>A)])>>>16&255,R=65535&z,!(A+(N=z>>>24)<=k);){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}w>>>=A,k-=A,n.back+=A}if(w>>>=N,k-=N,n.back+=N,n.length=R,0===I){n.mode=26;break}if(32&I){n.back=-1,n.mode=12;break}if(64&I){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&I,n.mode=22;case 22:if(n.extra){for(L=n.extra;k<L;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.length+=w&(1<<n.extra)-1,w>>>=n.extra,k-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;I=(z=n.distcode[w&(1<<n.distbits)-1])>>>16&255,R=65535&z,!((N=z>>>24)<=k);){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(0==(240&I)){for(A=N,B=I,D=R;I=(z=n.distcode[D+((w&(1<<A+B)-1)>>A)])>>>16&255,R=65535&z,!(A+(N=z>>>24)<=k);){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}w>>>=A,k-=A,n.back+=A}if(w>>>=N,k-=N,n.back+=N,64&I){e.msg="invalid distance code",n.mode=30;break}n.offset=R,n.extra=15&I,n.mode=24;case 24:if(n.extra){for(L=n.extra;k<L;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}n.offset+=w&(1<<n.extra)-1,w>>>=n.extra,k-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===b)break e;if(E=S-b,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}_=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),M=n.window}else M=f,_=v-n.offset,E=n.length;for(b<E&&(E=b),b-=E,n.length-=E;f[v++]=M[_++],--E;);0===n.length&&(n.mode=21);break;case 26:if(0===b)break e;f[v++]=n.length,b--,n.mode=21;break;case 27:if(n.wrap){for(;k<32;){if(0===y)break e;y--,w|=h[g++]<<k,k+=8}if(S-=b,e.total_out+=S,n.total+=S,S&&(e.adler=n.check=n.flags?i(n.check,f,S,v-S):o(n.check,f,S,v-S)),S=b,(n.flags?w:m(w))!==n.check){e.msg="incorrect data check",n.mode=30;break}k=w=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;k<32;){if(0===y)break e;y--,w+=h[g++]<<k,k+=8}if(w!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}k=w=0}n.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return-4;case 32:default:return u}return e.next_out=v,e.avail_out=b,e.next_in=g,e.avail_in=y,n.hold=w,n.bits=k,(n.wsize||S!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&T(e,e.output,e.next_out,S-e.avail_out)?(n.mode=31,-4):(x-=e.avail_in,S-=e.avail_out,e.total_in+=x,e.total_out+=S,n.total+=S,n.wrap&&S&&(e.adler=n.check=n.flags?i(n.check,f,S,e.next_out-S):o(n.check,f,S,e.next_out-S)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==x&&0===S||4===t)&&P===d&&(P=-5),P)},n.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,d},n.inflateGetHeader=function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?u:((n.head=t).done=!1,d):u},n.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?u:11===n.mode&&o(1,t,r,0)!==n.check?-3:T(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,d):u},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){"use strict";var r=e("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,s,c,d,u,p){var h,f,m,g,v,y,b,w,k,x=p.bits,S=0,C=0,T=0,E=0,_=0,M=0,N=0,I=0,R=0,A=0,B=null,D=0,F=new r.Buf16(16),P=new r.Buf16(16),O=null,L=0;for(S=0;S<=15;S++)F[S]=0;for(C=0;C<s;C++)F[t[n+C]]++;for(_=x,E=15;1<=E&&0===F[E];E--);if(E<_&&(_=E),0===E)return c[d++]=20971520,c[d++]=20971520,p.bits=1,0;for(T=1;T<E&&0===F[T];T++);for(_<T&&(_=T),S=I=1;S<=15;S++)if(I<<=1,(I-=F[S])<0)return-1;if(0<I&&(0===e||1!==E))return-1;for(P[1]=0,S=1;S<15;S++)P[S+1]=P[S]+F[S];for(C=0;C<s;C++)0!==t[n+C]&&(u[P[t[n+C]]++]=C);if(y=0===e?(B=O=u,19):1===e?(B=o,D-=257,O=i,L-=257,256):(B=a,O=l,-1),S=T,v=d,N=C=A=0,m=-1,g=(R=1<<(M=_))-1,1===e&&852<R||2===e&&592<R)return 1;for(;;){for(b=S-N,k=u[C]<y?(w=0,u[C]):u[C]>y?(w=O[L+u[C]],B[D+u[C]]):(w=96,0),h=1<<S-N,T=f=1<<M;c[v+(A>>N)+(f-=h)]=b<<24|w<<16|k,0!==f;);for(h=1<<S-1;A&h;)h>>=1;if(0!==h?(A&=h-1,A+=h):A=0,C++,0==--F[S]){if(S===E)break;S=t[n+u[C]]}if(_<S&&(A&g)!==m){for(0===N&&(N=_),v+=T,I=1<<(M=S-N);M+N<E&&!((I-=F[M+N])<=0);)M++,I<<=1;if(R+=1<<M,1===e&&852<R||2===e&&592<R)return 1;c[m=A&g]=_<<24|M<<16|v-d}}return 0!==A&&(c[v+A]=S-N<<24|64<<16),p.bits=_,0}},{"../utils/common":41}],51:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){"use strict";var r=e("../utils/common"),o=0,i=1;function a(e){for(var t=e.length;0<=--t;)e[t]=0}var l=0,s=29,c=256,d=c+1+s,u=30,p=19,h=2*d+1,f=15,m=16,g=7,v=256,y=16,b=17,w=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],x=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T=new Array(2*(d+2));a(T);var E=new Array(2*u);a(E);var _=new Array(512);a(_);var M=new Array(256);a(M);var N=new Array(s);a(N);var I,R,A,B=new Array(u);function D(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?_[e]:_[256+(e>>>7)]}function O(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function L(e,t,n){e.bi_valid>m-n?(e.bi_buf|=t<<e.bi_valid&65535,O(e,e.bi_buf),e.bi_buf=t>>m-e.bi_valid,e.bi_valid+=n-m):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function z(e,t,n){L(e,n[2*t],n[2*t+1])}function V(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function $(e,t,n){var r,o,i=new Array(f+1),a=0;for(r=1;r<=f;r++)i[r]=a=a+n[r-1]<<1;for(o=0;o<=t;o++){var l=e[2*o+1];0!==l&&(e[2*o]=V(i[l]++,l))}}function j(e){var t;for(t=0;t<d;t++)e.dyn_ltree[2*t]=0;for(t=0;t<u;t++)e.dyn_dtree[2*t]=0;for(t=0;t<p;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*v]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function H(e){8<e.bi_valid?O(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function W(e,t,n,r){var o=2*t,i=2*n;return e[o]<e[i]||e[o]===e[i]&&r[t]<=r[n]}function q(e,t,n){for(var r=e.heap[n],o=n<<1;o<=e.heap_len&&(o<e.heap_len&&W(t,e.heap[o+1],e.heap[o],e.depth)&&o++,!W(t,r,e.heap[o],e.depth));)e.heap[n]=e.heap[o],n=o,o<<=1;e.heap[n]=r}function Z(e,t,n){var r,o,i,a,l=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],o=e.pending_buf[e.l_buf+l],l++,0===r?z(e,o,t):(z(e,(i=M[o])+c+1,t),0!==(a=k[i])&&L(e,o-=N[i],a),z(e,i=P(--r),n),0!==(a=x[i])&&L(e,r-=B[i],a)),l<e.last_lit;);z(e,v,t)}function U(e,t){var n,r,o,i=t.dyn_tree,a=t.stat_desc.static_tree,l=t.stat_desc.has_stree,s=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=h,n=0;n<s;n++)0!==i[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):i[2*n+1]=0;for(;e.heap_len<2;)i[2*(o=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[o]=0,e.opt_len--,l&&(e.static_len-=a[2*o+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)q(e,i,n);for(o=s;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],q(e,i,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,i[2*o]=i[2*n]+i[2*r],e.depth[o]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,i[2*n+1]=i[2*r+1]=o,e.heap[1]=o++,q(e,i,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,o,i,a,l,s=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,u=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,m=t.stat_desc.extra_base,g=t.stat_desc.max_length,v=0;for(i=0;i<=f;i++)e.bl_count[i]=0;for(s[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<h;n++)g<(i=s[2*s[2*(r=e.heap[n])+1]+1]+1)&&(i=g,v++),s[2*r+1]=i,c<r||(e.bl_count[i]++,a=0,m<=r&&(a=p[r-m]),l=s[2*r],e.opt_len+=l*(i+a),u&&(e.static_len+=l*(d[2*r+1]+a)));if(0!==v){do{for(i=g-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[g]--,v-=2}while(0<v);for(i=g;0!==i;i--)for(r=e.bl_count[i];0!==r;)c<(o=e.heap[--n])||(s[2*o+1]!==i&&(e.opt_len+=(i-s[2*o+1])*s[2*o],s[2*o+1]=i),r--)}}(e,t),$(i,c,e.bl_count)}function K(e,t,n){var r,o,i=-1,a=t[1],l=0,s=7,c=4;for(0===a&&(s=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)o=a,a=t[2*(r+1)+1],++l<s&&o===a||(l<c?e.bl_tree[2*o]+=l:0!==o?(o!==i&&e.bl_tree[2*o]++,e.bl_tree[2*y]++):l<=10?e.bl_tree[2*b]++:e.bl_tree[2*w]++,i=o,c=(l=0)===a?(s=138,3):o===a?(s=6,3):(s=7,4))}function G(e,t,n){var r,o,i=-1,a=t[1],l=0,s=7,c=4;for(0===a&&(s=138,c=3),r=0;r<=n;r++)if(o=a,a=t[2*(r+1)+1],!(++l<s&&o===a)){if(l<c)for(;z(e,o,e.bl_tree),0!=--l;);else 0!==o?(o!==i&&(z(e,o,e.bl_tree),l--),z(e,y,e.bl_tree),L(e,l-3,2)):l<=10?(z(e,b,e.bl_tree),L(e,l-3,3)):(z(e,w,e.bl_tree),L(e,l-11,7));i=o,c=(l=0)===a?(s=138,3):o===a?(s=6,3):(s=7,4)}}a(B);var X=!1;function Y(e,t,n,o){L(e,(l<<1)+(o?1:0),3),function(e,t,n,o){H(e),o&&(O(e,n),O(e,~n)),r.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n,!0)}n._tr_init=function(e){X||(function(){var e,t,n,r,o,i=new Array(f+1);for(r=n=0;r<s-1;r++)for(N[r]=n,e=0;e<1<<k[r];e++)M[n++]=r;for(M[n-1]=r,r=o=0;r<16;r++)for(B[r]=o,e=0;e<1<<x[r];e++)_[o++]=r;for(o>>=7;r<u;r++)for(B[r]=o<<7,e=0;e<1<<x[r]-7;e++)_[256+o++]=r;for(t=0;t<=f;t++)i[t]=0;for(e=0;e<=143;)T[2*e+1]=8,e++,i[8]++;for(;e<=255;)T[2*e+1]=9,e++,i[9]++;for(;e<=279;)T[2*e+1]=7,e++,i[7]++;for(;e<=287;)T[2*e+1]=8,e++,i[8]++;for($(T,d+1,i),e=0;e<u;e++)E[2*e+1]=5,E[2*e]=V(e,5);I=new D(T,k,c+1,d,f),R=new D(E,x,0,u,f),A=new D(new Array(0),S,0,p,g)}(),X=!0),e.l_desc=new F(e.dyn_ltree,I),e.d_desc=new F(e.dyn_dtree,R),e.bl_desc=new F(e.bl_tree,A),e.bi_buf=0,e.bi_valid=0,j(e)},n._tr_stored_block=Y,n._tr_flush_block=function(e,t,n,r){var a,l,s=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return i;for(t=32;t<c;t++)if(0!==e.dyn_ltree[2*t])return i;return o}(e)),U(e,e.l_desc),U(e,e.d_desc),s=function(e){var t;for(K(e,e.dyn_ltree,e.l_desc.max_code),K(e,e.dyn_dtree,e.d_desc.max_code),U(e,e.bl_desc),t=p-1;3<=t&&0===e.bl_tree[2*C[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),a=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=a&&(a=l)):a=l=n+5,n+4<=a&&-1!==t?Y(e,t,n,r):4===e.strategy||l===a?(L(e,2+(r?1:0),3),Z(e,T,E)):(L(e,4+(r?1:0),3),function(e,t,n,r){var o;for(L(e,t-257,5),L(e,n-1,5),L(e,r-4,4),o=0;o<r;o++)L(e,e.bl_tree[2*C[o]+1],3);G(e,e.dyn_ltree,t-1),G(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Z(e,e.dyn_ltree,e.dyn_dtree)),j(e),r&&H(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(M[n]+c+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){L(e,2,3),z(e,v,T),function(e){16===e.bi_valid?(O(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,r,o,i,a=1,l={},s=!1,c=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick(function(){p(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(i="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},function(e){o.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(p,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var o={callback:e,args:t};return l[a]=o,n(a),a++},d.clearImmediate=u}function u(e){delete l[e]}function p(e){if(s)setTimeout(p,0,e);else{var n=l[e];if(n){s=!0;try{!function(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r)}}(n)}finally{u(e),s=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&p(+t.data.slice(i.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)})},6533:function(e,t,n){n(4423),n(4114),n(8111),n(2489),n(7588),n(3110),function(e){e.parser=function(e,t){return new o(e,t)},e.SAXParser=o,e.SAXStream=u,e.createStream=c,e.MAX_BUFFER_LENGTH=65536;var t,r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function o(t,n){if(!(this instanceof o))return new o(t,n);var r=this;a(r),r.q=r.c="",r.bufferCheckPosition=e.MAX_BUFFER_LENGTH,r.encoding=null,r.opt=n||{},r.opt.lowercase=r.opt.lowercase||r.opt.lowercasetags,r.looseCase=r.opt.lowercase?"toLowerCase":"toUpperCase",r.opt.maxEntityCount=r.opt.maxEntityCount||512,r.opt.maxEntityDepth=r.opt.maxEntityDepth||4,r.entityCount=r.entityDepth=0,r.tags=[],r.closed=r.closedRoot=r.sawRoot=!1,r.tag=r.error=null,r.strict=!!t,r.noscript=!(!t&&!r.opt.noscript),r.state=E.BEGIN,r.strictEntities=r.opt.strictEntities,r.ENTITIES=r.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),r.attribList=[],r.opt.xmlns&&(r.ns=Object.create(g)),void 0===r.opt.unquotedAttributeValues&&(r.opt.unquotedAttributeValues=!t),r.trackPosition=!1!==r.opt.position,r.trackPosition&&(r.position=r.line=r.column=0),M(r,"onready")}function i(t){for(var n=Math.max(e.MAX_BUFFER_LENGTH,10),o=0,i=0,a=r.length;i<a;i++){var l=t[r[i]].length;if(l>n)switch(r[i]){case"textNode":D(t);break;case"cdata":B(t,"oncdata",t.cdata),t.cdata="";break;case"script":B(t,"onscript",t.script),t.script="";break;default:P(t,"Max buffer length exceeded: "+r[i])}o=Math.max(o,l)}var s=e.MAX_BUFFER_LENGTH-o;t.bufferCheckPosition=s+t.position}function a(e){for(var t=0,n=r.length;t<n;t++)e[r[t]]=""}function l(e){D(e),""!==e.cdata&&(B(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(B(e,"onscript",e.script),e.script="")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}t.prototype=e;var n=new t;return n}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),o.prototype={end:function(){O(this)},write:U,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){l(this)}};try{t=n(8277).Stream}catch(K){t=function(){}}t||(t=function(){});var s=e.EVENTS.filter(function(e){return"error"!==e&&"end"!==e});function c(e,t){return new u(e,t)}function d(e,t){if(e.length>=2){if(255===e[0]&&254===e[1])return"utf-16le";if(254===e[0]&&255===e[1])return"utf-16be"}return e.length>=3&&239===e[0]&&187===e[1]&&191===e[2]?"utf8":e.length>=4?60===e[0]&&0===e[1]&&63===e[2]&&0===e[3]?"utf-16le":0===e[0]&&60===e[1]&&0===e[2]&&63===e[3]?"utf-16be":"utf8":t?"utf8":null}function u(e,n){if(!(this instanceof u))return new u(e,n);t.apply(this),this._parser=new o(e,n),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(e){r.emit("error",e),r._parser.error=null},this._decoder=null,this._decoderBuffer=null,s.forEach(function(e){Object.defineProperty(r,"on"+e,{get:function(){return r._parser["on"+e]},set:function(t){if(!t)return r.removeAllListeners(e),r._parser["on"+e]=t,t;r.on(e,t)},enumerable:!0,configurable:!1})})}u.prototype=Object.create(t.prototype,{constructor:{value:u}}),u.prototype._decodeBuffer=function(e,t){if(this._decoderBuffer&&(e=Buffer.concat([this._decoderBuffer,e]),this._decoderBuffer=null),!this._decoder){var n=d(e,t);if(!n)return this._decoderBuffer=e,"";this._parser.encoding=n,this._decoder=new TextDecoder(n)}return this._decoder.decode(e,{stream:!t})},u.prototype.write=function(e){if("function"===typeof Buffer&&"function"===typeof Buffer.isBuffer&&Buffer.isBuffer(e))e=this._decodeBuffer(e,!1);else if(this._decoderBuffer){var t=this._decodeBuffer(Buffer.alloc(0),!0);t&&(this._parser.write(t),this.emit("data",t))}return this._parser.write(e.toString()),this.emit("data",e),!0},u.prototype.end=function(e){if(e&&e.length&&this.write(e),this._decoderBuffer){var t=this._decodeBuffer(Buffer.alloc(0),!0);t&&(this._parser.write(t),this.emit("data",t))}else if(this._decoder){var n=this._decoder.decode();n&&(this._parser.write(n),this.emit("data",n))}return this._parser.end(),!0},u.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===s.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var p="[CDATA[",h="DOCTYPE",f="http://www.w3.org/XML/1998/namespace",m="http://www.w3.org/2000/xmlns/",g={xml:f,xmlns:m},v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,b=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,w=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function k(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function x(e){return'"'===e||"'"===e}function S(e){return">"===e||k(e)}function C(e,t){return e.test(t)}function T(e,t){return!C(e,t)}var E=0;for(var _ in e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(t){var n=e.ENTITIES[t],r="number"===typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r}),e.STATE)e.STATE[e.STATE[_]]=_;function M(e,t,n){e[t]&&e[t](n)}function N(e){var t=e&&e.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return t?t[2]:null}function I(e){return e?e.toLowerCase().replace(/[^a-z0-9]/g,""):null}function R(e,t){const n=I(e),r=I(t);return!n||!r||("utf16"===r?"utf16le"===n||"utf16be"===n:n===r)}function A(e,t){if(e.strict&&e.encoding&&t&&"xml"===t.name){var n=N(t.body);n&&!R(e.encoding,n)&&L(e,"XML declaration encoding "+n+" does not match detected stream encoding "+e.encoding.toUpperCase())}}function B(e,t,n){e.textNode&&D(e),M(e,t,n)}function D(e){e.textNode=F(e.opt,e.textNode),e.textNode&&M(e,"ontext",e.textNode),e.textNode=""}function F(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function P(e,t){return D(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,M(e,"onerror",t),e}function O(e){return e.sawRoot&&!e.closedRoot&&L(e,"Unclosed root tag"),e.state!==E.BEGIN&&e.state!==E.BEGIN_WHITESPACE&&e.state!==E.TEXT&&P(e,"Unexpected end"),D(e),e.c="",e.closed=!0,M(e,"onend"),o.call(e,e.strict,e.opt),e}function L(e,t){if("object"!==typeof e||!(e instanceof o))throw new Error("bad call to strictFail");e.strict&&P(e,t)}function z(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,B(e,"onopentagstart",n)}function V(e,t){var n=e.indexOf(":"),r=n<0?["",e]:e.split(":"),o=r[0],i=r[1];return t&&"xmlns"===e&&(o="xmlns",i=""),{prefix:o,local:i}}function $(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=V(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==f)L(e,"xml: prefix must be bound to "+f+"\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==m)L(e,"xmlns: prefix must be bound to "+m+"\nActual: "+e.attribValue);else{var o=e.tag,i=e.tags[e.tags.length-1]||e;o.ns===i.ns&&(o.ns=Object.create(i.ns)),o.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,B(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function j(e,t){if(e.opt.xmlns){var n=e.tag,r=V(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(L(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var o=e.tags[e.tags.length-1]||e;n.ns&&o.ns!==n.ns&&Object.keys(n.ns).forEach(function(t){B(e,"onopennamespace",{prefix:t,uri:n.ns[t]})});for(var i=0,a=e.attribList.length;i<a;i++){var l=e.attribList[i],s=l[0],c=l[1],d=V(s,!0),u=d.prefix,p=d.local,h=""===u?"":n.ns[u]||"",f={name:s,value:c,prefix:u,local:p,uri:h};u&&"xmlns"!==u&&!h&&(L(e,"Unbound namespace prefix: "+JSON.stringify(u)),f.uri=u),e.tag.attributes[s]=f,B(e,"onattribute",f)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),B(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=E.TEXT:e.state=E.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function H(e){if(!e.tagName)return L(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=E.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=E.SCRIPT);B(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());var r=n;while(t--){var o=e.tags[t];if(o.name===r)break;L(e,"Unexpected close tag")}if(t<0)return L(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=E.TEXT);e.tagName=n;var i=e.tags.length;while(i-- >t){var a=e.tag=e.tags.pop();e.tagName=e.tag.name,B(e,"onclosetag",e.tagName);var l={};for(var s in a.ns)l[s]=a.ns[s];var c=e.tags[e.tags.length-1]||e;e.opt.xmlns&&a.ns!==c.ns&&Object.keys(a.ns).forEach(function(t){var n=a.ns[t];B(e,"onclosenamespace",{prefix:t,uri:n})})}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=E.TEXT}function W(e){var t,n=e.entity,r=n.toLowerCase(),o="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:(n=r,"#"===n.charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),t=parseInt(n,16),o=t.toString(16)):(n=n.slice(1),t=parseInt(n,10),o=t.toString(10))),n=n.replace(/^0+/,""),isNaN(t)||o.toLowerCase()!==n||t<0||t>1114111?(L(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function q(e,t){"<"===t?(e.state=E.OPEN_WAKA,e.startTagPosition=e.position):k(t)||(L(e,"Non-whitespace before first tag."),e.textNode=t,e.state=E.TEXT)}function Z(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}function U(t){var n=this;if(this.error)throw this.error;if(n.closed)return P(n,"Cannot write after close. Assign an onready handler.");if(null===t)return O(n);"object"===typeof t&&(t=t.toString());var r=0,o="";while(1){if(o=Z(t,r++),n.c=o,!o)break;switch(n.trackPosition&&(n.position++,"\n"===o?(n.line++,n.column=0):n.column++),n.state){case E.BEGIN:if(n.state=E.BEGIN_WHITESPACE,"\ufeff"===o)continue;q(n,o);continue;case E.BEGIN_WHITESPACE:q(n,o);continue;case E.TEXT:if(n.sawRoot&&!n.closedRoot){var a=r-1;while(o&&"<"!==o&&"&"!==o)o=Z(t,r++),o&&n.trackPosition&&(n.position++,"\n"===o?(n.line++,n.column=0):n.column++);n.textNode+=t.substring(a,r-1)}"<"!==o||n.sawRoot&&n.closedRoot&&!n.strict?(k(o)||n.sawRoot&&!n.closedRoot||L(n,"Text data outside of root node."),"&"===o?n.state=E.TEXT_ENTITY:n.textNode+=o):(n.state=E.OPEN_WAKA,n.startTagPosition=n.position);continue;case E.SCRIPT:"<"===o?n.state=E.SCRIPT_ENDING:n.script+=o;continue;case E.SCRIPT_ENDING:"/"===o?n.state=E.CLOSE_TAG:(n.script+="<"+o,n.state=E.SCRIPT);continue;case E.OPEN_WAKA:if("!"===o)n.state=E.SGML_DECL,n.sgmlDecl="";else if(k(o));else if(C(v,o))n.state=E.OPEN_TAG,n.tagName=o;else if("/"===o)n.state=E.CLOSE_TAG,n.tagName="";else if("?"===o)n.state=E.PROC_INST,n.procInstName=n.procInstBody="";else{if(L(n,"Unencoded <"),n.startTagPosition+1<n.position){var l=n.position-n.startTagPosition;o=new Array(l).join(" ")+o}n.textNode+="<"+o,n.state=E.TEXT}continue;case E.SGML_DECL:if(n.sgmlDecl+o==="--"){n.state=E.COMMENT,n.comment="",n.sgmlDecl="";continue}n.doctype&&!0!==n.doctype&&n.sgmlDecl?(n.state=E.DOCTYPE_DTD,n.doctype+="<!"+n.sgmlDecl+o,n.sgmlDecl=""):(n.sgmlDecl+o).toUpperCase()===p?(B(n,"onopencdata"),n.state=E.CDATA,n.sgmlDecl="",n.cdata=""):(n.sgmlDecl+o).toUpperCase()===h?(n.state=E.DOCTYPE,(n.doctype||n.sawRoot)&&L(n,"Inappropriately located doctype declaration"),n.doctype="",n.sgmlDecl=""):">"===o?(B(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=E.TEXT):x(o)?(n.state=E.SGML_DECL_QUOTED,n.sgmlDecl+=o):n.sgmlDecl+=o;continue;case E.SGML_DECL_QUOTED:o===n.q&&(n.state=E.SGML_DECL,n.q=""),n.sgmlDecl+=o;continue;case E.DOCTYPE:">"===o?(n.state=E.TEXT,B(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=o,"["===o?n.state=E.DOCTYPE_DTD:x(o)&&(n.state=E.DOCTYPE_QUOTED,n.q=o));continue;case E.DOCTYPE_QUOTED:n.doctype+=o,o===n.q&&(n.q="",n.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:"]"===o?(n.doctype+=o,n.state=E.DOCTYPE):"<"===o?(n.state=E.OPEN_WAKA,n.startTagPosition=n.position):x(o)?(n.doctype+=o,n.state=E.DOCTYPE_DTD_QUOTED,n.q=o):n.doctype+=o;continue;case E.DOCTYPE_DTD_QUOTED:n.doctype+=o,o===n.q&&(n.state=E.DOCTYPE_DTD,n.q="");continue;case E.COMMENT:"-"===o?n.state=E.COMMENT_ENDING:n.comment+=o;continue;case E.COMMENT_ENDING:"-"===o?(n.state=E.COMMENT_ENDED,n.comment=F(n.opt,n.comment),n.comment&&B(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+o,n.state=E.COMMENT);continue;case E.COMMENT_ENDED:">"!==o?(L(n,"Malformed comment"),n.comment+="--"+o,n.state=E.COMMENT):n.doctype&&!0!==n.doctype?n.state=E.DOCTYPE_DTD:n.state=E.TEXT;continue;case E.CDATA:a=r-1;while(o&&"]"!==o)o=Z(t,r++),o&&n.trackPosition&&(n.position++,"\n"===o?(n.line++,n.column=0):n.column++);n.cdata+=t.substring(a,r-1),"]"===o&&(n.state=E.CDATA_ENDING);continue;case E.CDATA_ENDING:"]"===o?n.state=E.CDATA_ENDING_2:(n.cdata+="]"+o,n.state=E.CDATA);continue;case E.CDATA_ENDING_2:">"===o?(n.cdata&&B(n,"oncdata",n.cdata),B(n,"onclosecdata"),n.cdata="",n.state=E.TEXT):"]"===o?n.cdata+="]":(n.cdata+="]]"+o,n.state=E.CDATA);continue;case E.PROC_INST:"?"===o?n.state=E.PROC_INST_ENDING:k(o)?n.state=E.PROC_INST_BODY:n.procInstName+=o;continue;case E.PROC_INST_BODY:if(!n.procInstBody&&k(o))continue;"?"===o?n.state=E.PROC_INST_ENDING:n.procInstBody+=o;continue;case E.PROC_INST_ENDING:if(">"===o){const e={name:n.procInstName,body:n.procInstBody};A(n,e),B(n,"onprocessinginstruction",e),n.procInstName=n.procInstBody="",n.state=E.TEXT}else n.procInstBody+="?"+o,n.state=E.PROC_INST_BODY;continue;case E.OPEN_TAG:C(y,o)?n.tagName+=o:(z(n),">"===o?j(n):"/"===o?n.state=E.OPEN_TAG_SLASH:(k(o)||L(n,"Invalid character in tag name"),n.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:">"===o?(j(n,!0),H(n)):(L(n,"Forward-slash in opening tag not followed by >"),n.state=E.ATTRIB);continue;case E.ATTRIB:if(k(o))continue;">"===o?j(n):"/"===o?n.state=E.OPEN_TAG_SLASH:C(v,o)?(n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):L(n,"Invalid attribute name");continue;case E.ATTRIB_NAME:"="===o?n.state=E.ATTRIB_VALUE:">"===o?(L(n,"Attribute without value"),n.attribValue=n.attribName,$(n),j(n)):k(o)?n.state=E.ATTRIB_NAME_SAW_WHITE:C(y,o)?n.attribName+=o:L(n,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if("="===o)n.state=E.ATTRIB_VALUE;else{if(k(o))continue;L(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",B(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===o?j(n):C(v,o)?(n.attribName=o,n.state=E.ATTRIB_NAME):(L(n,"Invalid attribute name"),n.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(k(o))continue;x(o)?(n.q=o,n.state=E.ATTRIB_VALUE_QUOTED):(n.opt.unquotedAttributeValues||P(n,"Unquoted attribute value"),n.state=E.ATTRIB_VALUE_UNQUOTED,n.attribValue=o);continue;case E.ATTRIB_VALUE_QUOTED:if(o!==n.q){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=o;continue}$(n),n.q="",n.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:k(o)?n.state=E.ATTRIB:">"===o?j(n):"/"===o?n.state=E.OPEN_TAG_SLASH:C(v,o)?(L(n,"No whitespace between attributes"),n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):L(n,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!S(o)){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_U:n.attribValue+=o;continue}$(n),">"===o?j(n):n.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(n.tagName)">"===o?H(n):C(y,o)?n.tagName+=o:n.script?(n.script+="</"+n.tagName+o,n.tagName="",n.state=E.SCRIPT):(k(o)||L(n,"Invalid tagname in closing tag"),n.state=E.CLOSE_TAG_SAW_WHITE);else{if(k(o))continue;T(v,o)?n.script?(n.script+="</"+o,n.state=E.SCRIPT):L(n,"Invalid tagname in closing tag."):n.tagName=o}continue;case E.CLOSE_TAG_SAW_WHITE:if(k(o))continue;">"===o?H(n):L(n,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var s,c;switch(n.state){case E.TEXT_ENTITY:s=E.TEXT,c="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:s=E.ATTRIB_VALUE_QUOTED,c="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:s=E.ATTRIB_VALUE_UNQUOTED,c="attribValue";break}if(";"===o){var d=W(n);n.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(d)?((n.entityCount+=1)>n.opt.maxEntityCount&&P(n,"Parsed entity count exceeds max entity count"),(n.entityDepth+=1)>n.opt.maxEntityDepth&&P(n,"Parsed entity depth exceeds max entity depth"),n.entity="",n.state=s,n.write(d),n.entityDepth-=1):(n[c]+=d,n.entity="",n.state=s)}else C(n.entity.length?w:b,o)?n.entity+=o:(L(n,"Invalid character in entity name"),n[c]+="&"+n.entity+o,n.entity="",n.state=s);continue;default:throw new Error(n,"Unknown state: "+n.state)}}return n.position>=n.bufferCheckPosition&&i(n),n}
|
|
2
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */E=e.STATE,String.fromCodePoint||function(){var e=String.fromCharCode,t=Math.floor,n=function(){var n,r,o=16384,i=[],a=-1,l=arguments.length;if(!l)return"";var s="";while(++a<l){var c=Number(arguments[a]);if(!isFinite(c)||c<0||c>1114111||t(c)!==c)throw RangeError("Invalid code point: "+c);c<=65535?i.push(c):(c-=65536,n=55296+(c>>10),r=c%1024+56320,i.push(n,r)),(a+1===l||i.length>o)&&(s+=e.apply(null,i),i.length=0)}return s};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:n,configurable:!0,writable:!0}):String.fromCodePoint=n}()}(t)},8868:function(e,t){"use strict";t.A=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n}},6906:function(e){e.exports={isArray:function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}}},6512:function(e,t,n){var r=n(2760),o=n(3433),i=n(8794),a=n(8455);e.exports={xml2js:r,xml2json:o,js2xml:i,json2xml:a}},8794:function(e,t,n){n(4114),n(8111),n(8237);var r,o,i=n(8071),a=n(6906).isArray;function l(e){var t=i.copyOptions(e);return i.ensureFlagExists("ignoreDeclaration",t),i.ensureFlagExists("ignoreInstruction",t),i.ensureFlagExists("ignoreAttributes",t),i.ensureFlagExists("ignoreText",t),i.ensureFlagExists("ignoreComment",t),i.ensureFlagExists("ignoreCdata",t),i.ensureFlagExists("ignoreDoctype",t),i.ensureFlagExists("compact",t),i.ensureFlagExists("indentText",t),i.ensureFlagExists("indentCdata",t),i.ensureFlagExists("indentAttributes",t),i.ensureFlagExists("indentInstruction",t),i.ensureFlagExists("fullTagEmptyElement",t),i.ensureFlagExists("noQuotesForNativeAttributes",t),i.ensureSpacesExists(t),"number"===typeof t.spaces&&(t.spaces=Array(t.spaces+1).join(" ")),i.ensureKeyExists("declaration",t),i.ensureKeyExists("instruction",t),i.ensureKeyExists("attributes",t),i.ensureKeyExists("text",t),i.ensureKeyExists("comment",t),i.ensureKeyExists("cdata",t),i.ensureKeyExists("doctype",t),i.ensureKeyExists("type",t),i.ensureKeyExists("name",t),i.ensureKeyExists("elements",t),i.checkFnExists("doctype",t),i.checkFnExists("instruction",t),i.checkFnExists("cdata",t),i.checkFnExists("comment",t),i.checkFnExists("text",t),i.checkFnExists("instructionName",t),i.checkFnExists("elementName",t),i.checkFnExists("attributeName",t),i.checkFnExists("attributeValue",t),i.checkFnExists("attributes",t),i.checkFnExists("fullTagEmptyElement",t),t}function s(e,t,n){return(!n&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function c(e,t,n){if(t.ignoreAttributes)return"";"attributesFn"in t&&(e=t.attributesFn(e,o,r));var i,a,l,c,d=[];for(i in e)e.hasOwnProperty(i)&&null!==e[i]&&void 0!==e[i]&&(c=t.noQuotesForNativeAttributes&&"string"!==typeof e[i]?"":'"',a=""+e[i],a=a.replace(/"/g,"""),l="attributeNameFn"in t?t.attributeNameFn(i,a,o,r):i,d.push(t.spaces&&t.indentAttributes?s(t,n+1,!1):" "),d.push(l+"="+c+("attributeValueFn"in t?t.attributeValueFn(a,i,o,r):a)+c));return e&&Object.keys(e).length&&t.spaces&&t.indentAttributes&&d.push(s(t,n,!1)),d.join("")}function d(e,t,n){return r=e,o="xml",t.ignoreDeclaration?"":"<?xml"+c(e[t.attributesKey],t,n)+"?>"}function u(e,t,n){if(t.ignoreInstruction)return"";var i;for(i in e)if(e.hasOwnProperty(i))break;var a="instructionNameFn"in t?t.instructionNameFn(i,e[i],o,r):i;if("object"===typeof e[i])return r=e,o=a,"<?"+a+c(e[i][t.attributesKey],t,n)+"?>";var l=e[i]?e[i]:"";return"instructionFn"in t&&(l=t.instructionFn(l,i,o,r)),"<?"+a+(l?" "+l:"")+"?>"}function p(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,o,r):e)+"--\x3e"}function h(e,t){return t.ignoreCdata?"":"<![CDATA["+("cdataFn"in t?t.cdataFn(e,o,r):e.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function f(e,t){return t.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in t?t.doctypeFn(e,o,r):e)+">"}function m(e,t){return t.ignoreText?"":(e=""+e,e=e.replace(/&/g,"&"),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"textFn"in t?t.textFn(e,o,r):e)}function g(e,t){var n;if(e.elements&&e.elements.length)for(n=0;n<e.elements.length;++n)switch(e.elements[n][t.typeKey]){case"text":if(t.indentText)return!0;break;case"cdata":if(t.indentCdata)return!0;break;case"instruction":if(t.indentInstruction)return!0;break;case"doctype":case"comment":case"element":return!0;default:return!0}return!1}function v(e,t,n){r=e,o=e.name;var i=[],a="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;i.push("<"+a),e[t.attributesKey]&&i.push(c(e[t.attributesKey],t,n));var l=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&"preserve"===e[t.attributesKey]["xml:space"];return l||(l="fullTagEmptyElementFn"in t?t.fullTagEmptyElementFn(e.name,e):t.fullTagEmptyElement),l?(i.push(">"),e[t.elementsKey]&&e[t.elementsKey].length&&(i.push(y(e[t.elementsKey],t,n+1)),r=e,o=e.name),i.push(t.spaces&&g(e,t)?"\n"+Array(n+1).join(t.spaces):""),i.push("</"+a+">")):i.push("/>"),i.join("")}function y(e,t,n,r){return e.reduce(function(e,o){var i=s(t,n,r&&!e);switch(o.type){case"element":return e+i+v(o,t,n);case"comment":return e+i+p(o[t.commentKey],t);case"doctype":return e+i+f(o[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?i:"")+h(o[t.cdataKey],t);case"text":return e+(t.indentText?i:"")+m(o[t.textKey],t);case"instruction":var a={};return a[o[t.nameKey]]=o[t.attributesKey]?o:o[t.instructionKey],e+(t.indentInstruction?i:"")+u(a,t,n)}},"")}function b(e,t,n){var r;for(r in e)if(e.hasOwnProperty(r))switch(r){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||n)return!0;break;case t.cdataKey:if(t.indentCdata||n)return!0;break;case t.instructionKey:if(t.indentInstruction||n)return!0;break;case t.doctypeKey:case t.commentKey:return!0;default:return!0}return!1}function w(e,t,n,i,a){r=e,o=t;var l="elementNameFn"in n?n.elementNameFn(t,e):t;if("undefined"===typeof e||null===e||""===e)return"fullTagEmptyElementFn"in n&&n.fullTagEmptyElementFn(t,e)||n.fullTagEmptyElement?"<"+l+"></"+l+">":"<"+l+"/>";var d=[];if(t){if(d.push("<"+l),"object"!==typeof e)return d.push(">"+m(e,n)+"</"+l+">"),d.join("");e[n.attributesKey]&&d.push(c(e[n.attributesKey],n,i));var u=b(e,n,!0)||e[n.attributesKey]&&"preserve"===e[n.attributesKey]["xml:space"];if(u||(u="fullTagEmptyElementFn"in n?n.fullTagEmptyElementFn(t,e):n.fullTagEmptyElement),!u)return d.push("/>"),d.join("");d.push(">")}return d.push(k(e,n,i+1,!1)),r=e,o=t,t&&d.push((a?s(n,i,!1):"")+"</"+l+">"),d.join("")}function k(e,t,n,r){var o,i,l,c=[];for(i in e)if(e.hasOwnProperty(i))for(l=a(e[i])?e[i]:[e[i]],o=0;o<l.length;++o){switch(i){case t.declarationKey:c.push(d(l[o],t,n));break;case t.instructionKey:c.push((t.indentInstruction?s(t,n,r):"")+u(l[o],t,n));break;case t.attributesKey:case t.parentKey:break;case t.textKey:c.push((t.indentText?s(t,n,r):"")+m(l[o],t));break;case t.cdataKey:c.push((t.indentCdata?s(t,n,r):"")+h(l[o],t));break;case t.doctypeKey:c.push(s(t,n,r)+f(l[o],t));break;case t.commentKey:c.push(s(t,n,r)+p(l[o],t));break;default:c.push(s(t,n,r)+w(l[o],i,t,n,b(l[o],t)))}r=r&&!c.length}return c.join("")}e.exports=function(e,t){t=l(t);var n=[];return r=e,o="_root_",t.compact?n.push(k(e,t,0,!0)):(e[t.declarationKey]&&n.push(d(e[t.declarationKey],t,0)),e[t.elementsKey]&&e[t.elementsKey].length&&n.push(y(e[t.elementsKey],t,0,!n.length))),n.join("")}},8455:function(e,t,n){n(9112);var r=n(8794);e.exports=function(e,t){e instanceof Buffer&&(e=e.toString());var n=null;if("string"===typeof e)try{n=JSON.parse(e)}catch(o){throw new Error("The JSON structure is invalid")}else n=e;return r(n,t)}},8071:function(e,t,n){var r=n(6906).isArray;e.exports={copyOptions:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},ensureFlagExists:function(e,t){e in t&&"boolean"===typeof t[e]||(t[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||"number"!==typeof e.spaces&&"string"!==typeof e.spaces)&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"===typeof e.alwaysArray||r(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(e,t){e+"Key"in t&&"string"===typeof t[e+"Key"]||(t[e+"Key"]=t.compact?"_"+e:e)},checkFnExists:function(e,t){return e+"Fn"in t}}},2760:function(e,t,n){n(4114);var r,o,i=n(6533),a={on:function(){},parse:function(){}},l=n(8071),s=n(6906).isArray,c=!0;function d(e){return r=l.copyOptions(e),l.ensureFlagExists("ignoreDeclaration",r),l.ensureFlagExists("ignoreInstruction",r),l.ensureFlagExists("ignoreAttributes",r),l.ensureFlagExists("ignoreText",r),l.ensureFlagExists("ignoreComment",r),l.ensureFlagExists("ignoreCdata",r),l.ensureFlagExists("ignoreDoctype",r),l.ensureFlagExists("compact",r),l.ensureFlagExists("alwaysChildren",r),l.ensureFlagExists("addParent",r),l.ensureFlagExists("trim",r),l.ensureFlagExists("nativeType",r),l.ensureFlagExists("nativeTypeAttributes",r),l.ensureFlagExists("sanitize",r),l.ensureFlagExists("instructionHasAttributes",r),l.ensureFlagExists("captureSpacesBetweenElements",r),l.ensureAlwaysArrayExists(r),l.ensureKeyExists("declaration",r),l.ensureKeyExists("instruction",r),l.ensureKeyExists("attributes",r),l.ensureKeyExists("text",r),l.ensureKeyExists("comment",r),l.ensureKeyExists("cdata",r),l.ensureKeyExists("doctype",r),l.ensureKeyExists("type",r),l.ensureKeyExists("name",r),l.ensureKeyExists("elements",r),l.ensureKeyExists("parent",r),l.checkFnExists("doctype",r),l.checkFnExists("instruction",r),l.checkFnExists("cdata",r),l.checkFnExists("comment",r),l.checkFnExists("text",r),l.checkFnExists("instructionName",r),l.checkFnExists("elementName",r),l.checkFnExists("attributeName",r),l.checkFnExists("attributeValue",r),l.checkFnExists("attributes",r),r}function u(e){var t=Number(e);if(!isNaN(t))return t;var n=e.toLowerCase();return"true"===n||"false"!==n&&e}function p(e,t){var n;if(r.compact){if(!o[r[e+"Key"]]&&(s(r.alwaysArray)?-1!==r.alwaysArray.indexOf(r[e+"Key"]):r.alwaysArray)&&(o[r[e+"Key"]]=[]),o[r[e+"Key"]]&&!s(o[r[e+"Key"]])&&(o[r[e+"Key"]]=[o[r[e+"Key"]]]),e+"Fn"in r&&"string"===typeof t&&(t=r[e+"Fn"](t,o)),"instruction"===e&&("instructionFn"in r||"instructionNameFn"in r))for(n in t)if(t.hasOwnProperty(n))if("instructionFn"in r)t[n]=r.instructionFn(t[n],n,o);else{var i=t[n];delete t[n],t[r.instructionNameFn(n,i,o)]=i}s(o[r[e+"Key"]])?o[r[e+"Key"]].push(t):o[r[e+"Key"]]=t}else{o[r.elementsKey]||(o[r.elementsKey]=[]);var a={};if(a[r.typeKey]=e,"instruction"===e){for(n in t)if(t.hasOwnProperty(n))break;a[r.nameKey]="instructionNameFn"in r?r.instructionNameFn(n,t,o):n,r.instructionHasAttributes?(a[r.attributesKey]=t[n][r.attributesKey],"instructionFn"in r&&(a[r.attributesKey]=r.instructionFn(a[r.attributesKey],n,o))):("instructionFn"in r&&(t[n]=r.instructionFn(t[n],n,o)),a[r.instructionKey]=t[n])}else e+"Fn"in r&&(t=r[e+"Fn"](t,o)),a[r[e+"Key"]]=t;r.addParent&&(a[r.parentKey]=o),o[r.elementsKey].push(a)}}function h(e){var t;if("attributesFn"in r&&e&&(e=r.attributesFn(e,o)),(r.trim||"attributeValueFn"in r||"attributeNameFn"in r||r.nativeTypeAttributes)&&e)for(t in e)if(e.hasOwnProperty(t)&&(r.trim&&(e[t]=e[t].trim()),r.nativeTypeAttributes&&(e[t]=u(e[t])),"attributeValueFn"in r&&(e[t]=r.attributeValueFn(e[t],t,o)),"attributeNameFn"in r)){var n=e[t];delete e[t],e[r.attributeNameFn(t,e[t],o)]=n}return e}function f(e){var t={};if(e.body&&("xml"===e.name.toLowerCase()||r.instructionHasAttributes)){var n,i=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;while(null!==(n=i.exec(e.body)))t[n[1]]=n[2]||n[3]||n[4];t=h(t)}if("xml"===e.name.toLowerCase()){if(r.ignoreDeclaration)return;o[r.declarationKey]={},Object.keys(t).length&&(o[r.declarationKey][r.attributesKey]=t),r.addParent&&(o[r.declarationKey][r.parentKey]=o)}else{if(r.ignoreInstruction)return;r.trim&&(e.body=e.body.trim());var a={};r.instructionHasAttributes&&Object.keys(t).length?(a[e.name]={},a[e.name][r.attributesKey]=t):a[e.name]=e.body,p("instruction",a)}}function m(e,t){var n;if("object"===typeof e&&(t=e.attributes,e=e.name),t=h(t),"elementNameFn"in r&&(e=r.elementNameFn(e,o)),r.compact){var i;if(n={},!r.ignoreAttributes&&t&&Object.keys(t).length)for(i in n[r.attributesKey]={},t)t.hasOwnProperty(i)&&(n[r.attributesKey][i]=t[i]);!(e in o)&&(s(r.alwaysArray)?-1!==r.alwaysArray.indexOf(e):r.alwaysArray)&&(o[e]=[]),o[e]&&!s(o[e])&&(o[e]=[o[e]]),s(o[e])?o[e].push(n):o[e]=n}else o[r.elementsKey]||(o[r.elementsKey]=[]),n={},n[r.typeKey]="element",n[r.nameKey]=e,!r.ignoreAttributes&&t&&Object.keys(t).length&&(n[r.attributesKey]=t),r.alwaysChildren&&(n[r.elementsKey]=[]),o[r.elementsKey].push(n);n[r.parentKey]=o,o=n}function g(e){r.ignoreText||(e.trim()||r.captureSpacesBetweenElements)&&(r.trim&&(e=e.trim()),r.nativeType&&(e=u(e)),r.sanitize&&(e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")),p("text",e))}function v(e){r.ignoreComment||(r.trim&&(e=e.trim()),p("comment",e))}function y(e){var t=o[r.parentKey];r.addParent||delete o[r.parentKey],o=t}function b(e){r.ignoreCdata||(r.trim&&(e=e.trim()),p("cdata",e))}function w(e){r.ignoreDoctype||(e=e.replace(/^ /,""),r.trim&&(e=e.trim()),p("doctype",e))}function k(e){e.note=e}e.exports=function(e,t){var n=c?i.parser(!0,{}):n=new a.Parser("UTF-8"),l={};if(o=l,r=d(t),c?(n.opt={strictEntities:!0},n.onopentag=m,n.ontext=g,n.oncomment=v,n.onclosetag=y,n.onerror=k,n.oncdata=b,n.ondoctype=w,n.onprocessinginstruction=f):(n.on("startElement",m),n.on("text",g),n.on("comment",v),n.on("endElement",y),n.on("error",k)),c)n.write(e).close();else if(!n.parse(e))throw new Error("XML parsing error: "+n.getError());if(l[r.elementsKey]){var s=l[r.elementsKey];delete l[r.elementsKey],l[r.elementsKey]=s,delete l.text}return l}},3433:function(e,t,n){n(3110);var r=n(8071),o=n(2760);function i(e){var t=r.copyOptions(e);return r.ensureSpacesExists(t),t}e.exports=function(e,t){var n,r,a,l;return n=i(t),r=o(e,n),l="compact"in n&&n.compact?"_parent":"parent",a="addParent"in n&&n.addParent?JSON.stringify(r,function(e,t){return e===l?"_":t},n.spaces):JSON.stringify(r,null,n.spaces),a.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},1128:function(t){"use strict";t.exports=e},8846:function(e){"use strict";e.exports=t},7193:function(e){"use strict";e.exports=n},5300:function(e){"use strict";e.exports=r},8521:function(e){"use strict";e.exports=o},9272:function(e){"use strict";e.exports=i},3305:function(e){"use strict";e.exports=a},8804:function(e){"use strict";e.exports=l},2748:function(e){"use strict";e.exports=s},4932:function(e){"use strict";e.exports=c},4339:function(e){"use strict";e.exports=d},5733:function(e){"use strict";e.exports=u},9083:function(e){"use strict";e.exports=p},1978:function(e){"use strict";e.exports=h},9150:function(e){"use strict";e.exports=f},7190:function(e){"use strict";e.exports=m},2266:function(e){"use strict";e.exports=g},8275:function(e){"use strict";e.exports=v},2337:function(e){"use strict";e.exports=y},154:function(e){"use strict";e.exports=b},8277:function(){},9306:function(e,t,n){"use strict";var r=n(4901),o=n(6823),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not a function")}},3506:function(e,t,n){"use strict";var r=n(3925),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i("Can't set "+o(e)+" as a prototype")}},7080:function(e,t,n){"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},3463:function(e){"use strict";var t=TypeError;e.exports=function(e){if("string"==typeof e)return e;throw new t("Argument is not a string")}},4328:function(e,t,n){"use strict";var r=n(4995),o=new r.WeakMap,i=r.set,a=r.remove;e.exports=function(e){return i(o,e,1),a(o,e),e}},6557:function(e,t,n){"use strict";var r=n(4995).has;e.exports=function(e){return r(e),e}},6469:function(e,t,n){"use strict";var r=n(8227),o=n(2360),i=n(4913).f,a=r("unscopables"),l=Array.prototype;void 0===l[a]&&i(l,a,{configurable:!0,value:o(null)}),e.exports=function(e){l[a][e]=!0}},679:function(e,t,n){"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},3972:function(e,t,n){"use strict";var r=n(34),o=String,i=TypeError;e.exports=function(e){if(void 0===e||r(e))return e;throw new i(o(e)+" is not an object or undefined")}},8551:function(e,t,n){"use strict";var r=n(34),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not an object")}},4154:function(e,t,n){"use strict";var r=n(6955),o=TypeError;e.exports=function(e){if("Uint8Array"===r(e))return e;throw new o("Argument is not an Uint8Array")}},7811:function(e){"use strict";e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7394:function(e,t,n){"use strict";var r=n(4576),o=n(6706),i=n(2195),a=r.ArrayBuffer,l=r.TypeError;e.exports=a&&o(a.prototype,"byteLength","get")||function(e){if("ArrayBuffer"!==i(e))throw new l("ArrayBuffer expected");return e.byteLength}},3238:function(e,t,n){"use strict";var r=n(4576),o=n(7811),i=n(7394),a=r.DataView;e.exports=function(e){if(!o||0!==i(e))return!1;try{return new a(e),!1}catch(t){return!0}}},5169:function(e,t,n){"use strict";var r=n(3238),o=TypeError;e.exports=function(e){if(r(e))throw new o("ArrayBuffer is detached");return e}},5636:function(e,t,n){"use strict";var r=n(4576),o=n(9504),i=n(6706),a=n(7696),l=n(5169),s=n(7394),c=n(4483),d=n(1548),u=r.structuredClone,p=r.ArrayBuffer,h=r.DataView,f=Math.max,m=Math.min,g=p.prototype,v=h.prototype,y=o(g.slice),b=i(g,"resizable","get"),w=i(g,"maxByteLength","get"),k=o(v.getInt8),x=o(v.setInt8);e.exports=(d||c)&&function(e,t,n){var r,o=s(e),i=void 0===t?o:a(t),g=!b||!b(e);if(l(e),d&&(e=u(e,{transfer:[e]}),o===i&&(n||g)))return e;if(o>=i&&(!n||g))r=y(e,0,i);else{var v=n&&!g&&w?{maxByteLength:f(i,w(e))}:void 0;r=new p(i,v);for(var S=new h(e),C=new h(r),T=m(i,o),E=0;E<T;E++)x(C,E,k(S,E))}return d||c(e),r}},4644:function(e,t,n){"use strict";var r,o,i,a=n(7811),l=n(3724),s=n(4576),c=n(4901),d=n(34),u=n(9297),p=n(6955),h=n(6823),f=n(6699),m=n(6840),g=n(2106),v=n(1625),y=n(2787),b=n(2967),w=n(8227),k=n(3392),x=n(1181),S=x.enforce,C=x.get,T=s.Int8Array,E=T&&T.prototype,_=s.Uint8ClampedArray,M=_&&_.prototype,N=T&&y(T),I=E&&y(E),R=Object.prototype,A=s.TypeError,B=w("toStringTag"),D=k("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",P=a&&!!b&&"Opera"!==p(s.opera),O=!1,L={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},z={BigInt64Array:8,BigUint64Array:8},V=function(e){if(!d(e))return!1;var t=p(e);return"DataView"===t||u(L,t)||u(z,t)},$=function(e){var t=y(e);if(d(t)){var n=C(t);return n&&u(n,F)?n[F]:$(t)}},j=function(e){if(!d(e))return!1;var t=p(e);return u(L,t)||u(z,t)},H=function(e){if(j(e))return e;throw new A("Target is not a typed array")},W=function(e){if(c(e)&&(!b||v(N,e)))return e;throw new A(h(e)+" is not a typed array constructor")},q=function(e,t,n,r){if(l){if(n)for(var o in L){var i=s[o];if(i&&u(i.prototype,e))try{delete i.prototype[e]}catch(a){try{i.prototype[e]=t}catch(c){}}}I[e]&&!n||m(I,e,n?t:P&&E[e]||t,r)}},Z=function(e,t,n){var r,o;if(l){if(b){if(n)for(r in L)if(o=s[r],o&&u(o,e))try{delete o[e]}catch(i){}if(N[e]&&!n)return;try{return m(N,e,n?t:P&&N[e]||t)}catch(i){}}for(r in L)o=s[r],!o||o[e]&&!n||m(o,e,t)}};for(r in L)o=s[r],i=o&&o.prototype,i?S(i)[F]=o:P=!1;for(r in z)o=s[r],i=o&&o.prototype,i&&(S(i)[F]=o);if((!P||!c(N)||N===Function.prototype)&&(N=function(){throw new A("Incorrect invocation")},P))for(r in L)s[r]&&b(s[r],N);if((!P||!I||I===R)&&(I=N.prototype,P))for(r in L)s[r]&&b(s[r].prototype,I);if(P&&y(M)!==I&&b(M,I),l&&!u(I,B))for(r in O=!0,g(I,B,{configurable:!0,get:function(){return d(this)?this[D]:void 0}}),L)s[r]&&f(s[r].prototype,D,r);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:O&&D,aTypedArray:H,aTypedArrayConstructor:W,exportTypedArrayMethod:q,exportTypedArrayStaticMethod:Z,getTypedArrayConstructor:$,isView:V,isTypedArray:j,TypedArray:N,TypedArrayPrototype:I}},9617:function(e,t,n){"use strict";var r=n(5397),o=n(5610),i=n(6198),a=function(e){return function(t,n,a){var l=r(t),s=i(l);if(0===s)return!e&&-1;var c,d=o(a,s);if(e&&n!==n){while(s>d)if(c=l[d++],c!==c)return!0}else for(;s>d;d++)if((e||d in l)&&l[d]===n)return e||d||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4527:function(e,t,n){"use strict";var r=n(3724),o=n(4376),i=TypeError,a=Object.getOwnPropertyDescriptor,l=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=l?function(e,t){if(o(e)&&!a(e,"length").writable)throw new i("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},7680:function(e,t,n){"use strict";var r=n(9504);e.exports=r([].slice)},2804:function(e){"use strict";var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=t+"+/",r=t+"-_",o=function(e){for(var t={},n=0;n<64;n++)t[e.charAt(n)]=n;return t};e.exports={i2c:n,c2i:o(n),i2cUrl:r,c2iUrl:o(r)}},6319:function(e,t,n){"use strict";var r=n(8551),o=n(9539);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(a){o(e,"throw",a)}}},2195:function(e,t,n){"use strict";var r=n(9504),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},6955:function(e,t,n){"use strict";var r=n(2140),o=n(4901),i=n(2195),a=n(8227),l=a("toStringTag"),s=Object,c="Arguments"===i(function(){return arguments}()),d=function(e,t){try{return e[t]}catch(n){}};e.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=d(t=s(e),l))?n:c?i(t):"Object"===(r=i(t))&&o(t.callee)?"Arguments":r}},7740:function(e,t,n){"use strict";var r=n(9297),o=n(5031),i=n(7347),a=n(4913);e.exports=function(e,t,n){for(var l=o(t),s=a.f,c=i.f,d=0;d<l.length;d++){var u=l[d];r(e,u)||n&&r(n,u)||s(e,u,c(t,u))}}},2211:function(e,t,n){"use strict";var r=n(9039);e.exports=!r(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},2529:function(e){"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:function(e,t,n){"use strict";var r=n(3724),o=n(4913),i=n(6980);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},6980:function(e){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:function(e,t,n){"use strict";var r=n(3724),o=n(4913),i=n(6980);e.exports=function(e,t,n){r?o.f(e,t,i(0,n)):e[t]=n}},2106:function(e,t,n){"use strict";var r=n(283),o=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),o.f(e,t,n)}},6840:function(e,t,n){"use strict";var r=n(4901),o=n(4913),i=n(283),a=n(9433);e.exports=function(e,t,n,l){l||(l={});var s=l.enumerable,c=void 0!==l.name?l.name:t;if(r(n)&&i(n,c,l),l.global)s?e[t]=n:a(t,n);else{try{l.unsafe?e[t]&&(s=!0):delete e[t]}catch(d){}s?e[t]=n:o.f(e,t,{value:n,enumerable:!1,configurable:!l.nonConfigurable,writable:!l.nonWritable})}return e}},6279:function(e,t,n){"use strict";var r=n(6840);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},9433:function(e,t,n){"use strict";var r=n(4576),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:function(e,t,n){"use strict";var r=n(9039);e.exports=!r(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4483:function(e,t,n){"use strict";var r,o,i,a,l=n(4576),s=n(9429),c=n(1548),d=l.structuredClone,u=l.ArrayBuffer,p=l.MessageChannel,h=!1;if(c)h=function(e){d(e,{transfer:[e]})};else if(u)try{p||(r=s("worker_threads"),r&&(p=r.MessageChannel)),p&&(o=new p,i=new u(2),a=function(e){o.port1.postMessage(null,[e])},2===i.byteLength&&(a(i),0===i.byteLength&&(h=a)))}catch(f){}e.exports=h},4055:function(e,t,n){"use strict";var r=n(4576),o=n(34),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},6837:function(e){"use strict";var t=TypeError,n=9007199254740991;e.exports=function(e){if(e>n)throw new t("Maximum allowed index exceeded");return e}},5002:function(e){"use strict";e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727:function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},9544:function(e,t,n){"use strict";var r=n(2839);e.exports=/ipad|iphone|ipod/i.test(r)&&/applewebkit/i.test(r)},6193:function(e,t,n){"use strict";var r=n(4215);e.exports="NODE"===r},2839:function(e,t,n){"use strict";var r=n(4576),o=r.navigator,i=o&&o.userAgent;e.exports=i?String(i):""},9519:function(e,t,n){"use strict";var r,o,i=n(4576),a=n(2839),l=i.process,s=i.Deno,c=l&&l.versions||s&&s.version,d=c&&c.v8;d&&(r=d.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),e.exports=o},4215:function(e,t,n){"use strict";var r=n(4576),o=n(2839),i=n(2195),a=function(e){return o.slice(0,e.length)===e};e.exports=function(){return a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"}()},8574:function(e,t,n){"use strict";var r=n(9504),o=Error,i=r("".replace),a=function(e){return String(new o(e).stack)}("zxcasd"),l=/\n\s*at [^:]*:[^\n]*/,s=l.test(a);e.exports=function(e,t){if(s&&"string"==typeof e&&!o.prepareStackTrace)while(t--)e=i(e,l,"");return e}},6518:function(e,t,n){"use strict";var r=n(4576),o=n(7347).f,i=n(6699),a=n(6840),l=n(9433),s=n(7740),c=n(2796);e.exports=function(e,t){var n,d,u,p,h,f,m=e.target,g=e.global,v=e.stat;if(d=g?r:v?r[m]||l(m,{}):r[m]&&r[m].prototype,d)for(u in t){if(h=t[u],e.dontCallGetSet?(f=o(d,u),p=f&&f.value):p=d[u],n=c(g?u:m+(v?".":"#")+u,e.forced),!n&&void 0!==p){if(typeof h==typeof p)continue;s(h,p)}(e.sham||p&&p.sham)&&i(h,"sham",!0),a(d,u,h,e)}}},9039:function(e){"use strict";e.exports=function(e){try{return!!e()}catch(t){return!0}}},8745:function(e,t,n){"use strict";var r=n(616),o=Function.prototype,i=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(i):function(){return a.apply(i,arguments)})},6080:function(e,t,n){"use strict";var r=n(7476),o=n(9306),i=n(616),a=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:i?a(e,t):function(){return e.apply(t,arguments)}}},616:function(e,t,n){"use strict";var r=n(9039);e.exports=!r(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},9565:function(e,t,n){"use strict";var r=n(616),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},350:function(e,t,n){"use strict";var r=n(3724),o=n(9297),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,l=o(i,"name"),s=l&&"something"===function(){}.name,c=l&&(!r||r&&a(i,"name").configurable);e.exports={EXISTS:l,PROPER:s,CONFIGURABLE:c}},6706:function(e,t,n){"use strict";var r=n(9504),o=n(9306);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(i){}}},7476:function(e,t,n){"use strict";var r=n(2195),o=n(9504);e.exports=function(e){if("Function"===r(e))return o(e)}},9504:function(e,t,n){"use strict";var r=n(616),o=Function.prototype,i=o.call,a=r&&o.bind.bind(i,i);e.exports=r?a:function(e){return function(){return i.apply(e,arguments)}}},944:function(e){"use strict";var t=TypeError;e.exports=function(e){var n=e&&e.alphabet;if(void 0===n||"base64"===n||"base64url"===n)return n||"base64";throw new t("Incorrect `alphabet` option")}},9429:function(e,t,n){"use strict";var r=n(4576),o=n(6193);e.exports=function(e){if(o){try{return r.process.getBuiltinModule(e)}catch(t){}try{return Function('return require("'+e+'")')()}catch(t){}}}},7751:function(e,t,n){"use strict";var r=n(4576),o=n(4901),i=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e]):r[e]&&r[e][t]}},1767:function(e){"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646:function(e,t,n){"use strict";var r=n(9565),o=n(8551),i=n(1767),a=n(851);e.exports=function(e,t){t&&"string"===typeof e||o(e);var n=a(e);return i(o(void 0!==n?r(n,e):e))}},851:function(e,t,n){"use strict";var r=n(6955),o=n(5966),i=n(4117),a=n(6269),l=n(8227),s=l("iterator");e.exports=function(e){if(!i(e))return o(e,s)||o(e,"@@iterator")||a[r(e)]}},81:function(e,t,n){"use strict";var r=n(9565),o=n(9306),i=n(8551),a=n(6823),l=n(851),s=TypeError;e.exports=function(e,t){var n=arguments.length<2?l(e):t;if(o(n))return i(r(n,e));throw new s(a(e)+" is not iterable")}},5966:function(e,t,n){"use strict";var r=n(9306),o=n(4117);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},3789:function(e,t,n){"use strict";var r=n(9306),o=n(8551),i=n(9565),a=n(1291),l=n(1767),s="Invalid size",c=RangeError,d=TypeError,u=Math.max,p=function(e,t){this.set=e,this.size=u(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return l(o(i(this.keys,this.set)))},includes:function(e){return i(this.has,this.set,e)}},e.exports=function(e){o(e);var t=+e.size;if(t!==t)throw new d(s);var n=a(t);if(n<0)throw new c(s);return new p(e,n)}},4576:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:function(e,t,n){"use strict";var r=n(9504),o=n(8981),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},421:function(e){"use strict";e.exports={}},397:function(e,t,n){"use strict";var r=n(7751);e.exports=r("document","documentElement")},5917:function(e,t,n){"use strict";var r=n(3724),o=n(9039),i=n(4055);e.exports=!r&&!o(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},7055:function(e,t,n){"use strict";var r=n(9504),o=n(9039),i=n(2195),a=Object,l=r("".split);e.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(e){return"String"===i(e)?l(e,""):a(e)}:a},3167:function(e,t,n){"use strict";var r=n(4901),o=n(34),i=n(2967);e.exports=function(e,t,n){var a,l;return i&&r(a=t.constructor)&&a!==n&&o(l=a.prototype)&&l!==n.prototype&&i(e,l),e}},3706:function(e,t,n){"use strict";var r=n(9504),o=n(4901),i=n(7629),a=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource},1181:function(e,t,n){"use strict";var r,o,i,a=n(8622),l=n(4576),s=n(34),c=n(6699),d=n(9297),u=n(7629),p=n(6119),h=n(421),f="Object already initialized",m=l.TypeError,g=l.WeakMap,v=function(e){return i(e)?o(e):r(e,{})},y=function(e){return function(t){var n;if(!s(t)||(n=o(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}};if(a||u.state){var b=u.state||(u.state=new g);b.get=b.get,b.has=b.has,b.set=b.set,r=function(e,t){if(b.has(e))throw new m(f);return t.facade=e,b.set(e,t),t},o=function(e){return b.get(e)||{}},i=function(e){return b.has(e)}}else{var w=p("state");h[w]=!0,r=function(e,t){if(d(e,w))throw new m(f);return t.facade=e,c(e,w,t),t},o=function(e){return d(e,w)?e[w]:{}},i=function(e){return d(e,w)}}e.exports={set:r,get:o,has:i,enforce:v,getterFor:y}},4209:function(e,t,n){"use strict";var r=n(8227),o=n(6269),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},4376:function(e,t,n){"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},1108:function(e,t,n){"use strict";var r=n(6955);e.exports=function(e){var t=r(e);return"BigInt64Array"===t||"BigUint64Array"===t}},4901:function(e){"use strict";var t="object"==typeof document&&document.all;e.exports="undefined"==typeof t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:function(e,t,n){"use strict";var r=n(9039),o=n(4901),i=/#|\.prototype\./,a=function(e,t){var n=s[l(e)];return n===d||n!==c&&(o(t)?r(t):!!t)},l=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=a.data={},c=a.NATIVE="N",d=a.POLYFILL="P";e.exports=a},4117:function(e){"use strict";e.exports=function(e){return null===e||void 0===e}},34:function(e,t,n){"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:function(e,t,n){"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:function(e){"use strict";e.exports=!1},5810:function(e,t,n){"use strict";var r=n(34),o=n(1181).get;e.exports=function(e){if(!r(e))return!1;var t=o(e);return!!t&&"RawJSON"===t.type}},757:function(e,t,n){"use strict";var r=n(7751),o=n(4901),i=n(1625),a=n(7040),l=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,l(e))}},507:function(e,t,n){"use strict";var r=n(9565);e.exports=function(e,t,n){var o,i,a=n?e:e.iterator,l=e.next;while(!(o=r(l,a)).done)if(i=t(o.value),void 0!==i)return i}},2652:function(e,t,n){"use strict";var r=n(6080),o=n(9565),i=n(8551),a=n(6823),l=n(4209),s=n(6198),c=n(1625),d=n(81),u=n(851),p=n(9539),h=TypeError,f=function(e,t){this.stopped=e,this.result=t},m=f.prototype;e.exports=function(e,t,n){var g,v,y,b,w,k,x,S=n&&n.that,C=!(!n||!n.AS_ENTRIES),T=!(!n||!n.IS_RECORD),E=!(!n||!n.IS_ITERATOR),_=!(!n||!n.INTERRUPTED),M=r(t,S),N=function(e){var t=g;return g=void 0,t&&p(t,"normal"),new f(!0,e)},I=function(e){return C?(i(e),_?M(e[0],e[1],N):M(e[0],e[1])):_?M(e,N):M(e)};if(T)g=e.iterator;else if(E)g=e;else{if(v=u(e),!v)throw new h(a(e)+" is not iterable");if(l(v)){for(y=0,b=s(e);b>y;y++)if(w=I(e[y]),w&&c(m,w))return w;return new f(!1)}g=d(e,v)}k=T?e.next:g.next;while(!(x=o(k,g)).done){var R=x.value;try{w=I(R)}catch(A){if(!g)throw A;p(g,"throw",A)}if("object"==typeof w&&w&&c(m,w))return w}return new f(!1)}},1385:function(e,t,n){"use strict";var r=n(9539);e.exports=function(e,t,n){for(var o=e.length-1;o>=0;o--)if(void 0!==e[o])try{n=r(e[o].iterator,t,n)}catch(i){t="throw",n=i}if("throw"===t)throw n;return n}},9539:function(e,t,n){"use strict";var r=n(9565),o=n(8551),i=n(5966);e.exports=function(e,t,n){var a,l;o(e);try{if(a=i(e,"return"),!a){if("throw"===t)throw n;return n}a=r(a,e)}catch(s){l=!0,a=s}if("throw"===t)throw n;if(l)throw a;return o(a),n}},9462:function(e,t,n){"use strict";var r=n(9565),o=n(2360),i=n(6699),a=n(6279),l=n(8227),s=n(1181),c=n(5966),d=n(7657).IteratorPrototype,u=n(2529),p=n(9539),h=n(1385),f=l("toStringTag"),m="IteratorHelper",g="WrapForValidIterator",v="normal",y="throw",b=s.set,w=function(e){var t=s.getterFor(e?g:m);return a(o(d),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return u(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:u(r,n.done)}catch(o){throw n.done=!0,o}},return:function(){var n=t(this),o=n.iterator,i=n.done;if(n.done=!0,e){var a=c(o,"return");return a?r(a,o):u(void 0,!0)}if(i)return u(void 0,!0);if(n.inner)try{p(n.inner.iterator,v)}catch(l){return p(o,y,l)}if(n.openIters)try{h(n.openIters,v)}catch(l){if(o)return p(o,y,l);throw l}return o&&p(o,v),u(void 0,!0)}})},k=w(!0),x=w(!1);i(x,f,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,o){o?(o.iterator=r.iterator,o.next=r.next):o=r,o.type=t?g:m,o.returnHandlerResult=!!n,o.nextHandler=e,o.counter=0,o.done=!1,b(this,o)};return r.prototype=t?k:x,r}},684:function(e){"use strict";e.exports=function(e,t){var n="function"==typeof Iterator&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch(r){return!0}}},4549:function(e,t,n){"use strict";var r=n(4576);e.exports=function(e,t){var n=r.Iterator,o=n&&n.prototype,i=o&&o[e],a=!1;if(i)try{i.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(l){l instanceof t||(a=!1)}if(!a)return i}},7657:function(e,t,n){"use strict";var r,o,i,a=n(9039),l=n(4901),s=n(34),c=n(2360),d=n(2787),u=n(6840),p=n(8227),h=n(6395),f=p("iterator"),m=!1;[].keys&&(i=[].keys(),"next"in i?(o=d(d(i)),o!==Object.prototype&&(r=o)):m=!0);var g=!s(r)||a(function(){var e={};return r[f].call(e)!==e});g?r={}:h&&(r=c(r)),l(r[f])||u(r,f,function(){return this}),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},6269:function(e){"use strict";e.exports={}},6198:function(e,t,n){"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:function(e,t,n){"use strict";var r=n(9504),o=n(9039),i=n(4901),a=n(9297),l=n(3724),s=n(350).CONFIGURABLE,c=n(3706),d=n(1181),u=d.enforce,p=d.get,h=String,f=Object.defineProperty,m=r("".slice),g=r("".replace),v=r([].join),y=l&&!o(function(){return 8!==f(function(){},"length",{value:8}).length}),b=String(String).split("String"),w=e.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+g(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||s&&e.name!==t)&&(l?f(e,"name",{value:t,configurable:!0}):e.name=t),y&&n&&a(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?l&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(o){}var r=u(e);return a(r,"source")||(r.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=w(function(){return i(this)&&p(this).source||c(this)},"toString")},2248:function(e,t,n){"use strict";var r=n(9504),o=Map.prototype;e.exports={Map:Map,set:r(o.set),get:r(o.get),has:r(o.has),remove:r(o["delete"]),proto:o}},741:function(e){"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},7819:function(e,t,n){"use strict";var r=n(9039);e.exports=!r(function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})},2603:function(e,t,n){"use strict";var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},2360:function(e,t,n){"use strict";var r,o=n(8551),i=n(6801),a=n(8727),l=n(421),s=n(397),c=n(4055),d=n(6119),u=">",p="<",h="prototype",f="script",m=d("IE_PROTO"),g=function(){},v=function(e){return p+f+u+e+p+"/"+f+u},y=function(e){e.write(v("")),e.close();var t=e.parentWindow.Object;return e=null,t},b=function(){var e,t=c("iframe"),n="java"+f+":";return t.style.display="none",s.appendChild(t),t.src=String(n),e=t.contentWindow.document,e.open(),e.write(v("document.F=Object")),e.close(),e.F},w=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}w="undefined"!=typeof document?document.domain&&r?y(r):b():y(r);var e=a.length;while(e--)delete w[h][a[e]];return w()};l[m]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(g[h]=o(e),n=new g,g[h]=null,n[m]=e):n=w(),void 0===t?n:i.f(n,t)}},6801:function(e,t,n){"use strict";var r=n(3724),o=n(8686),i=n(4913),a=n(8551),l=n(5397),s=n(1072);t.f=r&&!o?Object.defineProperties:function(e,t){a(e);var n,r=l(t),o=s(t),c=o.length,d=0;while(c>d)i.f(e,n=o[d++],r[n]);return e}},4913:function(e,t,n){"use strict";var r=n(3724),o=n(5917),i=n(8686),a=n(8551),l=n(6969),s=TypeError,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,u="enumerable",p="configurable",h="writable";t.f=r?i?function(e,t,n){if(a(e),t=l(t),a(n),"function"===typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=d(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:u in n?n[u]:r[u],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=l(t),a(n),o)try{return c(e,t,n)}catch(r){}if("get"in n||"set"in n)throw new s("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:function(e,t,n){"use strict";var r=n(3724),o=n(9565),i=n(8773),a=n(6980),l=n(5397),s=n(6969),c=n(9297),d=n(5917),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=l(e),t=s(t),d)try{return u(e,t)}catch(n){}if(c(e,t))return a(!o(i.f,e,t),e[t])}},8480:function(e,t,n){"use strict";var r=n(1828),o=n(8727),i=o.concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:function(e,t){"use strict";t.f=Object.getOwnPropertySymbols},2787:function(e,t,n){"use strict";var r=n(9297),o=n(4901),i=n(8981),a=n(6119),l=n(2211),s=a("IE_PROTO"),c=Object,d=c.prototype;e.exports=l?c.getPrototypeOf:function(e){var t=i(e);if(r(t,s))return t[s];var n=t.constructor;return o(n)&&t instanceof n?n.prototype:t instanceof c?d:null}},1625:function(e,t,n){"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:function(e,t,n){"use strict";var r=n(9504),o=n(9297),i=n(5397),a=n(9617).indexOf,l=n(421),s=r([].push);e.exports=function(e,t){var n,r=i(e),c=0,d=[];for(n in r)!o(l,n)&&o(r,n)&&s(d,n);while(t.length>c)o(r,n=t[c++])&&(~a(d,n)||s(d,n));return d}},1072:function(e,t,n){"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},8773:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:function(e,t,n){"use strict";var r=n(6706),o=n(34),i=n(7750),a=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{e=r(Object.prototype,"__proto__","set"),e(n,[]),t=n instanceof Array}catch(l){}return function(n,r){return i(n),a(r),o(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:function(e,t,n){"use strict";var r=n(9565),o=n(4901),i=n(34),a=TypeError;e.exports=function(e,t){var n,l;if("string"===t&&o(n=e.toString)&&!i(l=r(n,e)))return l;if(o(n=e.valueOf)&&!i(l=r(n,e)))return l;if("string"!==t&&o(n=e.toString)&&!i(l=r(n,e)))return l;throw new a("Can't convert object to primitive value")}},5031:function(e,t,n){"use strict";var r=n(7751),o=n(9504),i=n(8480),a=n(3717),l=n(8551),s=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(l(e)),n=a.f;return n?s(t,n(e)):t}},8235:function(e,t,n){"use strict";var r=n(9504),o=n(9297),i=SyntaxError,a=parseInt,l=String.fromCharCode,s=r("".charAt),c=r("".slice),d=r(/./.exec),u={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},p=/^[\da-f]{4}$/i,h=/^[\u0000-\u001F]$/;e.exports=function(e,t){var n=!0,r="";while(t<e.length){var f=s(e,t);if("\\"===f){var m=c(e,t,t+2);if(o(u,m))r+=u[m],t+=2;else{if("\\u"!==m)throw new i('Unknown escape sequence: "'+m+'"');t+=2;var g=c(e,t,t+4);if(!d(p,g))throw new i("Bad Unicode escape at: "+t);r+=l(a(g,16)),t+=4}}else{if('"'===f){n=!1,t++;break}if(d(h,f))throw new i("Bad control character in string literal at: "+t);r+=f,t++}}if(n)throw new i("Unterminated string at: "+t);return{value:r,end:t}}},7750:function(e,t,n){"use strict";var r=n(4117),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},9472:function(e,t,n){"use strict";var r=n(4576),o=n(8745),i=n(4901),a=n(4215),l=n(2839),s=n(7680),c=n(2812),d=r.Function,u=/MSIE .\./.test(l)||"BUN"===a&&function(){var e=r.Bun.version.split(".");return e.length<3||"0"===e[0]&&(e[1]<3||"3"===e[1]&&"0"===e[2])}();e.exports=function(e,t){var n=t?2:1;return u?function(r,a){var l=c(arguments.length,1)>n,u=i(r)?r:d(r),p=l?s(arguments,n):[],h=l?function(){o(u,this,p)}:u;return t?e(h,a):e(h)}:e}},9286:function(e,t,n){"use strict";var r=n(4402),o=n(8469),i=r.Set,a=r.add;e.exports=function(e){var t=new i;return o(e,function(e){a(t,e)}),t}},3440:function(e,t,n){"use strict";var r=n(7080),o=n(4402),i=n(9286),a=n(5170),l=n(3789),s=n(8469),c=n(507),d=o.has,u=o.remove;e.exports=function(e){var t=r(this),n=l(e),o=i(t);return a(o)<=n.size?s(o,function(e){n.includes(e)&&u(o,e)}):c(n.getIterator(),function(e){d(o,e)&&u(o,e)}),o}},4402:function(e,t,n){"use strict";var r=n(9504),o=Set.prototype;e.exports={Set:Set,add:r(o.add),has:r(o.has),remove:r(o["delete"]),proto:o}},8750:function(e,t,n){"use strict";var r=n(7080),o=n(4402),i=n(5170),a=n(3789),l=n(8469),s=n(507),c=o.Set,d=o.add,u=o.has;e.exports=function(e){var t=r(this),n=a(e),o=new c;return i(t)>n.size?s(n.getIterator(),function(e){u(t,e)&&d(o,e)}):l(t,function(e){n.includes(e)&&d(o,e)}),o}},4449:function(e,t,n){"use strict";var r=n(7080),o=n(4402).has,i=n(5170),a=n(3789),l=n(8469),s=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(i(t)<=n.size)return!1!==l(t,function(e){if(n.includes(e))return!1},!0);var d=n.getIterator();return!1!==s(d,function(e){if(o(t,e))return c(d.iterator,"normal",!1)})}},3838:function(e,t,n){"use strict";var r=n(7080),o=n(5170),i=n(8469),a=n(3789);e.exports=function(e){var t=r(this),n=a(e);return!(o(t)>n.size)&&!1!==i(t,function(e){if(!n.includes(e))return!1},!0)}},8527:function(e,t,n){"use strict";var r=n(7080),o=n(4402).has,i=n(5170),a=n(3789),l=n(507),s=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(i(t)<n.size)return!1;var c=n.getIterator();return!1!==l(c,function(e){if(!o(t,e))return s(c.iterator,"normal",!1)})}},8469:function(e,t,n){"use strict";var r=n(9504),o=n(507),i=n(4402),a=i.Set,l=i.proto,s=r(l.forEach),c=r(l.keys),d=c(new a).next;e.exports=function(e,t,n){return n?o({iterator:c(e),next:d},t):s(e,t)}},4916:function(e,t,n){"use strict";var r=n(7751),o=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},i=function(e){return{size:e,has:function(){return!0},keys:function(){throw new Error("e")}}};e.exports=function(e,t){var n=r("Set");try{(new n)[e](o(0));try{return(new n)[e](o(-1)),!1}catch(l){if(!t)return!0;try{return(new n)[e](i(-1/0)),!1}catch(s){var a=new n([1,2]);return t(a[e](i(1/0)))}}}catch(s){return!1}}},9835:function(e){"use strict";e.exports=function(e){try{var t=new Set,n={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}},r=t[e](n);return 1===r.size&&4===r.values().next().value}catch(o){return!1}}},5170:function(e,t,n){"use strict";var r=n(6706),o=n(4402);e.exports=r(o.proto,"size","get")||function(e){return e.size}},3650:function(e,t,n){"use strict";var r=n(7080),o=n(4402),i=n(9286),a=n(3789),l=n(507),s=o.add,c=o.has,d=o.remove;e.exports=function(e){var t=r(this),n=a(e).getIterator(),o=i(t);return l(n,function(e){c(t,e)?d(o,e):s(o,e)}),o}},4204:function(e,t,n){"use strict";var r=n(7080),o=n(4402).add,i=n(9286),a=n(3789),l=n(507);e.exports=function(e){var t=r(this),n=a(e).getIterator(),s=i(t);return l(n,function(e){o(s,e)}),s}},6119:function(e,t,n){"use strict";var r=n(5745),o=n(3392),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},7629:function(e,t,n){"use strict";var r=n(6395),o=n(4576),i=n(9433),a="__core-js_shared__",l=e.exports=o[a]||i(a,{});(l.versions||(l.versions=[])).push({version:"3.49.0",mode:r?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(e,t,n){"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},1548:function(e,t,n){"use strict";var r=n(4576),o=n(9039),i=n(9519),a=n(4215),l=r.structuredClone;e.exports=!!l&&!o(function(){if("DENO"===a&&i>92||"NODE"===a&&i>94||"BROWSER"===a&&i>97)return!1;var e=new ArrayBuffer(8),t=l(e,{transfer:[e]});return 0!==e.byteLength||8!==t.byteLength})},4495:function(e,t,n){"use strict";var r=n(9519),o=n(9039),i=n(4576),a=i.String;e.exports=!!Object.getOwnPropertySymbols&&!o(function(){var e=Symbol("symbol detection");return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41})},9225:function(e,t,n){"use strict";var r,o,i,a,l=n(4576),s=n(8745),c=n(6080),d=n(4901),u=n(9297),p=n(9039),h=n(397),f=n(7680),m=n(4055),g=n(2812),v=n(9544),y=n(6193),b=l.setImmediate,w=l.clearImmediate,k=l.process,x=l.Dispatch,S=l.Function,C=l.MessageChannel,T=l.String,E=0,_={},M="onreadystatechange";p(function(){r=l.location});var N=function(e){if(u(_,e)){var t=_[e];delete _[e],t()}},I=function(e){return function(){N(e)}},R=function(e){N(e.data)},A=function(e){l.postMessage(T(e),r.protocol+"//"+r.host)};b&&w||(b=function(e){g(arguments.length,1);var t=d(e)?e:S(e),n=f(arguments,1);return _[++E]=function(){s(t,void 0,n)},o(E),E},w=function(e){delete _[e]},y?o=function(e){k.nextTick(I(e))}:x&&x.now?o=function(e){x.now(I(e))}:C&&!v?(i=new C,a=i.port2,i.port1.onmessage=R,o=c(a.postMessage,a)):l.addEventListener&&d(l.postMessage)&&!l.importScripts&&r&&"file:"!==r.protocol&&!p(A)?(o=A,l.addEventListener("message",R,!1)):o=M in m("script")?function(e){h.appendChild(m("script"))[M]=function(){h.removeChild(this),N(e)}}:function(e){setTimeout(I(e),0)}),e.exports={set:b,clear:w}},5610:function(e,t,n){"use strict";var r=n(1291),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},5854:function(e,t,n){"use strict";var r=n(2777),o=TypeError;e.exports=function(e){var t=r(e,"number");if("number"==typeof t)throw new o("Can't convert number to bigint");return BigInt(t)}},7696:function(e,t,n){"use strict";var r=n(1291),o=n(8014),i=RangeError;e.exports=function(e){if(void 0===e)return 0;var t=r(e),n=o(t);if(t!==n)throw new i("Wrong length or index");return n}},5397:function(e,t,n){"use strict";var r=n(7055),o=n(7750);e.exports=function(e){return r(o(e))}},1291:function(e,t,n){"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!==t||0===t?0:r(t)}},8014:function(e,t,n){"use strict";var r=n(1291),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},8981:function(e,t,n){"use strict";var r=n(7750),o=Object;e.exports=function(e){return o(r(e))}},2777:function(e,t,n){"use strict";var r=n(9565),o=n(34),i=n(757),a=n(5966),l=n(4270),s=n(8227),c=TypeError,d=s("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var n,s=a(e,d);if(s){if(void 0===t&&(t="default"),n=r(s,e,t),!o(n)||i(n))return n;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),l(e,t)}},6969:function(e,t,n){"use strict";var r=n(2777),o=n(757);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},2140:function(e,t,n){"use strict";var r=n(8227),o=r("toStringTag"),i={};i[o]="z",e.exports="[object z]"===String(i)},655:function(e,t,n){"use strict";var r=n(6955),o=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return o(e)}},6823:function(e){"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(n){return"Object"}}},3392:function(e,t,n){"use strict";var r=n(9504),o=0,i=Math.random(),a=r(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+i,36)}},9143:function(e,t,n){"use strict";var r=n(4576),o=n(9504),i=n(3972),a=n(3463),l=n(9297),s=n(2804),c=n(944),d=n(5169),u=s.c2i,p=s.c2iUrl,h=r.SyntaxError,f=r.TypeError,m=o("".charAt),g=function(e,t){for(var n=e.length;t<n;t++){var r=m(e,t);if(" "!==r&&"\t"!==r&&"\n"!==r&&"\f"!==r&&"\r"!==r)break}return t},v=function(e,t,n){var r=e.length;r<4&&(e+=2===r?"AA":"A");var o=(t[m(e,0)]<<18)+(t[m(e,1)]<<12)+(t[m(e,2)]<<6)+t[m(e,3)],i=[o>>16&255,o>>8&255,255&o];if(2===r){if(n&&0!==i[1])throw new h("Extra bits");return[i[0]]}if(3===r){if(n&&0!==i[2])throw new h("Extra bits");return[i[0],i[1]]}return i},y=function(e,t,n){for(var r=t.length,o=0;o<r;o++)e[n+o]=t[o];return n+r};e.exports=function(e,t,n,r){a(e),i(t);var o="base64"===c(t)?u:p,s=t?t.lastChunkHandling:void 0;if(void 0===s&&(s="loose"),"loose"!==s&&"strict"!==s&&"stop-before-partial"!==s)throw new f("Incorrect `lastChunkHandling` option");n&&d(n.buffer);var b=e.length,w=n||[],k=0,x=0,S="",C=0;if(r)while(1){if(C=g(e,C),C===b){if(S.length>0){if("stop-before-partial"===s)break;if("loose"!==s)throw new h("Missing padding");if(1===S.length)throw new h("Malformed padding: exactly one additional character");k=y(w,v(S,o,!1),k)}x=b;break}var T=m(e,C);if(++C,"="===T){if(S.length<2)throw new h("Padding is too early");if(C=g(e,C),2===S.length){if(C===b){if("stop-before-partial"===s)break;throw new h("Malformed padding: only one =")}"="===m(e,C)&&(++C,C=g(e,C))}if(C<b)throw new h("Unexpected character after padding");k=y(w,v(S,o,"strict"===s),k),x=b;break}if(!l(o,T))throw new h("Unexpected character");var E=r-k;if(1===E&&2===S.length||2===E&&3===S.length)break;if(S+=T,4===S.length&&(k=y(w,v(S,o,!1),k),S="",x=C,k===r))break}return{bytes:w,read:x,written:k}}},2303:function(e,t,n){"use strict";var r=n(4576),o=n(9504),i=r.Uint8Array,a=r.SyntaxError,l=Math.min,s=o("".match);e.exports=function(e,t){var n=e.length;if(n%2!==0)throw new a("String should be an even number of characters");for(var r=t?l(t.length,n/2):n/2,o=t||new i(r),c=s(e,/.{2}/g),d=0;d<r;d++){var u=+("0x"+c[d]+"0");if(u!==u)throw new a("String should only contain hex characters");o[d]=u>>4}return{bytes:o,read:d<<1}}},7040:function(e,t,n){"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:function(e,t,n){"use strict";var r=n(3724),o=n(9039);e.exports=r&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},2812:function(e){"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8622:function(e,t,n){"use strict";var r=n(4576),o=n(4901),i=r.WeakMap;e.exports=o(i)&&/native code/.test(String(i))},4995:function(e,t,n){"use strict";var r=n(9504),o=WeakMap.prototype;e.exports={WeakMap:WeakMap,set:r(o.set),get:r(o.get),has:r(o.has),remove:r(o["delete"])}},8227:function(e,t,n){"use strict";var r=n(4576),o=n(5745),i=n(9297),a=n(3392),l=n(4495),s=n(7040),c=r.Symbol,d=o("wks"),u=s?c["for"]||c:c&&c.withoutSetter||a;e.exports=function(e){return i(d,e)||(d[e]=l&&i(c,e)?c[e]:u("Symbol."+e)),d[e]}},6573:function(e,t,n){"use strict";var r=n(3724),o=n(2106),i=n(3238),a=ArrayBuffer.prototype;r&&!("detached"in a)&&o(a,"detached",{configurable:!0,get:function(){return i(this)}})},7936:function(e,t,n){"use strict";var r=n(6518),o=n(5636);o&&r({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return o(this,arguments.length?arguments[0]:void 0,!1)}})},8100:function(e,t,n){"use strict";var r=n(6518),o=n(5636);o&&r({target:"ArrayBuffer",proto:!0},{transfer:function(){return o(this,arguments.length?arguments[0]:void 0,!0)}})},4423:function(e,t,n){"use strict";var r=n(6518),o=n(9617).includes,i=n(9039),a=n(6469),l=i(function(){return!Array(1).includes()}),s=i(function(){return[,1].includes(void 0,1)});r({target:"Array",proto:!0,forced:l||s},{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4114:function(e,t,n){"use strict";var r=n(6518),o=n(8981),i=n(6198),a=n(4527),l=n(6837),s=n(9039),c=s(function(){return 4294967297!==[].push.call({length:4294967296},1)}),d=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}},u=c||!d();r({target:"Array",proto:!0,arity:1,forced:u},{push:function(e){var t=o(this),n=i(t),r=arguments.length;l(n+r);for(var s=0;s<r;s++)t[n]=arguments[s],n++;return a(t,n),n}})},8111:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(679),a=n(8551),l=n(4901),s=n(2787),c=n(2106),d=n(4659),u=n(9039),p=n(9297),h=n(8227),f=n(7657).IteratorPrototype,m=n(3724),g=n(6395),v="constructor",y="Iterator",b=h("toStringTag"),w=TypeError,k=o[y],x=g||!l(k)||k.prototype!==f||!u(function(){k({})}),S=function(){if(i(this,f),s(this)===f)throw new w("Abstract class Iterator not directly constructable")},C=function(e,t){m?c(f,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===f)throw new w("You can't redefine this property");p(this,e)?this[e]=t:d(this,e,t)}}):f[e]=t};p(f,b)||C(b,y),!x&&p(f,v)&&f[v]!==Object||C(v,S),S.prototype=f,r({global:!0,constructor:!0,forced:x},{Iterator:S})},1148:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(2652),a=n(9306),l=n(8551),s=n(1767),c=n(9539),d=n(4549),u=d("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(e){l(this);try{a(e)}catch(r){c(this,"throw",r)}if(u)return o(u,this,e);var t=s(this),n=0;return!i(t,function(t,r){if(!e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(9306),a=n(8551),l=n(1767),s=n(9462),c=n(6319),d=n(6395),u=n(9539),p=n(684),h=n(4549),f=!d&&!p("filter",function(){}),m=!d&&!f&&h("filter",TypeError),g=d||f||m,v=s(function(){var e,t,n,r=this.iterator,i=this.predicate,l=this.next;while(1){if(e=a(o(l,r)),t=this.done=!!e.done,t)return;if(n=e.value,c(r,i,[n,this.counter++],!0))return n}});r({target:"Iterator",proto:!0,real:!0,forced:g},{filter:function(e){a(this);try{i(e)}catch(t){u(this,"throw",t)}return m?o(m,this,e):new v(l(this),{predicate:e})}})},116:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(2652),a=n(9306),l=n(8551),s=n(1767),c=n(9539),d=n(4549),u=d("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(e){l(this);try{a(e)}catch(r){c(this,"throw",r)}if(u)return o(u,this,e);var t=s(this),n=0;return i(t,function(t,r){if(e(t,n++))return r(t)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},531:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(9306),a=n(8551),l=n(1767),s=n(8646),c=n(9462),d=n(9539),u=n(6395),p=n(684),h=n(4549);function f(){try{var e=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(e){return e});e.next(),e["return"]()}catch(t){return!0}}var m=!u&&!p("flatMap",function(){}),g=!u&&!m&&h("flatMap",TypeError),v=u||m||g||f(),y=c(function(){var e,t,n=this.iterator,r=this.mapper;while(1){if(t=this.inner)try{if(e=a(o(t.next,t.iterator)),!e.done)return e.value;this.inner=null}catch(i){d(n,"throw",i)}if(e=a(o(this.next,n)),this.done=!!e.done)return;try{this.inner=s(r(e.value,this.counter++),!1)}catch(i){d(n,"throw",i)}}});r({target:"Iterator",proto:!0,real:!0,forced:v},{flatMap:function(e){a(this);try{i(e)}catch(t){d(this,"throw",t)}return g?o(g,this,e):new y(l(this),{mapper:e,inner:null})}})},7588:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(2652),a=n(9306),l=n(8551),s=n(1767),c=n(9539),d=n(4549),u=d("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(e){l(this);try{a(e)}catch(r){c(this,"throw",r)}if(u)return o(u,this,e);var t=s(this),n=0;i(t,function(t){e(t,n++)},{IS_RECORD:!0})}})},1701:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(9306),a=n(8551),l=n(1767),s=n(9462),c=n(6319),d=n(9539),u=n(684),p=n(4549),h=n(6395),f=!h&&!u("map",function(){}),m=!h&&!f&&p("map",TypeError),g=h||f||m,v=s(function(){var e=this.iterator,t=a(o(this.next,e)),n=this.done=!!t.done;if(!n)return c(e,this.mapper,[t.value,this.counter++],!0)});r({target:"Iterator",proto:!0,real:!0,forced:g},{map:function(e){a(this);try{i(e)}catch(t){d(this,"throw",t)}return m?o(m,this,e):new v(l(this),{mapper:e})}})},8237:function(e,t,n){"use strict";var r=n(6518),o=n(2652),i=n(9306),a=n(8551),l=n(1767),s=n(9539),c=n(4549),d=n(8745),u=n(9039),p=TypeError,h=u(function(){[].keys().reduce(function(){},void 0)}),f=!h&&c("reduce",p);r({target:"Iterator",proto:!0,real:!0,forced:h||f},{reduce:function(e){a(this);try{i(e)}catch(u){s(this,"throw",u)}var t=arguments.length<2,n=t?void 0:arguments[1];if(f)return d(f,this,t?[e]:[e,n]);var r=l(this),c=0;if(o(r,function(r){t?(t=!1,n=r):n=e(n,r,c),c++},{IS_RECORD:!0}),t)throw new p("Reduce of empty iterator with no initial value");return n}})},3579:function(e,t,n){"use strict";var r=n(6518),o=n(9565),i=n(2652),a=n(9306),l=n(8551),s=n(1767),c=n(9539),d=n(4549),u=d("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(e){l(this);try{a(e)}catch(r){c(this,"throw",r)}if(u)return o(u,this,e);var t=s(this),n=0;return i(t,function(t,r){if(e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},9112:function(e,t,n){"use strict";var r=n(6518),o=n(3724),i=n(4576),a=n(7751),l=n(9504),s=n(9565),c=n(4901),d=n(34),u=n(4376),p=n(9297),h=n(655),f=n(6198),m=n(4659),g=n(9039),v=n(8235),y=n(4495),b=i.JSON,w=i.Number,k=i.SyntaxError,x=b&&b.parse,S=a("Object","keys"),C=Object.getOwnPropertyDescriptor,T=l("".charAt),E=l("".slice),_=l(/./.exec),M=l([].push),N=/^\d$/,I=/^[1-9]$/,R=/^[\d-]$/,A=/^[\t\n\r ]$/,B=0,D=1,F=function(e,t){e=h(e);var n=new z(e,0,""),r=n.parse(),o=r.value,i=n.skip(A,r.end);if(i<e.length)throw new k('Unexpected extra character: "'+T(e,i)+'" after the parsed data at: '+i);return c(t)?P({"":o},"",t,r):o},P=function(e,t,n,r){var o,i,a,l,c,h=e[t],m=r&&h===r.value,g=m&&"string"==typeof r.source?{source:r.source}:{};if(d(h)){var v=u(h),y=m?r.nodes:v?[]:{};if(v)for(o=y.length,a=f(h),l=0;l<a;l++)O(h,l,P(h,""+l,n,l<o?y[l]:void 0));else for(i=S(h),a=f(i),l=0;l<a;l++)c=i[l],O(h,c,P(h,c,n,p(y,c)?y[c]:void 0))}return s(n,e,t,h,g)},O=function(e,t,n){if(o){var r=C(e,t);if(r&&!r.configurable)return}void 0===n?delete e[t]:m(e,t,n)},L=function(e,t,n,r){this.value=e,this.end=t,this.source=n,this.nodes=r},z=function(e,t){this.source=e,this.index=t};z.prototype={fork:function(e){return new z(this.source,e)},parse:function(){var e=this.source,t=this.skip(A,this.index),n=this.fork(t),r=T(e,t);if(_(R,r))return n.number();switch(r){case"{":return n.object();case"[":return n.array();case'"':return n.string();case"t":return n.keyword(!0);case"f":return n.keyword(!1);case"n":return n.keyword(null)}throw new k('Unexpected character: "'+r+'" at: '+t)},node:function(e,t,n,r,o){return new L(t,r,e?null:E(this.source,n,r),o)},object:function(){var e=this.source,t=this.index+1,n=!1,r={},o={},i=!1;while(t<e.length){if(t=this.until(['"',"}"],t),"}"===T(e,t)&&!n){t++,i=!0;break}var a=this.fork(t).string(),l=a.value;t=a.end,t=this.until([":"],t)+1,t=this.skip(A,t),a=this.fork(t).parse(),m(o,l,a),m(r,l,a.value),t=this.until([",","}"],a.end);var s=T(e,t);if(","===s)n=!0,t++;else if("}"===s){t++,i=!0;break}}if(!i)throw new k("Unterminated object at: "+t);return this.node(D,r,this.index,t,o)},array:function(){var e=this.source,t=this.index+1,n=!1,r=[],o=[],i=!1;while(t<e.length){if(t=this.skip(A,t),"]"===T(e,t)&&!n){t++,i=!0;break}var a=this.fork(t).parse();if(M(o,a),M(r,a.value),t=this.until([",","]"],a.end),","===T(e,t))n=!0,t++;else if("]"===T(e,t)){t++,i=!0;break}}if(!i)throw new k("Unterminated array at: "+t);return this.node(D,r,this.index,t,o)},string:function(){var e=this.index,t=v(this.source,this.index+1);return this.node(B,t.value,e,t.end)},number:function(){var e=this.source,t=this.index,n=t;if("-"===T(e,n)&&n++,"0"===T(e,n))n++;else{if(!_(I,T(e,n)))throw new k("Failed to parse number at: "+n);n=this.skip(N,n+1)}if("."===T(e,n)){var r=n+1;if(n=this.skip(N,r),r===n)throw new k("Failed to parse number's fraction at: "+n)}if("e"===T(e,n)||"E"===T(e,n)){n++,"+"!==T(e,n)&&"-"!==T(e,n)||n++;var o=n;if(n=this.skip(N,n),o===n)throw new k("Failed to parse number's exponent value at: "+n)}return this.node(B,w(E(e,t,n)),t,n)},keyword:function(e){var t=""+e,n=this.index,r=n+t.length;if(E(this.source,n,r)!==t)throw new k("Failed to parse value at: "+n);return this.node(B,e,n,r)},skip:function(e,t){for(var n=this.source;t<n.length;t++)if(!_(e,T(n,t)))break;return t},until:function(e,t){t=this.skip(A,t);for(var n=T(this.source,t),r=0;r<e.length;r++)if(e[r]===n)return t;throw new k('Unexpected character: "'+n+'" at: '+t)}};var V=g(function(){var e,t="9007199254740993";return x(t,function(t,n,r){e=r.source}),e!==t}),$=y&&!g(function(){return 1/x("-0 \t")!==-1/0});r({target:"JSON",stat:!0,forced:V},{parse:function(e,t){return $&&!c(t)?x(e):F(e,t)}})},3110:function(e,t,n){"use strict";var r=n(6518),o=n(7751),i=n(8745),a=n(9565),l=n(9504),s=n(9039),c=n(4376),d=n(4901),u=n(5810),p=n(757),h=n(2195),f=n(655),m=n(7680),g=n(8235),v=n(3392),y=n(4495),b=n(7819),w=String,k=o("JSON","stringify"),x=l(/./.exec),S=l("".charAt),C=l("".charCodeAt),T=l("".replace),E=l("".slice),_=l([].push),M=l(1.1.toString),N=/[\uD800-\uDFFF]/g,I=/^[\uD800-\uDBFF]$/,R=/^[\uDC00-\uDFFF]$/,A=v(),B=A.length,D=!y||s(function(){var e=o("Symbol")("stringify detection");return"[null]"!==k([e])||"{}"!==k({a:e})||"{}"!==k(Object(e))}),F=s(function(){return'"\\udf06\\ud834"'!==k("\udf06\ud834")||'"\\udead"'!==k("\udead")}),P=D?function(e,t){var n=m(arguments),r=L(t);if(d(r)||void 0!==e&&!p(e))return n[1]=function(e,t){if(d(r)&&(t=a(r,this,w(e),t)),!p(t))return t},i(k,null,n)}:k,O=function(e,t,n){var r=S(n,t-1),o=S(n,t+1);return x(I,e)&&!x(R,o)||x(R,e)&&!x(I,r)?"\\u"+M(C(e,0),16):e},L=function(e){if(d(e))return e;if(c(e)){for(var t=e.length,n=[],r=0;r<t;r++){var o=e[r];"string"==typeof o?_(n,o):"number"!=typeof o&&"Number"!==h(o)&&"String"!==h(o)||_(n,f(o))}var i=n.length,a=!0;return function(e,t){if(a)return a=!1,t;if(c(this))return t;for(var r=0;r<i;r++)if(n[r]===e)return t}}};k&&r({target:"JSON",stat:!0,arity:3,forced:D||F||!b},{stringify:function(e,t,n){var r=L(t),o=[],i=P(e,function(e,t){var n=d(r)?a(r,this,w(e),t):t;return!b&&u(n)?A+(_(o,n.rawJSON)-1):n},n);if("string"!=typeof i)return i;if(F&&(i=T(i,N,O)),b)return i;for(var l="",s=i.length,c=0;c<s;c++){var p=S(i,c);if('"'===p){var h=g(i,++c).end-1,f=E(i,c,h);l+=E(f,0,B)===A?o[E(f,B)]:'"'+f+'"',c=h}else l+=p}return l}})},2731:function(e,t,n){"use strict";var r=n(6518),o=n(9306),i=n(2248),a=n(6395),l=i.get,s=i.has,c=i.set;r({target:"Map",proto:!0,real:!0,forced:a},{getOrInsertComputed:function(e,t){var n=s(this,e);if(o(t),n)return l(this,e);0===e&&1/e===-1/0&&(e=0);var r=t(e);return c(this,e,r),r}})},5367:function(e,t,n){"use strict";var r=n(6518),o=n(2248),i=n(6395),a=o.get,l=o.has,s=o.set;r({target:"Map",proto:!0,real:!0,forced:i},{getOrInsert:function(e,t){return l(this,e)?a(this,e):(s(this,e,t),t)}})},7642:function(e,t,n){"use strict";var r=n(6518),o=n(3440),i=n(9039),a=n(4916),l=!a("difference",function(e){return 0===e.size}),s=l||i(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var n=e++>1;return t.has(1)&&t.clear(),{done:n,value:2}}}}},t=new Set([1,2,3,4]);return 3!==t.difference(e).size});r({target:"Set",proto:!0,real:!0,forced:s},{difference:o})},8004:function(e,t,n){"use strict";var r=n(6518),o=n(9039),i=n(8750),a=n(4916),l=!a("intersection",function(e){return 2===e.size&&e.has(1)&&e.has(2)})||o(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))});r({target:"Set",proto:!0,real:!0,forced:l},{intersection:i})},3853:function(e,t,n){"use strict";var r=n(6518),o=n(4449),i=n(4916),a=!i("isDisjointFrom",function(e){return!e});r({target:"Set",proto:!0,real:!0,forced:a},{isDisjointFrom:o})},5876:function(e,t,n){"use strict";var r=n(6518),o=n(3838),i=n(4916),a=!i("isSubsetOf",function(e){return e});r({target:"Set",proto:!0,real:!0,forced:a},{isSubsetOf:o})},2475:function(e,t,n){"use strict";var r=n(6518),o=n(8527),i=n(4916),a=!i("isSupersetOf",function(e){return!e});r({target:"Set",proto:!0,real:!0,forced:a},{isSupersetOf:o})},5024:function(e,t,n){"use strict";var r=n(6518),o=n(3650),i=n(9835),a=n(4916),l=!a("symmetricDifference")||!i("symmetricDifference");r({target:"Set",proto:!0,real:!0,forced:l},{symmetricDifference:o})},1698:function(e,t,n){"use strict";var r=n(6518),o=n(4204),i=n(9835),a=n(4916),l=!a("union")||!i("union");r({target:"Set",proto:!0,real:!0,forced:l},{union:o})},9577:function(e,t,n){"use strict";var r=n(4644),o=n(1108),i=n(6198),a=n(1291),l=n(5854),s=r.aTypedArray,c=r.getTypedArrayConstructor,d=r.exportTypedArrayMethod,u=RangeError,p=function(){try{new Int8Array(1)["with"](2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}(),h=p&&function(){try{new Int8Array(1)["with"](-.5,1)}catch(e){return!0}}();d("with",{with:function(e,t){var n=s(this),r=i(n),d=a(e),p=d<0?r+d:d,h=o(n)?l(t):+t;if(p>=r||p<0)throw new u("Incorrect index");for(var f=new(c(n))(r),m=0;m<r;m++)f[m]=m===p?h:n[m];return f}}["with"],!p||h)},6632:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(9143),a=n(4154),l=o.Uint8Array,s=!l||!l.prototype.setFromBase64||!function(){var e=new l([255,255,255,255,255]);try{return void e.setFromBase64("",null)}catch(t){}try{return void e.setFromBase64("a")}catch(t){}try{e.setFromBase64("MjYyZg===")}catch(t){return 50===e[0]&&54===e[1]&&50===e[2]&&255===e[3]&&255===e[4]}}();l&&r({target:"Uint8Array",proto:!0,forced:s},{setFromBase64:function(e){a(this);var t=i(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})},4226:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(3463),a=n(4154),l=n(5169),s=n(2303);function c(){try{var e=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(e).setFromHex("cafed00d")}catch(t){return!0}}o.Uint8Array&&r({target:"Uint8Array",proto:!0,forced:c()},{setFromHex:function(e){a(this),i(e),l(this.buffer);var t=s(e,this).read;return{read:t,written:t/2}}})},9486:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(9504),a=n(3972),l=n(4154),s=n(5169),c=n(2804),d=n(944),u=c.i2c,p=c.i2cUrl,h=i("".charAt),f=o.Uint8Array,m=!f||!f.prototype.toBase64||!function(){try{var e=new f;e.toBase64(null)}catch(t){return!0}}();f&&r({target:"Uint8Array",proto:!0,forced:m},{toBase64:function(){var e=l(this),t=arguments.length?a(arguments[0]):void 0,n="base64"===d(t)?u:p,r=!!t&&!!t.omitPadding;s(this.buffer);for(var o,i="",c=0,f=e.length,m=function(e){return h(n,o>>6*e&63)};c+2<f;c+=3)o=(e[c]<<16)+(e[c+1]<<8)+e[c+2],i+=m(3)+m(2)+m(1)+m(0);return c+2===f?(o=(e[c]<<16)+(e[c+1]<<8),i+=m(3)+m(2)+m(1)+(r?"":"=")):c+1===f&&(o=e[c]<<16,i+=m(3)+m(2)+(r?"":"==")),i}})},456:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(9504),a=n(4154),l=n(5169),s=i(1.1.toString),c=i([].join),d=Array,u=o.Uint8Array,p=!u||!u.prototype.toHex||!function(){try{var e=new u([255,255,255,255,255,255,255,255]);return"ffffffffffffffff"===e.toHex()}catch(t){return!1}}();u&&r({target:"Uint8Array",proto:!0,forced:p},{toHex:function(){a(this),l(this.buffer);for(var e=d(this.length),t=0,n=this.length;t<n;t++){var r=s(this[t],16);e[t]=1===r.length?"0"+r:r}return c(e,"")}})},9452:function(e,t,n){"use strict";var r=n(6518),o=n(9306),i=n(6557),a=n(4328),l=n(4995),s=n(6395),c=l.get,d=l.has,u=l.set,p=s||!function(){try{WeakMap.prototype.getOrInsertComputed&&(new WeakMap).getOrInsertComputed(1,function(){throw 1})}catch(e){return e instanceof TypeError}}();r({target:"WeakMap",proto:!0,real:!0,forced:p},{getOrInsertComputed:function(e,t){if(s||i(this),a(e),o(t),d(this,e))return c(this,e);var n=t(e);return u(this,e,n),n}})},8454:function(e,t,n){"use strict";var r=n(6518),o=n(4995),i=n(6395),a=o.get,l=o.has,s=o.set;r({target:"WeakMap",proto:!0,real:!0,forced:i},{getOrInsert:function(e,t){return l(this,e)?a(this,e):(s(this,e,t),t)}})},6368:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(9225).clear;r({global:!0,bind:!0,enumerable:!0,forced:o.clearImmediate!==i},{clearImmediate:i})},4979:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(7751),a=n(6980),l=n(4913).f,s=n(9297),c=n(679),d=n(3167),u=n(2603),p=n(5002),h=n(8574),f=n(3724),m=n(6395),g="DOMException",v=i("Error"),y=i(g),b=function(){c(this,w);var e=arguments.length,t=u(e<1?void 0:arguments[0]),n=u(e<2?void 0:arguments[1],"Error"),r=new y(t,n),o=new v(t);return o.name=g,l(r,"stack",a(1,h(o.stack,1))),d(r,this,b),r},w=b.prototype=y.prototype,k="stack"in new v(g),x="stack"in new y(1,2),S=y&&f&&Object.getOwnPropertyDescriptor(o,g),C=!!S&&!(S.writable&&S.configurable),T=k&&!C&&!x;r({global:!0,constructor:!0,forced:m||T},{DOMException:T?b:y});var E=i(g),_=E.prototype;if(_.constructor!==E)for(var M in m||l(_,"constructor",a(1,E)),p)if(s(p,M)){var N=p[M],I=N.s;s(E,I)||l(E,I,a(6,N.c))}},9848:function(e,t,n){"use strict";n(6368),n(9309)},9309:function(e,t,n){"use strict";var r=n(6518),o=n(4576),i=n(9225).set,a=n(9472),l=o.setImmediate?a(i,!1):i;r({global:!0,bind:!0,enumerable:!0,forced:o.setImmediate!==l},{setImmediate:l})},4603:function(e,t,n){"use strict";var r=n(6840),o=n(9504),i=n(655),a=n(2812),l=URLSearchParams,s=l.prototype,c=o(s.append),d=o(s["delete"]),u=o(s.forEach),p=o([].push),h=new l("a=1&a=2&b=3");h["delete"]("a",1),h["delete"]("b",void 0),h+""!=="a=2"&&r(s,"delete",function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return d(this,e);var r=[];u(this,function(e,t){p(r,{key:t,value:e})}),a(t,1);var o,l=i(e),s=i(n),h=0,f=r.length;while(h<f)o=r[h],d(this,o.key),h++;h=0;while(h<f)o=r[h++],o.key===l&&o.value===s||c(this,o.key,o.value)},{enumerable:!0,unsafe:!0})},7566:function(e,t,n){"use strict";var r=n(6840),o=n(9504),i=n(655),a=n(2812),l=URLSearchParams,s=l.prototype,c=o(s.getAll),d=o(s.has),u=new l("a=1");!u.has("a",2)&&u.has("a",void 0)||r(s,"has",function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return d(this,e);var r=c(this,e);a(t,1);var o=i(n),l=0;while(l<r.length)if(r[l++]===o)return!0;return!1},{enumerable:!0,unsafe:!0})},8721:function(e,t,n){"use strict";var r=n(3724),o=n(9504),i=n(2106),a=URLSearchParams.prototype,l=o(a.forEach);r&&!("size"in a)&&i(a,"size",{get:function(){var e=0;return l(this,function(){e++}),e},configurable:!0,enumerable:!0})},9970:function(e,t,n){"use strict";n.d(t,{a:function(){return o},b:function(){return i},c:function(){return a},d:function(){return l},e:function(){return c},f:function(){return d},h:function(){return u},i:function(){return p},j:function(){return h},k:function(){return f},l:function(){return m},m:function(){return g},n:function(){return v},o:function(){return y},p:function(){return b},q:function(){return w},r:function(){return k}});n(4423),n(4114),n(8111),n(2489),n(116),n(5367),n(2731);var r=n(6512);function o(e){return(0,r.xml2js)(e,{compact:!1,ignoreComment:!0,ignoreInstruction:!0,ignoreDoctype:!0,alwaysArray:!1,trim:!1,captureSpacesBetweenElements:!0,attributesKey:"attributes",textKey:"text"})}function i(e){return(0,r.js2xml)({elements:[e]},{compact:!1,spaces:0})}function a(e){try{let t=o(e);return t.elements&&t.elements.length>0?t.elements.find(e=>"element"===e.type)??null:t}catch(t){return console.warn("Failed to parse XML:",t),null}}function l(e){let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function s(e,t,n){if(!e.name)return!1;let r=`${t}:${n}`;return e.name===r||l(e.name)===n}function c(e,t,n){if(!e||!e.elements)return null;let r=`${t}:${n}`;for(let o of e.elements)if("element"===o.type&&(o.name===r||l(o.name||"")===n))return o;return null}function d(e,t,n){if(!e||!e.elements)return[];let r=`${t}:${n}`,o=[];for(let i of e.elements)"element"===i.type&&(i.name===r||l(i.name||"")===n)&&o.push(i);return o}function u(e,t){if(!e||!e.elements)return null;for(let n of e.elements)if("element"===n.type&&n.name===t)return n;return null}function p(e){return e&&e.elements?e.elements.filter(e=>"element"===e.type):[]}function h(e,t,n){if(!e||!e.attributes)return null;let r=e.attributes;if(t){let e=`${t}:${n}`;if(e in r)return r[e]}return n in r?r[n]:null}function f(e){if(!e)return"";if("text"in e&&"string"==typeof e.text)return e.text;if(!e.elements)return"";let t="";for(let n of e.elements)"text"===n.type&&"text"in n?t+=n.text??"":"element"===n.type&&(t+=f(n));return t}function m(e,t,n,r=1){let o=h(e,t,n);if(null===o)return;let i=parseInt(o,10);return isNaN(i)?void 0:i*r}function g(e,t="w"){if(!e)return!1;let n=h(e,t,"val");return null===n||!("0"===n||"false"===n||"off"===n)}function v(e,t,n){if(!e)return null;if(s(e,t,n))return e;if(e.elements)for(let r of e.elements){if("element"!==r.type)continue;let e=v(r,t,n);if(e)return e}return null}var y={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",footnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",endnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",webSettings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",oleObject:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",diagramData:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",customProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",customXml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};function b(e){let t=new Map;if(!e||0===e.trim().length)return t;let n=a(e);if(!n)return console.warn("Failed to parse relationships XML"),t;let r=p(n);for(let o of r){let e=o.name||"";if(!e.endsWith("Relationship")&&!e.includes(":Relationship"))continue;let n=h(o,null,"Id"),r=h(o,null,"Type"),i=h(o,null,"Target"),a=h(o,null,"TargetMode");if(!n||!r||!i){console.warn("Relationship missing required attributes:",{id:n,type:r,target:i});continue}let l={id:n,type:r,target:i};"External"===a?l.targetMode="External":"Internal"===a&&(l.targetMode="Internal"),t.set(n,l)}return t}function w(e){return e.type===y.hyperlink&&"External"===e.targetMode}function k(e,t){return e.get(t)?.target}},1213:function(e,t,n){"use strict";function r(){return Math.floor(2147483647*Math.random()).toString(16).toUpperCase().padStart(8,"0")}n.d(t,{a:function(){return r}})}},k={};function x(e){var t=k[e];if(void 0!==t)return t.exports;var n=k[e]={exports:{}};return w[e].call(n.exports,n,n.exports,x),n.exports}x.m=w,function(){x.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return x.d(t,{a:t}),t}}(),function(){x.d=function(e,t){for(var n in t)x.o(t,n)&&!x.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}}(),function(){x.f={},x.e=function(e){return Promise.all(Object.keys(x.f).reduce(function(t,n){return x.f[n](e,t),t},[]))}}(),function(){x.u=function(e){return"FDocxEditor.umd.min."+e+".js"}}(),function(){x.miniCssF=function(e){}}(),function(){x.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){x.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="FDocxEditor:";x.l=function(n,r,o,i){if(e[n])e[n].push(r);else{var a,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var d=s[c];if(d.getAttribute("src")==n||d.getAttribute("data-webpack")==t+o){a=d;break}}a||(l=!0,a=document.createElement("script"),a.charset="utf-8",x.nc&&a.setAttribute("nonce",x.nc),a.setAttribute("data-webpack",t+o),a.src=n),e[n]=[r];var u=function(t,r){a.onerror=a.onload=null,clearTimeout(p);var o=e[n];if(delete e[n],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(function(e){return e(r)}),t)return t(r)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),l&&document.head.appendChild(a)}}}(),function(){x.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){x.p=""}(),function(){var e={316:0};x.f.j=function(t,n){var r=x.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(function(n,o){r=e[t]=[n,o]});n.push(r[2]=o);var i=x.p+x.u(t),a=new Error,l=function(n){if(x.o(e,t)&&(r=e[t],0!==r&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,r[1](a)}};x.l(i,l,"chunk-"+t,t)}};var t=function(t,n){var r,o,i=n[0],a=n[1],l=n[2],s=0;if(i.some(function(t){return 0!==e[t]})){for(r in a)x.o(a,r)&&(x.m[r]=a[r]);if(l)l(x)}for(t&&t(n);s<i.length;s++)o=i[s],x.o(e,o)&&e[o]&&e[o][0](),e[o]=0},n=("undefined"!==typeof self?self:this)["webpackChunkFDocxEditor"]=("undefined"!==typeof self?self:this)["webpackChunkFDocxEditor"]||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var S={};return function(){"use strict";if(x.r(S),x.d(S,{FDocxEditor:function(){return NP},default:function(){return RP}}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(x.p=t[1])}x(4423),x(4114),x(8111),x(2489),x(116),x(531),x(7588),x(1701),x(8237),x(3579),x(9112),x(3110),x(7642),x(8004),x(3853),x(5876),x(2475),x(5024),x(1698),x(4603),x(7566),x(8721);var n=x(154),r=x(8275),o=x(2337),i=x(1978),a=x.n(i),l=x(9150),s=x.n(l),c=x(2266),d=x.n(c),u=x(9083),p=x(7190),h=x(1128),f=x(8846),m=x.n(f),g=x(7193),v=x.n(g),y=x(5300),b=x.n(y);x(8454),x(9452);function w(e){this.content=e}w.prototype={constructor:w,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new w(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new w(n)},addToStart:function(e,t){return new w([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new w(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new w(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=w.from(e),e.size?new w(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=w.from(e),e.size?new w(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=w.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},w.from=function(e){if(e instanceof w)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new w(t)};var k=w;function C(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=C(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function T(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let a=e.child(--o),l=t.child(--i),s=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);while(e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1])e++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let e=T(a.content,l.content,n-1,r-1);if(e)return e}n-=s,r-=s}else n-=s,r-=s}}class E{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,a=0;a<t;i++){let l=this.content[i],s=a+l.nodeSize;if(s>e&&!1!==n(l,r+a,o||null,i)&&l.content.size){let o=a+1;l.nodesBetween(Math.max(0,e-o),Math.min(l.content.size,t-o),n,r+o)}a=s}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(a,l)=>{let s=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?r?"function"===typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&s||a.isTextblock)&&n&&(i?i=!1:o+=n),o+=s},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new E(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let a=this.content[o],l=i+a.nodeSize;l>e&&((i<e||l>t)&&(a=a.isText?a.cut(Math.max(0,e-i),Math.min(a.text.length,t-i)):a.cut(Math.max(0,e-i-1),Math.min(a.content.size,t-i-1))),n.push(a),r+=a.nodeSize),i=l}return new E(n,r)}cutByIndex(e,t){return e==t?E.empty:0==e&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new E(r,o)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return C(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return T(this,e,t,n)}findIndex(e){if(0==e)return M(0,e);if(e==this.size)return M(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),o=n+r.nodeSize;if(o>=e)return o==e?M(t+1,o):M(t,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return E.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new E(t||e,n)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const _={index:0,offset:0};function M(e,t){return _.index=e,_.offset=t,_}function N(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!N(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!N(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class I{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&N(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return I.none;if(e instanceof I)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}I.none=[];class R extends Error{}class A{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=D(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new A(n,this.openStart,this.openEnd)}removeBetween(e,t){return new A(B(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return A.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new A(E.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new A(e,n,r)}}function B(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:a,offset:l}=e.findIndex(n);if(o==t||i.isText){if(l!=n&&!e.child(a).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(B(i.content,t-o-1,n-o-1)))}function D(e,t,n,r,o,i){let{index:a,offset:l}=e.findIndex(t),s=e.maybeChild(a);if(l==t||s.isText)return i&&r<=0&&o<=0&&!i.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=D(s.content,t-l-1,n,0==a?r-1:0,a==e.childCount-1?o-1:0,s);return c&&e.replaceChild(a,s.copy(c))}function F(e,t,n){if(n.openStart>e.depth)throw new R("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new R("Inconsistent open depths");return P(e,t,n,0)}function P(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let a=P(e,t,n,r+1);return i.copy(i.content.replaceChild(o,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:a}=W(n,e);return $(i,j(e,o,a,t,r))}{let r=e.parent,o=r.content;return $(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return $(i,H(e,t,r))}function O(e,t){if(!t.type.compatibleContent(e.type))throw new R("Cannot join "+t.type.name+" onto "+e.type.name)}function L(e,t,n){let r=e.node(n);return O(r,t.node(n)),r}function z(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function V(e,t,n,r){let o=(t||e).node(n),i=0,a=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(z(e.nodeAfter,r),i++));for(let l=i;l<a;l++)z(o.child(l),r);t&&t.depth==n&&t.textOffset&&z(t.nodeBefore,r)}function $(e,t){return e.type.checkContent(t),e.copy(t)}function j(e,t,n,r,o){let i=e.depth>o&&L(e,t,o+1),a=r.depth>o&&L(n,r,o+1),l=[];return V(null,e,o,l),i&&a&&t.index(o)==n.index(o)?(O(i,a),z($(i,j(e,t,n,r,o+1)),l)):(i&&z($(i,H(e,t,o+1)),l),V(t,n,o,l),a&&z($(a,H(n,r,o+1)),l)),V(r,null,o,l),new E(l)}function H(e,t,n){let r=[];if(V(null,e,n,r),e.depth>n){let o=L(e,t,n+1);z($(o,H(e,t,n+1)),r)}return V(t,null,n,r),new E(r)}function W(e,t){let n=t.depth-e.openStart,r=t.node(n),o=r.copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(E.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}A.empty=new A(E.empty,0,0);class q{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return e=this.resolveDepth(e),0==e?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new G(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),a=o-t;if(n.push(i,e,r+t),!a)break;if(i=i.child(e),i.isText)break;o=a-1,r+=t+1}return new q(t,n,o)}static resolveCached(e,t){let n=K.get(e);if(n)for(let o=0;o<n.elts.length;o++){let e=n.elts[o];if(e.pos==t)return e}else K.set(e,n=new Z);let r=n.elts[n.i]=q.resolve(e,t);return n.i=(n.i+1)%U,r}}class Z{constructor(){this.elts=[],this.i=0}}const U=12,K=new WeakMap;class G{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const X=Object.create(null);class Y{constructor(e,t,n,r=I.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||E.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&N(this.attrs,t||e.defaultAttrs||X)&&I.sameSet(this.marks,n||I.none)}copy(e=null){return e==this.content?this:new Y(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Y(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return A.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),a=r.start(i),l=r.node(i),s=l.content.cut(r.pos-a,o.pos-a);return new A(s,r.depth-i,o.depth-i)}replace(e,t,n){return F(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return q.resolveCached(this,e)}resolveNoCache(e){return q.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Q(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=E.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=r;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=I.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!I.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=E.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Y.prototype.text=void 0;class J extends Y{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Q(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new J(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new J(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Q(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ee{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new te(e,t);if(null==n.next)return ee.empty;let r=ne(n);n.next&&n.err("Unexpected trailing text");let o=pe(ce(r));return he(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function o(i,a){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return E.from(a.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,a.concat(t));if(e)return e}}return null}return o(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];while(n.length){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:a}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!a.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}ee.empty=new ee(!0);class te{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ne(e){let t=[];do{t.push(re(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function re(e){let t=[];do{t.push(oe(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function oe(e){let t=se(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=ae(e,t)}return t}function ie(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function ae(e,t){let n=ie(e),r=n;return e.eat(",")&&(r="}"!=e.next?ie(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function le(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.isInGroup(t)&&o.push(e)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}function se(e){if(e.eat("(")){let t=ne(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=le(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}function ce(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let a=n();return r(t,a),o(i(e.expr,a),a),[r(a)]}if("plus"==e.type){let a=n();return o(i(e.expr,t),a),o(i(e.expr,a),a),[r(a)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let a=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,a),t),a=t}if(-1==e.max)o(i(e.expr,a),a);else for(let t=e.min;t<e.max;t++){let t=n();r(a,t),o(i(e.expr,a),t),a=t}return[r(a)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let a=i(e.exprs[r],t);if(r==e.exprs.length-1)return a;o(a,t=n())}}}function de(e,t){return t-e}function ue(e,t){let n=[];return r(t),n.sort(de);function r(t){let o=e[t];if(1==o.length&&!o[0].term)return r(o[0].to);n.push(t);for(let e=0;e<o.length;e++){let{term:t,to:i}=o[e];t||-1!=n.indexOf(i)||r(i)}}}function pe(e){let t=Object.create(null);return n(ue(e,0));function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);ue(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new ee(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(de);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}function he(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:a}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(a)&&r.push(a)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fe(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function me(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function ge(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let n=e[o];n.validate&&n.validate(t[o])}}function ve(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new we(e,r,t[r]);return n}class ye{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=ve(e,n.attrs),this.defaultAttrs=fe(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ee.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:me(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Y(this,this.computeAttrs(e),E.from(t),I.setFrom(n))}createChecked(e=null,t,n){return t=E.from(t),this.checkContent(t),new Y(this,this.computeAttrs(e),t,I.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=E.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(E.empty,!0);return o?new Y(this,e,t.append(o),I.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ge(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:I.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new ye(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}function be(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}class we{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?be(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class ke{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ve(e,r.attrs),this.excluded=null;let o=fe(this.attrs);this.instance=o?new I(this,o):null}create(e=null){return!e&&this.instance?this.instance:new I(this,me(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new ke(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ge(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class xe{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=k.from(e.nodes),t.marks=k.from(e.marks||{}),this.nodes=ye.compile(this.spec.nodes,this),this.marks=ke.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;if(e.contentMatch=n[t]||(n[t]=ee.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==o?null:o?Se(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:Se(this,t.split(" "))}this.nodeFromJSON=e=>Y.fromJSON(this,e),this.markFromJSON=e=>I.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ye))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new J(n,n.defaultAttrs,e,I.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Se(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],a=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=r)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function Ce(e){return null!=e.tag}function Te(e){return null!=e.style}class Ee{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Ce(e))this.tags.push(e);else if(Te(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Fe(this,t,!1);return n.addAll(e,I.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Fe(this,t,!0);return n.addAll(e,I.none,t.from,t.to),A.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r],o=null==e.priority?50:e.priority;if(o<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Le(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Le(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ee(e,Ee.schemaRules(e)))}}const _e={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Me={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ne={ol:!0,ul:!0},Ie=1,Re=2,Ae=4;function Be(e,t,n){return null!=t?(t?Ie:0)|("full"===t?Re:0):e&&"pre"==e.whitespace?Ie|Re:n&~Ae}class De{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=I.none,this.match=o||(i&Ae?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ie)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_e.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Fe{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=Be(null,t.preserveWhitespace,0)|(n?Ae:0);r=o?new De(o.type,o.attrs,I.none,!0,t.topMatch||o.type.contentMatch,i):new De(n?null:e.schema.topNodeType,null,I.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=r.options&Re?"full":this.localPreserveWS||(r.options&Ie)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,a=e.nodeName.toLowerCase();Ne.hasOwnProperty(a)&&this.parser.normalizeLists&&Pe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Me.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(_e.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=l&&l.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let e=this.parser.matchedStyles[r],o=n.getPropertyValue(e);if(o)for(let n;;){let r=this.parser.matchStyle(e,o,this,n);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;n=r}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(a)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let i=this.open,a=0;i>=0;i--){let t=this.nodes[i],l=t.findWrapping(e);if(l&&(!r||r.length>l.length+a)&&(r=l,o=t,!l.length))break;if(t.solid){if(n)break;a+=2}}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)t=this.enterInner(r[i],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=I.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):ze(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=Be(e,o,i.options);i.options&Ae&&0==i.content.length&&(a|=Ae);let l=I.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):ze(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new De(e,t,l,r,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ie)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){let e=t.compareDocumentPosition(this.find[r].node);e&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,a)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;a>=o;a--)if(i(e-1,a))return!0;return!1}{let e=a>0||0==a&&r?this.nodes[a].type:n&&a>=o?n.node(a-o).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function Pe(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Ne.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}function Oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Le(e){let t={};for(let n in e)t[n]=e[n];return t}function ze(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],a=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&a(o))return!0}};if(a(o.contentMatch))return!0}}class Ve{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=je(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;while(n<o.length&&i<e.marks.length){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}while(n<o.length)r=o.pop()[1];while(i<e.marks.length){let n=e.marks[i++],a=this.serializeMark(n,e.isInline,t);a&&(o.push([n,r]),r.appendChild(a.dom),r=a.contentDOM||a.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return je(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Ze(je(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ze(je(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:Ze(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ve(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=$e(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return $e(e.marks)}}function $e(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function je(e){return e.document||window.document}const He=new WeakMap;function We(e){let t=He.get(e);return void 0===t&&He.set(e,t=qe(e)),t}function qe(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Ze(e,t,n,r){if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=We(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a,l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let s=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&s.style?s.style.cssText=c[e]:s.setAttribute(e,c[e])}}for(let u=d;u<t.length;u++){let o=t[u];if(0===o){if(u<t.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}if("string"==typeof o)s.appendChild(e.createTextNode(o));else{let{dom:t,contentDOM:i}=Ze(e,o,n,r);if(s.appendChild(t),i){if(a)throw new RangeError("Multiple content holes");a=i}}}return{dom:s,contentDOM:a}}const Ue=65535,Ke=Math.pow(2,16);function Ge(e,t){return e+t*Ke}function Xe(e){return e&Ue}function Ye(e){return(e-(e&Ue))/Ke}const Je=1,Qe=2,et=4,tt=8;class nt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&tt)>0}get deletedBefore(){return(this.delInfo&(Je|et))>0}get deletedAfter(){return(this.delInfo&(Qe|et))>0}get deletedAcross(){return(this.delInfo&et)>0}}class rt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&rt.empty)return rt.empty}recover(e){let t=0,n=Xe(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+Ye(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let s=this.ranges[a+o],c=this.ranges[a+i],d=l+s;if(e<=d){let o=s?e==l?-1:e==d?1:t:t,i=l+r+(o<0?0:c);if(n)return i;let u=e==(t<0?l:d)?null:Ge(a/3,e-l),p=e==l?Qe:e==d?Je:et;return(t<0?e!=l:e!=d)&&(p|=tt),new nt(i,p,u)}r+=c-s}return n?e+r:new nt(e+r,0,null)}touches(e,t){let n=0,r=Xe(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let t=this.ranges[a]-(this.inverted?n:0);if(t>e)break;let l=this.ranges[a+o],s=t+l;if(e<=s&&a==3*r)return!0;n+=this.ranges[a+i]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],a=i-(this.inverted?o:0),l=i+(this.inverted?0:o),s=this.ranges[r+t],c=this.ranges[r+n];e(a,a+s,l,l+c),o+=c-s}}invert(){return new rt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?rt.empty:new rt(e<0?[0,-e,0]:[0,0,e])}}rt.empty=new rt([]);class ot{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ot(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ot;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this._maps[o],i=n.mapResult(e,t);if(null!=i.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new nt(e,r,null)}}const it=Object.create(null);class at{getMap(){return rt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=it[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in it)throw new RangeError("Duplicate use of step JSON ID "+e);return it[e]=t,t.prototype.jsonID=e,t}}class lt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new lt(e,null)}static fail(e){return new lt(null,e)}static fromReplace(e,t,n,r){try{return lt.ok(e.replace(t,n,r))}catch(Us){if(Us instanceof R)return lt.fail(Us.message);throw Us}}}function st(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(st(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return E.fromArray(r)}class ct extends at{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new A(st(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,o)}invert(){return new dt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ct(t.pos,n.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ct(t.from,t.to,e.markFromJSON(t.mark))}}at.jsonID("addMark",ct);class dt extends at{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new A(st(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,n)}invert(){return new ct(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new dt(t.pos,n.pos,this.mark)}merge(e){return e instanceof dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new dt(t.from,t.to,e.markFromJSON(t.mark))}}at.jsonID("removeMark",dt);class ut extends at{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return lt.fromReplace(e,this.pos,this.pos+1,new A(E.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ut(this.pos,t.marks[n]);return new ut(this.pos,this.mark)}}return new pt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ut(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ut(t.pos,e.markFromJSON(t.mark))}}at.jsonID("addNodeMark",ut);class pt extends at{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return lt.fromReplace(e,this.pos,this.pos+1,new A(E.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ut(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pt(t.pos,e.markFromJSON(t.mark))}}at.jsonID("removeNodeMark",pt);class ht extends at{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&mt(e,this.from,this.to)?lt.fail("Structure replace would overwrite content"):lt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ht(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&ht.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new ht(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ht)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ht(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ht(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ht(t.from,t.to,A.fromJSON(e,t.slice),!!t.structure)}}ht.MAP_BIAS=1,at.jsonID("replace",ht);class ft extends at{constructor(e,t,n,r,o,i,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=a}apply(e){if(this.structure&&(mt(e,this.from,this.gapFrom)||mt(e,this.gapTo,this.to)))return lt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return lt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?lt.fromReplace(e,this.from,this.to,n):lt.fail("Content does not fit in gap")}getMap(){return new rt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ft(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new ft(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ft(t.from,t.to,t.gapFrom,t.gapTo,A.fromJSON(e,t.slice),t.insert,!!t.structure)}}function mt(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;while(o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));while(o>0){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function gt(e,t,n,r){let o,i,a=[],l=[];e.doc.nodesBetween(t,n,(e,s,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(s,t),u=Math.min(s+e.nodeSize,n),p=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=u:a.push(o=new dt(c,u,d[e])));i&&i.to==c?i.to=u:l.push(i=new ct(c,u,r))}}),a.forEach(t=>e.step(t)),l.forEach(t=>e.step(t))}function vt(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,a)=>{if(!e.isInline)return;i++;let l=null;if(r instanceof ke){let t,n=e.marks;while(t=r.isInSet(n))(l||(l=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(l=[r]):l=e.marks;if(l&&l.length){let r=Math.min(a+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,s=l[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&s.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:s,from:Math.max(a,t),to:r,step:i})}}}),o.forEach(t=>e.step(new dt(t.from,t.to,t.style)))}function yt(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),a=[],l=t+1;for(let s=0;s<i.childCount;s++){let t=i.child(s),c=l+t.nodeSize,d=r.matchType(t.type);if(d){r=d;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new dt(l,c,t.marks[r]));if(o&&t.isText&&"pre"!=n.whitespace){let e,r,o=/\r?\n|\r/g;while(e=o.exec(t.text))r||(r=new A(E.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),a.push(new ht(l+e.index,l+e.index+e[0].length,r))}}else a.push(new ht(l,c,A.empty));l=c}if(!r.validEnd){let t=r.fillBefore(E.empty,!0);e.replace(l,l,new A(t,0,0))}for(let s=a.length-1;s>=0;s--)e.step(a[s])}function bt(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function wt(e){let t=e.parent,n=t.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,o=0,i=0;;--r){let t=e.$from.node(r),a=e.$from.index(r)+o,l=e.$to.indexAfter(r)-i;if(r<e.depth&&t.canReplace(a,l,n))return r;if(0==r||t.type.spec.isolating||!bt(t,a,l))break;a&&(o=1),l<t.childCount&&(i=1)}return null}function kt(e,t,n){let{$from:r,$to:o,depth:i}=t,a=r.before(i+1),l=o.after(i+1),s=a,c=l,d=E.empty,u=0;for(let f=i,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,d=E.from(r.node(f).copy(d)),u++):s--;let p=E.empty,h=0;for(let f=i,m=!1;f>n;f--)m||o.after(f+1)<o.end(f)?(m=!0,p=E.from(o.node(f).copy(p)),h++):c++;e.step(new ft(s,c,a,l,new A(d.append(p),u,h),d.size-u,!0))}function xt(e,t,n){let r=E.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let e=n[a].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(n[a].type.create(n[a].attrs,r))}let o=t.start,i=t.end;e.step(new ft(o,i,o,i,new A(r,0,0),n.length,!0))}function St(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let a="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,a)&&Et(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&Tt(e,t,n,i),yt(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let l=e.mapping.slice(i),s=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new ft(s,c,s+1,c-1,new A(E.from(r.create(a,null,t.marks)),0,0),1,!0)),!0===o&&Ct(e,t,n,i),!1}})}function Ct(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let a,l=/\r?\n|\r/g;while(a=l.exec(o.text)){let o=e.mapping.slice(r).map(n+1+i+a.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function Tt(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function Et(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function _t(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let a=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,a);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ft(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new A(E.from(a),0,0),1,!0))}function Mt(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,a=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[d+1];i&&(n=n.replaceChild(0,i.type.create(i.attrs)));let a=r&&r[d]||e;if(!e.canReplace(t+1,e.childCount)||!a.type.validContent(n))return!1}let l=o.indexAfter(i),s=r&&r[0];return o.node(i).canReplaceWith(l,l,s?s.type:o.node(i+1).type)}function Nt(e,t,n=1,r){let o=e.doc.resolve(t),i=E.empty,a=E.empty;for(let l=o.depth,s=o.depth-n,c=n-1;l>s;l--,c--){i=E.from(o.node(l).copy(i));let e=r&&r[c];a=E.from(e?e.type.create(e.attrs,a):o.node(l).copy(a))}e.step(new ht(t,t,new A(i.append(a),n,n),!0))}function It(e,t){let n=e.resolve(t),r=n.index();return At(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rt(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),a=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(a),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function At(e,t){return!(!e||!t||e.isLeaf||!Rt(e,t))}function Bt(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),a=i.node().type;if(o&&a.inlineContent){let e="pre"==a.whitespace,t=!!a.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);Tt(e,r.node(),r.before(),l)}a.inlineContent&&yt(e,t+n-1,a,i.node().contentMatchAt(i.index()),null==r);let s=e.mapping.slice(l),c=s.map(t-n);if(e.step(new ht(c,s.map(t+n,-1),A.empty,!0)),!0===r){let t=e.doc.resolve(c);Ct(e,t.node(),t.before(),e.steps.length)}return e}function Dt(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}function Ft(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),a=r.node(e),l=!1;if(1==i)l=a.canReplace(n,n,o);else{let e=a.contentMatchAt(n).findWrapping(o.firstChild.type);l=e&&a.canReplaceWith(n,n,e[0])}if(l)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function Pt(e,t,n=t,r=A.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ot(o,i,r)?new ht(t,n,r):new Lt(o,i,r).fit()}function Ot(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}at.jsonID("replaceAround",ft);class Lt{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=E.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=E.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){while(this.unplaced.size){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,a=r.depth;while(i&&a&&1==o.childCount)o=o.firstChild.content,i--,a--;let l=new A(o,i,a);return e>-1?new ft(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new ht(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=$t(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let i=this.depth;i>=0;i--){let e,{type:a,match:l}=this.frontier[i],s=null;if(1==t&&(o?l.matchType(o.type)||(s=l.fillBefore(E.from(o),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:i,parent:r,inject:s};if(2==t&&o&&(e=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:i,parent:r,wrap:e};if(r&&l.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=$t(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new A(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=$t(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new A(zt(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new A(zt(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){while(this.depth>t)this.closeFrontierNode();if(o)for(let f=0;f<o.length;f++)this.openFrontierNode(o[f]);let i=this.unplaced,a=n?n.content:i.content,l=i.openStart-e,s=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let p=a.size+e-(i.content.size-i.openEnd);while(s<a.childCount){let e=a.child(s),t=d.matchType(e.type);if(!t)break;s++,(s>1||0==l||e.content.size)&&(d=t,c.push(jt(e.mark(u.allowedMarks(e.marks)),1==s?l:0,s==a.childCount?p:-1)))}let h=s==a.childCount;h||(p=-1),this.placed=Vt(this.placed,t,E.from(c)),this.frontier[t].match=d,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=a;f<p;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=h?0==e?A.empty:new A(zt(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new A(zt(i.content,e,s),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Ht(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);while(n>1&&r==this.$to.end(--n))++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Ht(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Ht(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;while(this.depth>t.depth)this.closeFrontierNode();t.fit.childCount&&(this.placed=Vt(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Vt(this.placed,this.depth,E.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop(),t=e.match.fillBefore(E.empty,!0);t.childCount&&(this.placed=Vt(this.placed,this.frontier.length,t))}}function zt(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(zt(e.firstChild.content,t-1,n)))}function Vt(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Vt(e.lastChild.content,t-1,n)))}function $t(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function jt(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,jt(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(E.empty,!0)))),e.copy(r)}function Ht(e,t,n,r,o){let i=e.node(t),a=o?e.indexAfter(t):e.index(t);if(a==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,a);return l&&!Wt(n,i.content,a)?l:null}function Wt(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function qt(e){return e.spec.defining||e.spec.definingForContent}function Zt(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Ot(o,i,r))return e.step(new ht(t,n,r));let a=Xt(o,i);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let p=o.depth,h=o.pos-1;p>0;p--,h--){let e=o.node(p).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;a.indexOf(p)>-1?l=p:o.before(p)==h&&a.splice(1,0,-p)}let s=a.indexOf(l),c=[],d=r.openStart;for(let p=r.content,h=0;;h++){let e=p.firstChild;if(c.push(e),h==r.openStart)break;p=e.content}for(let p=d-1;p>=0;p--){let e=c[p],t=qt(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(l)-1)))d=p;else if(t||!e.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let t=(p+d+1)%(r.openStart+1),l=c[t];if(l)for(let c=0;c<a.length;c++){let d=a[(c+s)%a.length],u=!0;d<0&&(u=!1,d=-d);let p=o.node(d-1),h=o.index(d-1);if(p.canReplaceWith(h,h,l.type,l.marks))return e.replace(o.before(d),u?i.after(d):n,new A(Ut(r.content,0,r.openStart,t),t,r.openEnd))}}let u=e.steps.length;for(let p=a.length-1;p>=0;p--){if(e.replace(t,n,r),e.steps.length>u)break;let l=a[p];l<0||(t=o.before(l),n=i.after(l))}}function Ut(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Ut(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(E.empty,!0))}return e}function Kt(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=Dt(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new A(E.from(r),0,0))}function Gt(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&0==r.parentOffset&&0==o.parentOffset){let i=r.sharedDepth(n),a=!1;for(let e=r.depth;e>i;e--)r.node(e).type.spec.isolating&&(a=!0);for(let e=o.depth;e>i;e--)o.node(e).type.spec.isolating&&(a=!0);if(!a){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=o.depth;e>0&&n==o.start(e);e--)n=o.before(e);r=e.doc.resolve(t),o=e.doc.resolve(n)}}let i=Xt(r,o);for(let a=0;a<i.length;a++){let t=i[a],n=a==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let a=1;a<=r.depth&&a<=o.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&o.end(a)-n!=o.depth-a&&r.start(a-1)==o.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),o.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Xt(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let r=e.start(o);if(r<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(r==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==r-1)&&n.push(o)}return n}class Yt extends at{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at attribute step's position");let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return lt.fromReplace(e,this.pos,this.pos+1,new A(E.from(r),0,t.isLeaf?0:1))}getMap(){return rt.empty}invert(e){return new Yt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yt(t.pos,t.attr,t.value)}}at.jsonID("attr",Yt);class Jt extends at{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return lt.ok(n)}getMap(){return rt.empty}invert(e){return new Jt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Jt(t.attr,t.value)}}at.jsonID("docAttr",Jt);let Qt=class extends Error{};Qt=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Qt.prototype=Object.create(Error.prototype),Qt.prototype.constructor=Qt,Qt.prototype.name="TransformError";class en{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ot}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Qt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=A.empty){let r=Pt(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new A(E.from(n),0,0))}delete(e,t){return this.replace(e,t,A.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Zt(this,e,t,n),this}replaceRangeWith(e,t,n){return Kt(this,e,t,n),this}deleteRange(e,t){return Gt(this,e,t),this}lift(e,t){return kt(this,e,t),this}join(e,t=1){return Bt(this,e,t),this}wrap(e,t){return xt(this,e,t),this}setBlockType(e,t=e,n,r=null){return St(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return _t(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Yt(e,t,n)),this}setDocAttribute(e,t){return this.step(new Jt(e,t)),this}addNodeMark(e,t){return this.step(new ut(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof I)t.isInSet(n.marks)&&this.step(new pt(e,t));else{let r,o=n.marks,i=[];while(r=t.isInSet(o))i.push(new pt(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return Nt(this,e,t,n),this}addMark(e,t,n){return gt(this,e,t,n),this}removeMark(e,t,n){return vt(this,e,t,n),this}clearIncompatible(e,t,n){return yt(this,e,t,n),this}}const tn=Object.create(null);class nn{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new rn(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=A.empty){let n=t.content.lastChild,r=null;for(let a=0;a<t.openEnd;a++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:s}=i[a],c=e.mapping.slice(o);e.replaceRange(c.map(l.pos),c.map(s.pos),a?A.empty:t),0==a&&fn(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:a}=r[o],l=e.mapping.slice(n),s=l.map(i.pos),c=l.map(a.pos);o?e.deleteRange(s,c):(e.replaceRangeWith(s,c,t),fn(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new ln(e):hn(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?hn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):hn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new un(e.node(0))}static atStart(e){return hn(e,e,0,0,1)||new un(e)}static atEnd(e){return hn(e,e,e.content.size,e.childCount,-1)||new un(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=tn[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in tn)throw new RangeError("Duplicate use of selection JSON ID "+e);return tn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ln.between(this.$anchor,this.$head).getBookmark()}}nn.prototype.visible=!0;class rn{constructor(e,t){this.$from=e,this.$to=t}}let on=!1;function an(e){on||e.parent.inlineContent||(on=!0,console["warn"]("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ln extends nn{constructor(e,t=e){an(e),an(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return nn.near(n);let r=e.resolve(t.map(this.anchor));return new ln(r.parent.inlineContent?r:n,n)}replace(e,t=A.empty){if(super.replace(e,t),t==A.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof ln&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new ln(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=nn.findFrom(t,n,!0)||nn.findFrom(t,-n,!0);if(!e)return nn.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(nn.findFrom(e,-n,!0)||nn.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new ln(e,t)}}nn.jsonID("text",ln);class sn{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sn(e.map(this.anchor),e.map(this.head))}resolve(e){return ln.between(e.resolve(this.anchor),e.resolve(this.head))}}class cn extends nn{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?nn.near(o):new cn(o)}content(){return new A(E.from(this.node),0,0)}eq(e){return e instanceof cn&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new dn(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new cn(e.resolve(t.anchor))}static create(e,t){return new cn(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}cn.prototype.visible=!1,nn.jsonID("node",cn);class dn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new sn(n,n):new dn(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&cn.isSelectable(n)?new cn(t):nn.near(t)}}class un extends nn{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=A.empty){if(t==A.empty){e.delete(0,e.doc.content.size);let t=nn.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new un(e)}map(e){return new un(e)}eq(e){return e instanceof un}getBookmark(){return pn}}nn.jsonID("all",un);const pn={map(){return this},resolve(e){return new un(e)}};function hn(e,t,n,r,o,i=!1){if(t.inlineContent)return ln.create(e,n);for(let a=r-(o>0?0:1);o>0?a<t.childCount:a>=0;a+=o){let r=t.child(a);if(r.isAtom){if(!i&&cn.isSelectable(r))return cn.create(e,n-(o<0?r.nodeSize:0))}else{let t=hn(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function fn(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof ht||o instanceof ft))return;let i,a=e.mapping.maps[r];a.forEach((e,t,n,r)=>{null==i&&(i=r)}),e.setSelection(nn.near(e.doc.resolve(i),n))}const mn=1,gn=2,vn=4;class yn extends en{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|mn)&~gn,this.storedMarks=null,this}get selectionSet(){return(this.updated&mn)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gn,this}ensureMarks(e){return I.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~gn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||I.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(nn.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=vn,this}get scrolledIntoView(){return(this.updated&vn)>0}}function bn(e,t){return t&&e?e.bind(t):e}class wn{constructor(e,t,n){this.name=e,this.init=bn(t.init,n),this.apply=bn(t.apply,n)}}const kn=[new wn("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new wn("selection",{init(e,t){return e.selection||nn.atStart(t.doc)},apply(e){return e.selection}}),new wn("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new wn("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class xn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=kn.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new wn(e.key,e.spec.state,e))})}}class Sn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=r?r[i].n:0,s=r?r[i].state:this,c=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,s,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Sn(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new yn(this)}static create(e){let t=new xn(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Sn(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new xn(this.schema,e.plugins),n=t.fields,r=new Sn(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new xn(e.schema,e.plugins),o=new Sn(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=Y.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=nn.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let a=n[i],l=a.spec.state;if(a.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=l.fromJSON.call(a,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function Cn(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=Cn(o,t,{})),n[r]=o}return n}class Tn{constructor(e){this.spec=e,this.props={},e.props&&Cn(e.props,this,this.props),this.key=e.key?e.key.key:_n("plugin")}getState(e){return e[this.key]}}const En=Object.create(null);function _n(e){return e in En?e+"$"+ ++En[e]:(En[e]=0,e+"$")}class Mn{constructor(e="key"){this.key=_n(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}x(1148),x(5367),x(2731);const Nn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},In=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Rn=null;const An=function(e,t,n){let r=Rn||(Rn=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Bn=function(){Rn=null},Dn=function(e,t,n,r){return n&&(Pn(e,t,n,r,-1)||Pn(e,t,n,r,1))},Fn=/^(img|br|input|textarea|hr)$/i;function Pn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:On(e))){let n=e.parentNode;if(!n||1!=n.nodeType||$n(e)||Fn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Nn(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?On(e):0}}}}function On(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ln(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;e=e.childNodes[t-1],t=On(e)}else{if(!e.parentNode||$n(e))return null;t=Nn(e),e=e.parentNode}}}function zn(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||$n(e))return null;t=Nn(e)+1,e=e.parentNode}}}function Vn(e,t,n){for(let r=0==t,o=t==On(e);r||o;){if(e==n)return!0;let t=Nn(e);if(e=e.parentNode,!e)return!1;r=r&&0==t,o=o&&t==On(e)}}function $n(e){let t;for(let n=e;n;n=n.parentNode)if(t=n.pmViewDesc)break;return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const jn=function(e){return e.focusNode&&Dn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hn(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Wn(e){let t=e.activeElement;while(t&&t.shadowRoot)t=t.shadowRoot.activeElement;return t}function qn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(On(r.offsetNode),r.offset)}}catch(Xs){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(On(r.startContainer),r.startOffset)}}}const Zn="undefined"!=typeof navigator?navigator:null,Un="undefined"!=typeof document?document:null,Kn=Zn&&Zn.userAgent||"",Gn=/Edge\/(\d+)/.exec(Kn),Xn=/MSIE \d/.exec(Kn),Yn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kn),Jn=!!(Xn||Yn||Gn),Qn=Xn?document.documentMode:Yn?+Yn[1]:Gn?+Gn[1]:0,er=!Jn&&/gecko\/(\d+)/i.test(Kn);er&&(/Firefox\/(\d+)/.exec(Kn)||[0,0])[1];const tr=!Jn&&/Chrome\/(\d+)/.exec(Kn),nr=!!tr,rr=tr?+tr[1]:0,or=!Jn&&!!Zn&&/Apple Computer/.test(Zn.vendor),ir=or&&(/Mobile\/\w+/.test(Kn)||!!Zn&&Zn.maxTouchPoints>2),ar=ir||!!Zn&&/Mac/.test(Zn.platform),lr=!!Zn&&/Win/.test(Zn.platform),sr=/Android \d/.test(Kn),cr=!!Un&&"webkitFontSmoothing"in Un.documentElement.style,dr=cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ur(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function pr(e,t){return"number"==typeof e?e:e[t]}function hr(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function fr(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let a=n||e.dom;;){if(!a)break;if(1!=a.nodeType){a=In(a);continue}let e=a,n=e==i.body,l=n?ur(i):hr(e),s=0,c=0;if(t.top<l.top+pr(r,"top")?c=-(l.top-t.top+pr(o,"top")):t.bottom>l.bottom-pr(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+pr(o,"top")-l.top:t.bottom-l.bottom+pr(o,"bottom")),t.left<l.left+pr(r,"left")?s=-(l.left-t.left+pr(o,"left")):t.right>l.right-pr(r,"right")&&(s=t.right-l.right+pr(o,"right")),s||c)if(n)i.defaultView.scrollBy(s,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),s&&(e.scrollLeft+=s);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let d=n?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(d))break;a="absolute"==d?a.offsetParent:In(a)}}function mr(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,a=o+1;a<Math.min(innerHeight,r.bottom);a+=5){let r=e.root.elementFromPoint(i,a);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=o-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:gr(e.dom)}}function gr(e){let t=[],n=e.ownerDocument;for(let r=e;r;r=In(r))if(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e==n)break;return t}function vr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;yr(n,0==r?0:r-t)}function yr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let br=null;function wr(e){if(e.setActive)return e.setActive();if(br)return e.focus(br);let t=gr(e);e.focus(null==br?{get preventScroll(){return br={preventScroll:!0},!0}}:void 0),br||(br=!1,yr(t,0))}function kr(e,t){let n,r,o,i,a=2e8,l=0,s=t.top,c=t.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=An(d).getClientRects()}for(let p=0;p<e.length;p++){let h=e[p];if(h.top<=s&&h.bottom>=c){s=Math.max(h.bottom,s),c=Math.min(h.top,c);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<a){n=d,a=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==d.nodeType&&e&&(l=u+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!o&&h.left<=t.left&&h.right>=t.left&&(o=d,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(l=u+1)}}return!n&&o&&(n=o,r=i,a=0),n&&3==n.nodeType?xr(n,r):!n||a&&1==n.nodeType?{node:e,offset:l}:kr(n,r)}function xr(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=Ir(o,1);if(r.top!=r.bottom&&Sr(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}function Sr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Cr(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Tr(e,t,n){let{node:r,offset:o}=kr(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function Er(e,t,n,r){let o=-1;for(let i=t,a=!1;;){if(i==e.dom)break;let t,n=e.docView.nearestDesc(i,!0);if(!n)return null;if(1==n.dom.nodeType&&(n.node.isBlock&&n.parent||!n.contentDOM)&&((t=n.dom.getBoundingClientRect()).width||t.height)&&(n.node.isBlock&&n.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(n.dom.nodeName)&&(!a&&t.left>r.left||t.top>r.top?o=n.posBefore:(!a&&t.right<r.left||t.bottom<r.top)&&(o=n.posAfter),a=!0),!n.contentDOM&&o<0&&!n.node.isText)){let e=n.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2;return e?n.posBefore:n.posAfter}i=n.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function _r(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Sr(t,o))return _r(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Mr(e,t){let n,r=e.dom.ownerDocument,o=0,i=qn(r,t.left,t.top);i&&({node:n,offset:o}=i);let a,l=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=e.dom.getBoundingClientRect();if(!Sr(t,n))return null;if(l=_r(e.dom,t,n),!l)return null}if(or)for(let c=l;n&&c;c=In(c))c.draggable&&(n=void 0);if(l=Cr(l,t),n){if(er&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;cr&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(a=Er(e,n,o,t))}null==a&&(a=Tr(e,l,t));let s=e.docView.nearestDesc(l,!0);return{pos:a,inside:s?s.posAtStart-s.border:-1}}function Nr(e){return e.top<e.bottom||e.left<e.right}function Ir(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Nr(e))return e}return Array.prototype.find.call(n,Nr)||e.getBoundingClientRect()}const Rr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ar(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),a=cr||er;if(3==r.nodeType){if(!a||!Rr.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Br(Ir(An(r,e,t),i),i<0)}{let e=Ir(An(r,o,o),n);if(er&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Ir(An(r,o-1,o-1),-1);if(t.top==e.top){let n=Ir(An(r,o,o+1),-1);if(n.top!=e.top)return Br(n,n.left<t.left)}}return e}}let l=e.state.doc.resolve(t-(i||0));if(!l.parent.inlineContent){if(null==i&&o&&(n<0||o==On(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Dr(e.getBoundingClientRect(),!1)}if(null==i&&o<On(r)){let e=r.childNodes[o];if(1==e.nodeType)return Dr(e.getBoundingClientRect(),!0)}return Dr(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==On(r))){let e=r.childNodes[o-1],t=3==e.nodeType?An(e,On(e)-(a?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Br(Ir(t,1),!1)}if(null==i&&o<On(r)){let e=r.childNodes[o];while(e.pmViewDesc&&e.pmViewDesc.ignoreForCoords)e=e.nextSibling;let t=e?3==e.nodeType?An(e,0,a?0:1):1==e.nodeType?e:null:null;if(t)return Br(Ir(t,-1),!0)}return Br(Ir(3==r.nodeType?An(r):r,-n),n>=0)}function Br(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Dr(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Fr(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function Pr(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Fr(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ar(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=An(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}const Or=/[\u0590-\u08ac]/;function Lr(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,a=o==r.parent.content.size,l=e.domSelection();return l?Or.test(r.parent.textContent)&&l.modify?Fr(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:a}=e.domSelectionRange(),s=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),p=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&o==u;try{l.collapse(i,a),t&&(t!=i||o!=a)&&l.extend&&l.extend(t,o)}catch(Xs){}return null!=s&&(l.caretBidiLevel=s),p}):"left"==n||"backward"==n?i:a:r.pos==r.start()||r.pos==r.end()}let zr=null,Vr=null,$r=!1;function jr(e,t,n){return zr==t&&Vr==n?$r:(zr=t,Vr=n,$r="up"==n||"down"==n?Pr(e,t,n):Lr(e,t,n))}const Hr=0,Wr=1,qr=2,Zr=3;class Ur{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Hr,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{while(e.parentNode!=this.contentDOM)e=e.parentNode;n=e.previousSibling}while(n&&(!(r=n.pmViewDesc)||r.parent!=this))n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{while(e.parentNode!=this.contentDOM)e=e.parentNode;n=e.nextSibling}while(n&&(!(r=n.pmViewDesc)||r.parent!=this))n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Nn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){while(!r.border&&r.children.length)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let t=this.children[n],i=o+t.size;if(i>e||t instanceof eo){r=e-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Kr&&o.side>=0;n--);if(t<=0){let e,r=!0;for(;;n--,r=!1)if(e=n?this.children[n-1]:null,!e||e.dom.parentNode==this.contentDOM)break;return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Nn(e.dom)+1:0}}{let e,r=!0;for(;;n++,r=!1)if(e=n<this.children.length?this.children[n]:null,!e||e.dom.parentNode==this.contentDOM)break;return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Nn(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,a=0;;a++){let n=this.children[a],l=i+n.size;if(-1==r&&e<=l){let o=i+n.border;if(e>=o&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=a;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Nn(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(let e=a+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Nn(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let p=0,h=0;p<this.children.length;p++){let a=this.children[p],l=h+a.size;if(o>h&&i<l)return a.setSelection(e-h-a.border,t-h-a.border,n,r);h=l}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),s=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((er||or)&&e==t){let{node:e,offset:t}=a;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(a=l={node:n.parentNode,offset:Nn(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(er&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&or)&&Dn(a.node,a.offset,c.anchorNode,c.anchorOffset)&&Dn(l.node,l.offset,c.focusNode,c.focusOffset))return;let u=!1;if((s.extend||e==t)&&(!d||!er)){s.collapse(a.node,a.offset);try{e!=t&&s.extend(l.node,l.offset),u=!0}catch(Xs){}}if(!u){if(e>t){let e=a;a=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),s.removeAllRanges(),s.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,a=i-o.border;if(e>=r&&t<=a)return this.dirty=e==n||t==i?qr:Wr,void(e!=r||t!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=Zr);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?Zr:qr}n=i}this.dirty=qr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?qr:Wr;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Kr extends Ur{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==Hr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Gr extends Ur{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Xr extends Ur{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Ve.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Xr(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&Zr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Zr&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Hr){let e=this.parent;while(!e.node)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Hr}}slice(e,t,n){let r=Xr.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=yo(o,t,i,n)),e>0&&(o=yo(o,0,e,n));for(let a=0;a<o.length;a++)o[a].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Yr extends Ur{constructor(e,t,n,r,o,i,a,l,s){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=a}static create(e,t,n,r,o,i){let a,l=o.nodeViews[t.type.name],s=l&&l(t,o,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:i,n,r),c=s&&s.dom,d=s&&s.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Ve.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=so(c,n,t),s?a=new to(e,t,n,r,c,d||null,u,s,o,i+1):t.isText?new Qr(e,t,n,r,c,u,o):new Yr(e,t,n,r,c,d||null,u,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>E.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return this.dirty==Hr&&e.eq(this.node)&&co(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new po(this,i&&i.node,e);mo(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&l.syncToMarks(o==this.node.childCount?I.none:this.node.child(o).marks,n,e,o),l.placeWidget(t,e,r)},(t,i,s,c)=>{let d;l.syncToMarks(t.marks,n,e,c),l.findNodeMatch(t,i,s,c)||a&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(t,i,s,d,e)||l.updateNextNode(t,i,s,e,c,r)||l.addNode(t,i,s,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==qr)&&(i&&this.protectLocalComposition(e,i),no(this.contentDOM,this.children,e),ir&&go(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof ln)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=vo(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;;o=o.parentNode){if(o.parentNode==this.contentDOM)break;while(o.previousSibling)o.parentNode.removeChild(o.previousSibling);while(o.nextSibling)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Gr(this,o,t,r);e.input.compositionNodes.push(i),this.children=yo(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(this.dirty==Zr||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Hr}updateOuterDeco(e){if(co(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ao(this.dom,this.nodeDOM,io(this.outerDeco,this.node,t),io(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Jr(e,t,n,r,o){so(r,t,e);let i=new Yr(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Qr extends Yr{constructor(e,t,n,r,o,i,a){super(e,t,n,r,o,null,i,a,0)}parseRule(){let e=this.nodeDOM.parentNode;while(e&&e!=this.dom&&!e.pmIsDeco)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(this.dirty==Zr||this.dirty!=Hr&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),this.dirty==Hr&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Hr,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Qr(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=Zr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class eo extends Ur{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Hr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class to extends Yr{constructor(e,t,n,r,o,i,a,l,s,c){super(e,t,n,r,o,i,a,s,c),this.spec=l}update(e,t,n,r){if(this.dirty==Zr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function no(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let a=t[i],l=a.dom;if(l.parentNode==e){while(l!=r)r=uo(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(a instanceof Xr){let t=r?r.previousSibling:e.lastChild;no(a.contentDOM,a.children,n),r=t?t.nextSibling:e.firstChild}}while(r)r=uo(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const ro=function(e){e&&(this.nodeName=e)};ro.prototype=Object.create(null);const oo=[new ro];function io(e,t,n){if(0==e.length)return oo;let r=n?oo[0]:new ro,o=[r];for(let i=0;i<e.length;i++){let a=e[i].type.attrs;if(a){a.nodeName&&o.push(r=new ro(a.nodeName));for(let e in a){let i=a[e];null!=i&&(n&&1==o.length&&o.push(r=new ro(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ao(e,t,n,r){if(n==oo&&r==oo)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],a=n[i];if(i){let n;a&&a.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(o),a=oo[0]),o=n}lo(o,a||oo[0],t)}return o}function lo(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;while(n=r.exec(t.style))e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function so(e,t,n){return ao(e,e,oo,io(t,n,1!=e.nodeType))}function co(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function uo(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class po{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ho(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,a=Math.min(i,e.length);while(o<a&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning)o++;while(o<i)this.destroyRest(),this.top.dirty=Hr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;while(i<e.length){this.stack.push(this.top,this.index+1);let o=-1,a=this.top.children.length;r<this.preMatch.index&&(a=Math.min(this.index+3,a));for(let t=this.index;t<a;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=Xr.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let r=this.top.children[a];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=a;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return i.dirty==Zr&&i.dom==i.contentDOM&&(i.dirty=qr),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Yr){let s=this.preMatch.matched.get(l);if(null!=s&&s!=o)return!1;let c,d=l.dom,u=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Zr&&co(t,l.outerDeco));if(!u&&l.update(e,t,n,r))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(l,e,t,n,r,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=qr,c.updateChildren(r,i+1),c.dirty=Hr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!co(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let a=Yr.create(this.top,t,n,r,o,i);if(a.contentDOM){a.children=e.children,e.children=[];for(let e of a.children)e.parent=a}return e.destroy(),a}addNode(e,t,n,r,o){let i=Yr.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Kr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;while(e instanceof Xr)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Qr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((or||nr)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new eo(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function ho(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,a=[];e:while(o>0){let l;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Xr)){l=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let s=l.node;if(s){if(s!=e.child(o-1))break;--o,i.set(l,o),a.push(l)}}return{index:o,matched:i,matches:a.reverse()}}function fo(e,t){return e.type.side-t.type.side}function mo(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let a=e.child(n);r(a,o,t.forChild(i,a),n),i+=a.nodeSize}return}let a=0,l=[],s=null;for(let c=0;;){let d,u,p,h;while(a<o.length&&o[a].to==i){let e=o[a++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(fo);for(let e=0;e<u.length;e++)n(u[e],c,!!s)}else n(d,c,!!s);if(s)h=-1,p=s,s=null;else{if(!(c<e.childCount))break;h=c,p=e.child(c++)}for(let e=0;e<l.length;e++)l[e].to<=i&&l.splice(e--,1);while(a<o.length&&o[a].from<=i&&o[a].to>i)l.push(o[a++]);let f=i+p.nodeSize;if(p.isText){let e=f;a<o.length&&o[a].from<e&&(e=o[a].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(s=p.cut(e-i),p=p.cut(0,e-i),f=e,h=-1)}else while(a<o.length&&o[a].to<f)a++;let m=p.isInline&&!p.isLeaf?l.filter(e=>!e.inline):l.slice();r(p,m,t.forChild(i,p),h),i=f}}function go(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function vo(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let a=e.child(o++),l=i;if(i+=a.nodeSize,!a.isText)continue;let s=a.text;while(o<e.childCount){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;s+=t.text}if(i>=n){if(i>=r&&s.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?s.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&s.length>=r+t.length-l&&s.slice(r-l,r-l+t.length)==t)return r}}return-1}function yo(e,t,n,r,o){let i=[];for(let a=0,l=0;a<e.length;a++){let s=e[a],c=l,d=l+=s.size;c>=n||d<=t?i.push(s):(c<t&&i.push(s.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(s.slice(n-c,s.size,r)))}return i}function bo(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let l,s,c=r.resolve(a);if(jn(n)){l=a;while(o&&!o.node)o=o.parent;let e=o.node;if(o&&e.isAtom&&cn.isSelectable(e)&&o.parent&&(!e.isInline||!Vn(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;s=new cn(a==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=a,o=a;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[l,a]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(a)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!s){let n="pointer"==t||e.state.selection.head<c.pos&&!i?1:-1;s=Io(e,d,c,n)}return s}function wo(e){return e.editable?e.hasFocus():Ao(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ko(e,t=!1){let n=e.state.selection;if(Mo(e,n),wo(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&nr){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Dn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)_o(e);else{let r,o,{anchor:i,head:a}=n;!xo||n instanceof ln||(n.$from.parent.inlineContent||(r=So(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=So(e,n.to))),e.docView.setSelection(i,a,e,t),xo&&(r&&To(r),o&&To(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Eo(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const xo=or||nr&&rr<63;function So(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(or&&o&&"false"==o.contentEditable)return Co(o);if((!o||"false"==o.contentEditable)&&(!i||"false"==i.contentEditable)){if(o)return Co(o);if(i)return Co(i)}}function Co(e){return e.contentEditable="true",or&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function To(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Eo(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{wo(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}function _o(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Nn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Jn&&Qn<=11&&(n.disabled=!0,n.disabled=!1)}function Mo(e,t){if(t instanceof cn){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(No(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else No(e)}function No(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Io(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||ln.between(t,n,r)}function Ro(e){return!(e.editable&&!e.hasFocus())&&Ao(e)}function Ao(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(Xs){return!1}}function Bo(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Dn(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Do(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&nn.findFrom(i,t)}function Fo(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Po(e,t,n){let r=e.state.selection;if(!(r instanceof ln)){if(r instanceof cn&&r.node.isInline)return Fo(e,new ln(t>0?r.$to:r.$from));{let n=Do(e.state,t);return!!n&&Fo(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return Fo(e,new ln(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Do(e.state,t);return!!(n&&n instanceof cn)&&Fo(e,n)}if(!(ar&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(a))&&!n.contentDOM)&&(cn.isSelectable(i)?Fo(e,new cn(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!cr&&Fo(e,new ln(e.state.doc.resolve(t<0?a:a+i.nodeSize))))}}function Oo(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Lo(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function zo(e,t){return t<0?Vo(e):$o(e)}function Vo(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=!1;for(er&&1==n.nodeType&&r<Oo(n)&&Lo(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Lo(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(jo(n))break;{let t=n.previousSibling;while(t&&Lo(t,-1))o=n.parentNode,i=Nn(t),t=t.previousSibling;if(t)n=t,r=Oo(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?qo(e,n,r):o&&qo(e,o,i)}function $o(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,a=Oo(n);for(;;)if(r<a){if(1!=n.nodeType)break;let e=n.childNodes[r];if(!Lo(e,1))break;o=n,i=++r}else{if(jo(n))break;{let t=n.nextSibling;while(t&&Lo(t,1))o=t.parentNode,i=Nn(t)+1,t=t.nextSibling;if(t)n=t,r=0,a=Oo(n);else{if(n=n.parentNode,n==e.dom)break;r=a=0}}}o&&qo(e,o,i)}function jo(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ho(e,t){while(e&&t==e.childNodes.length&&!$n(e))t=Nn(e)+1,e=e.parentNode;while(e&&t<e.childNodes.length){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}function Wo(e,t){while(e&&!t&&!$n(e))t=Nn(e),e=e.parentNode;while(e&&t){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=e.childNodes.length}}function qo(e,t,n){if(3!=t.nodeType){let e,r;(r=Ho(t,n))?(t=r,n=0):(e=Wo(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(jn(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ko(e)},50)}function Zo(e,t){let n=e.state.doc.resolve(t);if(!nr&&!lr&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}let r=getComputedStyle(e.dom).direction;return"rtl"==r?"rtl":"ltr"}function Uo(e,t,n){let r=e.state.selection;if(r instanceof ln&&!r.empty||n.indexOf("s")>-1)return!1;if(ar&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Do(e.state,t);if(n&&n instanceof cn)return Fo(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,a=r instanceof un?nn.near(n,t):nn.findFrom(n,t);return!!a&&Fo(e,a)}return!1}function Ko(e,t){if(!(e.state.selection instanceof ln))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Go(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Xo(e){if(!or||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Go(e,n,"true"),setTimeout(()=>Go(e,n,"false"),20)}return!1}function Yo(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function Jo(e,t){let n=t.keyCode,r=Yo(t);if(8==n||ar&&72==n&&"c"==r)return Ko(e,-1)||zo(e,-1);if(46==n&&!t.shiftKey||ar&&68==n&&"c"==r)return Ko(e,1)||zo(e,1);if(13==n||27==n)return!0;if(37==n||ar&&66==n&&"c"==r){let t=37==n?"ltr"==Zo(e,e.state.selection.from)?-1:1:-1;return Po(e,t,r)||zo(e,t)}if(39==n||ar&&70==n&&"c"==r){let t=39==n?"ltr"==Zo(e,e.state.selection.from)?1:-1:1;return Po(e,t,r)||zo(e,t)}return 38==n||ar&&80==n&&"c"==r?Uo(e,-1,r)||zo(e,-1):40==n||ar&&78==n&&"c"==r?Xo(e)||Uo(e,1,r)||zo(e,1):r==(ar?"m":"c")&&(66==n||73==n||89==n||90==n)}function Qo(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;while(o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let a=e.someProp("clipboardSerializer")||Ve.fromSchema(e.state.schema),l=di(),s=l.createElement("div");s.appendChild(a.serializeFragment(r,{document:l}));let c,d=s.firstChild,u=0;while(d&&1==d.nodeType&&(c=si[d.nodeName.toLowerCase()])){for(let e=c.length-1;e>=0;e--){let t=l.createElement(c[e]);while(s.firstChild)t.appendChild(s.firstChild);s.appendChild(t),u++}d=s.firstChild}d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`);let p=e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n");return{dom:s,text:p,slice:t}}function ei(e,t,n,r,o){let i,a,l=o.parent.type.spec.code;if(!n&&!t)return null;let s=!!t&&(r||l||!n);if(s){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return a=new A(E.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{a=t(a,e,!0)}),a;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)a=n;else{let n=o.marks(),{schema:r}=e.state,a=Ve.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=hi(n),cr&&fi(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let e=i.firstChild;while(e&&1!=e.nodeType)e=e.nextSibling;if(!e)break;i=e}if(!a){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Ee.fromSchema(e.state.schema);a=t.parseSlice(i,{preserveWhitespace:!(!s&&!d),context:o,ruleFromNode(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ti.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(d)a=mi(li(a,+d[1],+d[2]),d[4]);else if(a=A.maxOpen(ni(a.content,o),!0),a.openStart||a.openEnd){let e=0,t=0;for(let n=a.content.firstChild;e<a.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=a.content.lastChild;t<a.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);a=li(a,e,t)}return e.someProp("transformPasted",t=>{a=t(a,e,s)}),a}const ti=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ni(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n),i=o.contentMatchAt(t.index(n)),a=[];if(e.forEach(e=>{if(!a)return;let t,n=i.findWrapping(e.type);if(!n)return a=null;if(t=a.length&&r.length&&oi(n,r,e,a[a.length-1],0))a[a.length-1]=t;else{a.length&&(a[a.length-1]=ii(a[a.length-1],r.length));let t=ri(e,n);a.push(t),i=i.matchType(t.type),r=n}}),a)return E.from(a)}return e}function ri(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,E.from(e));return e}function oi(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=oi(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));let a=r.contentMatchAt(r.childCount);if(a.matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(E.from(ri(n,e,o+1))))}}function ii(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,ii(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(E.empty,!0);return e.copy(n.append(r))}function ai(e,t,n,r,o,i){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(i=0),o<r-1&&(l=ai(l,t,n,r,o+1,i)),o>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(E.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function li(e,t,n){return t<e.openStart&&(e=new A(ai(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new A(ai(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const si={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let ci=null;function di(){return ci||(ci=document.implementation.createHTMLDocument("title"))}let ui=null;function pi(e){let t=window.trustedTypes;return t?(ui||(ui=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),ui.createHTML(e)):e}function hi(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=di().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&si[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=pi(e),n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}function fi(e){let t=e.querySelectorAll(nr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function mi(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(Us){return e}let{content:o,openStart:i,openEnd:a}=e;for(let l=n.length-2;l>=0;l-=2){let e=r.nodes[n[l]];if(!e||e.hasRequiredAttrs())break;o=E.from(e.create(n[l+1],o)),i++,a++}return new A(o,i,a)}const gi={},vi={},yi={touchstart:!0,touchmove:!0};class bi{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function wi(e){for(let t in gi){let n=gi[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Ti(e,t)||Ci(e,t)||!e.editable&&t.type in vi||n(e,t)},yi[t]?{passive:!0}:void 0)}or&&e.dom.addEventListener("input",()=>null),Si(e)}function ki(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function xi(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Si(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Ci(e,t))})}function Ci(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Ti(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ei(e,t){Ci(e,t)||!gi[t.type]||!e.editable&&t.type in vi||gi[t.type](e,t)}function _i(e){return{left:e.clientX,top:e.clientY}}function Mi(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Ni(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let a=i.depth+1;a>0;a--)if(e.someProp(t,t=>a>i.depth?t(e,n,i.nodeAfter,i.before(a),o,!0):t(e,n,i.node(a),i.before(a),o,!1)))return!0;return!1}function Ii(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Ri(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&cn.isSelectable(r))&&(Ii(e,new cn(n),"pointer"),!0)}function Ai(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof cn&&(n=o.node);let i=e.state.doc.resolve(t);for(let a=i.depth+1;a>0;a--){let e=a>i.depth?i.nodeAfter:i.node(a);if(cn.isSelectable(e)){r=n&&o.$from.depth>0&&a>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(a);break}}return null!=r&&(Ii(e,cn.create(e.state.doc,r),"pointer"),!0)}function Bi(e,t,n,r,o){return Ni(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?Ai(e,n):Ri(e,n))}function Di(e,t,n,r){return Ni(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function Fi(e,t,n,r){return Ni(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||Pi(e,n,r)}function Pi(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Ii(e,ln.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let t=i>o.depth?o.nodeAfter:o.node(i),n=o.before(i);if(t.inlineContent)Ii(e,ln.create(r,n+1,n+1+t.content.size),"pointer");else{if(!cn.isSelectable(t))continue;Ii(e,cn.create(r,n),"pointer")}return!0}}function Oi(e){return Ui(e)}vi.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Vi(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!sr||!nr||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!ir||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Jo(e,n)?n.preventDefault():ki(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Hn(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},vi.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},vi.keypress=(e,t)=>{let n=t;if(Vi(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||ar&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof ln)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const Li=ar?"metaKey":"ctrlKey";gi.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Oi(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&Mi(n,e.input.lastClick)&&!n[Li]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let a=e.posAtCoords(_i(n));a&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zi(e,a,n,!!r)):("doubleClick"==i?Di:Fi)(e,a.pos,a.inside,n)?n.preventDefault():ki(e,"pointer"))};class zi{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Li],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const a=r?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:s}=e.state;0==n.button&&(o.type.spec.draggable&&!1!==o.type.spec.selectable||s instanceof cn&&s.from<=i&&s.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!er||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ki(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ko(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(_i(e))),this.updateAllowDefault(e),this.allowDefault||!t?ki(this.view,"pointer"):Bi(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||or&&this.mightDrag&&!this.mightDrag.node.isAtom||nr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ii(this.view,nn.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):ki(this.view,"pointer")}move(e){this.updateAllowDefault(e),ki(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Vi(e,t){return!!e.composing||!!(or&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}gi.touchstart=e=>{e.input.lastTouch=Date.now(),Oi(e),ki(e,"pointer")},gi.touchmove=e=>{e.input.lastTouch=Date.now(),ki(e,"pointer")},gi.contextmenu=e=>Oi(e);const $i=sr?5e3:-1;function ji(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}function Hi(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ui(e),t))}function Wi(e){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Zi());while(e.input.compositionNodes.length>0)e.input.compositionNodes.pop().markParentsDirty()}function qi(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Ln(t.focusNode,t.focusOffset),r=zn(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function Zi(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Ui(e,t=!1){if(!(sr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Wi(e),t||e.docView&&e.docView.dirty){let n=bo(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}function Ki(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}vi.compositionstart=vi.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ln&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||nr&&lr&&ji(e)))e.markCursor=e.state.storedMarks||n.marks(),Ui(e,!0),e.markCursor=null;else if(Ui(e,!t.selection.empty),er&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Hi(e,$i)},vi.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Hi(e,20))};const Gi=Jn&&Qn<15||ir&&dr<604;function Xi(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}function Yi(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ji(e,r.value,null,o,t):Ji(e,r.textContent,r.innerHTML,o,t)},50)}function Ji(e,t,n,r,o){let i=ei(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||A.empty)))return!0;if(!i)return!1;let a=Xi(i),l=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qi(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}gi.copy=vi.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Gi?null:n.clipboardData,a=r.content(),{dom:l,text:s}=Qo(e,a);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",s)):Ki(e,l),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},vi.paste=(e,t)=>{let n=t;if(e.composing&&!sr)return;let r=Gi?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Ji(e,Qi(r),r.getData("text/html"),o,n)?n.preventDefault():Yi(e,n)};class ea{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const ta=ar?"altKey":"ctrlKey";function na(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[ta]}function ra(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(_i(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=ei(e,Qi(t.dataTransfer),Gi?null:t.dataTransfer.getData("text/html"),!1,o);let a=!(!n||!na(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||A.empty,a)))return void t.preventDefault();if(!i)return;t.preventDefault();let l=i?Ft(e.state.doc,o.pos,i):o.pos;null==l&&(l=o.pos);let s=e.state.tr;if(a){let{node:e}=n;e?e.replace(s):s.deleteSelection()}let c=s.mapping.map(l),d=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=s.doc;if(d?s.replaceRangeWith(c,c,i.content.firstChild):s.replaceRange(c,c,i),s.doc.eq(u))return;let p=s.doc.resolve(c);if(d&&cn.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))s.setSelection(new cn(p));else{let t=s.mapping.map(l);s.mapping.maps[s.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),s.setSelection(Io(e,p,s.doc.resolve(t)))}e.focus(),e.dispatch(s.setMeta("uiEvent","drop"))}gi.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,a=i.empty?null:e.posAtCoords(_i(n));if(a&&a.pos>=i.from&&a.pos<=(i instanceof cn?i.to-1:i.to));else if(r&&r.mightDrag)o=cn.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=cn.create(e.state.doc,t.posBefore))}let l=(o||e.state.selection).content(),{dom:s,text:c,slice:d}=Qo(e,l);(!n.dataTransfer.files.length||!nr||rr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Gi?"Text":"text/html",s.innerHTML),n.dataTransfer.effectAllowed="copyMove",Gi||n.dataTransfer.setData("text/plain",c),e.dragging=new ea(d,na(e,n),o)},gi.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},vi.dragover=vi.dragenter=(e,t)=>t.preventDefault(),vi.drop=(e,t)=>{try{ra(e,t,e.dragging)}finally{e.dragging=null}},gi.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ko(e)},20))},gi.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},gi.beforeinput=(e,t)=>{let n=t;if(nr&&sr&&"deleteContentBackward"==n.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Hn(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let x in vi)gi[x]=vi[x];function oa(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class ia{constructor(e,t){this.toDOM=e,this.spec=t||da,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new sa(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ia&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&oa(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class aa{constructor(e,t){this.attrs=e,this.spec=t||da}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new sa(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof aa&&oa(this.attrs,e.attrs)&&oa(this.spec,e.spec)}static is(e){return e.type instanceof aa}destroy(){}}class la{constructor(e,t){this.attrs=e,this.spec=t||da}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new sa(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof la&&oa(this.attrs,e.attrs)&&oa(this.spec,e.spec)}destroy(){}}class sa{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new sa(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new sa(e,e,new ia(t,n))}static inline(e,t,n,r){return new sa(e,t,new aa(n,r))}static node(e,t,n,r){return new sa(e,t,new la(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof aa}get widget(){return this.type instanceof ia}}const ca=[],da={};class ua{constructor(e,t){this.local=e.length?e:ca,this.children=t.length?t:ca}static create(e,t){return t.length?ba(t,e,0,da):pa}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,t-a,n,r+a,o)}}map(e,t,n){return this==pa||0==e.maps.length?this:this.mapInner(e,t,0,0,n||da)}mapInner(e,t,n,r,o){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,r);l&&l.type.valid(t,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?fa(this.children,i||[],e,t,n,r,o):i?new ua(i.sort(wa),ca):pa}add(e,t){return t.length?this==pa?ua.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let a,l=i+n;if(a=va(t,e,l)){r||(r=this.children.slice());while(o<r.length&&r[o]<i)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,a,l+1):r.splice(o,0,i,i+e.nodeSize,ba(a,e,l+1,da)),o+=3}});let i=ma(o?ya(t):t,-n);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new ua(i.length?this.local.concat(i).sort(wa):this.local,r||this.children)}remove(e){return 0==e.length||this==pa?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,a=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<a&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let l=n[o+2].removeInner(r,i+1);l!=pa?n[o+2]=l:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ua(r,n):pa}forChild(e,t){if(this==pa)return this;if(t.isLeaf)return ua.empty;let n,r;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let o=e+1,i=o+t.content.size;for(let a=0;a<this.local.length;a++){let e=this.local[a];if(e.from<i&&e.to>o&&e.type instanceof aa){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new ua(r.sort(wa),ca);return n?new ha([e,n]):e}return n||pa}eq(e){if(this==e)return!0;if(!(e instanceof ua)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ka(this.localsInner(e))}localsInner(e){if(this==pa)return ca;if(e.inlineContent||!this.local.some(aa.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof aa||t.push(this.local[n]);return t}forEachSet(e){e(this)}}ua.empty=new ua([],[]),ua.removeOverlap=ka;const pa=ua.empty;class ha{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,da));return ha.from(n)}forChild(e,t){if(t.isLeaf)return ua.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=pa&&(o instanceof ha?n=n.concat(o.members):n.push(o))}return ha.from(n)}eq(e){if(!(e instanceof ha)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?ka(n?t:t.sort(wa)):ca}static from(e){switch(e.length){case 0:return pa;case 1:return e[0];default:return new ha(e.every(e=>e instanceof ua)?e:e.reduce((e,t)=>e.concat(t instanceof ua?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function fa(e,t,n,r,o,i,a){let l=e.slice();for(let c=0,d=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,o)=>{let i=o-r-(n-t);for(let a=0;a<l.length;a+=3){let r=l[a+1];if(r<0||t>r+d-e)continue;let o=l[a]+d-e;n>=o?l[a+1]=t<=o?-2:-1:t>=d&&i&&(l[a]+=i,l[a+1]+=i)}e+=i}),d=n.maps[c].map(d,-1)}let s=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(-2==l[c+1]){s=!0,l[c+1]=-1;continue}let t=n.map(e[c]+i),d=t-o;if(d<0||d>=r.content.size){s=!0;continue}let u=n.map(e[c+1]+i,-1),p=u-o,{index:h,offset:f}=r.content.findIndex(d),m=r.maybeChild(h);if(m&&f==d&&f+m.nodeSize==p){let r=l[c+2].mapInner(n,m,t+1,e[c]+i+1,a);r!=pa?(l[c]=d,l[c+1]=p,l[c+2]=r):(l[c+1]=-2,s=!0)}else s=!0}if(s){let s=ga(l,e,t,n,o,i,a),c=ba(s,r,0,a);t=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];while(t<l.length&&l[t]<n)t+=3;l.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new ua(t.sort(wa),l)}function ma(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new sa(o.from+t,o.to+t,o.type))}return n}function ga(e,t,n,r,o,i,a){function l(e,t){for(let i=0;i<e.local.length;i++){let l=e.local[i].map(r,o,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)l(e.children[n+2],e.children[n]+t+1)}for(let s=0;s<e.length;s+=3)-1==e[s+1]&&l(e[s+2],t[s]+i+1);return n}function va(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,a=0;a<e.length;a++)(i=e[a])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[a]=null);return o}function ya(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ba(e,t,n,r){let o=[],i=!1;t.forEach((t,a)=>{let l=va(e,t,a+n);if(l){i=!0;let e=ba(l,t,n+a+1,r);e!=pa&&o.push(a,a+t.nodeSize,e)}});let a=ma(i?ya(e):e,-n).sort(wa);for(let l=0;l<a.length;l++)a[l].type.valid(t,a[l])||(r.onRemove&&r.onRemove(a[l].spec),a.splice(l--,1));return a.length||o.length?new ua(a,o):pa}function wa(e,t){return e.from-t.from||e.to-t.to}function ka(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),xa(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),xa(t,o+1,i.copy(r.to,i.to)))}}return t}function xa(e,t,n){while(t<e.length&&wa(n,e[t])>0)t++;e.splice(t,0,n)}function Sa(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=pa&&t.push(r)}),e.cursorWrapper&&t.push(ua.create(e.state.doc,[e.cursorWrapper.deco])),ha.from(t)}const Ca={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ta=Jn&&Qn<=11;class Ea{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _a{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ea,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Jn&&Qn<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():or&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ta&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ca)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ro(this.view)){if(this.suppressingSelectionUpdates)return ko(this.view);if(Jn&&Qn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Dn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=In(o))n.add(o);for(let o=e.anchorNode;o;o=In(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Ro(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,a=!1,l=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],l);e&&(o=o<0?e.from:Math.min(e.from,o),i=i<0?e.to:Math.max(e.to,i),e.typeOver&&(a=!0))}if(!l.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(er&&l.length){let t=l.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Ba(e,n)==t||r.remove()}}}}else for(let c of l)if("BR"==c.nodeName&&c.parentNode){let e=c.nextSibling;while(e&&1==e.nodeType){if("false"==e.contentEditable){c.parentNode.removeChild(c);break}e=e.firstChild}}let s=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&jn(n)&&(s=bo(e))&&s.eq(nn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ko(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),Ia(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Da(e,l)),this.handleDOMChange(o,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ko(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(Jn&&Qn<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Nn(r)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?Nn(o):e.target.childNodes.length,s=n.localPosFromDOM(e.target,l,1);return{from:a,to:s}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ma=new WeakMap,Na=!1;function Ia(e){if(!Ma.has(e)&&(Ma.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=er,Na)return;console["warn"]("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Na=!0}}function Ra(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return Dn(a.node,a.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Aa(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ra(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Ra(e,n):null}function Ba(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Da(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;while(t&&"TD"!=t.nodeName&&"TH"!=t.nodeName)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function Fa(e,t,n){let r,{node:o,fromOffset:i,toOffset:a,from:l,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],jn(c)||r.push({node:c.focusNode,offset:c.focusOffset})),nr&&8===e.input.lastKeyCode)for(let g=a;g>i;g--){let e=o.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){a=g;break}if(!t||t.size)break}let u=e.state.doc,p=e.someProp("domParser")||Ee.fromSchema(e.state.schema),h=u.resolve(l),f=null,m=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:a,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Pa,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+l,head:t+l}}return{doc:m,sel:f,from:l,to:s}}function Pa(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(or&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||or&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Oa=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function La(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=bo(e,t);if(n&&!e.state.selection.eq(n)){if(nr&&sr&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Hn(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let a=e.state.doc.resolve(t),l=a.sharedDepth(n);t=a.before(l+1),n=e.state.doc.resolve(n).after(l+1);let s,c,d=e.state.selection,u=Fa(e,t,n),p=e.state.doc,h=p.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,c="end"):(s=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=Ha(h.content,u.doc.content,u.from,s,c);if(f&&e.input.domChangeCount++,(ir&&e.input.lastIOSEnter>Date.now()-225||sr)&&o.some(e=>1==e.nodeType&&!Oa.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Hn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&d instanceof ln&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=za(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof ln&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),Jn&&Qn<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&" "==u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),v=p.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=f.endA;if((ir&&e.input.lastIOSEnter>Date.now()-225&&(!y||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Hn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&$a(p,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Hn(8,"Backspace"))))return void(sr&&nr&&e.domObserver.suppressSelectionUpdates());nr&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),sr&&!y&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Hn(13,"Enter"))})},20));let b,w=f.start,k=f.endA,x=t=>{let n=t||e.state.tr.replace(w,k,u.doc.slice(f.start-u.from,f.endB-u.from));if(u.sel){let t=za(e,n.doc,u.sel);t&&!(nr&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(k)-1)||Jn&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(y)if(m.pos==g.pos){Jn&&Qn<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ko(e),20));let t=x(e.state.tr.delete(w,k)),n=p.resolve(f.start).marksAcross(p.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(b=Va(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=x(e.state.tr);"add"==b.type?t.addMark(w,k,b.mark):t.removeMark(w,k,b.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,w,k));e.someProp("handleTextInput",r=>r(e,w,k,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function za(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Io(e,t.resolve(n.anchor),t.resolve(n.head))}function Va(e,t){let n,r,o,i=e.firstChild.marks,a=t.firstChild.marks,l=i,s=a;for(let d=0;d<a.length;d++)l=a[d].removeFromSet(l);for(let d=0;d<i.length;d++)s=i[d].removeFromSet(s);if(1==l.length&&0==s.length)r=l[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=l.length||1!=s.length)return null;r=s[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let d=0;d<t.childCount;d++)c.push(o(t.child(d)));if(E.from(c).eq(e))return{mark:r,type:n}}function $a(e,t,n,r,o){if(n-t<=o.pos-r.pos||ja(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let a=e.resolve(ja(i,!0,!0));return!(!a.parent.isTextblock||a.pos>n||ja(a,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function ja(e,t,n){let r=e.depth,o=t?e.end():e.pos;while(r>0&&(t||e.indexAfter(r)==e.node(r).childCount))r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));while(t&&!t.isLeaf)t=t.firstChild,o++}return o}function Ha(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:a,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){let e=Math.max(0,i-Math.min(a,l));r-=a+e-i}if(a<i&&e.size<t.size){let e=r<=i&&r>=a?i-r:0;i-=e,i&&i<t.size&&Wa(t.textBetween(i-1,i+1))&&(i+=e?1:-1),l=i+(l-a),a=i}else if(l<i){let t=r<=i&&r>=l?i-r:0;i-=t,i&&i<e.size&&Wa(e.textBetween(i-1,i+1))&&(i+=t?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function Wa(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class qa{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bi,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Ja),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ka(this),Ua(this),this.nodeViews=Xa(this),this.docView=Jr(this.state.doc,Za(this),Sa(this),this.dom,this),this.domObserver=new _a(this,(e,t,n,r)=>La(this,e,t,n,r)),this.domObserver.start(),wi(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Si(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ja),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(Wi(this),i=!0),this.state=e;let a=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Xa(this);Ya(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Si(this),this.editable=Ka(this),Ua(this);let l=Sa(this),s=Za(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(e.doc,s,l);!d&&e.selection.eq(r.selection)||(i=!0);let u="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&mr(this);if(i){this.domObserver.stop();let t=d&&(Jn||nr)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Ga(r.selection,e.selection);if(d){let n=nr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=qi(this)),!o&&this.docView.update(e.doc,s,l,this)||(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Jr(e.doc,s,l,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Bo(this))?ko(this,t):(Mo(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&vr(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof cn){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&fr(this,t.getBoundingClientRect(),e)}else fr(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;while(e=this.pluginViews.pop())e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size),o=e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e);o==n.node&&(r=e)}this.dragging=new ea(e.slice,e.move,r<0?void 0:cn.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(Jn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;while(e&&this.dom!=e&&this.dom.contains(e)){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wr(this.dom),ko(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Mr(this,e)}coordsAtPos(e,t=1){return Ar(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return jr(this,t||this.state,e)}pasteHTML(e,t){return Ji(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ji(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Qo(this,e)}destroy(){this.docView&&(xi(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Sa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Bn())}get isDestroyed(){return null==this.docView}dispatchEvent(e){return Ei(this,e)}domSelectionRange(){let e=this.domSelection();return e?or&&11===this.root.nodeType&&Wn(this.dom.ownerDocument)==this.dom&&Aa(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Za(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[sa.node(0,e.state.doc.content.size,t)]}function Ua(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:sa.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ka(e){return!e.someProp("editable",t=>!1===t(e.state))}function Ga(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Xa(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Ya(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function Ja(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}qa.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Qa={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},el={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tl="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),nl="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rl=0;rl<10;rl++)Qa[48+rl]=Qa[96+rl]=String(rl);for(rl=1;rl<=24;rl++)Qa[rl+111]="F"+rl;for(rl=65;rl<=90;rl++)Qa[rl]=String.fromCharCode(rl+32),el[rl]=String.fromCharCode(rl);for(var ol in Qa)el.hasOwnProperty(ol)||(el[ol]=Qa[ol]);function il(e){var t=tl&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||nl&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key,n=!t&&e.key||(e.shiftKey?el:Qa)[e.keyCode]||e.key||"Unidentified";return"Esc"==n&&(n="Escape"),"Del"==n&&(n="Delete"),"Left"==n&&(n="ArrowLeft"),"Up"==n&&(n="ArrowUp"),"Right"==n&&(n="ArrowRight"),"Down"==n&&(n="ArrowDown"),n}const al="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ll="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function sl(e){let t,n,r,o,i=e.split(/-(?!$)/),a=i[i.length-1];"Space"==a&&(a=" ");for(let l=0;l<i.length-1;l++){let e=i[l];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);al?o=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function cl(e){let t=Object.create(null);for(let n in e)t[sl(n)]=e[n];return t}function dl(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ul(e){return new Tn({props:{handleKeyDown:pl(e)}})}function pl(e){let t=cl(e);return function(e,n){let r,o=il(n),i=t[dl(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[dl(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ll&&n.ctrlKey&&n.altKey)&&(r=Qa[n.keyCode])&&r!=o){let o=t[dl(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}let hl,fl;if("undefined"!=typeof WeakMap){let e=new WeakMap;hl=t=>e.get(t),fl=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;hl=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},fl=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var ml=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,a=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;a<this.height&&this.map[t+this.width*e]==n;e++)a++;return{left:r,top:o,right:i,bottom:a}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:a}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:a==this.height)?null:this.map[r+this.width*(n<0?i-1:a)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:a,right:l,top:s,bottom:c}=this.findCell(t);return{left:Math.min(n,a),top:Math.min(o,s),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,a=this.map[i];n[a]||(n[a]=!0,o==e.left&&o&&this.map[i-1]==a||r==e.top&&r&&this.map[i-this.width]==a||t.push(a))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;while(n<r&&this.map[n]<o)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return hl(e)||fl(e,gl(e))}};function gl(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=vl(e),n=e.childCount,r=[];let o=0,i=null;const a=[];for(let c=0,d=t*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const l=e.child(c);d++;for(let e=0;;e++){while(o<r.length&&0!=r[o])o++;if(e==l.childCount)break;const s=l.child(e),{colspan:u,rowspan:p,colwidth:h}=s.attrs;for(let e=0;e<p;e++){if(e+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:p-e});break}const l=o+e*t;for(let e=0;e<u;e++){0==r[l+e]?r[l+e]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:u-e});const n=h&&h[e];if(n){const r=(l+e)%t*2,o=a[r];null==o||o!=n&&1==a[r+1]?(a[r]=n,a[r+1]=1):o==n&&a[r+1]++}}}o+=u,d+=s.nodeSize}const s=(c+1)*t;let u=0;while(o<s)0==r[o++]&&u++;u&&(i||(i=[])).push({type:"missing",row:c,n:u}),d++}0!==t&&0!==n||(i||(i=[])).push({type:"zero_sized"});const l=new ml(t,n,r,i);let s=!1;for(let c=0;!s&&c<a.length;c+=2)null!=a[c]&&a[c+1]<n&&(s=!0);return s&&yl(l,a,e),l}function vl(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}function yl(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const a=n.nodeAt(i);if(!a)throw new RangeError(`No cell with offset ${i} found`);let l=null;const s=a.attrs;for(let n=0;n<s.colspan;n++){const r=t[(o+n)%e.width*2];null==r||s.colwidth&&s.colwidth[n]==r||((l||(l=bl(s)))[n]=r)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function bl(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function wl(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const kl=new Mn("selectingCells");function xl(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function Sl(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}function Cl(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if("row"==t.node(n).type.spec.tableRole)return!0;return!1}function Tl(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=xl(t.$head)||El(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function El(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}function _l(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function Ml(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Nl(e,t,n){const r=e.node(-1),o=ml.get(r),i=e.start(-1),a=o.nextCell(e.pos-i,t,n);return null==a?null:e.node(0).resolve(i+a)}function Il(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Rl(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var Al=class e extends nn{constructor(e,t=e){const n=e.node(-1),r=ml.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),a=e.node(0),l=r.cellsInRect(i).filter(e=>e!=t.pos-o);l.unshift(t.pos-o);const s=l.map(e=>{const t=n.nodeAt(e);if(!t)throw new RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new rn(a.resolve(r),a.resolve(r+t.content.size))});super(s[0].$from,s[0].$to,s),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(_l(r)&&_l(o)&&Ml(r,o)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,o):t&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return ln.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=ml.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let l=r.top;l<r.bottom;l++){const n=[];for(let i=l*t.width+r.left,a=r.left;a<r.right;a++,i++){const a=t.map[i];if(o[a])continue;o[a]=!0;const l=t.findCell(a);let s=e.nodeAt(a);if(!s)throw new RangeError(`No cell with offset ${a} found`);const c=r.left-l.left,d=l.right-r.right;if(c>0||d>0){let e=s.attrs;if(c>0&&(e=Il(e,0,c)),d>0&&(e=Il(e,e.colspan-d,d)),l.left<r.left){if(s=s.type.createAndFill(e),!s)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else s=s.type.create(e,s.content)}if(l.top<r.top||l.bottom>r.bottom){const e={...s.attrs,rowspan:Math.min(l.bottom,r.bottom)-Math.max(l.top,r.top)};s=l.top<r.top?s.type.createAndFill(e):s.type.create(e,s.content)}n.push(s)}i.push(e.child(l).copy(E.from(n)))}const a=this.isColSelection()&&this.isRowSelection()?e:i;return new A(E.from(a),1,1)}replace(e,t=A.empty){const n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){const{$from:o,$to:a}=r[i],l=e.mapping.slice(n);e.replace(l.map(o.pos),l.map(a.pos),i?A.empty:t)}const o=nn.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new A(E.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=ml.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let i=0;i<o.length;i++)e(t.nodeAt(o[i]),r+o[i])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=ml.get(r),i=t.start(-1),a=o.findCell(t.pos-i),l=o.findCell(n.pos-i),s=t.node(0);return a.top<=l.top?(a.top>0&&(t=s.resolve(i+o.map[a.left])),l.bottom<o.height&&(n=s.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=s.resolve(i+o.map[l.left])),a.bottom<o.height&&(t=s.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=ml.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,a)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=ml.get(r),i=t.start(-1),a=o.findCell(t.pos-i),l=o.findCell(n.pos-i),s=t.node(0);return a.left<=l.left?(a.left>0&&(t=s.resolve(i+o.map[a.top*o.width])),l.right<o.width&&(n=s.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=s.resolve(i+o.map[l.top*o.width])),a.right<o.width&&(t=s.resolve(i+o.map[o.width*(a.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Bl(this.$anchorCell.pos,this.$headCell.pos)}};Al.prototype.visible=!1,nn.jsonID("cell",Al);var Bl=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&Ml(t,n)?new Al(t,n):nn.near(n,1)}};function Dl(e){if(!(e.selection instanceof Al))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push(sa.node(n,n+e.nodeSize,{class:"selectedCell"}))}),ua.create(e.doc,t)}function Fl({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0;o--,n++)if(e.after(o+1)<e.end(o))break;for(let i=t.depth;i>=0;i--,r--)if(t.before(i+1)>t.start(i))break;return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}function Pl({$from:e,$to:t}){let n,r;for(let o=e.depth;o>0;o--){const t=e.node(o);if("cell"===t.type.spec.tableRole||"header_cell"===t.type.spec.tableRole){n=t;break}}for(let o=t.depth;o>0;o--){const e=t.node(o);if("cell"===e.type.spec.tableRole||"header_cell"===e.type.spec.tableRole){r=e;break}}return n!==r&&0===t.parentOffset}function Ol(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,a;if(r instanceof cn&&(a=r.node.type.spec.tableRole)){if("cell"==a||"header_cell"==a)i=Al.create(o,r.from);else if("row"==a){const e=o.resolve(r.from+1);i=Al.rowSelection(e,e)}else if(!n){const e=ml.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=Al.create(o,t+1,n)}}else r instanceof ln&&Fl(r)?i=ln.create(o,r.from):r instanceof ln&&Pl(r)&&(i=ln.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}const Ll=new Mn("fix-tables");function zl(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let a=0,l=0;a<i;a++){const i=t.child(a);for(let t=l,r=Math.min(o,a+3);t<r;t++)if(e.child(t)==i){l=t+1,n+=i.nodeSize;continue e}r(i,n),l<o&&e.child(l).sameMarkup(i)?zl(e.child(l),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function Vl(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=$l(e,t,r,n))};return t?t.doc!=e.doc&&zl(t.doc,e.doc,0,r):e.doc.descendants(r),n}function $l(e,t,n,r){const o=ml.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let s=0;s<o.height;s++)i.push(0);for(let s=0;s<o.problems.length;s++){const e=o.problems[s];if("collision"==e.type){const o=t.nodeAt(e.pos);if(!o)continue;const a=o.attrs;for(let t=0;t<a.rowspan;t++)i[e.row+t]+=e.n;r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,Il(a,a.colspan-e.n,e.n))}else if("missing"==e.type)i[e.row]+=e.n;else if("overlong_rowspan"==e.type){const o=t.nodeAt(e.pos);if(!o)continue;r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,{...o.attrs,rowspan:o.attrs.rowspan-e.n})}else if("colwidth mismatch"==e.type){const o=t.nodeAt(e.pos);if(!o)continue;r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,{...o.attrs,colwidth:e.colwidth})}else if("zero_sized"==e.type){const e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let a,l;for(let s=0;s<i.length;s++)i[s]&&(null==a&&(a=s),l=s);for(let s=0,c=n+1;s<o.height;s++){const n=t.child(s),o=c+n.nodeSize,d=i[s];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<d;n++){const n=wl(e.schema)[t].createAndFill();n&&i.push(n)}const u=0!=s&&a!=s-1||l!=s?o-1:c+1;r.insert(r.mapping.map(u),i)}c=o}return r.setMeta(Ll,{fixTables:!0})}function jl(e){const t=e.selection,n=Tl(e),r=n.node(-1),o=n.start(-1),i=ml.get(r);return{...t instanceof Al?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function Hl(e){const t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function Wl({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,a=(r.bottom-1)*e+r.left,l=o+(r.right-r.left-1);for(let s=r.top;s<r.bottom;s++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[l]==n[l+1])return!0;i+=e,l+=e}for(let s=r.left;s<r.right;s++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[a]==n[a+e])return!0;o++,a++}return!1}function ql(e,t){const n=e.selection;if(!(n instanceof Al)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=jl(e),{map:o}=r;if(Wl(o,r))return!1;if(t){const n=e.tr,i={};let a,l,s=E.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){const c=o.map[e*o.width+t],d=r.table.nodeAt(c);if(!i[c]&&d)if(i[c]=!0,null==a)a=c,l=d;else{Hl(d)||(s=s.append(d.content));const e=n.mapping.map(c+r.tableStart);n.delete(e,e+d.nodeSize)}}if(null==a||null==l)return!0;if(n.setNodeMarkup(a+r.tableStart,null,{...Rl(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),s.size>0){const e=a+1+l.content.size,t=Hl(l)?a+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,s)}n.setSelection(new Al(n.doc.resolve(a+r.tableStart))),t(n)}return!0}function Zl(e,t){const n=wl(e.schema);return Ul(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Ul(e){return(t,n)=>{const r=t.selection;let o,i;if(r instanceof Al){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var a;if(o=Sl(r.$from),!o)return!1;i=null===(a=xl(r.$from))||void 0===a?void 0:a.pos}if(null==o||null==i)return!1;if(1==o.attrs.colspan&&1==o.attrs.rowspan)return!1;if(n){let a=o.attrs;const l=[],s=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=jl(t),d=t.tr;for(let e=0;e<c.right-c.left;e++)l.push(s?{...a,colwidth:s&&s[e]?[s[e]]:null}:a);let u;for(let t=c.top;t<c.bottom;t++){let n=c.map.positionAt(t,c.left,c.table);t==c.top&&(n+=o.nodeSize);for(let r=c.left,i=0;r<c.right;r++,i++)r==c.left&&t==c.top||d.insert(u=d.mapping.map(n+c.tableStart,1),e({node:o,row:t,col:r}).createAndFill(l[i]))}d.setNodeMarkup(i,e({node:o,row:c.top,col:c.left}),l[0]),r instanceof Al&&d.setSelection(new Al(d.doc.resolve(r.$anchorCell.pos),u?d.doc.resolve(u):void 0)),n(d)}return!0}}function Kl(e){return function(t,n){if(!Cl(t))return!1;if(n){const r=wl(t.schema),o=jl(t),i=t.tr,a=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=a.map(e=>o.table.nodeAt(e));for(let e=0;e<a.length;e++)l[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+a[e],r.cell,l[e].attrs);if(0===i.steps.length)for(let e=0;e<a.length;e++)i.setNodeMarkup(o.tableStart+a[e],r.header_cell,l[e].attrs);n(i)}return!0}}function Gl(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let o=0;o<r.length;o++){const e=t.table.nodeAt(r[o]);if(e&&e.type!==n.header_cell)return!1}return!0}function Xl(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?Kl(e):function(t,n){if(!Cl(t))return!1;if(n){const r=wl(t.schema),o=jl(t),i=t.tr,a=Gl("row",o,r),l=Gl("column",o,r),s=("column"===e?a:"row"===e&&l)?1:0,c="column"==e?{left:0,top:s,right:1,bottom:o.map.height}:"row"==e?{left:s,top:0,right:o.map.width,bottom:1}:o,d="column"==e?l?r.cell:r.header_cell:"row"==e?a?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach(e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,d,n.attrs)}),n(i)}return!0}}Xl("row",{useDeprecatedLogic:!0}),Xl("column",{useDeprecatedLogic:!0}),Xl("cell",{useDeprecatedLogic:!0});function Yl(e,t){const n=e.selection;if(!(n instanceof Al))return!1;if(t){const r=e.tr,o=wl(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new A(o,0,0))}),r.docChanged&&t(r)}return!0}function Jl(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;while(1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole))n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==i)for(let s=0;s<t.childCount;s++){let e=t.child(s).content;const o=s?0:Math.max(0,n-1),i=s<t.childCount-1?0:Math.max(0,r-1);(o||i)&&(e=es(wl(a).row,new A(e,o,i)).content),l.push(e)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?es(wl(a).row,new A(t,n,r)).content:t)}return Ql(a,l)}function Ql(e,t){const n=[];for(let o=0;o<t.length;o++){const e=t[o];for(let t=e.childCount-1;t>=0;t--){const{rowspan:r,colspan:i}=e.child(t).attrs;for(let e=o;e<o+r;e++)n[e]=(n[e]||0)+i}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(E.empty),n[o]<r){const i=wl(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(i);t[o]=t[o].append(E.from(a))}return{height:t.length,width:r,rows:t}}function es(e,t){const n=e.createAndFill();return new en(n).replace(0,n.content.size,t).doc}function ts({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],a=[];for(let n=t[e]||0,o=0;n<r;o++){let l=i.child(o%i.childCount);n+l.attrs.colspan>r&&(l=l.type.createChecked(Il(l.attrs,l.attrs.colspan,n+l.attrs.colspan-r),l.content)),a.push(l),n+=l.attrs.colspan;for(let n=1;n<l.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+l.attrs.colspan}o.push(E.from(a))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const a=[],l=n[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(E.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}function ns(e,t,n,r,o,i,a){const l=e.doc.type.schema,s=wl(l);let c,d;if(o>t.width)for(let u=0,p=0;u<t.height;u++){const i=n.child(u);p+=i.nodeSize;const l=[];let h;h=null==i.lastChild||i.lastChild.type==s.cell?c||(c=s.cell.createAndFill()):d||(d=s.header_cell.createAndFill());for(let e=t.width;e<o;e++)l.push(h);e.insert(e.mapping.slice(a).map(p-1+r),l)}if(i>t.height){const l=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==s.header_cell;l.push(o?d||(d=s.header_cell.createAndFill()):c||(c=s.cell.createAndFill()))}const u=s.row.create(null,E.from(l)),p=[];for(let e=t.height;e<i;e++)p.push(u);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),p)}return!(!c&&!d)}function rs(e,t,n,r,o,i,a,l){if(0==a||a==t.height)return!1;let s=!1;for(let c=o;c<i;c++){const o=a*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){s=!0;const o=n.nodeAt(i),{top:d,left:u}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(l).map(i+r),null,{...o.attrs,rowspan:a-d}),e.insert(e.mapping.slice(l).map(t.positionAt(a,u,n)),o.type.createAndFill({...o.attrs,rowspan:d+o.attrs.rowspan-a})),c+=o.attrs.colspan-1}}return s}function is(e,t,n,r,o,i,a,l){if(0==a||a==t.width)return!1;let s=!1;for(let c=o;c<i;c++){const o=c*t.width+a,i=t.map[o];if(t.map[o-1]==i){s=!0;const o=n.nodeAt(i),d=t.colCount(i),u=e.mapping.slice(l).map(i+r);e.setNodeMarkup(u,null,Il(o.attrs,a-d,o.attrs.colspan-(a-d))),e.insert(u+o.nodeSize,o.type.createAndFill(Il(o.attrs,0,a-d))),c+=o.attrs.rowspan-1}}return s}function as(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let a=ml.get(i);const{top:l,left:s}=r,c=s+o.width,d=l+o.height,u=e.tr;let p=0;function h(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");a=ml.get(i),p=u.mapping.maps.length}ns(u,a,i,n,c,d,p)&&h(),rs(u,a,i,n,s,c,l,p)&&h(),rs(u,a,i,n,s,c,d,p)&&h(),is(u,a,i,n,l,d,s,p)&&h(),is(u,a,i,n,l,d,c,p)&&h();for(let f=l;f<d;f++){const e=a.positionAt(f,s,i),t=a.positionAt(f,c,i);u.replace(u.mapping.slice(p).map(e+n),u.mapping.slice(p).map(t+n),new A(o.rows[f-l],0,0))}h(),u.setSelection(new Al(u.doc.resolve(n+a.positionAt(l,s,i)),u.doc.resolve(n+a.positionAt(d-1,c-1,i)))),t(u)}const ls=pl({ArrowLeft:cs("horiz",-1),ArrowRight:cs("horiz",1),ArrowUp:cs("vert",-1),ArrowDown:cs("vert",1),"Shift-ArrowLeft":ds("horiz",-1),"Shift-ArrowRight":ds("horiz",1),"Shift-ArrowUp":ds("vert",-1),"Shift-ArrowDown":ds("vert",1),Backspace:Yl,"Mod-Backspace":Yl,Delete:Yl,"Mod-Delete":Yl});function ss(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function cs(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Al)return ss(n,r,nn.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const a=fs(o,e,t);if(null==a)return!1;if("horiz"==e)return ss(n,r,nn.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(a),i=Nl(o,e,t);let l;return l=i?nn.near(i,1):t<0?nn.near(n.doc.resolve(o.before(-1)),-1):nn.near(n.doc.resolve(o.after(-1)),1),ss(n,r,l)}}}function ds(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let a;if(i instanceof Al)a=i;else{const r=fs(o,e,t);if(null==r)return!1;a=new Al(n.doc.resolve(r))}const l=Nl(a.$headCell,e,t);return!!l&&ss(n,r,new Al(a.$anchorCell,l))}}function us(e,t){const n=e.state.doc,r=xl(n.resolve(t));return!!r&&(e.dispatch(e.state.tr.setSelection(new Al(r))),!0)}function ps(e,t,n){if(!Cl(e.state))return!1;let r=Jl(n);const o=e.state.selection;if(o instanceof Al){r||(r={width:1,height:1,rows:[E.from(es(wl(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=ml.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=ts(r,a.right-a.left,a.bottom-a.top),as(e.state,e.dispatch,i,a,r),!0}if(r){const t=Tl(e.state),n=t.start(-1);return as(e.state,e.dispatch,n,ml.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function hs(e,t){var n;if(0!=t.button)return;if(t.ctrlKey||t.metaKey)return;const r=ms(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof Al)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=xl(e.state.selection.$anchor))&&(null===(n=gs(e,t))||void 0===n?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=gs(e,n);const o=null==kl.getState(e.state);if(!r||!Ml(t,r)){if(!o)return;r=t}const i=new Al(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(kl,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener("mouseup",a),e.root.removeEventListener("dragstart",a),e.root.removeEventListener("mousemove",l),null!=kl.getState(e.state)&&e.dispatch(e.state.tr.setMeta(kl,-1))}function l(n){const o=n,l=kl.getState(e.state);let s;if(null!=l)s=e.state.doc.resolve(l);else if(ms(e,o.target)!=r&&(s=gs(e,t),!s))return a();s&&i(s,o)}e.root.addEventListener("mouseup",a),e.root.addEventListener("dragstart",a),e.root.addEventListener("mousemove",l)}function fs(e,t,n){if(!(e.state.selection instanceof ln))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),a="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(a)?i:null}}return null}function ms(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function gs(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&xl(e.state.doc.resolve(r))||xl(e.state.doc.resolve(o))}var vs=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ys(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,ys(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function ys(e,t,n,r,o,i){let a=0,l=!0,s=t.firstChild;const c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){const{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){const c=o==n?i:u&&u[e],d=c?c+"px":"";if(a+=c||r,c||(l=!1),s)s.style.width!=d&&(s.style.width=d),s=s.nextSibling;else{const e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}while(s){var d;const e=s.nextSibling;null===(d=s.parentNode)||void 0===d||d.removeChild(s),s=e}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}const bs=new Mn("tableColumnResizing");function ws({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=vs,lastColumnResizable:o=!0}={}){const i=new Tn({key:bs,state:{init(e,t){var o;const a=null===(o=i.spec)||void 0===o||null===(o=o.props)||void 0===o?void 0:o.nodeViews,l=wl(t.schema).table.name;return r&&a&&(a[l]=(e,t)=>new r(e,n,t)),new ks(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{const t=bs.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{xs(t,n,e,o)},mouseleave:e=>{Ss(e)},mousedown:(e,r)=>{Cs(e,r,t,n)}},decorations:e=>{const t=bs.getState(e);if(t&&t.activeHandle>-1)return Bs(e,t.activeHandle)},nodeViews:{}}});return i}var ks=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(bs);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return _l(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function xs(e,t,n,r){if(!e.editable)return;const o=bs.getState(e.state);if(o&&!o.dragging){const i=Es(t.target);let a=-1;if(i){const{left:r,right:o}=i.getBoundingClientRect();t.clientX-r<=n?a=_s(e,t,"left",n):o-t.clientX<=n&&(a=_s(e,t,"right",n))}if(a!=o.activeHandle){if(!r&&-1!==a){const t=e.state.doc.resolve(a),n=t.node(-1),r=ml.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Ns(e,a)}}}function Ss(e){if(!e.editable)return;const t=bs.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Ns(e,-1)}function Cs(e,t,n,r){var o;if(!e.editable)return!1;const i=null!==(o=e.dom.ownerDocument.defaultView)&&void 0!==o?o:window,a=bs.getState(e.state);if(!a||-1==a.activeHandle||a.dragging)return!1;const l=e.state.doc.nodeAt(a.activeHandle),s=Ts(e,a.activeHandle,l.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const r=bs.getState(e.state);(null===r||void 0===r?void 0:r.dragging)&&(Is(e,r.activeHandle,Ms(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(bs,{setDragging:null})))}function d(t){if(!t.which)return c(t);const o=bs.getState(e.state);if(o&&o.dragging){const i=Ms(o.dragging,t,n);Rs(e,o.activeHandle,i,r)}}return e.dispatch(e.state.tr.setMeta(bs,{setDragging:{startX:t.clientX,startWidth:s}})),Rs(e,a.activeHandle,s,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),t.preventDefault(),!0}function Ts(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let a=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let s=0;s<n;s++)r[s]&&(a-=r[s],l--);return a/l}function Es(e){while(e&&"TD"!=e.nodeName&&"TH"!=e.nodeName)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function _s(e,t,n,r){const o="right"==n?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:a}=i,l=xl(e.state.doc.resolve(a));if(!l)return-1;if("right"==n)return l.pos;const s=ml.get(l.node(-1)),c=l.start(-1),d=s.map.indexOf(l.pos-c);return d%s.width==0?-1:c+s.map[d-1]}function Ms(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Ns(e,t){e.dispatch(e.state.tr.setMeta(bs,{setHandle:t}))}function Is(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=ml.get(o),a=r.start(-1),l=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,s=e.state.tr;for(let c=0;c<i.height;c++){const e=c*i.width+l;if(c&&i.map[e]==i.map[e-i.width])continue;const t=i.map[e],r=o.nodeAt(t).attrs,d=1==r.colspan?0:l-i.colCount(t);if(r.colwidth&&r.colwidth[d]==n)continue;const u=r.colwidth?r.colwidth.slice():As(r.colspan);u[d]=n,s.setNodeMarkup(a+t,null,{...r,colwidth:u})}s.docChanged&&e.dispatch(s)}function Rs(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),a=o.start(-1),l=ml.get(i).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let s=e.domAtPos(o.start(-1)).node;while(s&&"TABLE"!=s.nodeName)s=s.parentNode;s&&ys(i,s.firstChild,s,r,l,n)}function As(e){return Array(e).fill(0)}function Bs(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return ua.empty;const i=ml.get(o),a=r.start(-1),l=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const t=l+c*i.width;if((l==i.width-1||i.map[t]!=i.map[t+1])&&(0==c||i.map[t]!=i.map[t-i.width])){var s;const r=i.map[t],l=a+r+o.nodeAt(r).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null===(s=bs.getState(e))||void 0===s?void 0:s.dragging)&&n.push(sa.node(a+r,a+r+o.nodeAt(r).nodeSize,{class:"column-resize-dragging"})),n.push(sa.widget(l,c))}}return ua.create(e.doc,n)}function Ds({allowTableNodeSelection:e=!1}={}){return new Tn({key:kl,state:{init(){return null},apply(e,t){const n=e.getMeta(kl);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:Dl,handleDOMEvents:{mousedown:hs},createSelectionBetween(e){return null!=kl.getState(e.state)?e.state.selection:null},handleTripleClick:us,handleKeyDown:ls,handlePaste:ps},appendTransaction(t,n,r){return Ol(r,Vl(r,n),e)}})}var Fs=x(8521),Ps=x(9272),Os=x.n(Ps),Ls=x(3305),zs=x.n(Ls),Vs=x(8804),$s=x.n(Vs),js=x(2748),Hs=x.n(js),Ws=x(4932),qs=x(4339),Zs=x.n(qs),Us=(x(6573),x(8100),x(7936),(e,t)=>{let n=e.__vccOpts||e;for(let[r,o]of t)n[r]=o;return n}),Ks=1440;function Gs(e){return e/1440*96}function Xs(e){return e/96*1440}function Ys(e){return null==e||isNaN(e)?0:Math.round(96*e/914400)}function Js(e){return Math.round(e/96*914400)}function Qs(e){return e/72*96}function ec(e){return e/144*96}function tc(e){return e/2}function nc(e){return 2*e}function rc(e){return e/576*96}function oc(e,t=2){let n=Math.pow(10,t);return Math.round(e*n)/n}function ic(e){return`${oc(e)}px`}var ac={undo:["M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"],redo:["M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"],print:["M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"],file_download:["M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],file_upload:["M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],format_bold:["M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"],format_italic:["M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"],format_underlined:["M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"],strikethrough_s:["M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"],superscript:["M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"],subscript:["M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"],link:["M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"],format_clear:["m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"],format_align_left:["M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"],format_align_center:["M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"],format_align_right:["M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"],format_align_justify:["M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"],format_line_spacing:["M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"],format_list_bulleted:["M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"],format_list_numbered:["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],format_indent_increase:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"],format_indent_decrease:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"],format_color_text:["M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"],ink_highlighter:["M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"],format_color_reset:["M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"],arrow_drop_down:["M480-360 280-560h400L480-360Z"],table:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"],table_chart:["M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"],grid_on:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],table_rows:["M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"],view_column:["M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"],border_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],border_outer:["M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"],border_inner:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"],border_clear:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],add:["M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"],remove:["M200-440v-80h560v80H200Z"],delete:["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],delete_sweep:["M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"],call_merge:["m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"],call_split:["M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"],drag_indicator:["M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"],image:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"],format_image_left:["M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"],format_image_right:["M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"],horizontal_rule:["M160-440v-80h640v80H160Z"],flip_to_back:["M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],flip_to_front:["M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],open_with:["M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"],tune:["M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"],rotate_right:["M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"],rotate_left:["M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"],swap_horiz:["M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"],swap_vert:["M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"],shapes:["M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"],format_paint:["M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"],expand_more:["M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"],expand_less:["m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"],border_top:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_bottom:["M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_left:["M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_right:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"],border_horizontal:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],border_vertical:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],padding:["M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],text_rotation_none:["M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"],wrap_text:["M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"],height:["M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"],fit_width:["M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],settings:["m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],border_color:["M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"],format_color_fill:["m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"],vertical_align_top:["M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"],vertical_align_center:["M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"],vertical_align_bottom:["M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"],line_weight:["M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"],keyboard_arrow_up:["M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"],keyboard_arrow_down:["M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"],keyboard_arrow_left:["M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"],keyboard_arrow_right:["M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"],more_vert:["M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"],page_break:["M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"],arrow_back:["M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"],done_all:["M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"],check_circle:["m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"],chat_bubble_outline:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],chat_bubble_check:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],check:["M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"],close:["m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"],add_comment:["M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],comment:["M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],edit_note:["M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"],rate_review:["M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],visibility:["M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"],format_textdirection_l_to_r:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"],format_textdirection_r_to_l:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"],"agent-sparkle":["m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"]},lc=["width","height"],sc=["d"],cc=(0,n.defineComponent)({__name:"MaterialSymbol",props:{name:{},size:{default:20},className:{default:""},style:{}},setup(e){let t=e,r=(0,n.computed)(()=>ac[t.name]||(typeof console<"u"&&console.warn(`Icon not found: ${t.name}`),null));return(t,o)=>r.value?((0,n.openBlock)(),(0,n.createElementBlock)("svg",{key:0,xmlns:"http://www.w3.org/2000/svg",width:e.size,height:e.size,viewBox:"0 -960 960 960",fill:"currentColor",class:(0,n.normalizeClass)(e.className),style:(0,n.normalizeStyle)({display:"inline-flex",flexShrink:0,...e.style??{}}),"aria-hidden":"true"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("path",{key:t,d:e},null,8,sc))),128))],14,lc)):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:1,class:(0,n.normalizeClass)(e.className),style:(0,n.normalizeStyle)({fontSize:`${e.size}px`,width:`${e.size}px`,height:`${e.size}px`,display:"inline-flex",...e.style??{}})},(0,n.toDisplayString)(e.name),7))}}),dc={_lang:"en",common:{cancel:"Cancel",insert:"Insert",apply:"Apply",close:"Close",delete:"Delete",update:"Update",save:"Save",retry:"Retry",send:"Send",edit:"Edit",comment:"Comment",reply:"Reply",accept:"Accept",reject:"Reject",dismiss:"Dismiss",change:"Change",clear:"Clear",px:"px",closeDialog:"Close dialog"},toolbar:{ariaLabel:"Formatting toolbar",file:"File",format:"Format",insert:"Insert",open:"Open",openShortcut:"Ctrl+O",save:"Save",saveShortcut:"Ctrl+S",print:"Print",printShortcut:"Ctrl+P",pageSetup:"Page setup",leftToRight:"Left-to-right text",rightToLeft:"Right-to-left text",image:"Image",table:"Table",pageBreak:"Page break",tableOfContents:"Table of contents",symbol:"Symbol",help:"Help",reportIssue:"Report issue"},formattingBar:{groups:{history:"History",zoom:"Zoom",styles:"Styles",font:"Font",textFormatting:"Text formatting",script:"Script",alignment:"Alignment",listFormatting:"List formatting",image:"Image",table:"Table"},undo:"Undo",undoShortcut:"Undo (Ctrl+Z)",redo:"Redo",redoShortcut:"Redo (Ctrl+Y)",bold:"Bold",boldShortcut:"Bold (Ctrl+B)",italic:"Italic",italicShortcut:"Italic (Ctrl+I)",underline:"Underline",underlineShortcut:"Underline (Ctrl+U)",strikethrough:"Strikethrough",fontColor:"Font Color",highlightColor:"Text Highlight Color",insertLink:"Insert link",insertLinkShortcut:"Insert link (Ctrl+K)",superscript:"Superscript",superscriptShortcut:"Superscript (Ctrl+Shift+=)",subscript:"Subscript",subscriptShortcut:"Subscript (Ctrl+=)",imageProperties:"Image properties",imagePropertiesShortcut:"Image properties (alt text, border)...",clearFormatting:"Clear formatting"},alignment:{alignLeft:"Align Left",alignLeftShortcut:"Ctrl+L",center:"Center",centerShortcut:"Ctrl+E",alignRight:"Align Right",alignRightShortcut:"Ctrl+R",justify:"Justify",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"List formatting",typeAriaLabel:"List type",indentationAriaLabel:"List indentation",bulletList:"Bullet List",numberedList:"Numbered List",decreaseIndent:"Decrease Indent",increaseIndent:"Increase Indent"},lineSpacing:{single:"Single",double:"Double",lineSpacingTitle:"Line spacing: {label}",paragraphSpacing:"Paragraph spacing"},styles:{selectAriaLabel:"Select paragraph style",normalText:"Normal text",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},font:{selectAriaLabel:"Select font family",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace"},fontSize:{decrease:"Decrease font size",increase:"Increase font size",label:"Font size",listLabel:"Font sizes"},zoom:{ariaLabel:"Zoom: {label}"},colorPicker:{ariaLabel:"{type} color picker",highlightColors:"Highlight Colors",customColor:"Custom Color",noColor:"No Color",automatic:"Automatic",themeColors:"Theme Colors",standardColors:"Standard Colors",colors:{black:"Black",darkRed:"Dark Red",red:"Red",orange:"Orange",yellow:"Yellow",darkYellow:"Dark Yellow",green:"Green",darkGreen:"Dark Green",teal:"Teal",darkTeal:"Dark Teal",blue:"Blue",darkBlue:"Dark Blue",purple:"Purple",darkPurple:"Dark Purple",brown:"Brown",grey50:"Grey 50%",grey25:"Grey 25%",grey10:"Grey 10%",white:"White",lightRed:"Light Red",lightOrange:"Light Orange",lightYellow:"Light Yellow",lightGreen:"Light Green",lightBlue:"Light Blue",lightPurple:"Light Purple",pink:"Pink",rose:"Rose",gold:"Gold",aqua:"Aqua",lavender:"Lavender",silver:"Silver",darkOrange:"Dark Orange",darkGray:"Dark Gray",gray:"Gray",cyan:"Cyan",magenta:"Magenta",paleGreen:"Pale Green",lightCyan:"Light Cyan",skyBlue:"Sky Blue",lightBlue2:"Light Blue 2",lightMagenta:"Light Magenta",brightGreen:"Bright Green",violet:"Violet"}},dialogs:{findReplace:{titleFind:"Find",titleFindReplace:"Find and Replace",findLabel:"Find:",findPlaceholder:"Enter text to find...",findAriaLabel:"Find text",findPrevious:"Find previous",findPreviousTitle:"Find Previous (Shift+Enter)",findNext:"Find next",findNextTitle:"Find Next (Enter)",matchCount:"{current} of {total} matches",noResults:"No results found",replaceLabel:"Replace:",replacePlaceholder:"Enter replacement text...",replaceAriaLabel:"Replace text",replaceButton:"Replace",replaceCurrentTitle:"Replace current match",replaceAllButton:"Replace All",replaceAllTitle:"Replace all matches",matchCase:"Match case",wholeWords:"Whole words",matchesFound:"{total} matches",toggleReplace:"+ Replace"},hyperlink:{titleEdit:"Edit Hyperlink",titleInsert:"Insert Hyperlink",tabWebAddress:"Web Address",tabBookmark:"Bookmark",urlLabel:"URL",urlPlaceholder:"https://example.com",urlHint:"Enter a web address, email (mailto:), or phone (tel:)",bookmarkLabel:"Bookmark",bookmarkPlaceholder:"Select a bookmark...",displayTextLabel:"Display Text",displayTextPlaceholder:"Text to display (optional)",displayTextHint:"Leave empty to use the selected text",tooltipLabel:"Tooltip (optional)",tooltipPlaceholder:"Text shown on hover",removeLink:"Remove Link",invalidUrl:"Please enter a valid URL",urlRequired:"URL is required"},insertTable:{title:"Insert Table",hoverToSelect:"Hover to select size",tableSize:"{cols} x {rows} Table",orSpecifySize:"or specify size",rowsLabel:"Rows:",columnsLabel:"Columns:",insertButton:"Insert Table",sizeSelector:"Table size selector",columnWidthLabel:"Column width",fixedWidth:"Fixed",autofit:"Auto-fit to contents",tableStyleLabel:"Table style",validationHint:"Rows: {minRows}-{maxRows}, Columns: {minCols}-{maxCols}"},splitCell:{title:"Split Cell",description:"Set how many rows and columns to split the selected cell into.",rowsLabel:"Rows:",columnsLabel:"Columns:",currentMinimum:"Minimum from current span: {rows} row(s) x {cols} column(s)",minValue:"Use at least {rows} row(s) and {cols} column(s).",notOneByOne:"Choose at least two resulting cells."},insertImage:{title:"Insert Image",uploadAriaLabel:"Click or drag to upload image",uploadText:"Click to select or drag and drop an image",uploadSubtext:"PNG, JPG, GIF up to 10MB",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",aspectRatioLocked:"Aspect ratio locked",aspectRatioUnlocked:"Aspect ratio unlocked",altTextLabel:"Alt Text (optional)",altTextPlaceholder:"Describe the image for accessibility",insertButton:"Insert Image",invalidFile:"Please select a valid image file",fileTooLarge:"Image file is too large (max 10MB)",readFailed:"Failed to read image file",loadFailed:"Failed to load image",preview:"Preview"},insertSymbol:{title:"Insert Symbol",searchPlaceholder:"Search symbols (character or Unicode)...",noResultsEmpty:"No symbols found",noResults:'No symbols found for "{query}"',decimal:"Decimal: {value}",recent:"Recent:",categories:{common:"Common",arrows:"Arrows",math:"Math",greek:"Greek",shapes:"Shapes",punctuation:"Punctuation",currency:"Currency",music:"Music",emoji:"Emoji"}},imageProperties:{title:"Image Properties",altText:"Alt Text",altTextPlaceholder:"Describe this image for accessibility...",border:"Border",width:"Width",style:"Style",color:"Color",preview:"Preview",textWrapping:"Text wrapping",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",lockAspectRatio:"Lock aspect ratio",wrapOptions:{inline:"Inline with text",wrapRight:"Wrap text, float left",wrapLeft:"Wrap text, float right",topAndBottom:"Top and bottom",behind:"Behind text",inFront:"In front of text"},borderStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"}},imagePosition:{title:"Image Position",horizontal:"Horizontal",vertical:"Vertical",position:"Position",alignment:"Alignment",offset:"Offset",offsetPx:"Offset (px)",align:"Align",relativeTo:"Relative to",alignOptions:{left:"Left",center:"Center",right:"Right",top:"Top",bottom:"Bottom"},relativeOptions:{page:"Page",column:"Column",margin:"Margin",character:"Character",paragraph:"Paragraph",line:"Line"}},pageSetup:{title:"Page Setup",pageSize:"PAGE SIZE",sizeLabel:"Size",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"MARGINS",top:"Top",bottom:"Bottom",left:"Left",right:"Right",pageSizes:{letter:'Letter (8.5" × 11")',a4:'A4 (8.27" × 11.69")',legal:'Legal (8.5" × 14")',a3:'A3 (11.69" × 16.54")',a5:'A5 (5.83" × 8.27")',b5:'B5 (6.93" × 9.84")',executive:'Executive (7.25" × 10.5")'}},tableProperties:{title:"Table Properties",widthType:"Width type",widthLabel:"Width",alignmentLabel:"Alignment",widthTypes:{auto:"Auto",fixed:"Fixed (twips)",percentage:"Percentage"},units:{fiftiethsPercent:"(50ths of %)",twips:"tw"},alignOptions:{left:"Left",center:"Center",right:"Right"}},pasteSpecial:{title:"Paste Special",keepFormatting:"Keep Source Formatting",keepFormattingDescription:"Paste with original formatting",keepFormattingShortcut:"Ctrl+V",plainText:"Paste as Plain Text",plainTextDescription:"Paste without any formatting",plainTextShortcut:"Ctrl+Shift+V",readingClipboard:"Reading clipboard...",preview:"Preview:",noContent:"No content available to paste",clipboardError:"Unable to read clipboard. Please use Ctrl+V to paste."},footnoteProperties:{title:"Footnote & Endnote Properties",footnotes:"Footnotes",endnotes:"Endnotes",position:"Position",numberFormat:"Number format",startAt:"Start at",numbering:"Numbering",footnotePositions:{bottomOfPage:"Bottom of page",belowText:"Below text"},endnotePositions:{endOfDocument:"End of document",endOfSection:"End of section"},numberingOptions:{continuous:"Continuous",restartSection:"Restart each section",restartPage:"Restart each page"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, †, ‡, ..."}},keyboardShortcuts:{ariaLabel:"Keyboard Shortcuts",searchPlaceholder:"Search shortcuts...",categories:{editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},shortcuts:{save:"Save",saveDescription:"Save document",print:"Print",printDescription:"Print document",undo:"Undo",undoDescription:"Undo last action",redo:"Redo",redoDescription:"Redo last action",delete:"Delete",deleteDescription:"Delete selected text",find:"Find",findDescription:"Find text in document",findReplace:"Find & Replace",findReplaceDescription:"Find and replace text",cut:"Cut",cutDescription:"Cut selected text",copy:"Copy",copyDescription:"Copy selected text",paste:"Paste",pasteDescription:"Paste from clipboard",pastePlainText:"Paste as Plain Text",pastePlainTextDescription:"Paste without formatting",bold:"Bold",boldDescription:"Toggle bold formatting",italic:"Italic",italicDescription:"Toggle italic formatting",underline:"Underline",underlineDescription:"Toggle underline formatting",strikethrough:"Strikethrough",strikethroughDescription:"Toggle strikethrough",subscript:"Subscript",subscriptDescription:"Toggle subscript",superscript:"Superscript",superscriptDescription:"Toggle superscript",alignLeft:"Align Left",alignLeftDescription:"Left align paragraph",alignCenter:"Align Center",alignCenterDescription:"Center align paragraph",alignRight:"Align Right",alignRightDescription:"Right align paragraph",justify:"Justify",justifyDescription:"Justify paragraph",increaseIndent:"Increase Indent",increaseIndentDescription:"Increase paragraph indent",decreaseIndent:"Decrease Indent",decreaseIndentDescription:"Decrease paragraph indent",selectAll:"Select All",selectAllDescription:"Select all content",selectWord:"Select Word",selectWordDescription:"Select current word",selectParagraph:"Select Paragraph",selectParagraphDescription:"Select current paragraph",extendSelectionByWord:"Extend Selection by Word",extendSelectionByWordDescription:"Extend selection to next/previous word",extendSelectionToLineEdge:"Extend Selection to Line Edge",extendSelectionToLineEdgeDescription:"Extend selection to line start/end",moveByWord:"Move by Word",moveByWordDescription:"Move cursor to next/previous word",moveToLineStart:"Move to Line Start",moveToLineStartDescription:"Move cursor to start of line",moveToLineEnd:"Move to Line End",moveToLineEndDescription:"Move cursor to end of line",moveToDocumentStart:"Move to Document Start",moveToDocumentStartDescription:"Move cursor to start of document",moveToDocumentEnd:"Move to Document End",moveToDocumentEndDescription:"Move cursor to end of document",pageUp:"Page Up",pageUpDescription:"Scroll up one page",pageDown:"Page Down",pageDownDescription:"Scroll down one page",zoomIn:"Zoom In",zoomInDescription:"Increase zoom level",zoomOut:"Zoom Out",zoomOutDescription:"Decrease zoom level",resetZoom:"Reset Zoom",resetZoomDescription:"Reset zoom to 100%",keyboardShortcuts:"Keyboard Shortcuts",keyboardShortcutsDescription:"Show this help dialog",insertLink:"Insert Link",insertLinkDescription:"Insert or edit hyperlink"},noResults:'No shortcuts found matching "{query}"',pressEscToClose:"Press {key} to close",or:"or"}},comments:{resolved:"Resolved",resolve:"Resolve",reopen:"Reopen",moreOptions:"More options",unknown:"Unknown",addComment:"Add a comment...",replyPlaceholder:"Reply or add others with @",replyCount:"{count, plural, one {# reply} other {# replies}}"},trackedChanges:{unknown:"Unknown",replaced:"Replaced",with:"with",added:"Added",deleted:"Deleted"},contextMenu:{ariaLabel:"AI actions menu",textMenuAriaLabel:"Text editing menu",customPromptPlaceholder:"Enter custom prompt...",cut:"Cut",cutShortcut:"Ctrl+X",copy:"Copy",copyShortcut:"Ctrl+C",paste:"Paste",pasteShortcut:"Ctrl+V",pastePlainText:"Paste as Plain Text",pastePlainTextShortcut:"Ctrl+Shift+V",delete:"Delete",deleteShortcut:"Del",selectAll:"Select All",selectAllShortcut:"Ctrl+A",selected:"Selected:",aiActions:{askAi:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom"}},documentOutline:{ariaLabel:"Document outline",closeAriaLabel:"Close outline",closeTitle:"Close outline",title:"Outline",noHeadings:"No headings found. Add headings to your document to see them here."},sidebar:{ariaLabel:"Annotations sidebar"},viewer:{pageIndicator:"{current} of {total}"},titleBar:{untitled:"Untitled",documentNameAriaLabel:"Document name",menuBarAriaLabel:"Menu bar"},errors:{loadingDocument:"Loading document...",noDocumentLoaded:"No document loaded",failedToLoad:"Failed to Load Document",unableToParse:"Unable to Parse Document",somethingWentWrong:"Something went wrong",errorDescription:"An error occurred while rendering this component. Please try again or contact support if the problem persists.",errorLabel:"Error:",componentStack:"Component Stack:",tryAgain:"Try Again",showDetails:"Show details",hideDetails:"Hide details",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?"},table:{insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",mergeCells:"Merge cells",splitCell:"Split cell",editingTools:"Table editing tools",label:"Table:",cellFillColor:"Cell Fill Color",borderColor:"Border Color",borderWidth:"Border width",unknownAction:"Unknown Action",borders:{all:"All borders",outside:"Outside borders",inside:"Inside borders",none:"No borders",remove:"Remove borders",top:"Top border",bottom:"Bottom border",left:"Left border",right:"Right border",styleAriaLabel:"Border style",tooltip:"Borders"},moreOptions:"More table options",styles:{title:"Table Styles",label:"Styles",normalTable:"Normal Table",tableGrid:"Table Grid",gridTableLight:"Grid Table Light",plainTable1:"Plain Table 1",plainTable2:"Plain Table 2",plainTable3:"Plain Table 3",plainTable4:"Plain Table 4",gridTable1Light:"Grid Table 1 Light",gridTable4Accent1:"Grid Table 4 Accent 1",gridTable5Dark:"Grid Table 5 Dark",listTable3Accent2:"List Table 3 Accent 2",listTable4Accent3:"List Table 4 Accent 3",gridTable4Accent5:"Grid Table 4 Accent 5",gridTable4Accent6:"Grid Table 4 Accent 6"}},tableAdvanced:{verticalAlignment:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",cellMargins:"Cell margins",textDirection:"Text direction",textDirections:{horizontal:"Horizontal (LR)",verticalRL:"Vertical (top-bottom, RL)",verticalLR:"Vertical (bottom-top, LR)"},toggleNoWrap:"Toggle no-wrap",rowHeight:"Row height",heightRules:{auto:"Auto",atLeast:"At least",exact:"Exact"},rule:"Rule",height:"Height",toggleHeaderRow:"Toggle header row",distributeColumns:"Distribute columns evenly",autoFit:"Auto-fit to contents",tableProperties:"Table properties...",tableAlignment:"Table alignment",alignTableLeft:"Align table left",alignTableCenter:"Align table center",alignTableRight:"Align table right",tableOptionsMenu:"Table options menu",tableOptions:"Table options"},imageTransform:{tooltip:"Transform",rotateClockwise:"Rotate clockwise",rotateCounterClockwise:"Rotate counter-clockwise",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical"},imageWrap:{inline:"In Line with Text",floatLeft:"Square Left",floatRight:"Square Right",topAndBottom:"Top and Bottom",behindText:"Behind Text",inFrontOfText:"In Front of Text",tooltipPrefix:"Wrap: {label}",menu:{inLineWithText:"In Line with Text",squareLeft:"Square Left",squareRight:"Square Right",behindText:"Behind Text",inFrontOfText:"In Front of Text",ariaLabel:"Image layout options",imageProperties:"Image properties…"},menuDesc:{inLineWithText:"Image flows in the line as a glyph",squareLeft:"Image floats left, text wraps on the right",squareRight:"Image floats right, text wraps on the left",behindText:"Image paints behind body text",inFrontOfText:"Image paints over body text"}},responsePreview:{loading:"{action}...",result:"{action} Result",closeEsc:"Close (Esc)",editPrompt:"Edit the result before accepting:",changes:"Changes:",original:"Original:",new:"New:",cancelEdit:"Cancel Edit"},commentMarkers:{resolvedComment:"Resolved comment",comment:"Comment"},editor:{toggleCommentsSidebar:"Toggle comments sidebar",showDocumentOutline:"Show document outline",editing:"Editing",editingDescription:"Edit document directly",suggesting:"Suggesting",suggestingDescription:"Edits become suggestions",viewing:"Viewing",viewingDescription:"Read-only, no edits",failedToParse:"Failed to parse document",linkRemoved:"Link removed",linkCopied:"Link copied to clipboard",failedToSave:"Failed to save document"},hyperlinkPopup:{displayTextPlaceholder:"Display text",urlPlaceholder:"https://example.com",copyLink:"Copy link",editLink:"Edit link",removeLink:"Remove link"},headerFooter:{header:"Header",footer:"Footer",options:"Options",insertPageNumber:"Insert current page number",insertTotalPages:"Insert total page count",remove:"Remove {label}",closeEditing:"Close {label} editing"},image:{placeholder:"Image placeholder",placeholderText:"[Image]",editableAriaLabel:"Editable image"},imageOverlay:{rotate:"Rotate",imageProperties:"Image properties",deleteImage:"Delete image"},ruler:{horizontal:"Horizontal ruler",vertical:"Vertical ruler",firstLineIndent:"First line indent",leftIndent:"Left indent",rightIndent:"Right indent",topMargin:"Top margin",bottomMargin:"Bottom margin"},print:{label:"Print",allPages:"All ({totalPages} pages)",singlePage:"Page {start}",pageRange:"Pages {start}-{end}"},unsaved:{unsaved:"Unsaved",saved:"Saved",unsavedTitle:"Document has unsaved changes",savedTitle:"All changes saved",unsavedAriaLabel:"Unsaved changes",savedAriaLabel:"All changes saved"},loading:{label:"Loading"},agentPanel:{defaultTitle:"Assistant",toggle:"Open assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant…",send:"Send",timeline:{working:"Working… {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};function uc(e){return"object"==typeof e&&!!e&&!Array.isArray(e)}function pc(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];null!==o&&(uc(e[r])&&uc(o)?n[r]=pc(e[r],o):void 0!==o&&(n[r]=o))}return n}function hc(e,t){let n=e;for(let r of t.split(".")){if(!uc(n))return;n=n[r]}return"string"==typeof n?n:void 0}function fc(e){let t,n={},r=/(=\d+|\w+)\s*\{([^}]*)\}/g;for(;null!==(t=r.exec(e));)n[t[1]]=t[2];return n}function mc(e,t,n){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(e,r,o)=>{let i=Number(t[r]);if(isNaN(i))return e;let a,l=fc(o),s=l[`=${i}`];if(void 0!==s)return s.replace(/#/g,String(i));try{a=new Intl.PluralRules(n||"en").select(i)}catch{a=1===i?"one":"other"}return(l[a]??l.other??"").replace(/#/g,String(i))}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return void 0===r?`{${n}}`:String(r)}):e}function gc(e,t="en"){return(n,r)=>mc(hc(e,n)??n,r,t)}var vc=Symbol("docx-locale"),yc=Symbol("docx-lang");function bc(e){return{strings:(0,n.computed)(()=>pc(dc,(0,n.unref)(e))),lang:(0,n.computed)(()=>{let t=(0,n.unref)(e)?._lang;return"string"==typeof t?t:"en"})}}function wc(e){let{strings:t,lang:r}=bc(e);(0,n.provide)(vc,t),(0,n.provide)(yc,r)}function kc(e){let{strings:t,lang:r}=bc(e);return{t:(e,o)=>gc((0,n.unref)(t),(0,n.unref)(r))(e,o)}}function xc(){let e=(0,n.inject)(vc,dc),t=(0,n.inject)(yc,"en");return{t:(r,o)=>gc((0,n.unref)(e),(0,n.unref)(t))(r,o)}}var Sc={class:"find-replace-dialog__header"},Cc={class:"find-replace-dialog__title"},Tc=["title"],Ec={class:"find-replace-dialog__body"},_c={class:"find-replace-dialog__row"},Mc=["placeholder","aria-label"],Nc={class:"find-replace-dialog__count"},Ic=["title"],Rc=["title"],Ac={class:"find-replace-dialog__options"},Bc=["title"],Dc={key:0,class:"find-replace-dialog__row"},Fc=["placeholder","aria-label","onKeydown"],Pc=["title"],Oc=["title"],Lc=Us((0,n.defineComponent)({__name:"FindReplaceDialog",props:{isOpen:{type:Boolean},view:{}},emits:["close"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(null),l=(0,n.ref)(""),s=(0,n.ref)(""),c=(0,n.ref)(!1),d=(0,n.ref)(!1),u=(0,n.ref)(!1),p=(0,n.ref)([]),h=(0,n.ref)(-1),f=(0,n.computed)(()=>l.value.trim()?0===p.value.length?r("dialogs.findReplace.noResults"):h.value<0?r("dialogs.findReplace.matchesFound",{total:p.value.length}):r("dialogs.findReplace.matchCount",{current:h.value+1,total:p.value.length}):"");function m(){x(),i("close")}function g(){p.value=[],h.value=-1;let e=o.view;if(!e||!l.value.trim())return void x();let t=e.state.doc,n=l.value,r=!c.value,i=[];t.descendants((e,o)=>{if(!e.isTextblock)return!0;let a=t.textBetween(o+1,o+e.nodeSize-1,"","");if(!a)return!1;let l=r?n.toLowerCase():n,s=r?a.toLowerCase():a,c=0;for(;c<s.length;){let e;if(d.value){let t=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=r?"gi":"g",o=RegExp(`\\b${t}\\b`,n);o.lastIndex=c;let i=o.exec(s);if(!i)break;e=i.index}else if(e=s.indexOf(l,c),-1===e)break;let t=o+1+e,a=t+n.length;i.push({from:t,to:a}),c=e+Math.max(1,n.length)}return!1}),p.value=i,i.length>0&&(h.value=0,v(0))}function v(e){let t=o.view;if(!t||0===p.value.length)return;let n=p.value[e];if(!n)return;h.value=e;let{from:r,to:i}=n;try{let e=t.state.doc.resolve(r),n=t.state.doc.resolve(i),o=ln.between(e,n);t.dispatch(t.state.tr.setSelection(o).scrollIntoView())}catch{}}function y(){0!==p.value.length?v((h.value+1)%p.value.length):g()}function b(){0!==p.value.length&&v((h.value-1+p.value.length)%p.value.length)}function w(){let e=o.view;if(!e||h.value<0||0===p.value.length)return;let t=p.value[h.value];if(t){try{let n;n=s.value?e.state.tr.replaceWith(t.from,t.to,e.state.schema.text(s.value)):e.state.tr.delete(t.from,t.to),e.dispatch(n)}catch{}g()}}function k(){let e=o.view;if(!e||0===p.value.length)return;let t=[...p.value].sort((e,t)=>t.from-e.from),n=e.state.tr;for(let r of t)try{n=s.value?n.replaceWith(r.from,r.to,e.state.schema.text(s.value)):n.delete(r.from,r.to)}catch{}e.dispatch(n),g()}function x(){p.value=[],h.value=-1}function S(e){"Enter"===e.key?(e.preventDefault(),e.shiftKey?b():y()):"Escape"===e.key&&m()}return(0,n.watch)(()=>o.isOpen,async e=>{e?(await(0,n.nextTick)(),a.value?.focus(),a.value?.select(),g()):x()}),(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"find-replace-dialog",onMousedown:o[5]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[6]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",Sc,[(0,n.createElementVNode)("span",Cc,(0,n.toDisplayString)(u.value?(0,n.unref)(r)("dialogs.findReplace.titleFindReplace"):(0,n.unref)(r)("dialogs.findReplace.titleFind")),1),(0,n.createElementVNode)("button",{class:"find-replace-dialog__close",onClick:m,title:(0,n.unref)(r)("common.closeDialog")}," ✕ ",8,Tc)]),(0,n.createElementVNode)("div",Ec,[(0,n.createElementVNode)("div",_c,[(0,n.withDirectives)((0,n.createElementVNode)("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":o[0]||=e=>l.value=e,class:"find-replace-dialog__input",placeholder:(0,n.unref)(r)("dialogs.findReplace.findPlaceholder"),"aria-label":(0,n.unref)(r)("dialogs.findReplace.findAriaLabel"),onKeydown:S,onInput:g},null,40,Mc),[[n.vModelText,l.value]]),(0,n.createElementVNode)("span",Nc,(0,n.toDisplayString)(f.value),1),(0,n.createElementVNode)("button",{title:(0,n.unref)(r)("dialogs.findReplace.findPreviousTitle"),onMousedown:(0,n.withModifiers)(b,["prevent"])}," ▲ ",40,Ic),(0,n.createElementVNode)("button",{title:(0,n.unref)(r)("dialogs.findReplace.findNextTitle"),onMousedown:(0,n.withModifiers)(y,["prevent"])}," ▼ ",40,Rc)]),(0,n.createElementVNode)("div",Ac,[(0,n.createElementVNode)("label",null,[(0,n.withDirectives)((0,n.createElementVNode)("input",{type:"checkbox","onUpdate:modelValue":o[1]||=e=>c.value=e,onChange:g},null,544),[[n.vModelCheckbox,c.value]]),(0,n.createTextVNode)(" "+(0,n.toDisplayString)((0,n.unref)(r)("dialogs.findReplace.matchCase")),1)]),(0,n.createElementVNode)("label",null,[(0,n.withDirectives)((0,n.createElementVNode)("input",{type:"checkbox","onUpdate:modelValue":o[2]||=e=>d.value=e,onChange:g},null,544),[[n.vModelCheckbox,d.value]]),(0,n.createTextVNode)(" "+(0,n.toDisplayString)((0,n.unref)(r)("dialogs.findReplace.wholeWords")),1)]),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["find-replace-dialog__toggle",{active:u.value}]),onMousedown:o[3]||=(0,n.withModifiers)(e=>u.value=!u.value,["prevent"]),title:(0,n.unref)(r)("dialogs.findReplace.toggleReplace")}," ↔ "+(0,n.toDisplayString)((0,n.unref)(r)("dialogs.findReplace.replaceButton")),43,Bc)]),u.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Dc,[(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[4]||=e=>s.value=e,class:"find-replace-dialog__input",placeholder:(0,n.unref)(r)("dialogs.findReplace.replacePlaceholder"),"aria-label":(0,n.unref)(r)("dialogs.findReplace.replaceAriaLabel"),onKeydown:(0,n.withKeys)((0,n.withModifiers)(w,["prevent"]),["enter"])},null,40,Fc),[[n.vModelText,s.value]]),(0,n.createElementVNode)("button",{title:(0,n.unref)(r)("dialogs.findReplace.replaceCurrentTitle"),onMousedown:(0,n.withModifiers)(w,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.findReplace.replaceButton")),41,Pc),(0,n.createElementVNode)("button",{title:(0,n.unref)(r)("dialogs.findReplace.replaceAllTitle"),onMousedown:(0,n.withModifiers)(k,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.findReplace.replaceAllButton")),41,Oc)])):(0,n.createCommentVNode)("",!0)])],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-0c72041a"]]),zc={class:"dialog__header"},Vc={class:"dialog__title"},$c=["aria-label"],jc={class:"dialog__body"},Hc={class:"drop-zone__icon"},Wc={class:"drop-zone__text"},qc={class:"drop-zone__hint"},Zc=["src","alt"],Uc=["aria-label"],Kc={key:0,class:"drop-zone__error"},Gc={key:1,class:"image-controls"},Xc={class:"lock-label"},Yc={key:2,class:"image-controls"},Jc={style:{flex:"1"}},Qc=["placeholder"],ed={key:3,class:"dialog__actions"},td=Us((0,n.defineComponent)({__name:"InsertImageDialog",props:{isOpen:{type:Boolean}},emits:["close","insert"],setup(e,{emit:t}){let{t:r}=xc(),o=t,i=(0,n.ref)(null),a=(0,n.ref)(""),l=(0,n.ref)(400),s=(0,n.ref)(300),c=(0,n.ref)(!0),d=(0,n.ref)(""),u=(0,n.ref)(""),p=(0,n.ref)(!1),h=1;function f(){o("close")}function m(){a.value="",u.value="",d.value="",l.value=400,s.value=300}function g(e){p.value=!1;let t=e.dataTransfer?.files?.[0];t&&y(t)}function v(e){let t=e.target.files?.[0];t&&y(t)}function y(e){if(u.value="",!e.type.startsWith("image/"))return void(u.value=r("dialogs.insertImage.invalidFile"));if(e.size>10485760)return void(u.value=r("dialogs.insertImage.fileTooLarge"));d.value=e.name.replace(/\.[^.]+$/,"");let t=new FileReader;t.onload=()=>{let e=t.result,n=new Image;n.onload=()=>{let t=n.naturalWidth,r=n.naturalHeight;t>800&&(r=Math.round(800/t*r),t=800),r>600&&(t=Math.round(600/r*t),r=600),l.value=t,s.value=r,h=t/r,a.value=e},n.onerror=()=>{u.value=r("dialogs.insertImage.loadFailed")},n.src=e},t.onerror=()=>{u.value=r("dialogs.insertImage.readFailed")},t.readAsDataURL(e)}function b(){c.value&&h&&(s.value=Math.round(l.value/h))}function w(){c.value&&h&&(l.value=Math.round(s.value*h))}function k(){a.value&&(o("insert",{src:a.value,width:l.value,height:s.value,alt:d.value}),m(),f())}return(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"dialog-overlay",onMousedown:(0,n.withModifiers)(f,["self"])},[(0,n.createElementVNode)("div",{class:"dialog",onMousedown:o[7]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[8]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",zc,[(0,n.createElementVNode)("span",Vc,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.title")),1),(0,n.createElementVNode)("button",{class:"dialog__close","aria-label":(0,n.unref)(r)("common.closeDialog"),onClick:f}," ✕ ",8,$c)]),(0,n.createElementVNode)("div",jc,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["drop-zone",{"drop-zone--active":p.value}]),onDragover:o[0]||=(0,n.withModifiers)(e=>p.value=!0,["prevent"]),onDragleave:o[1]||=e=>p.value=!1,onDrop:(0,n.withModifiers)(g,["prevent"]),onClick:o[2]||=e=>i.value?.click()},[a.value?((0,n.openBlock)(),(0,n.createElementBlock)("img",{key:1,src:a.value,class:"drop-zone__preview",alt:(0,n.unref)(r)("dialogs.insertImage.preview")},null,8,Zc)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("div",Hc,[(0,n.createVNode)(cc,{name:"image",size:48})]),(0,n.createElementVNode)("div",Wc,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.uploadText")),1),(0,n.createElementVNode)("div",qc,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.uploadSubtext")),1)],64))],34),(0,n.createElementVNode)("input",{ref_key:"fileInput",ref:i,type:"file",accept:"image/*",style:{display:"none"},"aria-label":(0,n.unref)(r)("dialogs.insertImage.uploadAriaLabel"),onChange:v},null,40,Uc),u.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Kc,(0,n.toDisplayString)(u.value),1)):(0,n.createCommentVNode)("",!0),a.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Gc,[(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.widthLabel"))+" ",1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[3]||=e=>l.value=e,type:"number",min:"1",max:"2000",class:"dim-input",onInput:b},null,544),[[n.vModelText,l.value,void 0,{number:!0}]])]),(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.heightLabel"))+" ",1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[4]||=e=>s.value=e,type:"number",min:"1",max:"2000",class:"dim-input",onInput:w},null,544),[[n.vModelText,s.value,void 0,{number:!0}]])]),(0,n.createElementVNode)("label",Xc,[(0,n.withDirectives)((0,n.createElementVNode)("input",{type:"checkbox","onUpdate:modelValue":o[5]||=e=>c.value=e},null,512),[[n.vModelCheckbox,c.value]]),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(c.value?(0,n.unref)(r)("dialogs.insertImage.aspectRatioLocked"):(0,n.unref)(r)("dialogs.insertImage.aspectRatioUnlocked")),1)])])):(0,n.createCommentVNode)("",!0),a.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Yc,[(0,n.createElementVNode)("label",Jc,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.altTextLabel"))+" ",1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[6]||=e=>d.value=e,class:"alt-input",placeholder:(0,n.unref)(r)("dialogs.insertImage.altTextPlaceholder")},null,8,Qc),[[n.vModelText,d.value]])])])):(0,n.createCommentVNode)("",!0),a.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",ed,[(0,n.createElementVNode)("button",{class:"dialog__btn",onClick:m},(0,n.toDisplayString)((0,n.unref)(r)("common.clear")),1),(0,n.createElementVNode)("button",{class:"dialog__btn dialog__btn--primary",onMousedown:(0,n.withModifiers)(k,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertImage.insertButton")),33)])):(0,n.createCommentVNode)("",!0)])],32)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-8ea71e65"]]),nd={class:"dialog__header"},rd={class:"dialog__title"},od=["aria-label"],id={class:"dialog__body"},ad={key:0,class:"link-tabs",role:"tablist"},ld=["aria-selected"],sd=["aria-selected"],cd={key:1,class:"field"},dd={class:"field__label"},ud=["placeholder","aria-invalid","onKeydown"],pd={key:0,class:"field__error"},hd={key:1,class:"field__hint"},fd={key:2,class:"field"},md={class:"field__label"},gd=["onKeydown"],vd={value:""},yd=["value"],bd={class:"field"},wd={class:"field__label"},kd=["placeholder"],xd={class:"field__hint"},Sd={class:"field"},Cd={class:"field__label"},Td=["placeholder"],Ed={class:"dialog__actions"},_d=["disabled"],Md=Us((0,n.defineComponent)({__name:"HyperlinkDialog",props:{isOpen:{type:Boolean},view:{},bookmarks:{}},emits:["close","submit","remove"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(null),l=(0,n.ref)(null),s=(0,n.ref)("url"),c=(0,n.ref)(""),d=(0,n.ref)(""),u=(0,n.ref)(""),p=(0,n.ref)(""),h=(0,n.ref)(!1),f=(0,n.ref)(""),m=(0,n.ref)(!1),g=(0,n.computed)(()=>o.bookmarks??[]),v=(0,n.computed)(()=>"bookmark"===s.value?!!d.value:!!c.value.trim()&&!f.value);function y(e){let t=e.trim();if(!t)return!1;if(/^(mailto:|tel:)/i.test(t))return t.replace(/^(mailto:|tel:)/i,"").length>0;if(/^ftp:\/\//i.test(t))return t.length>6;try{let e=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}}function b(e){let t=e.trim();return/^(https?:\/\/|mailto:|tel:|ftp:\/\/)/i.test(t)?t:`https://${t}`}function w(){i("close")}function k(){if("bookmark"===s.value){if(!d.value)return;return i("submit",{bookmark:d.value,displayText:u.value,tooltip:p.value}),void w()}m.value=!0,y(c.value)?(i("submit",{url:b(c.value),displayText:u.value,tooltip:p.value}),w()):f.value=c.value.trim()?r("dialogs.hyperlink.invalidUrl"):r("dialogs.hyperlink.urlRequired")}function x(){if("url"===s.value){if(m.value=!0,!c.value.trim())return void(f.value="");f.value=y(c.value)?"":r("dialogs.hyperlink.invalidUrl")}}function S(){i("remove"),w()}return(0,n.watch)(c,()=>{f.value&&=""}),(0,n.watch)(()=>o.isOpen,async e=>{if(e){let e=o.view;if(e){let{$from:t,empty:n,from:r,to:o}=e.state.selection,i=(e.state.storedMarks||t.marks()).find(e=>"hyperlink"===e.type.name);if(i){let e=i.attrs.href||"";e.startsWith("#")?(s.value="bookmark",d.value=e.slice(1),c.value=""):(s.value="url",c.value=e,d.value=""),p.value=i.attrs.tooltip||"",h.value=!0}else s.value="url",c.value="",d.value="",p.value="",h.value=!1;u.value=n?"":e.state.doc.textBetween(r,o)}await(0,n.nextTick)(),"bookmark"===s.value?l.value?.focus():a.value?.focus()}else m.value=!1,f.value=""}),(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"dialog-overlay",onMousedown:(0,n.withModifiers)(w,["self"])},[(0,n.createElementVNode)("div",{class:"dialog",onMousedown:o[6]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[7]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",nd,[(0,n.createElementVNode)("span",rd,(0,n.toDisplayString)(h.value?(0,n.unref)(r)("dialogs.hyperlink.titleEdit"):(0,n.unref)(r)("dialogs.hyperlink.titleInsert")),1),(0,n.createElementVNode)("button",{class:"dialog__close","aria-label":(0,n.unref)(r)("common.closeDialog"),onClick:w}," ✕ ",8,od)]),(0,n.createElementVNode)("div",id,[g.value.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",ad,[(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["link-tab",{active:"url"===s.value}]),role:"tab","aria-selected":"url"===s.value,onMousedown:o[0]||=(0,n.withModifiers)(e=>s.value="url",["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.tabWebAddress")),43,ld),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["link-tab",{active:"bookmark"===s.value}]),role:"tab","aria-selected":"bookmark"===s.value,onMousedown:o[1]||=(0,n.withModifiers)(e=>s.value="bookmark",["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.tabBookmark")),43,sd)])):(0,n.createCommentVNode)("",!0),"url"===s.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",cd,[(0,n.createElementVNode)("label",dd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.urlLabel")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{ref_key:"urlInputRef",ref:a,"onUpdate:modelValue":o[2]||=e=>c.value=e,class:(0,n.normalizeClass)(["field__input",{"field__input--error":m.value&&!!f.value}]),placeholder:(0,n.unref)(r)("dialogs.hyperlink.urlPlaceholder"),"aria-invalid":m.value&&!!f.value,onKeydown:(0,n.withKeys)((0,n.withModifiers)(k,["prevent"]),["enter"]),onBlur:x},null,42,ud),[[n.vModelText,c.value]]),m.value&&f.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",pd,(0,n.toDisplayString)(f.value),1)):((0,n.openBlock)(),(0,n.createElementBlock)("div",hd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.urlHint")),1))])):((0,n.openBlock)(),(0,n.createElementBlock)("div",fd,[(0,n.createElementVNode)("label",md,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.bookmarkLabel")),1),(0,n.withDirectives)((0,n.createElementVNode)("select",{ref_key:"bookmarkSelectRef",ref:l,"onUpdate:modelValue":o[3]||=e=>d.value=e,class:"field__input",onKeydown:(0,n.withKeys)((0,n.withModifiers)(k,["prevent"]),["enter"])},[(0,n.createElementVNode)("option",vd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.bookmarkPlaceholder")),1),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(g.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("option",{key:e.name,value:e.name},(0,n.toDisplayString)(e.label||e.name),9,yd))),128))],40,gd),[[n.vModelSelect,d.value]])])),(0,n.createElementVNode)("div",bd,[(0,n.createElementVNode)("label",wd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.displayTextLabel")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[4]||=e=>u.value=e,class:"field__input",placeholder:(0,n.unref)(r)("dialogs.hyperlink.displayTextPlaceholder")},null,8,kd),[[n.vModelText,u.value]]),(0,n.createElementVNode)("div",xd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.displayTextHint")),1)]),(0,n.createElementVNode)("div",Sd,[(0,n.createElementVNode)("label",Cd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.tooltipLabel")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[5]||=e=>p.value=e,class:"field__input",placeholder:(0,n.unref)(r)("dialogs.hyperlink.tooltipPlaceholder")},null,8,Td),[[n.vModelText,p.value]])]),(0,n.createElementVNode)("div",Ed,[h.value?((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:0,class:"dialog__btn dialog__btn--danger",onMousedown:(0,n.withModifiers)(S,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("dialogs.hyperlink.removeLink")),33)):(0,n.createCommentVNode)("",!0),o[8]||=(0,n.createElementVNode)("div",{style:{flex:"1"}},null,-1),(0,n.createElementVNode)("button",{class:"dialog__btn",onClick:w},(0,n.toDisplayString)((0,n.unref)(r)("common.cancel")),1),(0,n.createElementVNode)("button",{class:"dialog__btn dialog__btn--primary",onMousedown:(0,n.withModifiers)(k,["prevent"]),disabled:!v.value},(0,n.toDisplayString)(h.value?(0,n.unref)(r)("common.update"):(0,n.unref)(r)("common.insert")),41,_d)])])],32)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-4dc1170f"]]),Nd={class:"dialog__header"},Id={class:"dialog__title"},Rd=["title"],Ad={class:"dialog__body"},Bd=["placeholder"],Dd={key:0,class:"symbol-tabs"},Fd=["onMousedown"],Pd={class:"symbol-grid"},Od=["title","onClick","onDblclick"],Ld={key:0,class:"symbol-empty"},zd={key:1,class:"symbol-preview"},Vd={class:"symbol-preview__char"},$d={class:"symbol-preview__info"},jd={key:2,class:"symbol-recent"},Hd={class:"symbol-recent__label"},Wd=["onDblclick","onClick"],qd={class:"dialog__actions"},Zd=["disabled"],Ud=Us((0,n.defineComponent)({__name:"InsertSymbolDialog",props:{isOpen:{type:Boolean}},emits:["close","insert"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(null),l=(0,n.ref)(""),s=(0,n.ref)("Common"),c=(0,n.ref)(""),d=(0,n.ref)([]),u=[{name:"Common",nameKey:"dialogs.insertSymbol.categories.common",symbols:[{char:"©",name:"Copyright"},{char:"®",name:"Registered"},{char:"™",name:"Trademark"},{char:"•",name:"Bullet"},{char:"…",name:"Ellipsis"},{char:"—",name:"Em dash"},{char:"–",name:"En dash"},{char:"±",name:"Plus-minus"},{char:"×",name:"Multiply"},{char:"÷",name:"Divide"},{char:"≠",name:"Not equal"},{char:"≈",name:"Approximately"},{char:"≤",name:"Less or equal"},{char:"≥",name:"Greater or equal"},{char:"°",name:"Degree"},{char:"µ",name:"Micro"},{char:"¶",name:"Pilcrow"},{char:"§",name:"Section"},{char:"†",name:"Dagger"},{char:"‡",name:"Double dagger"},{char:"¿",name:"Inverted question"},{char:"¡",name:"Inverted exclamation"},{char:"‰",name:"Per mille"},{char:"∞",name:"Infinity"}]},{name:"Arrows",nameKey:"dialogs.insertSymbol.categories.arrows",symbols:[{char:"←",name:"Left"},{char:"→",name:"Right"},{char:"↑",name:"Up"},{char:"↓",name:"Down"},{char:"↔",name:"Left-right"},{char:"↕",name:"Up-down"},{char:"⇐",name:"Double left"},{char:"⇒",name:"Double right"},{char:"⇑",name:"Double up"},{char:"⇓",name:"Double down"},{char:"⇔",name:"Double left-right"},{char:"➡",name:"Heavy right"},{char:"↩",name:"Return"},{char:"↪",name:"Curved right"},{char:"↻",name:"Clockwise"},{char:"↺",name:"Counter-clockwise"}]},{name:"Math",nameKey:"dialogs.insertSymbol.categories.math",symbols:[{char:"∑",name:"Summation"},{char:"∏",name:"Product"},{char:"∫",name:"Integral"},{char:"√",name:"Square root"},{char:"∂",name:"Partial diff"},{char:"∇",name:"Nabla"},{char:"∈",name:"Element of"},{char:"∉",name:"Not element"},{char:"⊂",name:"Subset"},{char:"⊃",name:"Superset"},{char:"∪",name:"Union"},{char:"∩",name:"Intersection"},{char:"∧",name:"And"},{char:"∨",name:"Or"},{char:"¬",name:"Not"},{char:"∀",name:"For all"},{char:"∃",name:"Exists"},{char:"∅",name:"Empty set"},{char:"∝",name:"Proportional"},{char:"∠",name:"Angle"}]},{name:"Greek",nameKey:"dialogs.insertSymbol.categories.greek",symbols:[{char:"α",name:"alpha"},{char:"β",name:"beta"},{char:"γ",name:"gamma"},{char:"δ",name:"delta"},{char:"ε",name:"epsilon"},{char:"ζ",name:"zeta"},{char:"η",name:"eta"},{char:"θ",name:"theta"},{char:"λ",name:"lambda"},{char:"μ",name:"mu"},{char:"π",name:"pi"},{char:"ρ",name:"rho"},{char:"σ",name:"sigma"},{char:"τ",name:"tau"},{char:"φ",name:"phi"},{char:"ψ",name:"psi"},{char:"ω",name:"omega"},{char:"Δ",name:"Delta"},{char:"Σ",name:"Sigma"},{char:"Ω",name:"Omega"},{char:"Π",name:"Pi"},{char:"Φ",name:"Phi"},{char:"Ψ",name:"Psi"},{char:"Θ",name:"Theta"}]},{name:"Currency",nameKey:"dialogs.insertSymbol.categories.currency",symbols:[{char:"$",name:"Dollar"},{char:"€",name:"Euro"},{char:"£",name:"Pound"},{char:"¥",name:"Yen"},{char:"₹",name:"Rupee"},{char:"₽",name:"Ruble"},{char:"₩",name:"Won"},{char:"₿",name:"Bitcoin"},{char:"¢",name:"Cent"},{char:"₫",name:"Dong"},{char:"₺",name:"Lira"},{char:"₴",name:"Hryvnia"}]},{name:"Shapes",nameKey:"dialogs.insertSymbol.categories.shapes",symbols:[{char:"■",name:"Black square"},{char:"□",name:"White square"},{char:"▲",name:"Up triangle"},{char:"▼",name:"Down triangle"},{char:"●",name:"Black circle"},{char:"○",name:"White circle"},{char:"◆",name:"Black diamond"},{char:"◇",name:"White diamond"},{char:"★",name:"Black star"},{char:"☆",name:"White star"},{char:"♠",name:"Spade"},{char:"♥",name:"Heart"},{char:"♦",name:"Diamond"},{char:"♣",name:"Club"},{char:"✓",name:"Check mark"},{char:"✗",name:"Ballot X"},{char:"✦",name:"Four pointed star"},{char:"◌",name:"Dotted circle"}]}],p=(0,n.computed)(()=>{let e=[];for(let t of u)for(let n of t.symbols)e.push({...n,category:t.name});return e}),h=(0,n.computed)(()=>{if(l.value){let e=l.value.toLowerCase();return p.value.filter(t=>t.name.toLowerCase().includes(e)||t.char===e)}let e=u.find(e=>e.name===s.value);return e?e.symbols.map(t=>({...t,category:e.name})):[]});function f(){i("close")}function m(e){e&&(d.value=[e,...d.value.filter(t=>t!==e)].slice(0,10),i("insert",e))}return(0,n.watch)(()=>o.isOpen,async e=>{e&&(await(0,n.nextTick)(),a.value?.focus())}),(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"dialog-overlay",onMousedown:(0,n.withModifiers)(f,["self"])},[(0,n.createElementVNode)("div",{class:"dialog symbol-dialog",onMousedown:o[2]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[3]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",Nd,[(0,n.createElementVNode)("span",Id,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertSymbol.title")),1),(0,n.createElementVNode)("button",{class:"dialog__close",title:(0,n.unref)(r)("common.closeDialog"),onClick:f},"✕",8,Rd)]),(0,n.createElementVNode)("div",Ad,[(0,n.withDirectives)((0,n.createElementVNode)("input",{ref_key:"searchRef",ref:a,"onUpdate:modelValue":o[0]||=e=>l.value=e,class:"symbol-search",placeholder:(0,n.unref)(r)("dialogs.insertSymbol.searchPlaceholder"),onKeydown:(0,n.withKeys)(f,["escape"])},null,40,Bd),[[n.vModelText,l.value]]),l.value?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",Dd,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(u,e=>(0,n.createElementVNode)("button",{key:e.name,class:(0,n.normalizeClass)(["symbol-tab",{active:s.value===e.name}]),onMousedown:(0,n.withModifiers)(t=>s.value=e.name,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)(e.nameKey)),43,Fd)),64))])),(0,n.createElementVNode)("div",Pd,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.char,class:(0,n.normalizeClass)(["symbol-cell",{selected:c.value===e.char}]),title:e.name,onClick:t=>c.value=e.char,onDblclick:t=>m(e.char)},(0,n.toDisplayString)(e.char),43,Od))),128)),0===h.value.length?((0,n.openBlock)(),(0,n.createElementBlock)("div",Ld,(0,n.toDisplayString)(l.value?(0,n.unref)(r)("dialogs.insertSymbol.noResults",{query:l.value}):(0,n.unref)(r)("dialogs.insertSymbol.noResultsEmpty")),1)):(0,n.createCommentVNode)("",!0)]),c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",zd,[(0,n.createElementVNode)("span",Vd,(0,n.toDisplayString)(c.value),1),(0,n.createElementVNode)("span",$d,"U+"+(0,n.toDisplayString)(c.value.codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")),1)])):(0,n.createCommentVNode)("",!0),d.value.length>0&&!l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",jd,[(0,n.createElementVNode)("div",Hd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.insertSymbol.recent")),1),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e,class:"symbol-cell symbol-cell--small",onDblclick:t=>m(e),onClick:t=>c.value=e},(0,n.toDisplayString)(e),41,Wd))),128))])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",qd,[(0,n.createElementVNode)("button",{class:"dialog__btn",onClick:f},(0,n.toDisplayString)((0,n.unref)(r)("common.cancel")),1),(0,n.createElementVNode)("button",{class:"dialog__btn dialog__btn--primary",onMousedown:o[1]||=(0,n.withModifiers)(e=>m(c.value),["prevent"]),disabled:!c.value},(0,n.toDisplayString)((0,n.unref)(r)("common.insert")),41,Zd)])])],32)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-c5817b27"]]),Kd={class:"dialog__header"},Gd={class:"dialog__title"},Xd=["aria-label"],Yd={class:"dialog__body"},Jd={class:"field"},Qd={class:"field__label"},eu=["placeholder"],tu={class:"field"},nu={class:"field__label"},ru={value:"inline"},ou={value:"wrapRight"},iu={value:"wrapLeft"},au={value:"topAndBottom"},lu={value:"behind"},su={value:"inFront"},cu={class:"field"},du={class:"field__label"},uu={class:"field-row"},pu={value:"solid"},hu={value:"dashed"},fu={value:"dotted"},mu={value:"double"},gu={class:"field"},vu={class:"field__label"},yu={class:"field-row"},bu=["value"],wu=["value"],ku={class:"field__checkbox"},xu={class:"dialog__actions"},Su=Us((0,n.defineComponent)({__name:"ImagePropertiesDialog",props:{isOpen:{type:Boolean},view:{},pmPos:{}},emits:["close"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(""),l=(0,n.ref)("inline"),s=(0,n.ref)(0),c=(0,n.ref)("solid"),d=(0,n.ref)("#000000"),u=(0,n.ref)(200),p=(0,n.ref)(150),h=(0,n.ref)(!0),f=1;function m(e){let t=Number(e.target.value);isNaN(t)||t<1||(u.value=t,h.value&&f>0&&(p.value=Math.round(t/f)))}function g(e){let t=Number(e.target.value);isNaN(t)||t<1||(p.value=t,h.value&&f>0&&(u.value=Math.round(t*f)))}function v(){i("close")}function y(){let e=o.view;if(e&&null!==o.pmPos){try{let t=e.state.doc.nodeAt(o.pmPos);if(!t||"image"!==t.type.name)return;let n="inline",r=null,i="inline";switch(l.value){case"wrapRight":n="float",r="left",i="square";break;case"wrapLeft":n="float",r="right",i="square";break;case"topAndBottom":n="block",i="topAndBottom";break;case"behind":n="float",r="none",i="behind";break;case"inFront":n="float",r="none",i="inFront";break;default:n="inline",i="inline";break}let h=e.state.tr.setNodeMarkup(o.pmPos,void 0,{...t.attrs,alt:a.value,width:u.value,height:p.value,borderWidth:s.value||void 0,borderStyle:s.value>0?c.value:void 0,borderColor:s.value>0?d.value:void 0,displayMode:n,cssFloat:r,wrapType:i});e.dispatch(h)}catch{}v()}}return(0,n.watch)(()=>o.isOpen,e=>{if(e&&o.view&&null!==o.pmPos)try{let e=o.view.state.doc.nodeAt(o.pmPos);if(e&&"image"===e.type.name){a.value=e.attrs.alt||"",s.value=e.attrs.borderWidth||0,c.value=e.attrs.borderStyle||"solid",d.value=e.attrs.borderColor||"#000000",u.value=e.attrs.width||200,p.value=e.attrs.height||150,f=u.value/(p.value||1),h.value=!0;let t=e.attrs.displayMode,n=e.attrs.cssFloat,r=e.attrs.wrapType;l.value="float"===t&&"left"===n?"wrapRight":"float"===t&&"right"===n?"wrapLeft":"block"===t?"topAndBottom":"behind"===r?"behind":"inFront"===r?"inFront":"inline"}}catch{}}),(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"dialog-overlay",onMousedown:(0,n.withModifiers)(v,["self"])},[(0,n.createElementVNode)("div",{class:"dialog",onMousedown:o[6]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[7]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",Kd,[(0,n.createElementVNode)("span",Gd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.title")),1),(0,n.createElementVNode)("button",{class:"dialog__close","aria-label":(0,n.unref)(r)("common.closeDialog"),onClick:v}," ✕ ",8,Xd)]),(0,n.createElementVNode)("div",Yd,[(0,n.createElementVNode)("div",Jd,[(0,n.createElementVNode)("label",Qd,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.altText")),1),(0,n.withDirectives)((0,n.createElementVNode)("textarea",{"onUpdate:modelValue":o[0]||=e=>a.value=e,class:"field__textarea",placeholder:(0,n.unref)(r)("dialogs.imageProperties.altTextPlaceholder"),rows:"2"},null,8,eu),[[n.vModelText,a.value]])]),(0,n.createElementVNode)("div",tu,[(0,n.createElementVNode)("label",nu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.textWrapping")),1),(0,n.withDirectives)((0,n.createElementVNode)("select",{"onUpdate:modelValue":o[1]||=e=>l.value=e,class:"field__select"},[(0,n.createElementVNode)("option",ru,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.inline")),1),(0,n.createElementVNode)("option",ou,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.wrapRight")),1),(0,n.createElementVNode)("option",iu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.wrapLeft")),1),(0,n.createElementVNode)("option",au,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.topAndBottom")),1),(0,n.createElementVNode)("option",lu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.behind")),1),(0,n.createElementVNode)("option",su,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.wrapOptions.inFront")),1)],512),[[n.vModelSelect,l.value]])]),(0,n.createElementVNode)("div",cu,[(0,n.createElementVNode)("label",du,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.border")),1),(0,n.createElementVNode)("div",uu,[(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.width"))+": ",1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[2]||=e=>s.value=e,type:"number",min:"0",max:"20",step:"0.5",class:"field__input--small"},null,512),[[n.vModelText,s.value,void 0,{number:!0}]]),(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("common.px")),1)]),(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.style"))+": ",1),(0,n.withDirectives)((0,n.createElementVNode)("select",{"onUpdate:modelValue":o[3]||=e=>c.value=e,class:"field__select--small"},[(0,n.createElementVNode)("option",pu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.borderStyles.solid")),1),(0,n.createElementVNode)("option",hu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.borderStyles.dashed")),1),(0,n.createElementVNode)("option",fu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.borderStyles.dotted")),1),(0,n.createElementVNode)("option",mu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.borderStyles.double")),1)],512),[[n.vModelSelect,c.value]])]),(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.color"))+": ",1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[4]||=e=>d.value=e,type:"color",class:"field__color"},null,512),[[n.vModelText,d.value]])])])]),(0,n.createElementVNode)("div",gu,[(0,n.createElementVNode)("label",vu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.dimensions")),1),(0,n.createElementVNode)("div",yu,[(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.widthLabel"))+" ",1),(0,n.createElementVNode)("input",{value:u.value,type:"number",min:"1",max:"2000",class:"field__input--small",onInput:m},null,40,bu),(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("common.px")),1)]),(0,n.createElementVNode)("label",null,[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.heightLabel"))+" ",1),(0,n.createElementVNode)("input",{value:p.value,type:"number",min:"1",max:"2000",class:"field__input--small",onInput:g},null,40,wu),(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(r)("common.px")),1)])]),(0,n.createElementVNode)("label",ku,[(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":o[5]||=e=>h.value=e,type:"checkbox"},null,512),[[n.vModelCheckbox,h.value]]),(0,n.createTextVNode)(" "+(0,n.toDisplayString)((0,n.unref)(r)("dialogs.imageProperties.lockAspectRatio")),1)])]),(0,n.createElementVNode)("div",xu,[(0,n.createElementVNode)("button",{class:"dialog__btn",onClick:v},(0,n.toDisplayString)((0,n.unref)(r)("common.cancel")),1),(0,n.createElementVNode)("button",{class:"dialog__btn dialog__btn--primary",onMousedown:(0,n.withModifiers)(y,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("common.apply")),33)])])],32)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-2bc21138"]]),Cu=["aria-label"],Tu={class:"ps-header"},Eu={class:"ps-body"},_u={class:"ps-section-label"},Mu={class:"ps-row"},Nu={class:"ps-label"},Iu=["value"],Ru=["value"],Au={key:0,value:-1},Bu={class:"ps-row"},Du={class:"ps-label"},Fu=["value"],Pu={value:"portrait"},Ou={value:"landscape"},Lu={class:"ps-section-label ps-section-label--spaced"},zu={class:"ps-row"},Vu={class:"ps-label"},$u={class:"ps-row"},ju={class:"ps-label"},Hu={class:"ps-row"},Wu={class:"ps-label"},qu={class:"ps-row"},Zu={class:"ps-label"},Uu={class:"ps-footer"},Ku=12240,Gu=15840,Xu=1440,Yu=Us((0,n.defineComponent)({__name:"PageSetupDialog",props:{isOpen:{type:Boolean},sectionProperties:{}},emits:["close","apply"],setup(e,{emit:t}){let{t:r}=xc(),o=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],i=e,a=t,l=(0,n.ref)(Ku),s=(0,n.ref)(Gu),c=(0,n.ref)("portrait"),d=(0,n.ref)(1),u=(0,n.ref)(1),p=(0,n.ref)(1),h=(0,n.ref)(1);function f(e){return Math.round(e/Ks*100)/100}function m(e){return Math.round((Number(e)||0)*Ks)}let g=(0,n.computed)(()=>{let e=Math.min(l.value,s.value),t=Math.max(l.value,s.value);return o.findIndex(n=>Math.abs(n.width-e)<20&&Math.abs(n.height-t)<20)});function v(e){let t=Number(e.target.value);if(t<0)return;let n=o[t];"landscape"===c.value?(l.value=n.height,s.value=n.width):(l.value=n.width,s.value=n.height)}function y(e){let t=e.target.value;if(t===c.value)return;c.value=t;let n=l.value;l.value=s.value,s.value=n}function b(){a("close")}function w(){a("apply",{pageWidth:l.value,pageHeight:s.value,orientation:c.value,marginTop:m(d.value),marginBottom:m(u.value),marginLeft:m(p.value),marginRight:m(h.value)}),b()}function k(e){"Escape"===e.key&&b(),"Enter"===e.key&&w()}return(0,n.watch)(()=>i.isOpen,e=>{if(!e)return;let t=i.sectionProperties,n=t?.pageWidth||Ku,r=t?.pageHeight||Gu;l.value=n,s.value=r,c.value=t?.orientation||(n>r?"landscape":"portrait"),d.value=f(t?.marginTop??Xu),u.value=f(t?.marginBottom??Xu),p.value=f(t?.marginLeft??Xu),h.value=f(t?.marginRight??Xu)},{immediate:!0}),(t,i)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"ps-overlay",onMousedown:(0,n.withModifiers)(b,["self"]),onKeydown:k},[(0,n.createElementVNode)("div",{class:"ps-dialog",role:"dialog","aria-label":(0,n.unref)(r)("dialogs.pageSetup.title"),onMousedown:i[4]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",Tu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.title")),1),(0,n.createElementVNode)("div",Eu,[(0,n.createElementVNode)("div",_u,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.pageSize")),1),(0,n.createElementVNode)("div",Mu,[(0,n.createElementVNode)("label",Nu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.sizeLabel")),1),(0,n.createElementVNode)("select",{class:"ps-input",value:g.value,onChange:v},[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(o,(e,t)=>(0,n.createElementVNode)("option",{key:e.labelKey,value:t},(0,n.toDisplayString)((0,n.unref)(r)(e.labelKey)),9,Ru)),64)),g.value<0?((0,n.openBlock)(),(0,n.createElementBlock)("option",Au,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.custom")),1)):(0,n.createCommentVNode)("",!0)],40,Iu)]),(0,n.createElementVNode)("div",Bu,[(0,n.createElementVNode)("label",Du,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.orientation")),1),(0,n.createElementVNode)("select",{class:"ps-input",value:c.value,onChange:y},[(0,n.createElementVNode)("option",Pu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.portrait")),1),(0,n.createElementVNode)("option",Ou,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.landscape")),1)],40,Fu)]),(0,n.createElementVNode)("div",Lu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.margins")),1),(0,n.createElementVNode)("div",zu,[(0,n.createElementVNode)("label",Vu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.top")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"ps-input",type:"number",min:"0",max:"10",step:"0.1","onUpdate:modelValue":i[0]||=e=>d.value=e},null,512),[[n.vModelText,d.value,void 0,{number:!0}]]),i[5]||=(0,n.createElementVNode)("span",{class:"ps-unit"},"in",-1)]),(0,n.createElementVNode)("div",$u,[(0,n.createElementVNode)("label",ju,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.bottom")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"ps-input",type:"number",min:"0",max:"10",step:"0.1","onUpdate:modelValue":i[1]||=e=>u.value=e},null,512),[[n.vModelText,u.value,void 0,{number:!0}]]),i[6]||=(0,n.createElementVNode)("span",{class:"ps-unit"},"in",-1)]),(0,n.createElementVNode)("div",Hu,[(0,n.createElementVNode)("label",Wu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.left")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"ps-input",type:"number",min:"0",max:"10",step:"0.1","onUpdate:modelValue":i[2]||=e=>p.value=e},null,512),[[n.vModelText,p.value,void 0,{number:!0}]]),i[7]||=(0,n.createElementVNode)("span",{class:"ps-unit"},"in",-1)]),(0,n.createElementVNode)("div",qu,[(0,n.createElementVNode)("label",Zu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.pageSetup.right")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"ps-input",type:"number",min:"0",max:"10",step:"0.1","onUpdate:modelValue":i[3]||=e=>h.value=e},null,512),[[n.vModelText,h.value,void 0,{number:!0}]]),i[8]||=(0,n.createElementVNode)("span",{class:"ps-unit"},"in",-1)])]),(0,n.createElementVNode)("div",Uu,[(0,n.createElementVNode)("button",{type:"button",class:"ps-btn",onClick:b},(0,n.toDisplayString)((0,n.unref)(r)("common.cancel")),1),(0,n.createElementVNode)("button",{type:"button",class:"ps-btn ps-btn--primary",onClick:w},(0,n.toDisplayString)((0,n.unref)(r)("common.apply")),1)])],40,Cu)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-bd508fe8"]]),Ju={class:"kbd-dialog__header"},Qu={class:"kbd-dialog__title"},ep=["aria-label"],tp={key:0,class:"kbd-dialog__search"},np=["placeholder"],rp={class:"kbd-dialog__body"},op={class:"kbd-category"},ip={class:"kbd-item__info"},ap={class:"kbd-item__name"},lp={class:"kbd-item__desc"},sp={class:"kbd-item__keys"},cp={class:"kbd-badge"},dp={class:"kbd-or"},up={class:"kbd-badge"},pp={key:0,class:"kbd-dialog__empty"},hp={class:"kbd-dialog__footer"},fp={key:0,class:"kbd-badge kbd-badge--small"},mp=Us((0,n.defineComponent)({__name:"KeyboardShortcutsDialog",props:{isOpen:{type:Boolean},showSearch:{type:Boolean,default:!0}},emits:["close"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(null),l=(0,n.ref)(""),s=typeof navigator<"u"&&/Mac/.test(navigator.platform);function c(e){return s?e.replace(/Ctrl/g,"⌘").replace(/Alt/g,"⌥").replace(/Shift/g,"⇧"):e}function d(){l.value="",i("close")}(0,n.watch)(()=>o.isOpen,e=>{e&&(0,n.nextTick)(()=>a.value?.focus())});let u=(0,n.computed)(()=>r("dialogs.keyboardShortcuts.pressEscToClose",{key:"Esc"}).split("Esc")),p=[{id:"undo",nameKey:"dialogs.keyboardShortcuts.shortcuts.undo",name:"Undo",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.undoDescription",description:"Undo last action",keys:"Ctrl+Z",category:"Editing"},{id:"redo",nameKey:"dialogs.keyboardShortcuts.shortcuts.redo",name:"Redo",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.redoDescription",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"Editing"},{id:"find",nameKey:"dialogs.keyboardShortcuts.shortcuts.find",name:"Find",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findDescription",description:"Open find dialog",keys:"Ctrl+F",category:"Editing"},{id:"replace",nameKey:"dialogs.keyboardShortcuts.shortcuts.findReplace",name:"Find & Replace",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findReplaceDescription",description:"Open find and replace",keys:"Ctrl+H",category:"Editing"},{id:"delete",nameKey:"dialogs.keyboardShortcuts.shortcuts.delete",name:"Delete",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.deleteDescription",description:"Delete selected content",keys:"Del",altKeys:"Backspace",category:"Editing"},{id:"cut",nameKey:"dialogs.keyboardShortcuts.shortcuts.cut",name:"Cut",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.cutDescription",description:"Cut selection",keys:"Ctrl+X",category:"Clipboard"},{id:"copy",nameKey:"dialogs.keyboardShortcuts.shortcuts.copy",name:"Copy",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.copyDescription",description:"Copy selection",keys:"Ctrl+C",category:"Clipboard"},{id:"paste",nameKey:"dialogs.keyboardShortcuts.shortcuts.paste",name:"Paste",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pasteDescription",description:"Paste content",keys:"Ctrl+V",category:"Clipboard"},{id:"bold",nameKey:"dialogs.keyboardShortcuts.shortcuts.bold",name:"Bold",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.boldDescription",description:"Toggle bold",keys:"Ctrl+B",category:"Formatting"},{id:"italic",nameKey:"dialogs.keyboardShortcuts.shortcuts.italic",name:"Italic",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.italicDescription",description:"Toggle italic",keys:"Ctrl+I",category:"Formatting"},{id:"underline",nameKey:"dialogs.keyboardShortcuts.shortcuts.underline",name:"Underline",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.underlineDescription",description:"Toggle underline",keys:"Ctrl+U",category:"Formatting"},{id:"strike",nameKey:"dialogs.keyboardShortcuts.shortcuts.strikethrough",name:"Strikethrough",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.strikethroughDescription",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"Formatting"},{id:"subscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.subscript",name:"Subscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.subscriptDescription",description:"Toggle subscript",keys:"Ctrl+=",category:"Formatting"},{id:"superscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.superscript",name:"Superscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.superscriptDescription",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"Formatting"},{id:"alignLeft",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignLeft",name:"Align Left",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignLeftDescription",description:"Left alignment",keys:"Ctrl+L",category:"Formatting"},{id:"alignCenter",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignCenter",name:"Align Center",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignCenterDescription",description:"Center alignment",keys:"Ctrl+E",category:"Formatting"},{id:"alignRight",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignRight",name:"Align Right",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignRightDescription",description:"Right alignment",keys:"Ctrl+R",category:"Formatting"},{id:"justify",nameKey:"dialogs.keyboardShortcuts.shortcuts.justify",name:"Justify",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.justifyDescription",description:"Justify alignment",keys:"Ctrl+J",category:"Formatting"},{id:"indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndent",name:"Increase Indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndentDescription",description:"Increase indent level",keys:"Tab",category:"Formatting"},{id:"outdent",nameKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndent",name:"Decrease Indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndentDescription",description:"Decrease indent level",keys:"Shift+Tab",category:"Formatting"},{id:"link",nameKey:"dialogs.keyboardShortcuts.shortcuts.insertLink",name:"Insert Link",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.insertLinkDescription",description:"Insert or edit hyperlink",keys:"Ctrl+K",category:"Formatting"},{id:"selectAll",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectAll",name:"Select All",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectAllDescription",description:"Select all content",keys:"Ctrl+A",category:"Selection"},{id:"selectWord",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectWord",name:"Select Word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectWordDescription",description:"Select current word",keys:"Double-click",category:"Selection"},{id:"selectPara",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraph",name:"Select Paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraphDescription",description:"Select current paragraph",keys:"Triple-click",category:"Selection"},{id:"moveWord",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveByWord",name:"Move by Word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveByWordDescription",description:"Jump to next/previous word",keys:"Ctrl+Arrow",category:"Navigation"},{id:"lineStart",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStart",name:"Line Start",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStartDescription",description:"Move to start of line",keys:"Home",category:"Navigation"},{id:"lineEnd",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEnd",name:"Line End",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEndDescription",description:"Move to end of line",keys:"End",category:"Navigation"},{id:"docStart",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStart",name:"Document Start",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStartDescription",description:"Move to start of document",keys:"Ctrl+Home",category:"Navigation"},{id:"docEnd",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEnd",name:"Document End",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEndDescription",description:"Move to end of document",keys:"Ctrl+End",category:"Navigation"},{id:"zoomIn",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomIn",name:"Zoom In",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomInDescription",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+=",category:"View"},{id:"zoomOut",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomOut",name:"Zoom Out",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomOutDescription",description:"Decrease zoom level",keys:"Ctrl+-",category:"View"},{id:"zoomReset",nameKey:"dialogs.keyboardShortcuts.shortcuts.resetZoom",name:"Reset Zoom",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.resetZoomDescription",description:"Reset to 100% zoom",keys:"Ctrl+0",category:"View"},{id:"shortcuts",nameKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcuts",name:"Keyboard Shortcuts",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcutsDescription",description:"Show this dialog",keys:"Ctrl+/",altKeys:"F1",category:"View"}],h={Editing:"dialogs.keyboardShortcuts.categories.editing",Clipboard:"dialogs.keyboardShortcuts.categories.clipboard",Formatting:"dialogs.keyboardShortcuts.categories.formatting",Selection:"dialogs.keyboardShortcuts.categories.selection",Navigation:"dialogs.keyboardShortcuts.categories.navigation",View:"dialogs.keyboardShortcuts.categories.view"},f=["Editing","Clipboard","Formatting","Selection","Navigation","View"],m=(0,n.computed)(()=>{let e=l.value.toLowerCase().trim(),t=[];for(let n of f){let o=p.filter(e=>e.category===n);e&&(o=o.filter(t=>{let n=t.nameKey?r(t.nameKey):t.name,o=t.descriptionKey?r(t.descriptionKey):t.description;return n.toLowerCase().includes(e)||o.toLowerCase().includes(e)||t.keys.toLowerCase().includes(e)||null!=t.altKeys&&t.altKeys.toLowerCase().includes(e)})),o.length>0&&t.push({name:n,labelKey:h[n],shortcuts:o})}return t});return(t,o)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"kbd-overlay",onMousedown:(0,n.withModifiers)(d,["self"])},[(0,n.createElementVNode)("div",{class:"kbd-dialog",onMousedown:o[1]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:o[2]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",Ju,[(0,n.createElementVNode)("span",Qu,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.keyboardShortcuts.ariaLabel")),1),(0,n.createElementVNode)("button",{class:"kbd-dialog__close","aria-label":(0,n.unref)(r)("common.closeDialog"),onClick:d}," ✕ ",8,ep)]),e.showSearch?((0,n.openBlock)(),(0,n.createElementBlock)("div",tp,[(0,n.withDirectives)((0,n.createElementVNode)("input",{ref_key:"searchInput",ref:a,"onUpdate:modelValue":o[0]||=e=>l.value=e,class:"kbd-dialog__search-input",placeholder:(0,n.unref)(r)("dialogs.keyboardShortcuts.searchPlaceholder"),type:"text"},null,8,np),[[n.vModelText,l.value]])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",rp,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:e.name},[(0,n.createElementVNode)("div",op,(0,n.toDisplayString)((0,n.unref)(r)(e.labelKey).toUpperCase()),1),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.shortcuts,e=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:e.id,class:"kbd-item"},[(0,n.createElementVNode)("div",ip,[(0,n.createElementVNode)("span",ap,(0,n.toDisplayString)(e.nameKey?(0,n.unref)(r)(e.nameKey):e.name),1),(0,n.createElementVNode)("span",lp,(0,n.toDisplayString)(e.descriptionKey?(0,n.unref)(r)(e.descriptionKey):e.description),1)]),(0,n.createElementVNode)("div",sp,[(0,n.createElementVNode)("kbd",cp,(0,n.toDisplayString)(c(e.keys)),1),e.altKeys?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("span",dp,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.keyboardShortcuts.or")),1),(0,n.createElementVNode)("kbd",up,(0,n.toDisplayString)(c(e.altKeys)),1)],64)):(0,n.createCommentVNode)("",!0)])]))),128))],64))),128)),0===m.value.length?((0,n.openBlock)(),(0,n.createElementBlock)("div",pp,(0,n.toDisplayString)((0,n.unref)(r)("dialogs.keyboardShortcuts.noResults",{query:l.value})),1)):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",hp,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(u.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e),1),t<u.value.length-1?((0,n.openBlock)(),(0,n.createElementBlock)("kbd",fp,"Esc")):(0,n.createCommentVNode)("",!0)],64))),128))])],32)],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-77199050"]]),gp=200,vp=function(){};vp.prototype.append=function(e){return e.length?(e=vp.from(e),!this.length&&e||e.length<gp&&this.leafAppend(e)||this.length<gp&&e.leafPrepend(this)||this.appendInner(e)):this},vp.prototype.prepend=function(e){return e.length?vp.from(e).append(this):this},vp.prototype.appendInner=function(e){return new bp(this,e)},vp.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?vp.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},vp.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},vp.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},vp.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},vp.from=function(e){return e instanceof vp?e:e&&e.length?new yp(e):vp.empty};var yp=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=gp)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=gp)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(vp);vp.empty=new yp([]);var bp=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(vp),wp=vp;const kp=500;class xp{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){let e=this.items.get(o-1);if(e.selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,a,l=e.tr,s=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Cp(e.map));let t,o=e.step.map(n.slice(r));o&&l.maybeStep(o).doc&&(t=l.mapping.maps[l.mapping.maps.length-1],s.push(new Cp(t,void 0,void 0,s.length+c.length))),r--,t&&n.appendMap(t,r)}else l.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,a=new xp(this.items.slice(0,o).append(c.reverse().concat(s)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:a,transform:l,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,a=this.items,l=!r&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let n,s=e.steps[c].invert(e.docs[c]),d=new Cp(e.mapping.maps[c],s,t);(n=l&&l.merge(d))&&(d=n,c?o.pop():a=a.slice(0,a.length-1)),o.push(d),t&&(i++,t=void 0),r||(l=d)}let s=i-n.depth;return s>Ep&&(a=Sp(a,s),i-=s),new xp(a.append(o),i)}remapping(e,t){let n=new ot;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new xp(this.items.append(e.map(e=>new Cp(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(e=>{e.selection&&a--},r);let l=t;this.items.forEach(t=>{let r=o.getMirror(--l);if(null==r)return;i=Math.min(i,r);let s=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(l+1,r));c&&a++,n.push(new Cp(s,i,c))}else n.push(new Cp(s))},r);let s=[];for(let u=t;u<i;u++)s.push(new Cp(o.maps[u]));let c=this.items.slice(0,r).append(s).append(n),d=new xp(c,a);return d.emptyItemCount()>kp&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,a)=>{if(a>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),a=e&&e.getMap();if(n--,a&&t.appendMap(a,n),e){let l=i.selection&&i.selection.map(t.slice(n));l&&o++;let s,c=new Cp(a.invert(),e,l),d=r.length-1;(s=r.length&&r[d].merge(c))?r[d]=s:r.push(c)}}else i.map&&n--},this.items.length,0),new xp(wp.from(r.reverse()),o)}}function Sp(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}xp.empty=new xp(wp.empty,0);class Cp{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Cp(t.getMap().invert(),t,this.selection)}}}class Tp{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Ep=20;function _p(e,t,n,r){let o,i=n.getMeta(Fp);if(i)return i.historyState;n.getMeta(Pp)&&(e=new Tp(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(Fp))return a.getMeta(Fp).redo?new Tp(e.done.addTransform(n,void 0,r,Dp(t)),e.undone,Np(n.mapping.maps),e.prevTime,e.prevComposition):new Tp(e.done,e.undone.addTransform(n,void 0,r,Dp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Tp(e.done.rebased(n,o),e.undone.rebased(n,o),Ip(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Tp(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ip(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!a&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Mp(n,e.prevRanges)),l=a?Ip(e.prevRanges,n.mapping):Np(n.mapping.maps);return new Tp(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Dp(t)),xp.empty,l,n.time,null==o?e.prevComposition:o)}}function Mp(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}function Np(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function Ip(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function Rp(e,t,n){let r=Dp(t),o=Fp.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let a=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),s=new Tp(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(a).setMeta(Fp,{redo:n,historyState:s})}let Ap=!1,Bp=null;function Dp(e){let t=e.plugins;if(Bp!=t){Ap=!1,Bp=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ap=!0;break}}return Ap}const Fp=new Mn("history"),Pp=new Mn("closeHistory");function Op(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Tn({key:Fp,state:{init(){return new Tp(xp.empty,xp.empty,null,0,-1)},apply(t,n,r){return _p(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?zp:"historyRedo"==n?Vp:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Lp(e,t){return(n,r)=>{let o=Fp.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=Rp(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const zp=Lp(!1,!0),Vp=Lp(!0,!0);Lp(!1,!1),Lp(!0,!1);function $p(e){let t=Fp.getState(e);return t?t.done.eventCount:0}function jp(e){let t=Fp.getState(e);return t?t.undone.eventCount:0}var Hp=new Mn("selectionTracker");function Wp(e){let{selection:t,doc:n}=e,{from:r,to:o,empty:i}=t,a=n.resolve(r),l=0,s=0;n.forEach((e,t,n)=>{if(t>o)return!1;t<=r&&(l=n),t<=o&&(s=n)});let c=qp(e),d=a.parent,u={};"paragraph"===d.type.name&&(d.attrs.alignment&&(u.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(u.lineSpacing=d.attrs.lineSpacing,u.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.indentLeft&&(u.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(u.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(u.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(u.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(u.tabs=d.attrs.tabs),d.attrs.numPr&&(u.numPr=d.attrs.numPr),d.attrs.styleId&&(u.styleId=d.attrs.styleId));let p=d.attrs?.numPr,h=!!p?.numId,f=1===p?.numId?"bullet":p?.numId?"numbered":void 0,m=p?.ilvl,g=e.storedMarks||(i?a.marks():[]),v=[],y=!1,b=!1;for(let w of g)"comment"===w.type.name&&w.attrs.commentId&&v.push(w.attrs.commentId),"insertion"===w.type.name&&(y=!0),"deletion"===w.type.name&&(b=!0);return{hasSelection:!i,isMultiParagraph:l!==s,textFormatting:c,paragraphFormatting:u,startParagraphIndex:l,endParagraphIndex:s,inList:h,listType:f,listLevel:m,activeCommentIds:v,inInsertion:y,inDeletion:b}}function qp(e){let{selection:t,doc:n}=e,{empty:r,$from:o,from:i,to:a}=t,l=e.storedMarks;if(!l)if(r)l=o.marks();else{let e=null;n.nodesBetween(i,a,t=>!e&&(!t.isText||(e=t.marks,!1))),l=e??o.marks()}let s={};for(let c of l)switch(c.type.name){case"bold":s.bold=!0;break;case"italic":s.italic=!0;break;case"underline":s.underline={style:c.attrs.style||"single",color:c.attrs.color};break;case"strike":c.attrs.double?s.doubleStrike=!0:s.strike=!0;break;case"textColor":s.color={rgb:c.attrs.rgb,themeColor:c.attrs.themeColor,themeTint:c.attrs.themeTint,themeShade:c.attrs.themeShade};break;case"highlight":s.highlight=c.attrs.color;break;case"fontSize":s.fontSize=c.attrs.size;break;case"fontFamily":s.fontFamily={ascii:c.attrs.ascii,hAnsi:c.attrs.hAnsi,asciiTheme:c.attrs.asciiTheme};break;case"superscript":s.vertAlign="superscript";break;case"subscript":s.vertAlign="subscript";break}return s}function Zp(e){return new Tn({key:Hp,state:{init(e,t){return Wp(t)},apply(t,n,r,o){if(!t.selectionSet&&!t.docChanged)return n;let i=Wp(o);return e&&!Kp(n,i)&&setTimeout(()=>e(i),0),i}},view(){return{update(t,n){if(!e||t.state.selection.eq(n.selection)&&t.state.doc.eq(n.doc))return;let r=Hp.getState(t.state);r&&e(r)}}}})}function Up(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Kp(e,t){return e.hasSelection===t.hasSelection&&e.isMultiParagraph===t.isMultiParagraph&&e.startParagraphIndex===t.startParagraphIndex&&e.endParagraphIndex===t.endParagraphIndex&&e.inList===t.inList&&e.listType===t.listType&&e.listLevel===t.listLevel&&e.inInsertion===t.inInsertion&&e.inDeletion===t.inDeletion&&Up(e.activeCommentIds,t.activeCommentIds)&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var Gp={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1172},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1074},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},Xp={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Yp(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function Jp(e){let t=e.trim().toLowerCase(),n=Gp[t];if(n)return{googleFont:n.googleFont,cssFallback:n.fallbackStack.map(Qp).join(", "),originalFont:e,hasGoogleEquivalent:!0,singleLineRatio:n.singleLineRatio};let r=Yp(e),o=Xp[r];return{googleFont:null,cssFallback:`${Qp(e)}, ${o}`,originalFont:e,hasGoogleEquivalent:!1,singleLineRatio:1.15}}function Qp(e){return["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function eh(e,t){if(!t)return null;let n=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!n)return null;let r=e.toLowerCase();return r.includes("eastasia")||r.includes("ea")?n.ea??n.latin??null:r.includes("cs")||r.includes("bidi")?n.cs??n.latin??null:n.latin??null}var th={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},nh={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},rh={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function oh(e){if(!e)return 1;let t=parseInt(e,16);return isNaN(t)?1:t/255}function ih(e){let t=e.padStart(6,"0").slice(0,6),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return{r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(o)?0:o}}function ah(e,t,n){let r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`${r(e)}${r(t)}${r(n)}`.toUpperCase()}function lh(e,t){if(t>=1)return e;if(t<=0)return"FFFFFF";let n=ih(e);return ah(Math.min(255,Math.max(0,Math.round(n.r*t+255*(1-t)))),Math.min(255,Math.max(0,Math.round(n.g*t+255*(1-t)))),Math.min(255,Math.max(0,Math.round(n.b*t+255*(1-t)))))}function sh(e,t){if(t>=1)return e;if(t<=0)return"000000";let n=ih(e);return ah(Math.min(255,Math.max(0,Math.round(n.r*t))),Math.min(255,Math.max(0,Math.round(n.g*t))),Math.min(255,Math.max(0,Math.round(n.b*t))))}function ch(e,t){let n=rh[t]??t,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],o=e=>r.includes(e);return e?.colorScheme?o(n)?e.colorScheme[n]??th[n]??"000000":"000000":o(n)?th[n]??"000000":"000000"}function dh(e){if(!e)return null;let t=e.toLowerCase();return rh[e]??rh[t]??null}function uh(e,t,n="000000"){if(!e)return`#${n}`;if(e.auto)return`#${n}`;let r;if(e.themeColor){let o=dh(e.themeColor);if(r=o?ch(t,o):e.rgb??n,e.themeTint){let t=oh(e.themeTint);r=lh(r,t)}else if(e.themeShade){let t=oh(e.themeShade);r=sh(r,t)}}else r=e.rgb?"auto"===e.rgb?n:e.rgb:n;return`#${r.toUpperCase().replace(/^#/,"")}`}function ph(e,t){if(e&&!e.auto){if(e.themeColor&&t)return uh(e,t).slice(1);if(e.rgb&&"auto"!==e.rgb)return e.rgb.toUpperCase().replace(/^#/,"")}}function hh(e){if(!e||"none"===e)return"";let t=nh[e];return t?`#${t}`:""}function fh(e,t){return e?e.auto?"transparent":uh(e,t):""}function mh(e){return e.startsWith("#")?e:`#${e}`}function gh(e){return hh(e)||mh(e)}var vh=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],yh=[{type:"base",value:0,hexValue:"",labelSuffix:""},{type:"tint",value:.8,hexValue:"CC",labelSuffix:", Lighter 80%"},{type:"tint",value:.6,hexValue:"99",labelSuffix:", Lighter 60%"},{type:"tint",value:.4,hexValue:"66",labelSuffix:", Lighter 40%"},{type:"shade",value:.75,hexValue:"BF",labelSuffix:", Darker 25%"},{type:"shade",value:.5,hexValue:"80",labelSuffix:", Darker 50%"}];function bh(e){let t=e??th;return yh.map(e=>vh.map(n=>{let r,o=t[n.slot]??th[n.slot]??"000000";r="base"===e.type?o.toUpperCase():"tint"===e.type?lh(o,1-e.value):sh(o,e.value);let i={hex:r,themeSlot:n.slot,label:`${n.name}${e.labelSuffix}`};return"tint"===e.type&&e.hexValue?i.tint=e.hexValue:"shade"===e.type&&e.hexValue&&(i.shade=e.hexValue),i}))}function wh(e,t){if(!e)return{};let n={};if(e.fontFamily){let r=null;if(e.fontFamily.asciiTheme&&t?.fontScheme&&(r=eh(e.fontFamily.asciiTheme,t.fontScheme)),r||(r=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),r){let e=Jp(r);n.fontFamily=e.cssFallback}}if(void 0!==e.fontSize&&(n.fontSize=`${tc(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=uh(e.color,t)),e.highlight&&"none"!==e.highlight&&(n.backgroundColor=gh(e.highlight)),e.shading){let r=Sh(e.shading,t);r&&!n.backgroundColor&&(n.backgroundColor=r)}let r=[],o=[],i=[];if(e.underline&&"none"!==e.underline.style){r.push("underline");let n=Ch(e.underline.style);"solid"!==n&&o.push(n),e.underline.color&&i.push(uh(e.underline.color,t))}if(e.strike&&r.push("line-through"),e.doubleStrike&&r.push("line-through"),r.length>0&&(n.textDecoration=r.join(" "),o.length>0&&(n.textDecorationStyle=o[0]),i.length>0&&(n.textDecorationColor=i[0])),e.vertAlign)switch(e.vertAlign){case"superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case"subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&0!==e.position){let t=ec(e.position);n.position="relative",n.top=ic(-t)}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),void 0!==e.spacing&&0!==e.spacing&&(n.letterSpacing=ic(Gs(e.spacing))),void 0!==e.scale&&100!==e.scale&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function kh(e,t){if(!e)return{};let n={};if(e.alignment&&(n.textAlign=Th(e.alignment)),void 0!==e.spaceBefore&&(n.marginTop=ic(Gs(e.spaceBefore))),void 0!==e.spaceAfter&&(n.marginBottom=ic(Gs(e.spaceAfter))),void 0!==e.lineSpacing&&e.lineSpacing>0)switch(e.lineSpacingRule){case"exact":{let t=Gs(e.lineSpacing);t>0&&(n.lineHeight=ic(t));break}case"atLeast":{let t=Gs(e.lineSpacing);t>0&&(n.minHeight=ic(t),n.lineHeight=ic(t));break}default:{let t=e.lineSpacing/240;t>0&&(n.lineHeight=t.toString());break}}if(void 0!==e.indentLeft&&(n.marginLeft=ic(Gs(e.indentLeft))),void 0!==e.indentRight&&(n.marginRight=ic(Gs(e.indentRight))),void 0!==e.indentFirstLine&&(e.hangingIndent,n.textIndent=ic(Gs(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,xh(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,xh(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,xh(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,xh(e.borders.right,"Right",t))),e.shading){let r=Sh(e.shading,t);r&&(n.backgroundColor=r)}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function xh(e,t="",n){if(!e||"none"===e.style||"nil"===e.style)return{};let r={},o=e.size?rc(e.size):1,i=e.color?uh(e.color,n):"#000000",a=Eh(e.style),l=`border${t}Width`,s=`border${t}Style`,c=`border${t}Color`;return r[l]=ic(Math.max(1,o)),r[s]=a,r[c]=i,r}function Sh(e,t){return e&&"clear"!==e.pattern&&"nil"!==e.pattern?e.fill?e.fill.auto||"auto"===e.fill.rgb||"FFFFFF"===e.fill.rgb?"":fh(e.fill,t):"solid"===e.pattern&&e.color||e.pattern&&e.pattern.startsWith("pct")&&e.color?fh(e.color,t):"":""}function Ch(e){switch(e){case"double":return"double";case"dotted":case"dottedHeavy":return"dotted";case"dash":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dashDotHeavy":case"dotDotDash":case"dashDotDotHeavy":return"dashed";case"wave":case"wavyHeavy":case"wavyDouble":return"wavy";default:return"solid"}}function Th(e){switch(e){case"center":return"center";case"right":return"right";case"both":case"distribute":return"justify";default:return"left"}}function Eh(e){switch(e){case"none":case"nil":return"none";case"double":case"triple":return"double";case"dotted":return"dotted";case"dashed":case"dashSmallGap":return"dashed";case"threeDEmboss":return"ridge";case"threeDEngrave":return"groove";case"outset":return"outset";case"inset":return"inset";default:return"solid"}}function _h(e){if(!e)return[];let t=()=>{if(!e.items||0===e.items.length)return[];let t=[];for(let n of Array.from(e.items)){if("file"!==n.kind||!n.type.startsWith("image/"))continue;let e=n.getAsFile();e&&t.push(e)}return t},n=()=>e.files&&0!==e.files.length?Array.from(e.files).filter(e=>e.type.startsWith("image/")):[],r=t(),o=r.length?r:n();if(o.length<=1)return o;let i=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],a=e=>{let t=e[0],n=i.indexOf(t.type);n<0&&(n=Number.MAX_SAFE_INTEGER);for(let r of e.slice(1)){let e=i.indexOf(r.type);(e<0&&(e=Number.MAX_SAFE_INTEGER),e<n)?(t=r,n=e):e===n&&r.size>t.size&&(t=r)}return t},l=new Map;for(let c of o){let e=c.name?.trim()??"",t=(e?e.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${c.size}`,n=l.get(t);n?n.push(c):l.set(t,[c])}let s=[];for(let c of l.values())s.push(a(c));return s}function Mh(e){let t=[];return e.descendants((e,n)=>{if("paragraph"===e.type.name){let r=e.attrs.outlineLevel,o=e.attrs.styleId,i=r;if(null==i&&o){let e=o.match(/^[Hh]eading(\d)$/);e&&(i=parseInt(e[1],10)-1)}if(null!=i&&i>=0&&i<=8){let r="";e.forEach(e=>{e.isText&&(r+=e.text||"")}),r.trim()&&t.push({text:r.trim(),level:i,pmPos:n})}}}),t}const Nh=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ih(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Rh=(e,t,n)=>{let r=Ih(e,n);if(!r)return!1;let o=Dh(r);if(!o){let n=r.blockRange(),o=n&&wt(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Gh(e,o,t,-1))return!0;if(0==r.parent.content.size&&(Ah(i,"end")||cn.isSelectable(i)))for(let a=r.depth;;a--){let n=Pt(e.doc,r.before(a),r.after(a),A.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ah(i,"end")?nn.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):cn.create(r.doc,o.pos-i.nodeSize)),t(r.scrollIntoView())}return!0}if(1==a||r.node(a-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function Ah(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const Bh=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Dh(r)}let a=i&&i.nodeBefore;return!(!a||!cn.isSelectable(a))&&(t&&t(e.tr.setSelection(cn.create(e.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function Dh(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Fh(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Ph=(e,t,n)=>{let r=Fh(e,n);if(!r)return!1;let o=Lh(r);if(!o)return!1;let i=o.nodeAfter;if(Gh(e,o,t,1))return!0;if(0==r.parent.content.size&&(Ah(i,"start")||cn.isSelectable(i))){let n=Pt(e.doc,r.before(),r.after(),A.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ah(i,"start")?nn.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):cn.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},Oh=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Lh(r)}let a=i&&i.nodeAfter;return!(!a||!cn.isSelectable(a))&&(t&&t(e.tr.setSelection(cn.create(e.doc,i.pos)).scrollIntoView()),!0)};function Lh(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const zh=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Vh(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const $h=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),a=Vh(o.contentMatchAt(i));if(!a||!o.canReplaceWith(i,i,a))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,a.createAndFill());o.setSelection(nn.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},jh=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof un||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Vh(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(n,i.createAndFill());a.setSelection(ln.create(a.doc,n+1)),t(a.scrollIntoView())}return!0},Hh=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Mt(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&wt(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function Wh(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof cn&&t.selection.node.isBlock)return!(!r.parentOffset||!Mt(t.doc,r.pos))&&(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i,a,l=[],s=!1,c=!1;for(let h=r.depth;;h--){let t=r.node(h);if(t.isBlock){s=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Vh(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let t=e&&e(o.parent,s,r);l.unshift(t||(s&&a?{type:a}:null)),i=h;break}if(1==h)return!1;l.unshift(null)}let d=t.tr;(t.selection instanceof ln||t.selection instanceof un)&&d.deleteSelection();let u=d.mapping.map(r.pos),p=Mt(d.doc,u,l.length,l);if(p||(l[0]=a?{type:a}:null,p=Mt(d.doc,u,l.length,l)),!p)return!1;if(d.split(u,l.length,l),!s&&c&&r.node(i).type!=a){let e=d.mapping.map(r.before(i)),t=d.doc.resolve(e);a&&r.node(i-1).canReplaceWith(t.index(),t.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(i)),a)}return n&&n(d.scrollIntoView()),!0}}const qh=Wh(),Zh=(e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(cn.create(e.doc,n))),!0)},Uh=(e,t)=>(t&&t(e.tr.setSelection(new un(e.doc))),!0);function Kh(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!(!t.parent.canReplace(i,i+1)||!o.isTextblock&&!It(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))}function Gh(e,t,n,r){let o,i,a=t.nodeBefore,l=t.nodeAfter,s=a.type.spec.isolating||l.type.spec.isolating;if(!s&&Kh(e,t,n))return!0;let c=!s&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=a.contentMatchAt(a.childCount)).findWrapping(l.type))&&i.matchType(o[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=E.empty;for(let e=o.length-1;e>=0;e--)i=E.from(o[e].create(null,i));i=E.from(a.copy(i));let s=e.tr.step(new ft(t.pos-1,r,t.pos,r,new A(i,1,0),o.length,!0)),c=s.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==a.type&&It(s.doc,c.pos)&&s.join(c.pos),n(s.scrollIntoView())}return!0}let d=l.type.spec.isolating||r>0&&s?null:nn.findFrom(t,1),u=d&&d.$from.blockRange(d.$to),p=u&&wt(u);if(null!=p&&p>=t.depth)return n&&n(e.tr.lift(u,p).scrollIntoView()),!0;if(c&&Ah(l,"start",!0)&&Ah(a,"end")){let r=a,o=[];for(;;){if(o.push(r),r.isTextblock)break;r=r.lastChild}let i=l,s=1;for(;!i.isTextblock;i=i.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=E.empty;for(let e=o.length-1;e>=0;e--)r=E.from(o[e].copy(r));let i=e.tr.step(new ft(t.pos-o.length,t.pos+l.nodeSize,t.pos+s,t.pos+l.nodeSize-s,new A(r,o.length,0),0,!0));n(i.scrollIntoView())}return!0}}return!1}function Xh(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;while(o.node(i).isInline){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(ln.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Yh=Xh(-1),Jh=Xh(1);function Qh(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:a}=t[o],l=0==i.depth&&(e.inlineContent&&e.type.allowsMarkType(n));if(e.nodesBetween(i.pos,a.pos,(e,t)=>{if(l||!r&&e.isAtom&&e.isInline&&t>=i.pos&&t+e.nodeSize<=a.pos)return!1;l=e.inlineContent&&e.type.allowsMarkType(n)}),l)return!0}return!1}function ef(e){let t=[];for(let n=0;n<e.length;n++){let{$from:r,$to:o}=e[n];r.doc.nodesBetween(r.pos,o.pos,(e,n)=>{if(e.isAtom&&e.content.size&&e.isInline&&n>=r.pos&&n+e.nodeSize<=o.pos)return n+1>r.pos&&t.push(new rn(r,r.doc.resolve(n+1))),r=r.doc.resolve(n+1+e.content.size),!1}),r.pos<o.pos&&t.push(new rn(r,o))}return t}function tf(e,t=null,n){let r=!1!==(n&&n.removeWhenPresent),o=!1!==(n&&n.enterInlineAtoms),i=!(n&&n.includeWhitespace);return function(n,a){let{empty:l,$cursor:s,ranges:c}=n.selection;if(l&&!s||!Qh(n.doc,c,e,o))return!1;if(a)if(s)e.isInSet(n.storedMarks||s.marks())?a(n.tr.removeStoredMark(e)):a(n.tr.addStoredMark(e.create(t)));else{let l,s=n.tr;o||(c=ef(c)),l=r?!c.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)):!c.every(t=>{let n=!1;return s.doc.nodesBetween(t.$from.pos,t.$to.pos,(r,o,i)=>{if(n)return!1;n=!e.isInSet(r.marks)&&!!i&&i.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-o),Math.min(r.nodeSize,t.$to.pos-o))))}),!n});for(let n=0;n<c.length;n++){let{$from:r,$to:o}=c[n];if(l){let n=r.pos,a=o.pos,l=r.nodeAfter,c=o.nodeBefore,d=i&&l&&l.isText?/^\s*/.exec(l.text)[0].length:0,u=i&&c&&c.isText?/\s*$/.exec(c.text)[0].length:0;n+d<a&&(n+=d,a-=u),s.addMark(n,a,e.create(t))}else s.removeMark(r.pos,o.pos,e)}a(s.scrollIntoView())}return!0}}function nf(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let rf=nf(Nh,Rh,Bh),of=nf(Nh,Ph,Oh);const af={Enter:nf(zh,jh,Hh,qh),"Mod-Enter":$h,Backspace:rf,"Mod-Backspace":rf,"Shift-Backspace":rf,Delete:of,"Mod-Delete":of,"Mod-a":Uh},lf={"Ctrl-h":af["Backspace"],"Alt-Backspace":af["Mod-Backspace"],"Ctrl-d":af["Delete"],"Ctrl-Alt-Backspace":af["Mod-Delete"],"Alt-Delete":af["Mod-Delete"],"Alt-d":af["Mod-Delete"],"Ctrl-a":Yh,"Ctrl-e":Jh};for(let x in af)lf[x]=af[x];const sf="undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform(),cf=sf?lf:af;var df={Highest:0,High:50,Default:100,Low:150,Lowest:200};function uf(e){return t=>{let n={...e.defaultOptions,...t};return{type:"extension",config:{name:e.name,priority:e.priority??df.Default,options:n},onSchemaReady(t){return e.onSchemaReady(t,n)}}}}function pf(e){return t=>{let n={...e.defaultOptions,...t},r="function"==typeof e.nodeSpec?e.nodeSpec(n):e.nodeSpec;return{type:"node",config:{name:e.name,priority:e.priority??df.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:r},onSchemaReady(t){return e.onSchemaReady?.(t,n)??{}}}}}function hf(e){return t=>{let n={...e.defaultOptions,...t},r="function"==typeof e.markSpec?e.markSpec(n):e.markSpec;return{type:"mark",config:{name:e.name,priority:e.priority??df.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:r},onSchemaReady(t){return e.onSchemaReady?.(t,n)??{}}}}}function ff(e){switch(e.toLowerCase()){case"solid":return"single";case"double":return"double";case"dotted":return"dotted";case"dashed":return"dashed";case"groove":return"threeDEngrave";case"ridge":return"threeDEmboss";case"inset":return"inset";case"outset":return"outset";default:return"single"}}function mf(e){if(!e)return 8;let t=e.trim().toLowerCase();if("thin"===t)return 4;if("medium"===t)return 8;if("thick"===t)return 16;let n=parseFloat(t);return isNaN(n)?8:t.endsWith("pt")?Math.round(8*n):(t.endsWith("px"),Math.round(6*n))}function gf(e){if(!e||"transparent"===e||"inherit"===e)return null;let t=e.match(/#([0-9a-fA-F]{6})/);if(t)return{rgb:t[1].toUpperCase()};let n=e.match(/#([0-9a-fA-F]{3})$/);if(n){let[e,t,r]=n[1];return{rgb:(e+e+t+t+r+r).toUpperCase()}}let r=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return r?{rgb:[r[1],r[2],r[3]].map(e=>parseInt(e).toString(16).padStart(2,"0")).join("").toUpperCase()}:null}function vf(e){let t=(e,t,n)=>{if(e&&"none"!==e&&"hidden"!==e)return{style:ff(e),color:gf(t)||void 0,size:mf(n)}},n=t(e.borderTopStyle,e.borderTopColor,e.borderTopWidth),r=t(e.borderBottomStyle,e.borderBottomColor,e.borderBottomWidth),o=t(e.borderLeftStyle,e.borderLeftColor,e.borderLeftWidth),i=t(e.borderRightStyle,e.borderRightColor,e.borderRightWidth);return n||r||o||i?{top:n,bottom:r,left:o,right:i}:null}function yf(e){let t=e=>{if(!e||"0px"===e)return;let t=parseFloat(e);return isNaN(t)||0===t?void 0:e.endsWith("pt")?Math.round(20*t):Math.round(15*t)},n=t(e.paddingTop),r=t(e.paddingRight),o=t(e.paddingBottom),i=t(e.paddingLeft);return void 0===n&&void 0===r&&void 0===o&&void 0===i?null:{top:n,right:r,bottom:o,left:i}}function bf(e){if(e)switch(e.toLowerCase()){case"top":return"top";case"middle":return"center";case"bottom":return"bottom";default:return}}function wf(e){return gf(e)?.rgb}function kf(e){let t=e.style,n=vf(t),r=yf(t);return{colspan:e.colSpan||1,rowspan:e.rowSpan||1,verticalAlign:e.dataset.valign||bf(t.verticalAlign)||void 0,backgroundColor:e.dataset.bgcolor||wf(t.backgroundColor)||void 0,borders:n||void 0,margins:r||void 0}}var xf={content:"tableRow+",group:"block",tableRole:"table",isolating:!0,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null},floating:{default:null},cellMargins:{default:null},look:{default:null},_originalFormatting:{default:null}},parseDOM:[{tag:"table",getAttrs(e){let t=e;return{styleId:t.dataset.styleId||void 0,justification:t.dataset.justification}}}],toDOM(e){let t=e.attrs,n={class:"docx-table"};t.styleId&&(n["data-style-id"]=t.styleId);let r=["border-collapse: collapse"];if(t.width&&"pct"===t.widthType)r.push(`width: ${t.width/50}%`),r.push("table-layout: fixed");else if(t.width&&"dxa"===t.widthType){let e=Math.round(t.width/20*1.333);r.push(`width: ${e}px`),r.push("table-layout: fixed")}else r.push("width: 100%"),r.push("table-layout: fixed");return"center"===t.justification?r.push("margin-left: auto","margin-right: auto"):"right"===t.justification&&r.push("margin-left: auto"),n.style=r.join("; "),["table",n,["tbody",0]]}},Sf={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:!1},_originalFormatting:{default:null}},parseDOM:[{tag:"tr"}],toDOM(e){let t=e.attrs,n={};if(t.height){let e=Math.round(t.height/20*1.333);n.style=`height: ${e}px`}return["tr",n,0]}},Cf={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",thinThickSmallGap:"double",thickThinSmallGap:"double",thinThickThinSmallGap:"double",thinThickMediumGap:"double",thickThinMediumGap:"double",thinThickThinMediumGap:"double",thinThickLargeGap:"double",thickThinLargeGap:"double",thinThickThinLargeGap:"double",wave:"solid",doubleWave:"double",dashDotStroked:"dashed",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function Tf(e){let t=[],n=e.borders;if(!n)return t;let r=e=>{if(!e||!e.style||"none"===e.style||"nil"===e.style)return"none";let t=e.size?Math.max(1,Math.round(e.size/8*1.333)):1,n=Cf[e.style]||"solid",r=uh(e.color,void 0);return`${t}px ${n} ${r}`};return t.push(`border-top: ${r(n.top)}`),t.push(`border-bottom: ${r(n.bottom)}`),t.push(`border-left: ${r(n.left)}`),t.push(`border-right: ${r(n.right)}`),t}function Ef(e){let t=e.margins;if(!t){let e=Math.round(7.1982);return[`padding: ${e}px ${e}px`]}let n=e=>e?Math.round(e/20*1.333):0,r=n(t.top),o=n(t.right),i=n(t.bottom),a=n(t.left);return[`padding: ${r}px ${o}px ${i}px ${a}px`]}function _f(e){if(!e)return[];let t=[];switch(e){case"tbRl":case"tbRlV":t.push("writing-mode: vertical-rl");break;case"btLr":t.push("writing-mode: vertical-lr","transform: rotate(180deg)");break;case"rl":case"rlV":t.push("direction: rtl");break;case"tb":case"tbV":t.push("writing-mode: vertical-lr");break}return t}function Mf(e){let t=[];if(e.colwidth&&e.colwidth.length>0){let n=e.colwidth.reduce((e,t)=>e+t,0);t.push(`width: ${n}px`)}else if(e.width&&"pct"===e.widthType)t.push(`width: ${e.width}%`);else if(e.width){let n=Math.round(e.width/20*1.333);t.push(`width: ${n}px`)}return t}var Nf={content:"(paragraph | table)+",tableRole:"cell",isolating:!0,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:!1},_originalFormatting:{default:null},_originalResolvedFill:{default:null}},parseDOM:[{tag:"td",getAttrs:e=>kf(e)}],toDOM(e){let t=e.attrs,n={class:"docx-table-cell"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let r=[];return r.push(...Ef(t)),t.noWrap?r.push("white-space: nowrap"):r.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),r.push(...Mf(t)),r.push(...Tf(t)),r.push(..._f(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,r.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,r.push(`background-color: #${t.backgroundColor}`)),n.style=r.join("; "),["td",n,0]}},If={content:"(paragraph | table)+",tableRole:"header_cell",isolating:!0,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:!1},_originalFormatting:{default:null},_originalResolvedFill:{default:null}},parseDOM:[{tag:"th",getAttrs:e=>kf(e)}],toDOM(e){let t=e.attrs,n={class:"docx-table-header"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let r=["font-weight: bold"];return r.push(...Ef(t)),t.noWrap?r.push("white-space: nowrap"):r.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),r.push(...Mf(t)),r.push(...Tf(t)),r.push(..._f(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,r.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,r.push(`background-color: #${t.backgroundColor}`)),n.style=r.join("; "),["th",n,0]}};function Rf(e){let t,n,r,o,i,{selection:a}=e,{$from:l}=a,s=a instanceof Al&&a.$anchorCell.pos!==a.$headCell.pos;for(let f=l.depth;f>0;f--){let e=l.node(f);if("tableCell"===e.type.name||"tableHeader"===e.type.name){i=e;let t=l.node(f-1);if(t&&"tableRow"===t.type.name){let e=0,n=!1;t.forEach((t,r,i)=>{n||(i===l.index(f-1)?(o=e,n=!0):e+=t.attrs.colspan||1)})}}else if("tableRow"===e.type.name){let e=l.node(f-1);e&&"table"===e.type.name&&(r=l.index(f-1))}else if("table"===e.type.name){t=e,n=l.before(f);break}}if(!t)return{isInTable:!1};let c=0,d=0;t.forEach(e=>{if("tableRow"===e.type.name){c++;let t=0;e.forEach(e=>{t+=e.attrs.colspan||1}),d=Math.max(d,t)}});let u,p,h=!!i&&!s;if(i){let e=i.attrs;e.backgroundColor&&"string"==typeof e.backgroundColor&&(p=e.backgroundColor);let t=e.borders;if(t)for(let n of["top","right","bottom","left"]){let e=t[n];if(e?.color&&e.style&&"none"!==e.style&&"nil"!==e.style){u=e.color;break}}}return{isInTable:!0,table:t,tablePos:n,rowIndex:r,columnIndex:o,rowCount:c,columnCount:d,hasMultiCellSelection:s,canSplitCell:!!h,cellBorderColor:u,cellBackgroundColor:p}}function Af(e){let{$from:t}=e.selection;for(let n=t.depth;n>0;n--){let e=t.node(n);if("tableCell"===e.type.name||"tableHeader"===e.type.name)return!0}return!1}function Bf(e){let{$from:t}=e.selection,n=-1,r=-1,o=-1;for(let i=t.depth;i>0;i--){let e=t.node(i);if("tableCell"===e.type.name||"tableHeader"===e.type.name)n=i;else if("tableRow"===e.type.name)r=i;else if("table"===e.type.name){o=i;break}}return-1===n||-1===r||-1===o?null:{cellDepth:n,cellPos:t.before(n),rowDepth:r,tableDepth:o}}function Df(){return(e,t)=>{if(!Af(e))return!1;let n=Bf(e);if(!n)return!1;let{$from:r}=e.selection,o=r.node(n.tableDepth),i=r.node(n.rowDepth),a=r.index(n.rowDepth),l=r.index(n.tableDepth);if(a<i.childCount-1){let o=n.cellPos+r.node(n.cellDepth).nodeSize;if(t){let n=o+1+1,r=e.tr.setSelection(nn.near(e.doc.resolve(n)));t(r.scrollIntoView())}return!0}if(l<o.childCount-1){let o=r.before(n.rowDepth)+i.nodeSize;if(t){let n=o+1+1+1,r=e.tr.setSelection(nn.near(e.doc.resolve(n)));t(r.scrollIntoView())}return!0}return!1}}function Ff(){return(e,t)=>{if(!Af(e))return!1;let n=Bf(e);if(!n)return!1;let{$from:r}=e.selection,o=r.node(n.tableDepth),i=r.index(n.rowDepth),a=r.index(n.tableDepth);if(i>0){let o=r.node(n.rowDepth).child(i-1),a=n.cellPos-o.nodeSize;if(t){let n=a+o.nodeSize-2,r=e.tr.setSelection(nn.near(e.doc.resolve(n),-1));t(r.scrollIntoView())}return!0}if(a>0){let i=o.child(a-1),l=r.before(n.rowDepth)-i.nodeSize;if(t){let n=l+i.nodeSize-1-1,r=e.tr.setSelection(nn.near(e.doc.resolve(n),-1));t(r.scrollIntoView())}return!0}return!1}}function Pf(e,t={}){let n=e?.attrs??{};return{colspan:n.colspan||1,rowspan:1,colwidth:n.colwidth,width:n.width,widthType:n.widthType,verticalAlign:n.verticalAlign,backgroundColor:n.backgroundColor,borders:n.borders,margins:n.margins,textDirection:n.textDirection,noWrap:n.noWrap,...t}}function Of(e,t){let{$from:n}=e.selection;for(let r=n.depth;r>0;r--){let e=n.node(r);if(e.type.name===t)return{pos:n.before(r),node:e}}return null}function Lf(e){let t=e.selection;if(t instanceof Al){let e=[];return t.forEachCell((t,n)=>{e.push({pos:n,node:t})}),e}let n=Of(e,"tableCell")??Of(e,"tableHeader");return n?[n]:[]}function zf(e,t){let n=new Map,r=new Map,o=e.childCount,i=0;return e.forEach((e,o,a)=>{if("tableRow"!==e.type.name)return;let l=0;e.forEach((e,i)=>{let s=t+o+i+2,c=e.attrs.colspan||1;n.set(s,{rowIdx:a,colIdx:l,colspan:c,pos:s,node:e}),r.set(`${a},${l}`,s),l+=c}),i=Math.max(i,l)}),{cellByPos:n,cellByRC:r,totalRows:o,totalCols:i}}function Vf(e){return function(t,n,r="000000",o=9360){let i=[],a=Math.floor(o/n),l=360,s="atLeast",c={style:"single",size:4,color:{rgb:r}},d={top:c,bottom:c,left:c,right:c};for(let p=0;p<t;p++){let t=[];for(let r=0;r<n;r++){let n=e.nodes.paragraph.create(),r={colspan:1,rowspan:1,borders:d,width:a,widthType:"dxa"};t.push(e.nodes.tableCell.create(r,n))}i.push(e.nodes.tableRow.create({height:l,heightRule:s},t))}let u=Array(n).fill(a);return e.nodes.table.create({columnWidths:u,width:o,widthType:"dxa"},i)}}function $f(e){let t=Vf(e);return function(n,r){return(o,i)=>{let{$from:a}=o.selection,l="000000",s=o.storedMarks||a.marks();for(let e of s)if("textColor"===e.type.name&&e.attrs.rgb){l=e.attrs.rgb;break}let c=a.pos;for(let e=a.depth;e>0;e--){let t=a.node(e);if("paragraph"===t.type.name||"table"===t.type.name){c=a.after(e);break}}if(i){let s=9360;for(let e=a.depth;e>0;e--){let t=a.node(e);if("tableCell"===t.type.name||"tableHeader"===t.type.name){let e=t.attrs.width;e&&e>0&&(s=Math.max(e-216,360));break}}let d=t(n,r,l,s),u=e.nodes.paragraph.create(),p="table"===o.doc.resolve(c).nodeBefore?.type.name,h=p?[u,d,u]:[d,u],f=o.tr.insert(c,h),m=c+1;p&&(m+=u.nodeSize);let g=m+1+1;f.setSelection(ln.create(f.doc,g)),i(f.scrollIntoView())}return!0}}}function jf(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.rowIndex||!r.table||void 0===r.tablePos)return!1;if(n){let o=t.tr,i=r.table.child(r.rowIndex),a=[];i.forEach(t=>{let n=e.nodes.paragraph.create(),r=Pf(t);a.push(e.nodes.tableCell.create(r,n))});let l=e.nodes.tableRow.create({height:i.attrs.height??360,heightRule:i.attrs.heightRule??"atLeast"},a),s=r.tablePos+1;for(let e=0;e<r.rowIndex;e++)s+=r.table.child(e).nodeSize;o.insert(s,l),n(o.scrollIntoView())}return!0}}function Hf(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.rowIndex||!r.table||void 0===r.tablePos)return!1;if(n){let o=t.tr,i=r.table.child(r.rowIndex),a=[];i.forEach(t=>{let n=e.nodes.paragraph.create(),r=Pf(t);a.push(e.nodes.tableCell.create(r,n))});let l=e.nodes.tableRow.create({height:i.attrs.height??360,heightRule:i.attrs.heightRule??"atLeast"},a),s=r.tablePos+1;for(let e=0;e<=r.rowIndex;e++)s+=r.table.child(e).nodeSize;o.insert(s,l),n(o.scrollIntoView())}return!0}}function Wf(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.columnIndex||!r.table||void 0===r.tablePos)return!1;if(n){let o=t.tr,i=(r.columnCount||1)+1,a=Math.floor(5e3/i),l=[],s=r.tablePos+1;r.table.forEach(e=>{l.push(s),s+=e.nodeSize}),r.table.forEach((t,n,i)=>{if("tableRow"===t.type.name){let n=o.mapping.map(l[i])+1,s=0,c=!1;if(t.forEach(t=>{if(!c&&s===r.columnIndex){let r=e.nodes.paragraph.create(),i=Pf(t,{colspan:1,rowspan:1});i.width=a,i.widthType="pct";let l=e.nodes.tableCell.create(i,r);o=o.insert(n,l),c=!0}n+=t.nodeSize,s+=t.attrs.colspan||1}),!c&&s<=r.columnIndex){let r=e.nodes.paragraph.create(),i=Pf(t.child(t.childCount-1)??null,{colspan:1,rowspan:1});i.width=a,i.widthType="pct";let l=e.nodes.tableCell.create(i,r);o=o.insert(n,l)}}});let c=o.doc.nodeAt(r.tablePos);if(c&&"table"===c.type.name){let e=c.child(0);if(e&&"tableRow"===e.type.name){let t=r.tablePos+2;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(o=o.setNodeMarkup(t,void 0,{...e.attrs,width:a,widthType:"pct"})),t+=e.nodeSize})}let t=e?.childCount??i,n=c.attrs.width||9360,l=Math.floor(n/Math.max(1,t));o=o.setNodeMarkup(r.tablePos,void 0,{...c.attrs,columnWidths:Array(t).fill(l)})}n(o.scrollIntoView())}return!0}}function qf(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.columnIndex||!r.table||void 0===r.tablePos)return!1;if(n){let o=t.tr,i=(r.columnCount||1)+1,a=Math.floor(5e3/i),l=[],s=r.tablePos+1;r.table.forEach(e=>{l.push(s),s+=e.nodeSize}),r.table.forEach((t,n,i)=>{if("tableRow"===t.type.name){let n=o.mapping.map(l[i])+1,s=0,c=!1;if(t.forEach(t=>{if(n+=t.nodeSize,s+=t.attrs.colspan||1,!c&&s>r.columnIndex){let r=e.nodes.paragraph.create(),i=Pf(t,{colspan:1,rowspan:1});i.width=a,i.widthType="pct";let l=e.nodes.tableCell.create(i,r);o=o.insert(n,l),c=!0}}),!c){let r=e.nodes.paragraph.create(),i=Pf(t.child(t.childCount-1)??null,{colspan:1,rowspan:1});i.width=a,i.widthType="pct";let l=e.nodes.tableCell.create(i,r);o=o.insert(n,l)}}});let c=o.doc.nodeAt(r.tablePos);if(c&&"table"===c.type.name){let e=c.child(0);if(e&&"tableRow"===e.type.name){let t=r.tablePos+2;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(o=o.setNodeMarkup(t,void 0,{...e.attrs,width:a,widthType:"pct"})),t+=e.nodeSize})}let t=e?.childCount??i,n=c.attrs.width||9360,l=Math.floor(n/Math.max(1,t));o=o.setNodeMarkup(r.tablePos,void 0,{...c.attrs,columnWidths:Array(t).fill(l)})}n(o.scrollIntoView())}return!0}}var Zf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.rowIndex||!n.table||void 0===n.tablePos||(n.rowCount||0)<=1)return!1;if(t){let r=e.tr,o=n.tablePos+1;for(let e=0;e<n.rowIndex;e++)o+=n.table.child(e).nodeSize;let i=o+n.table.child(n.rowIndex).nodeSize;r.delete(o,i),t(r.scrollIntoView())}return!0},Uf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.columnIndex||!n.table||void 0===n.tablePos||(n.columnCount||0)<=1)return!1;if(t){let r=e.tr,o=(n.columnCount||2)-1,i=Math.floor(5e3/o),a=[],l=n.tablePos+1;n.table.forEach(e=>{if("tableRow"===e.type.name){let t=l+1,r=0;e.forEach(e=>{let o=t,i=t+e.nodeSize,l=e.attrs.colspan||1;r<=n.columnIndex&&n.columnIndex<r+l&&a.push({start:o,end:i}),t=i,r+=l})}l+=e.nodeSize}),a.reverse().forEach(({start:e,end:t})=>{r=r.delete(e,t)});let s=r.doc.nodeAt(n.tablePos);if(s&&"table"===s.type.name){let e=s.child(0);if(e&&"tableRow"===e.type.name){let t=n.tablePos+2;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(r=r.setNodeMarkup(t,void 0,{...e.attrs,width:i,widthType:"pct"})),t+=e.nodeSize})}let t=e?.childCount??o,a=s.attrs.width||9360,l=Math.floor(a/Math.max(1,t));r=r.setNodeMarkup(n.tablePos,void 0,{...s.attrs,columnWidths:Array(t).fill(l)})}t(r.scrollIntoView())}return!0},Kf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table)return!1;if(t){let r=e.tr;r.delete(n.tablePos,n.tablePos+n.table.nodeSize),t(r.scrollIntoView())}return!0},Gf=(e,t)=>{let n=e.selection;if(!("$anchorCell"in n)||"function"!=typeof n.forEachCell)return!1;let r=Rf(e);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;let o=0;r.table.descendants(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(o+=1)});let i=0;if(n.forEachCell(()=>{i+=1}),!(o>0&&i>=o))return!1;if(t){let n=e.tr.delete(r.tablePos,r.tablePos+r.table.nodeSize);t(n.scrollIntoView())}return!0},Xf=e=>{let{$from:t,empty:n}=e.selection;if(!n)return!1;let r=t.parent;if("paragraph"!==r.type.name||r.textContent.length>0)return!1;let o=t.depth;if(o<1)return!1;let i=t.node(o-1),a=t.index(o-1),l=a>0?i.child(a-1):null,s=a+1<i.childCount?i.child(a+1):null,c="table"===l?.type.name,d="table"===s?.type.name;return!(!c&&!d)},Yf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table)return!1;if(t){let r=n.tablePos+1,o=e.doc.resolve(r),i=e.doc.resolve(n.tablePos+n.table.nodeSize-2),a=Al.create(e.doc,o.pos,i.pos);t(e.tr.setSelection(a))}return!0},Jf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table||void 0===n.rowIndex)return!1;if(t){let r=n.tablePos+1;for(let e=0;e<n.rowIndex;e++){let t=n.table.child(e);r+=t.nodeSize}let o=n.table.child(n.rowIndex),i=r+1,a=r+o.nodeSize-2,l=Al.create(e.doc,i,a);t(e.tr.setSelection(l))}return!0},Qf=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table||void 0===n.columnIndex)return!1;if(t){let r=n.tablePos+1,o=n.table.child(0),i=n.table.child(n.table.childCount-1),a=r+1;for(let e=0;e<n.columnIndex&&e<o.childCount;e++)a+=o.child(e).nodeSize;let l=r;for(let e=0;e<n.table.childCount-1;e++)l+=n.table.child(e).nodeSize;let s=l+1;for(let e=0;e<n.columnIndex&&e<i.childCount;e++)s+=i.child(e).nodeSize;let c=Al.create(e.doc,a,s);t(e.tr.setSelection(c))}return!0},em={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};function tm(e,t){return(n,r)=>{let o=Rf(n);if(!o.isInTable||void 0===o.tablePos||!o.table)return!1;if(r){let i=n.tr,a=o.table,l=o.tablePos,s=t??{style:"single",size:4,color:{rgb:"000000"}},c={style:"none"},{cellByPos:d,cellByRC:u}=zf(a,l),p=Lf(n),h=1/0,f=-1,m=1/0,g=-1;for(let{pos:e}of p){let t=d.get(e);t&&(h=Math.min(h,t.rowIdx),f=Math.max(f,t.rowIdx),m=Math.min(m,t.colIdx),g=Math.max(g,t.colIdx+t.colspan-1))}let v=new Map,y=(e,t)=>v.get(e)??{...t.attrs},b=(e,t)=>{v.set(e,t)};for(let{pos:t}of p){let n=d.get(t);if(!n)continue;let r,o=n.rowIdx===h,i=n.rowIdx===f,a=n.colIdx===m,l=n.colIdx+n.colspan-1===g;switch(e){case"all":r={top:s,bottom:s,left:s,right:s};break;case"outside":r={top:o?s:c,bottom:i?s:c,left:a?s:c,right:l?s:c};break;case"inside":r={top:o?c:s,bottom:i?c:s,left:a?c:s,right:l?c:s};break;case"none":r={top:c,bottom:c,left:c,right:c};break}let p=y(t,n.node),v=p.borders||{};b(t,{...p,borders:{...v,...r}});for(let e of["top","bottom","left","right"]){let t=r[e];if(!t)continue;let o=em[e],i="right"===e?n.colIdx+n.colspan:n.colIdx+o.dCol,a=u.get(`${n.rowIdx+o.dRow},${i}`);if(void 0===a)continue;let l=d.get(a),s=y(a,l.node),c=s.borders||{};b(a,{...s,borders:{...c,[o.adjSide]:t}})}}for(let[e,t]of v)i.setNodeMarkup(i.mapping.map(e),void 0,t);r(i.scrollIntoView())}return!0}}function nm(e,t,n){return(r,o)=>{let i=Rf(r);if(!i.isInTable||void 0===i.tablePos||!i.table)return!1;if(o){let a=r.tr,l=Lf(r),s=t||{style:"none"},c={style:"none"},d=["top","bottom","left","right"],{cellByPos:u,cellByRC:p}=zf(i.table,i.tablePos),h=new Map,f=(e,t)=>h.get(e)??{...t.attrs},m=(e,t)=>h.set(e,t);for(let{pos:t,node:r}of l){let o=u.get(t),i=f(t,r),a=i.borders||{},l="all"===e?d:[e],h=n?{top:c,bottom:c,left:c,right:c}:{...a};for(let e of l)h[e]=s;if(o){let e=n?d:l;for(let t of e){let e=h[t],n=em[t],r="right"===t?o.colIdx+o.colspan:o.colIdx+n.dCol,i=p.get(`${o.rowIdx+n.dRow},${r}`);if(void 0!==i){let t=u.get(i),r=f(i,t.node),o=r.borders||{};m(i,{...r,borders:{...o,[n.adjSide]:e}})}}}m(t,{...i,borders:h})}for(let[e,t]of h)a.setNodeMarkup(a.mapping.map(e),void 0,t);o(a.scrollIntoView())}return!0}}function rm(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let o=t.tr,i=Lf(t),a=e.replace(/^#/,""),l={style:"single",size:4},{cellByPos:s,cellByRC:c}=zf(r.table,r.tablePos),d=new Map,u=(e,t)=>d.get(e)??{...t.attrs},p=(e,t)=>d.set(e,t);for(let{pos:e,node:t}of i){let n=s.get(e),r=u(e,t),o=r.borders||{},i={};for(let e of["top","bottom","left","right"]){let t={...l,...o[e],color:{rgb:a}};if(i[e]=t,n){let r=em[e],o="right"===e?n.colIdx+n.colspan:n.colIdx+r.dCol,i=c.get(`${n.rowIdx+r.dRow},${o}`);if(void 0!==i){let e=s.get(i),n=u(i,e.node),o=n.borders||{};p(i,{...n,borders:{...o,[r.adjSide]:t}})}}}p(e,{...r,borders:{...o,...i}})}for(let[e,t]of d)o.setNodeMarkup(o.mapping.map(e),void 0,t);n(o.scrollIntoView())}return!0}}function om(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let o=t.tr,i=Lf(t),a={style:"single",color:{rgb:"000000"}},{cellByPos:l,cellByRC:s}=zf(r.table,r.tablePos),c=new Map,d=(e,t)=>c.get(e)??{...t.attrs},u=(e,t)=>c.set(e,t);for(let{pos:t,node:n}of i){let r=l.get(t),o=d(t,n),i=o.borders||{},c={};for(let t of["top","bottom","left","right"]){let n={...a,...i[t],size:e};if(c[t]=n,r){let e=em[t],o="right"===t?r.colIdx+r.colspan:r.colIdx+e.dCol,i=s.get(`${r.rowIdx+e.dRow},${o}`);if(void 0!==i){let t=l.get(i),r=d(i,t.node),o=r.borders||{};u(i,{...r,borders:{...o,[e.adjSide]:n}})}}}u(t,{...o,borders:{...i,...c}})}for(let[e,t]of c)o.setNodeMarkup(o.mapping.map(e),void 0,t);n(o.scrollIntoView())}return!0}}function im(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let r=t.tr,o=Lf(t),i=e?e.replace(/^#/,""):null;for(let{pos:e,node:t}of o)r.setNodeMarkup(r.mapping.map(e),void 0,{...t.attrs,backgroundColor:i});n(r.scrollIntoView())}return!0}}function am(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let r=t.tr,o=Lf(t);for(let{pos:t,node:n}of o)r.setNodeMarkup(r.mapping.map(t),void 0,{...n.attrs,verticalAlign:e});n(r.scrollIntoView())}return!0}}function lm(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let r=t.tr,o=Lf(t);for(let{pos:t,node:n}of o){let o={...n.attrs.margins||{},...e};r.setNodeMarkup(r.mapping.map(t),void 0,{...n.attrs,margins:o})}n(r.scrollIntoView())}return!0}}function sm(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let r=t.tr,o=Lf(t);for(let{pos:t,node:n}of o)r.setNodeMarkup(r.mapping.map(t),void 0,{...n.attrs,textDirection:e});n(r.scrollIntoView())}return!0}}var cm=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table)return!1;if(t){let n=e.tr,r=Lf(e);for(let{pos:e,node:t}of r)n.setNodeMarkup(n.mapping.map(e),void 0,{...t.attrs,noWrap:!t.attrs.noWrap});t(n.scrollIntoView())}return!0};function dm(e,t){return(n,r)=>{let o=Rf(n);if(!o.isInTable||void 0===o.tablePos||!o.table)return!1;if(r){let o=Of(n,"tableRow");if(!o)return!0;let i=n.tr.setNodeMarkup(o.pos,void 0,{...o.node.attrs,height:e,heightRule:e?t||"atLeast":null});r(i.scrollIntoView())}return!0}}var um=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table||!n.columnCount)return!1;if(t){let r=e.tr,o=n.table,i=n.columnCount,a=o.attrs.columnWidths,l=a?a.reduce((e,t)=>e+t,0):9360,s=Math.floor(l/i),c=n.tablePos+1;o.forEach(e=>{if("tableRow"===e.type.name){let t=c+1;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(r=r.setNodeMarkup(t,void 0,{...e.attrs,width:s,widthType:"dxa",colwidth:null})),t+=e.nodeSize})}c+=e.nodeSize});let d=Array(i).fill(s);r=r.setNodeMarkup(n.tablePos,void 0,{...o.attrs,columnWidths:d}),t(r.scrollIntoView())}return!0},pm=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table)return!1;if(t){let r=e.tr,o=n.table,i=n.tablePos+1;o.forEach(e=>{if("tableRow"===e.type.name){let t=i+1;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&(r=r.setNodeMarkup(t,void 0,{...e.attrs,width:null,widthType:null,colwidth:null})),t+=e.nodeSize})}i+=e.nodeSize}),r=r.setNodeMarkup(n.tablePos,void 0,{...o.attrs,columnWidths:null,width:null,widthType:"auto"}),t(r.scrollIntoView())}return!0};function hm(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let o=t.tr,i=r.table,a=r.tablePos,l=i.childCount,s=e.look??{firstRow:!0,lastRow:!1,noHBand:!1},c=e.conditionals??{},d=e.tableBorders;o=o.setNodeMarkup(a,void 0,{...i.attrs,styleId:e.styleId});let u=0,p=a+1;for(let e=0;e<l;e++){let t,n=i.child(e),r=0===e&&!!s.firstRow,a=e===l-1&&!!s.lastRow,h=!0!==s.noHBand,f=n.childCount;r?t="firstRow":a?t="lastRow":(h&&(t=u%2===0?"band1Horz":"band2Horz"),u++);let m=p+1;for(let i=0;i<f;i++){let u=n.child(i),p=o.mapping.map(m),h=t,g=0===i&&!!s.firstCol,v=i===f-1&&!!s.lastCol;r&&g&&c.nwCell?h="nwCell":r&&v&&c.neCell?h="neCell":a&&g&&c.swCell?h="swCell":a&&v&&c.seCell?h="seCell":g?h="firstCol":v&&(h="lastCol");let y=h?c[h]:void 0,b={...u.attrs};b.backgroundColor=y?.backgroundColor?y.backgroundColor:null;let w={},k=["top","bottom","left","right"];for(let t of k)y?.borders&&void 0!==y.borders[t]?w[t]=y.borders[t]:d&&(w[t]="top"===t&&e>0||"bottom"===t&&e<l-1?d.insideH??d[t]:"left"===t&&i>0||"right"===t&&i<f-1?d.insideV??d[t]:d[t]);Object.keys(w).length>0?b.borders=w:b.borders=null,o=o.setNodeMarkup(p,void 0,b),m+=u.nodeSize}p+=n.nodeSize}n(o.scrollIntoView())}return!0}}function fm(e){return(t,n)=>{let r=Rf(t);if(!r.isInTable||void 0===r.tablePos||!r.table)return!1;if(n){let o=t.tr,i={...r.table.attrs};"width"in e&&(i.width=e.width),"widthType"in e&&(i.widthType=e.widthType),"justification"in e&&(i.justification=e.justification),o.setNodeMarkup(r.tablePos,void 0,i),n(o.scrollIntoView())}return!0}}var mm=(e,t)=>{let n=Rf(e);if(!n.isInTable||void 0===n.tablePos||!n.table)return!1;if(t){let n=Of(e,"tableRow");if(!n)return!0;let r=e.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,isHeader:!n.node.attrs.isHeader});t(r.scrollIntoView())}return!0};function gm(){let e=new Mn("activeCell");return new Tn({key:e,props:{decorations(e){let{selection:t}=e;if(t instanceof Al)return ua.empty;let{$from:n}=t;for(let r=n.depth;r>0;r--){let t=n.node(r);if("tableCell"===t.type.name||"tableHeader"===t.type.name){let o=n.before(r);return ua.create(e.doc,[sa.node(o,o+t.nodeSize,{class:"activeCell"})])}}return ua.empty}}})}function vm(e){let{schema:t}=e,n=$f(t),r=jf(t),o=Hf(t),i=Wf(t),a=qf(t);return{plugins:[ws({handleWidth:5,cellMinWidth:25,lastColumnResizable:!0}),Ds(),gm()],keyboardShortcuts:{Backspace:nf(Gf,Xf),Delete:nf(Gf,Xf)},commands:{insertTable:n,addRowAbove:()=>r,addRowBelow:()=>o,deleteRow:()=>Zf,addColumnLeft:()=>i,addColumnRight:()=>a,deleteColumn:()=>Uf,deleteTable:()=>Kf,selectTable:()=>Yf,selectRow:()=>Jf,selectColumn:()=>Qf,mergeCells:()=>ql,splitCell:()=>Zl,setCellBorder:nm,setTableBorders:tm,setCellVerticalAlign:am,setCellMargins:lm,setCellTextDirection:sm,toggleNoWrap:()=>cm,setRowHeight:dm,toggleHeaderRow:()=>mm,distributeColumns:()=>um,autoFitContents:()=>pm,setTableProperties:fm,applyTableStyle:hm,setCellFillColor:im,setTableBorderColor:rm,setTableBorderWidth:om,removeTableBorders:()=>tm("none"),setAllTableBorders:e=>tm("all",e),setOutsideTableBorders:e=>tm("outside",e),setInsideTableBorders:e=>tm("inside",e)}}}var ym=pf({name:"table",schemaNodeName:"table",nodeSpec:xf}),bm=pf({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:Sf}),wm=pf({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:Nf}),km=pf({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:If}),xm=uf({name:"tablePlugin",onSchemaReady:vm});function Sm(){return[ym(),bm(),wm(),km(),xm()]}var Cm=x(1213);function Tm(e,t){let n=e?{...e}:{},r=t,o=[["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","csTheme"]],i=new Set;for(let[a,l]of o)i.add(a),i.add(l),(void 0!==r[a]||void 0!==r[l])&&(delete n[a],delete n[l],void 0!==r[a]&&(n[a]=r[a]),void 0!==r[l]&&(n[l]=r[l]));for(let a of Object.keys(r))!i.has(a)&&void 0!==r[a]&&(n[a]=r[a]);return n}var Em=Object.defineProperty,_m=e=>{throw TypeError(e)},Mm=(e,t,n)=>t in e?Em(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nm=(e,t,n)=>Mm(e,"symbol"!=typeof t?t+"":t,n),Im=(e,t,n)=>t.has(e)||_m("Cannot "+n),Rm=(e,t,n)=>(Im(e,t,"read from private field"),n?n.call(e):t.get(e)),Am=(e,t,n)=>t.has(e)?_m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Bm=(e,t,n,r)=>(Im(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Dm=(e,t,n)=>(Im(e,t,"access private method"),n),Fm=(e,t,n,r)=>({set _(r){Bm(e,t,r,n)},get _(){return Rm(e,t,r)}});function Pm(e={}){return new Tn({view(t){return new Om(t,e)}})}class Om{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,a=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*a;e={left:o.left,right:o.right,top:i-l,bottom:i+l}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let l,s,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)l=-pageXOffset,s=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;l=e.left-c.scrollLeft*t,s=e.top-c.scrollTop*n}this.element.style.left=(e.left-l)/i+"px",this.element.style.top=(e.top-s)/a+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Ft(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}function Lm(e){let t=e.indentLeft;e.numPr?.numId&&null==t&&(t=720*((e.numPr.ilvl??0)+1));let n={alignment:e.alignment,spaceBefore:e.spaceBefore,spaceAfter:e.spaceAfter,lineSpacing:e.lineSpacing,lineSpacingRule:e.lineSpacingRule,indentLeft:t,indentRight:e.indentRight,indentFirstLine:e.indentFirstLine,hangingIndent:e.hangingIndent,borders:e.borders,shading:e.shading},r=kh(n);return r.marginTop&&(r["--docx-space-before"]=r.marginTop),r.marginBottom&&(r["--docx-space-after"]=r.marginBottom),Object.entries(r).map(([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${t}`).join("; ")}function zm(e){switch(e){case"upperRoman":return"docx-list-upper-roman";case"lowerRoman":return"docx-list-lower-roman";case"upperLetter":return"docx-list-upper-alpha";case"lowerLetter":return"docx-list-lower-alpha";default:return"docx-list-decimal"}}function Vm(e,t,n){if(!e?.numId)return"";let r=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${r}`:`docx-list-numbered ${zm(n)} docx-list-level-${r}`}function $m(e){if(!e)return;let t=e.trim(),n=parseFloat(t);if(!isNaN(n)&&0!==n){if(t.endsWith("pt"))return Math.round(20*n);if(t.endsWith("px"))return Math.round(15*n);if(t.endsWith("in"))return Math.round(1440*n);if(t.endsWith("mm"))return Math.round(n*(1440/25.4));if(t.endsWith("cm"))return Math.round(n*(1440/2.54));if(/^[\d.]+$/.test(t))return Math.round(15*n)}}function jm(e){switch(e.trim().toLowerCase()){case"left":case"start":return"left";case"center":return"center";case"right":case"end":return"right";case"justify":return"both";default:return}}function Hm(e){if(!e||"normal"===e)return;let t=e.trim();if(t.endsWith("%")){let e=parseFloat(t);return isNaN(e)||0===e?void 0:{lineSpacing:Math.round(e/100*240),lineSpacingRule:"auto"}}if(/[a-z]/i.test(t)){let e=$m(t);return null==e?void 0:{lineSpacing:e,lineSpacingRule:"exact"}}let n=parseFloat(t);return isNaN(n)||0===n?void 0:{lineSpacing:Math.round(240*n),lineSpacingRule:"auto"}}function Wm(e){let t=e.style,n={};if(t.textAlign){let e=jm(t.textAlign);e&&(n.alignment=e)}let r=t.marginLeft||t.paddingLeft;if(r){let e=$m(r);null!=e&&(n.indentLeft=e)}let o=t.marginRight||t.paddingRight;if(o){let e=$m(o);null!=e&&(n.indentRight=e)}if(t.textIndent){let e=$m(t.textIndent);null!=e&&(e<0?(n.indentFirstLine=Math.abs(e),n.hangingIndent=!0):n.indentFirstLine=e)}if(t.lineHeight){let e=Hm(t.lineHeight);e&&(n.lineSpacing=e.lineSpacing,n.lineSpacingRule=e.lineSpacingRule)}if(t.marginTop){let e=$m(t.marginTop);null!=e&&(n.spaceBefore=e)}if(t.marginBottom){let e=$m(t.marginBottom);null!=e&&(n.spaceAfter=e)}return n}var qm={content:"inline*",group:"block",attrs:{paraId:{default:null},textId:{default:null},alignment:{default:null},spaceBefore:{default:null},spaceAfter:{default:null},lineSpacing:{default:null},lineSpacingRule:{default:null},spacingExplicit:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:!1},numPr:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},listMarkerHidden:{default:null},listMarkerFontFamily:{default:null},listMarkerFontSize:{default:null},listLevelNumFmts:{default:null},listAbstractNumId:{default:null},listStartOverride:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},renderedPageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},bidi:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null},_sectionProperties:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e,n={paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0},r=Wm(t);return{...r,...n,alignment:n.alignment||r.alignment||void 0}}},...["h1","h2","h3","h4","h5","h6"].map(e=>({tag:e,getAttrs(t){let n=parseInt(e.charAt(1));return{...Wm(t),styleId:`Heading${n}`,outlineLevel:n-1}}}))],toDOM(e){let t=e.attrs,n=Lm(t),r=Vm(t.numPr,t.listIsBullet,t.listNumFmt),o={};return n&&(o.style=n),r&&(o.class=r),t.paraId&&(o["data-para-id"]=t.paraId),t.alignment&&(o["data-alignment"]=t.alignment),t.styleId&&(o["data-style-id"]=t.styleId),t.listMarker&&(o["data-list-marker"]=t.listMarker),t.bidi&&(o.dir="rtl"),t.sectionBreakType&&(o["data-section-break"]=t.sectionBreakType,o.class=(o.class?o.class+" ":"")+"docx-section-break"),["p",o,0]}};function Zm(e,t){return(n,r)=>{let{$from:o,$to:i}=n.selection;if(!r)return!0;let a=n.tr,l=new Set;return n.doc.nodesBetween(o.pos,i.pos,(n,r)=>{"paragraph"===n.type.name&&!l.has(r)&&(l.add(r),a=a.setNodeMarkup(r,void 0,{...n.attrs,[e]:t}))}),r(a.scrollIntoView()),!0}}function Um(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(!n)return!0;let i=t.tr,a=new Set;return t.doc.nodesBetween(r.pos,o.pos,(t,n)=>{"paragraph"===t.type.name&&!a.has(n)&&(a.add(n),i=i.setNodeMarkup(n,void 0,{...t.attrs,...e}))}),n(i.scrollIntoView()),!0}}function Km(e){return(t,n)=>Zm("alignment",e)(t,n)}function Gm(e,t="auto"){return(n,r)=>Um({lineSpacing:e,lineSpacingRule:t})(n,r)}function Xm(e=720){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(!n)return!0;let i=t.tr,a=new Set;return t.doc.nodesBetween(r.pos,o.pos,(t,n)=>{if("paragraph"===t.type.name&&!a.has(n)){a.add(n);let r=t.attrs.indentLeft||0;i=i.setNodeMarkup(n,void 0,{...t.attrs,indentLeft:r+e})}}),n(i.scrollIntoView()),!0}}function Ym(e=720){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(!n)return!0;let i=t.tr,a=new Set;return t.doc.nodesBetween(r.pos,o.pos,(t,n)=>{if("paragraph"===t.type.name&&!a.has(n)){a.add(n);let r=t.attrs.indentLeft||0,o=Math.max(0,r-e);i=i.setNodeMarkup(n,void 0,{...t.attrs,indentLeft:o>0?o:null})}}),n(i.scrollIntoView()),!0}}function Jm(e){return(t,n)=>(r,o)=>{let{$from:i,$to:a}=r.selection;if(!o)return!0;let l=r.tr,s=new Set,c=[];if(n?.runFormatting){let t=n.runFormatting;t.bold&&c.push(e.marks.bold.create()),t.italic&&c.push(e.marks.italic.create()),t.fontSize&&c.push(e.marks.fontSize.create({size:t.fontSize})),t.fontFamily&&c.push(e.marks.fontFamily.create({ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi,asciiTheme:t.fontFamily.asciiTheme})),t.color&&!t.color.auto&&c.push(e.marks.textColor.create({rgb:t.color.rgb,themeColor:t.color.themeColor,themeTint:t.color.themeTint,themeShade:t.color.themeShade})),t.underline&&"none"!==t.underline.style&&c.push(e.marks.underline.create({style:t.underline.style,color:t.underline.color})),(t.strike||t.doubleStrike)&&c.push(e.marks.strike.create({double:t.doubleStrike||!1}))}let d=[e.marks.bold,e.marks.italic,e.marks.fontSize,e.marks.fontFamily,e.marks.textColor,e.marks.underline,e.marks.strike].filter(Boolean);return r.doc.nodesBetween(i.pos,a.pos,(e,r)=>{if("paragraph"===e.type.name&&!s.has(r)){s.add(r);let o={...e.attrs,styleId:t};if(n){let e=n.paragraphFormatting;o.alignment=e?.alignment??null,o.spaceBefore=e?.spaceBefore??null,o.spaceAfter=e?.spaceAfter??null,o.lineSpacing=e?.lineSpacing??null,o.lineSpacingRule=e?.lineSpacingRule??null,o.indentLeft=e?.indentLeft??null,o.indentRight=e?.indentRight??null,o.indentFirstLine=e?.indentFirstLine??null,o.hangingIndent=e?.hangingIndent??null,o.contextualSpacing=e?.contextualSpacing??null,o.keepNext=e?.keepNext??null,o.keepLines=e?.keepLines??null,o.pageBreakBefore=e?.pageBreakBefore??null,o.outlineLevel=e?.outlineLevel??null}if(l=l.setNodeMarkup(r,void 0,o),n){let t=r+1,n=r+e.nodeSize-1;if(n>t){for(let e of d)l=l.removeMark(t,n,e);for(let e of c)l=l.addMark(t,n,e)}}}}),c.length>0&&(l=l.setStoredMarks(c)),o(l.scrollIntoView()),!0}}var Qm=pf({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:qm,onSchemaReady(e){let t=Jm(e.schema);return{commands:{setAlignment:e=>Km(e),alignLeft:()=>Km("left"),alignCenter:()=>Km("center"),alignRight:()=>Km("right"),alignJustify:()=>Km("both"),setLineSpacing:(e,t)=>Gm(e,t),singleSpacing:()=>Gm(240),oneAndHalfSpacing:()=>Gm(360),doubleSpacing:()=>Gm(480),setSpaceBefore:e=>Zm("spaceBefore",e),setSpaceAfter:e=>Zm("spaceAfter",e),increaseIndent:e=>Xm(e),decreaseIndent:e=>Ym(e),setIndentLeft:e=>Zm("indentLeft",e>0?e:null),setIndentRight:e=>Zm("indentRight",e>0?e:null),setIndentFirstLine:(e,t)=>Um({indentFirstLine:e>0?e:null,hangingIndent:t??!1}),applyStyle:(e,n)=>t(e,n),clearStyle:()=>Zm("styleId",null),insertSectionBreak:e=>Zm("sectionBreakType",e),removeSectionBreak:()=>Zm("sectionBreakType",null),generateTOC:()=>(e,t)=>{let n=Mh(e.doc);if(0===n.length)return!1;if(!t)return!0;let{schema:r}=e,o=e.tr,i=[];for(let s of n){let e=`_Toc${Math.floor(1e8+9e8*Math.random())}`;i.push({name:e,level:s.level,text:s.text});let t=o.mapping.map(s.pmPos),n=o.doc.resolve(t).nodeAfter;if(n&&"paragraph"===n.type.name){let r=[...(n.attrs.bookmarks||[]).filter(e=>!e.name.startsWith("_Toc")),{id:Math.floor(2147483647*Math.random()),name:e}];o.setNodeMarkup(t,void 0,{...n.attrs,bookmarks:r})}}let a=[];a.push(r.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[r.text("Table of Contents",[r.marks.bold.create()])]));for(let s of i){let e=720*s.level,t=`TOC${s.level+1}`,n=r.marks.hyperlink.create({href:`#${s.name}`});a.push(r.node("paragraph",{styleId:t,indentLeft:e>0?e:null},[r.text(s.text,[n])]))}let l=o.mapping.map(e.selection.from);return o.insert(l,E.from(a)),t(o.scrollIntoView()),!0},toggleBidi:()=>(e,t)=>{let{$from:n}=e.selection,r=n.parent;if("paragraph"!==r.type.name)return!1;let o=r.attrs.bidi||!1;return Zm("bidi",!o||null)(e,t)},setRtl:()=>Zm("bidi",!0),setLtr:()=>Zm("bidi",null),setTabs:e=>Zm("tabs",e.length>0?e:null),addTabStop:(e,t="left",n="none")=>(r,o)=>{let{$from:i}=r.selection,a=i.parent;if("paragraph"!==a.type.name)return!1;let l=[...(a.attrs.tabs||[]).filter(t=>t.position!==e),{position:e,alignment:t,leader:n}].sort((e,t)=>e.position-t.position);return Zm("tabs",l)(r,o)},removeTabStop:e=>(t,n)=>{let{$from:r}=t.selection,o=r.parent;if("paragraph"!==o.type.name)return!1;let i=(o.attrs.tabs||[]).filter(t=>t.position!==e);return Zm("tabs",i.length>0?i:null)(t,n)}}}}});function eg(e){let t={};for(let n of e)switch(n.type.name){case"bold":t.bold=!0;break;case"italic":t.italic=!0;break;case"underline":t.underline={style:n.attrs.style||"single"};break;case"strike":t.strike=!0;break;case"textColor":t.color=n.attrs;break;case"highlight":t.highlight=n.attrs.color;break;case"fontSize":t.fontSize=n.attrs.size;break;case"fontFamily":t.fontFamily={ascii:n.attrs.ascii,hAnsi:n.attrs.hAnsi};break;case"superscript":t.vertAlign="superscript";break;case"subscript":t.vertAlign="subscript";break}return t}function tg(e,t,n){let{$from:r}=e.selection,o=r.parent;if("paragraph"!==o.type.name||o.textContent.length>0)return t;if(0===n.length)return t.setNodeMarkup(r.before(),void 0,{...o.attrs,defaultTextFormatting:null});let i=eg(n);return t.setNodeMarkup(r.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function ng(e,t,n){let r=e.tr;r=tg(e,r,n),r.setStoredMarks(n),t(r)}function rg(e,t){return(n,r)=>{let{from:o,to:i,empty:a}=n.selection,l=e.create(t);if(a){if(r){let t=n.storedMarks||n.selection.$from.marks(),o=e.isInSet(t)?t.filter(t=>t.type!==e):t;ng(n,r,[...o,l])}return!0}return r&&r(n.tr.addMark(o,i,l).scrollIntoView()),!0}}function og(e){return(t,n)=>{let{from:r,to:o,empty:i}=t.selection;if(i){if(n){let r=(t.storedMarks||t.selection.$from.marks()).filter(t=>t.type!==e);ng(t,n,r)}return!0}return n&&n(t.tr.removeMark(r,o,e).scrollIntoView()),!0}}function ig(e,t){let n=[];return e.bold&&n.push(t.marks.bold.create()),e.italic&&n.push(t.marks.italic.create()),e.underline&&n.push(t.marks.underline.create({style:e.underline.style||"single",color:e.underline.color})),e.strike&&n.push(t.marks.strike.create()),e.doubleStrike&&n.push(t.marks.strike.create({double:!0})),e.color&&n.push(t.marks.textColor.create({rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&n.push(t.marks.highlight.create({color:e.highlight})),e.fontSize&&n.push(t.marks.fontSize.create({size:e.fontSize})),e.fontFamily&&n.push(t.marks.fontFamily.create({ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),"superscript"===e.vertAlign&&n.push(t.marks.superscript.create()),"subscript"===e.vertAlign&&n.push(t.marks.subscript.create()),n}var ag=(e,t)=>{let{from:n,to:r,empty:o}=e.selection;if(o)return t&&t(e.tr.setStoredMarks([])),!0;if(t){let o=e.tr;e.doc.nodesBetween(n,r,(e,t)=>{if(e.isText&&e.marks.length>0){let i=Math.max(n,t),a=Math.min(r,t+e.nodeSize);for(let t of e.marks)o=o.removeMark(i,a,t.type)}}),t(o.scrollIntoView())}return!0};function lg(e,t){let n=e.schema.marks.hyperlink;if(!n)return null;let{$from:r}=e.selection,o=r.marks().find(e=>e.type===n);if(!o&&r.nodeAfter&&(o=r.nodeAfter.marks.find(e=>e.type===n)),!o&&r.nodeBefore&&(o=r.nodeBefore.marks.find(e=>e.type===n)),!o&&t&&r.parent.forEach(e=>{if(o||!e.isText)return;let r=e.marks.find(e=>e.type===n&&e.attrs.href===t);r&&(o=r)}),!o)return null;let i=r.start(),a=[],l=null;r.parent.forEach((e,t)=>{let r=i+t,s=r+e.nodeSize;e.isText&&e.marks.some(e=>e.type===n&&e.attrs.href===o.attrs.href)?l?l.end=s:l={start:r,end:s}:l&&(a.push(l),l=null)}),l&&a.push(l);let s=a.find(e=>e.start<=r.pos&&r.pos<=e.end);return s?{mark:o,start:s.start,end:s.end}:null}var sg=hf({name:"hyperlink",schemaMarkName:"hyperlink",markSpec:{attrs:{href:{},tooltip:{default:null},rId:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return{href:t.getAttribute("href")||"",tooltip:t.getAttribute("title")||void 0}}}],toDOM(e){let t=e.attrs,n={href:t.href,target:"_blank",rel:"noopener noreferrer"};return t.tooltip&&(n.title=t.tooltip),["a",n,0]}},onSchemaReady(e){let t=e.schema.marks.hyperlink,n=(e,n)=>(r,o)=>{let{from:i,to:a,empty:l}=r.selection;if(l)return!1;if(o){let l=t.create({href:e,tooltip:n||null}),s=r.tr.addMark(i,a,l),c=r.schema.marks.textColor;c&&(s=s.removeMark(i,a,c)),o(s.scrollIntoView())}return!0},r=(e,n)=>{let{from:r,to:o,empty:i}=e.selection;if(i){let r=e.selection.$from;if(!r.marks().find(e=>e.type===t))return!1;let o=r.pos,i=r.pos;return r.parent.forEach((e,n)=>{if(e.isText){let a=r.start()+n,l=a+e.nodeSize;a<=r.pos&&r.pos<=l&&e.marks.some(e=>e.type===t)&&(o=Math.min(o,a),i=Math.max(i,l))}}),n&&n(e.tr.removeMark(o,i,t).scrollIntoView()),!0}return n&&n(e.tr.removeMark(r,o,t).scrollIntoView()),!0};return{commands:{setHyperlink:n,removeHyperlink:()=>r,insertHyperlink:(e,n,r)=>(o,i)=>{if(i){let a=t.create({href:n,tooltip:r||null}),l=o.schema.text(e,[a]);i(o.tr.replaceSelectionWith(l,!1).scrollIntoView())}return!0}}}}});function cg(...e){return(t,n,r)=>{for(let o of e)if(o(t,n,r))return!0;return!1}}function dg(e){return(t,n)=>{let{$from:r,$to:o}=t.selection,i=r.parent;if("paragraph"!==i.type.name)return!1;let a=i.attrs.numPr?.numId===e;if(!n)return!0;let l=t.tr,s=new Set;return t.doc.nodesBetween(r.pos,o.pos,(t,n)=>{if("paragraph"===t.type.name&&!s.has(n))if(s.add(n),a)l=l.setNodeMarkup(n,void 0,{...t.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});else{let r=1===e;l=l.setNodeMarkup(n,void 0,{...t.attrs,numPr:{numId:e,ilvl:t.attrs.numPr?.ilvl||0},listIsBullet:r,listNumFmt:r?null:"decimal",listMarker:null})}}),n(l.scrollIntoView()),!0}}var ug=(e,t)=>dg(1)(e,t),pg=(e,t)=>dg(2)(e,t),hg=(e,t)=>{let{$from:n}=e.selection,r=n.parent;if("paragraph"!==r.type.name||!r.attrs.numPr)return!1;let o=r.attrs.numPr.ilvl||0;if(o>=8)return!1;if(!t)return!0;let i=n.before(n.depth);return t(e.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:{...r.attrs.numPr,ilvl:o+1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),!0},fg=(e,t)=>{let{$from:n}=e.selection,r=n.parent;if("paragraph"!==r.type.name||!r.attrs.numPr)return!1;let o=r.attrs.numPr.ilvl||0;if(!t)return!0;let i=n.before(n.depth);return t(o<=0?e.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView():e.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:{...r.attrs.numPr,ilvl:o-1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),!0},mg=(e,t)=>{let{$from:n,$to:r}=e.selection;if(!t)return!0;let o=e.tr,i=new Set;return e.doc.nodesBetween(n.pos,r.pos,(e,t)=>{"paragraph"===e.type.name&&e.attrs.numPr&&!i.has(t)&&(i.add(t),o=o.setNodeMarkup(t,void 0,{...e.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null}))}),t(o.scrollIntoView()),!0};function gg(){return(e,t)=>{let{$from:n,empty:r}=e.selection;if(!r)return!1;let o=n.parent;if("paragraph"!==o.type.name||!o.attrs.numPr||o.textContent.length>0)return!1;if(t){let r=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});t(r)}return!0}}function vg(){return(e,t)=>{let{$from:n,empty:r}=e.selection;if(!r)return!1;let o=n.parent;if("paragraph"!==o.type.name||!o.attrs.numPr)return!1;if(t){let{tr:r}=e,i=n.pos;r.split(i,1,[{type:e.schema.nodes.paragraph,attrs:{...o.attrs}}]),t(r.scrollIntoView())}return!0}}function yg(){return(e,t)=>{let{$from:n,empty:r}=e.selection;if(!r||0!==n.parentOffset)return!1;let o=n.parent;if("paragraph"!==o.type.name||!o.attrs.numPr)return!1;if(t){let r=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});t(r)}return!0}}function bg(){return(e,t)=>{let{$from:n,$to:r}=e.selection,o=[];if(e.doc.nodesBetween(n.pos,r.pos,(e,t)=>{"paragraph"===e.type.name&&e.attrs.numPr&&(e.attrs.numPr.ilvl??0)<8&&o.push({pos:t,attrs:e.attrs})}),0===o.length)return!1;if(t){let n=e.tr;for(let{pos:e,attrs:t}of o){let r=t.numPr;n=n.setNodeMarkup(e,void 0,{...t,numPr:{...r,ilvl:(r.ilvl??0)+1},indentLeft:null,indentFirstLine:null,hangingIndent:null})}t(n)}return!0}}function wg(){return(e,t)=>{let{$from:n,$to:r}=e.selection,o=[];if(e.doc.nodesBetween(n.pos,r.pos,(e,t)=>{"paragraph"===e.type.name&&e.attrs.numPr&&o.push({pos:t,attrs:e.attrs})}),0===o.length)return!1;if(t){let n=e.tr;for(let{pos:e,attrs:t}of o){let r=t.numPr,o=r.ilvl??0;n=o<=0?n.setNodeMarkup(e,void 0,{...t,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}):n.setNodeMarkup(e,void 0,{...t,numPr:{...r,ilvl:o-1},indentLeft:null,indentFirstLine:null,hangingIndent:null})}t(n)}return!0}}function kg(){return(e,t)=>{let{schema:n}=e,r=n.nodes.tab;if(!r)return!1;if(t){let n=e.tr.replaceSelectionWith(r.create());t(n.scrollIntoView())}return!0}}var xg=uf({name:"list",priority:df.High,onSchemaReady(){return{commands:{toggleBulletList:()=>ug,toggleNumberedList:()=>pg,increaseListLevel:()=>hg,decreaseListLevel:()=>fg,removeList:()=>mg},keyboardShortcuts:{Tab:cg(Df(),bg(),kg()),"Shift-Tab":cg(Ff(),wg()),"Shift-Enter":()=>!1,Enter:cg(gg(),vg()),Backspace:yg()}}}}),Sg=new Mn("paragraphChangeTracker");function Cg(e){let t=0;return e.descendants(e=>{"paragraph"===e.type.name&&t++}),t}function Tg(e,t,n){let r=new Set,o=!1;return e.nodesBetween(t,n,e=>{if("paragraph"===e.type.name){let t=e.attrs.paraId;t?r.add(t):o=!0}}),{ids:r,hasUntracked:o}}function Eg(e,t,n){let r=Math.min(t,n),o=Math.max(t,n),i=o>r?o:r+1,a=Tg(e,r,i);if(a.ids.size>0||a.hasUntracked)return a;try{let t=e.resolve(r);for(let e=t.depth;e>=0;e--){let n=t.node(e);if("paragraph"===n.type.name){let e=n.attrs.paraId;return e?{ids:new Set([e]),hasUntracked:!1}:{ids:new Set,hasUntracked:!0}}}}catch{}return{ids:new Set,hasUntracked:!1}}function _g(){return new Tn({key:Sg,state:{init(e,t){return{changedParaIds:new Set,structuralChange:!1,hasUntrackedChanges:!1,paragraphCount:Cg(t.doc)}},apply(e,t){if("clear"===e.getMeta(Sg))return{changedParaIds:new Set,structuralChange:!1,hasUntrackedChanges:!1,paragraphCount:t.paragraphCount};if(!e.docChanged)return t;let n=Cg(e.doc),r={changedParaIds:new Set(t.changedParaIds),structuralChange:t.structuralChange,hasUntrackedChanges:t.hasUntrackedChanges,paragraphCount:n};t.paragraphCount!==n&&(r.structuralChange=!0);for(let o=0;o<e.steps.length;o++){let t=e.steps[o],n=e.mapping.slice(o+1);if(t instanceof ct||t instanceof dt){let o=n.map(t.from,1),i=n.map(t.to,-1);if(i<=o)continue;let{ids:a,hasUntracked:l}=Eg(e.doc,o,i);for(let e of a)r.changedParaIds.add(e);l&&(r.hasUntrackedChanges=!0);continue}if(t instanceof ut||t instanceof pt){let o=n.map(t.pos,1),i=e.doc.nodeAt(o);if(!i)continue;let a=o+i.nodeSize,{ids:l,hasUntracked:s}=Tg(e.doc,o,a);for(let e of l)r.changedParaIds.add(e);s&&(r.hasUntrackedChanges=!0);continue}t.getMap().forEach((t,o,i,a)=>{let l=n.map(i,1),s=n.map(a,-1);if(s<l)return;let{ids:c,hasUntracked:d}=Tg(e.doc,l,s);for(let e of c)r.changedParaIds.add(e);d&&(r.hasUntrackedChanges=!0)})}return r}}})}var Mg=uf({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return{plugins:[_g()]}}}),Ng=pf({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table | textBox)+"}}),Ig=pf({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}}),Rg=uf({name:"history",defaultOptions:{depth:100,newGroupDelay:500},onSchemaReady(e,t){return{plugins:[Op({depth:t.depth,newGroupDelay:t.newGroupDelay})],commands:{undo:()=>zp,redo:()=>Vp},keyboardShortcuts:{"Mod-z":zp,"Mod-y":Vp,"Mod-Shift-z":Vp}}}}),Ag=hf({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs(e){let t=e.style?.fontWeight;return"normal"!==t&&"400"!==t&&null}},{style:"font-weight",getAttrs:e=>!!/^(bold(er)?|[5-9]\d{2})$/.test(e)&&null}],toDOM(){return["strong",0]}},onSchemaReady(e){return{commands:{toggleBold:()=>tf(e.schema.marks.bold)},keyboardShortcuts:{"Mod-b":tf(e.schema.marks.bold)}}}}),Bg=hf({name:"italic",schemaMarkName:"italic",markSpec:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e&&null}],toDOM(){return["em",0]}},onSchemaReady(e){return{commands:{toggleItalic:()=>tf(e.schema.marks.italic)},keyboardShortcuts:{"Mod-i":tf(e.schema.marks.italic)}}}}),Dg=hf({name:"underline",schemaMarkName:"underline",markSpec:{attrs:{style:{default:"single"},color:{default:null}},parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:e=>!!e.includes("underline")&&{}}],toDOM(e){let t=e.attrs,n=["text-decoration: underline"];if(t.style&&"single"!==t.style){let e={double:"double",dotted:"dotted",dash:"dashed",wave:"wavy"}[t.style];e&&n.push(`text-decoration-style: ${e}`)}return t.color?.rgb&&n.push(`text-decoration-color: #${t.color.rgb}`),["span",{style:n.join("; ")},0]}},onSchemaReady(e){return{commands:{toggleUnderline:()=>tf(e.schema.marks.underline),setUnderlineStyle:(t,n)=>rg(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":tf(e.schema.marks.underline)}}}}),Fg=hf({name:"strike",schemaMarkName:"strike",markSpec:{attrs:{double:{default:!1}},parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:e=>!!e.includes("line-through")&&{}}],toDOM(){return["s",0]}},onSchemaReady(e){return{commands:{toggleStrike:()=>tf(e.schema.marks.strike)}}}}),Pg=hf({name:"textColor",schemaMarkName:"textColor",markSpec:{attrs:{rgb:{default:null},themeColor:{default:null},themeTint:{default:null},themeShade:{default:null}},parseDOM:[{style:"color",getAttrs:e=>{let t=e.match(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/);return!!t&&{rgb:t[1].toUpperCase()}}}],toDOM(e){let t=e.attrs,n=wh({color:t});return["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return{commands:{setTextColor:t=>t.rgb||t.themeColor?rg(e.schema.marks.textColor,t):og(e.schema.marks.textColor),clearTextColor:()=>og(e.schema.marks.textColor)}}}}),Og=hf({name:"highlight",schemaMarkName:"highlight",markSpec:{attrs:{color:{default:"yellow"}},parseDOM:[{tag:"mark"},{style:"background-color",getAttrs:e=>!(!e||"transparent"===e||"inherit"===e)&&{color:e}}],toDOM(e){let t=e.attrs.color;return["mark",{style:`background-color: ${gh(t)}`},0]}},onSchemaReady(e){return{commands:{setHighlight:t=>t&&"none"!==t?rg(e.schema.marks.highlight,{color:t}):og(e.schema.marks.highlight),clearHighlight:()=>og(e.schema.marks.highlight)}}}}),Lg=hf({name:"fontSize",schemaMarkName:"fontSize",markSpec:{attrs:{size:{default:24}},parseDOM:[{style:"font-size",getAttrs:e=>{let t=e,n=t.match(/^([\d.]+)px$/);if(n){let e=.75*parseFloat(n[1]);return{size:Math.round(2*e)}}let r=t.match(/^([\d.]+)pt$/);return!!r&&{size:Math.round(2*parseFloat(r[1]))}}}],toDOM(e){let t=e.attrs.size/2,n=(1.15*t).toFixed(2);return["span",{style:`font-size: ${t}pt; line-height: ${n}pt`},0]}},onSchemaReady(e){return{commands:{setFontSize:t=>rg(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>og(e.schema.marks.fontSize)}}}}),zg=hf({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},eastAsia:{default:null},cs:{default:null},asciiTheme:{default:null},hAnsiTheme:{default:null},eastAsiaTheme:{default:null},csTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:e=>{let t=e.split(",")[0].trim().replace(/['"]/g,"");return!!t&&{ascii:t}}}],toDOM(e){let t=e.attrs,n=t.ascii||t.hAnsi;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},onSchemaReady(e){return{commands:{setFontFamily:t=>rg(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>og(e.schema.marks.fontFamily)}}}}),Vg=hf({name:"superscript",schemaMarkName:"superscript",markSpec:{excludes:"subscript",parseDOM:[{tag:"sup"}],toDOM(){return["sup",0]}},onSchemaReady(e){return{commands:{toggleSuperscript:()=>tf(e.schema.marks.superscript)}}}}),$g=hf({name:"subscript",schemaMarkName:"subscript",markSpec:{excludes:"superscript",parseDOM:[{tag:"sub"}],toDOM(){return["sub",0]}},onSchemaReady(e){return{commands:{toggleSubscript:()=>tf(e.schema.marks.subscript)}}}}),jg=hf({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>"uppercase"===e&&{}}],toDOM(){return["span",{style:"text-transform: uppercase"},0]}}}),Hg=hf({name:"smallCaps",schemaMarkName:"smallCaps",markSpec:{parseDOM:[{style:"font-variant",getAttrs:e=>"small-caps"===e&&{}}],toDOM(){return["span",{style:"font-variant: small-caps"},0]}}}),Wg=hf({name:"footnoteRef",schemaMarkName:"footnoteRef",markSpec:{attrs:{id:{},noteType:{default:"footnote"}},parseDOM:[{tag:"sup.docx-footnote-ref",getAttrs:e=>{let t=e;return{id:t.dataset.id||"",noteType:t.dataset.noteType||"footnote"}}}],toDOM(e){let t=e.attrs;return["sup",{class:`docx-${t.noteType}-ref`,"data-id":t.id,"data-note-type":t.noteType},0]}},onSchemaReady(e){let{schema:t}=e;function n(e){return n=>(r,o)=>{if(!o)return!0;let i=t.marks.footnoteRef.create({id:String(n),noteType:e}),a=t.text(String(n),[i]),l=r.tr.replaceSelectionWith(a,!1);return o(l.scrollIntoView()),!0}}let r=(e,n)=>{let{$from:r,$to:o}=e.selection;if(!n)return!0;let i=e.tr,a=t.marks.footnoteRef;return i=i.removeMark(r.pos,o.pos,a),n(i.scrollIntoView()),!0};return{commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>r}}}});function qg(e){return e/2*(96/72)}var Zg=hf({name:"characterSpacing",schemaMarkName:"characterSpacing",markSpec:{attrs:{spacing:{default:null},position:{default:null},scale:{default:null},kerning:{default:null}},parseDOM:[{tag:"span.docx-char-spacing",getAttrs:e=>{let t=e;return{spacing:t.dataset.spacing?Number(t.dataset.spacing):null,position:t.dataset.position?Number(t.dataset.position):null,scale:t.dataset.scale?Number(t.dataset.scale):null,kerning:t.dataset.kerning?Number(t.dataset.kerning):null}}}],toDOM(e){let t=e.attrs,n=[],r={class:"docx-char-spacing"};if(null!=t.spacing&&0!==t.spacing&&(n.push(`letter-spacing: ${ic(Gs(t.spacing))}`),r["data-spacing"]=String(t.spacing)),null!=t.position&&0!==t.position){let e=qg(t.position);n.push(`vertical-align: ${ic(e)}`),r["data-position"]=String(t.position)}return null!=t.scale&&100!==t.scale&&(n.push(`transform: scaleX(${t.scale/100})`),n.push("display: inline-block"),r["data-scale"]=String(t.scale)),null!=t.kerning&&(r["data-kerning"]=String(t.kerning)),n.length>0&&(r.style=n.join("; ")),["span",r,0]}}}),Ug=hf({name:"comment",schemaMarkName:"comment",markSpec:{attrs:{commentId:{default:0}},inclusive:!1,parseDOM:[{tag:"span.docx-comment",getAttrs(e){return{commentId:parseInt(e.dataset.commentId||"0",10)}}}],toDOM(e){return["span",{class:"docx-comment","data-comment-id":String(e.attrs.commentId),style:"background-color: rgba(255, 212, 0, 0.25); border-bottom: 2px solid rgba(255, 212, 0, 0.6);"},0]}}}),Kg=hf({name:"insertion",schemaMarkName:"insertion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:!1,parseDOM:[{tag:"span.docx-insertion",getAttrs(e){let t=e;return{revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return["span",{class:"docx-insertion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #2e7d32;"},0]}}}),Gg=hf({name:"deletion",schemaMarkName:"deletion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:!1,parseDOM:[{tag:"span.docx-deletion",getAttrs(e){let t=e;return{revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return["span",{class:"docx-deletion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #c62828;"},0]}}}),Xg=hf({name:"emboss",schemaMarkName:"emboss",markSpec:{parseDOM:[{tag:"span.docx-emboss"}],toDOM(){return["span",{class:"docx-emboss",style:"text-shadow: 1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"},0]}}}),Yg=hf({name:"imprint",schemaMarkName:"imprint",markSpec:{parseDOM:[{tag:"span.docx-imprint"}],toDOM(){return["span",{class:"docx-imprint",style:"-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"},0]}}}),Jg=hf({name:"textShadow",schemaMarkName:"textShadow",markSpec:{parseDOM:[{tag:"span.docx-text-shadow"}],toDOM(){return["span",{class:"docx-text-shadow",style:"text-shadow: 1px 1px 2px rgba(0,0,0,0.3)"},0]}}}),Qg=hf({name:"emphasisMark",schemaMarkName:"emphasisMark",markSpec:{attrs:{type:{default:"dot"}},parseDOM:[{tag:"span.docx-emphasis-mark",getAttrs:e=>({type:e.dataset.emType||"dot"})}],toDOM(e){let t=e.attrs.type,n="filled dot";switch(t){case"dot":n="filled dot";break;case"comma":n="filled sesame";break;case"circle":n="filled circle";break;case"underDot":n="filled dot";break}let r="underDot"===t?"under right":"over right";return["span",{class:"docx-emphasis-mark","data-em-type":t,style:`text-emphasis: ${n}; text-emphasis-position: ${r}; -webkit-text-emphasis: ${n}; -webkit-text-emphasis-position: ${r}`},0]}}}),ev=hf({name:"textOutline",schemaMarkName:"textOutline",markSpec:{parseDOM:[{tag:"span.docx-text-outline"}],toDOM(){return["span",{class:"docx-text-outline",style:"-webkit-text-stroke: 1px currentColor; -webkit-text-fill-color: transparent"},0]}}}),tv=hf({name:"hidden",schemaMarkName:"hidden",markSpec:{parseDOM:[{tag:"span.docx-hidden"}],toDOM(){return["span",{class:"docx-hidden",style:"opacity: 0.4; text-decoration: underline dotted"},0]}}}),nv=hf({name:"rtl",schemaMarkName:"rtl",markSpec:{parseDOM:[{tag:"span[dir=rtl].docx-rtl"}],toDOM(){return["span",{class:"docx-rtl",dir:"rtl"},0]}}}),rv=hf({name:"textEffect",schemaMarkName:"textEffect",markSpec:{attrs:{effect:{default:"blinkBackground"}},parseDOM:[{tag:"span.docx-text-effect",getAttrs:e=>{let t=e.dataset.effect;return("blinkBackground"===t||"lights"===t||"antsBlack"===t||"antsRed"===t||"shimmer"===t||"sparkle"===t)&&{effect:t}}}],toDOM(e){let t=e.attrs.effect;return["span",{class:`docx-text-effect docx-text-effect-${t}`,"data-effect":t},0]}}}),ov=pf({name:"hardBreak",schemaNodeName:"hardBreak",nodeSpec:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}},onSchemaReady(e){let t=e.schema.nodes.hardBreak;return{keyboardShortcuts:{"Shift-Enter":(e,n)=>(n&&n(e.tr.replaceSelectionWith(t.create()).scrollIntoView()),!0)}}}}),iv=pf({name:"tab",schemaNodeName:"tab",nodeSpec:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"span.docx-tab"}],toDOM(){return["span",{class:"docx-tab",style:"display: inline-block; min-width: 16px; white-space: pre;"},"\t"]}}});function av(e,t,n){let r=()=>t.position?.horizontal&&t.position?.vertical?t.position:n?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:n.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:n.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case"inline":return{wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case"squareLeft":case"squareRight":{let n="squareLeft"===e?"left":"right",o="squareLeft"===e?"right":"left";return{wrapType:"tight"===t.wrapType||"through"===t.wrapType?t.wrapType:"square",displayMode:"float",cssFloat:n,wrapText:o,position:r()}}case"square":case"tight":case"through":{let n="left"===t.cssFloat||"right"===t.cssFloat?t.cssFloat:"left";return{wrapType:e,displayMode:"float",cssFloat:n,wrapText:"left"===n?"right":"left",position:r()}}case"topAndBottom":return{wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case"behind":case"inFront":return{wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}var lv=pf({name:"image",schemaNodeName:"image",nodeSpec:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},rId:{default:null},wrapType:{default:"inline"},displayMode:{default:"inline"},cssFloat:{default:null},transform:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null},position:{default:null},borderWidth:{default:null},borderColor:{default:null},borderStyle:{default:null},wrapText:{default:null},hlinkHref:{default:null},cropTop:{default:null},cropRight:{default:null},cropBottom:{default:null},cropLeft:{default:null},opacity:{default:null},effectExtentTop:{default:null},effectExtentBottom:{default:null},effectExtentLeft:{default:null},effectExtentRight:{default:null},layoutInCell:{default:null},allowOverlap:{default:null}},parseDOM:[{tag:"img[src]",getAttrs(e){let t=e;return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||void 0,title:t.getAttribute("title")||void 0,width:t.width||void 0,height:t.height||void 0,rId:t.dataset.rid||void 0,wrapType:t.dataset.wrapType||"inline",displayMode:t.dataset.displayMode||"inline",cssFloat:t.dataset.cssFloat||void 0,transform:t.dataset.transform||void 0,borderWidth:t.dataset.borderWidth?Number(t.dataset.borderWidth):void 0,borderColor:t.dataset.borderColor||void 0,borderStyle:t.dataset.borderStyle||void 0}}}],toDOM(e){let t=e.attrs,n={src:t.src,class:"docx-image"};t.alt&&(n.alt=t.alt),t.title&&(n.title=t.title),t.rId&&(n["data-rid"]=t.rId),t.wrapType&&(n["data-wrap-type"]=t.wrapType),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.transform&&(n["data-transform"]=t.transform),t.borderWidth&&(n["data-border-width"]=String(t.borderWidth)),t.borderColor&&(n["data-border-color"]=t.borderColor),t.borderStyle&&(n["data-border-style"]=t.borderStyle);let r=[];if(t.width&&(n.width=String(t.width),r.push(`width: ${t.width}px`)),t.height&&(n.height=String(t.height),r.push(`height: ${t.height}px`)),r.push("max-width: 100%"),t.width&&t.height?r.push("object-fit: contain"):r.push("height: auto"),"float"===t.displayMode&&t.cssFloat&&"none"!==t.cssFloat){r.push(`float: ${t.cssFloat}`),n.class+=` docx-image-float docx-image-float-${t.cssFloat}`;let e=t.distTop??0,o=t.distBottom??0,i=t.distLeft??0,a=t.distRight??0;"left"===t.cssFloat?r.push(`margin: ${e}px ${a||12}px ${o}px ${i}px`):r.push(`margin: ${e}px ${a}px ${o}px ${i||12}px`)}else if("block"===t.displayMode){r.push("display: block"),r.push("margin-left: auto"),r.push("margin-right: auto"),n.class+=" docx-image-block";let e=t.distTop??0,o=t.distBottom??0;e>0&&r.push(`margin-top: ${e}px`),o>0&&r.push(`margin-bottom: ${o}px`)}if(t.transform&&r.push(`transform: ${t.transform}`),t.borderWidth&&t.borderWidth>0){let e=t.borderStyle||"solid",n=t.borderColor||"#000000";r.push(`border: ${t.borderWidth}px ${e} ${n}`)}return n.style=r.join("; "),["img",n]}},onSchemaReady(e){let t=e.schema.nodes.image,n=(e,n,r)=>(o,i)=>{let a=o.doc.nodeAt(e);if(!a||a.type!==t)return!1;let l=a.attrs,s=av(n,{wrapType:l.wrapType,cssFloat:l.cssFloat,position:l.position},r);return l.wrapType===s.wrapType&&l.displayMode===s.displayMode&&l.cssFloat===s.cssFloat&&l.wrapText===s.wrapText&&l.position===s.position||i&&i(o.tr.setNodeMarkup(e,void 0,{...l,...s})),!0};return{commands:{setImageWrapType:(e,t,r)=>n(e,t,r)}}}}),sv=pf({name:"textBox",schemaNodeName:"textBox",nodeSpec:{group:"block",content:"(paragraph | table)+",isolating:!0,draggable:!0,attrs:{width:{default:200},height:{default:null},textBoxId:{default:null},fillColor:{default:null},outlineWidth:{default:null},outlineColor:{default:null},outlineStyle:{default:null},marginTop:{default:4},marginBottom:{default:4},marginLeft:{default:7},marginRight:{default:7},verticalAlign:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"},wrapText:{default:null},anchorTarget:{default:null},position:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null}},parseDOM:[{tag:"div.docx-textbox",getAttrs(e){let t=e;return{width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,textBoxId:t.dataset.textboxId||void 0,fillColor:t.dataset.fillColor||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,marginTop:t.dataset.marginTop?Number(t.dataset.marginTop):void 0,marginBottom:t.dataset.marginBottom?Number(t.dataset.marginBottom):void 0,marginLeft:t.dataset.marginLeft?Number(t.dataset.marginLeft):void 0,marginRight:t.dataset.marginRight?Number(t.dataset.marginRight):void 0,verticalAlign:t.dataset.verticalAlign||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0,wrapText:t.dataset.wrapText||void 0,anchorTarget:t.dataset.anchorTarget||void 0,position:t.dataset.position?JSON.parse(t.dataset.position):void 0,distTop:t.dataset.distTop?Number(t.dataset.distTop):void 0,distBottom:t.dataset.distBottom?Number(t.dataset.distBottom):void 0,distLeft:t.dataset.distLeft?Number(t.dataset.distLeft):void 0,distRight:t.dataset.distRight?Number(t.dataset.distRight):void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-textbox"};t.width&&(n["data-width"]=String(t.width)),t.height&&(n["data-height"]=String(t.height)),t.textBoxId&&(n["data-textbox-id"]=t.textBoxId),t.fillColor&&(n["data-fill-color"]=t.fillColor),t.outlineWidth&&(n["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(n["data-outline-color"]=t.outlineColor),t.outlineStyle&&(n["data-outline-style"]=t.outlineStyle),null!=t.marginTop&&(n["data-margin-top"]=String(t.marginTop)),null!=t.marginBottom&&(n["data-margin-bottom"]=String(t.marginBottom)),null!=t.marginLeft&&(n["data-margin-left"]=String(t.marginLeft)),null!=t.marginRight&&(n["data-margin-right"]=String(t.marginRight)),t.verticalAlign&&(n["data-vertical-align"]=t.verticalAlign),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.wrapType&&(n["data-wrap-type"]=t.wrapType),t.wrapText&&(n["data-wrap-text"]=t.wrapText),t.anchorTarget&&(n["data-anchor-target"]=t.anchorTarget),t.position&&(n["data-position"]=JSON.stringify(t.position)),null!=t.distTop&&(n["data-dist-top"]=String(t.distTop)),null!=t.distBottom&&(n["data-dist-bottom"]=String(t.distBottom)),null!=t.distLeft&&(n["data-dist-left"]=String(t.distLeft)),null!=t.distRight&&(n["data-dist-right"]=String(t.distRight));let r=[];if(t.width&&r.push(`width: ${t.width}px`),t.height&&r.push(`min-height: ${t.height}px`),t.fillColor&&r.push(`background-color: ${t.fillColor}`),t.outlineWidth&&t.outlineWidth>0){let e=t.outlineStyle||"solid",n=t.outlineColor||"#000000";r.push(`border: ${t.outlineWidth}px ${e} ${n}`)}else r.push("border: 1px solid var(--doc-border, #d1d5db)");let o=t.marginTop??4,i=t.marginBottom??4,a=t.marginLeft??7,l=t.marginRight??7;return r.push(`padding: ${o}px ${l}px ${i}px ${a}px`),"middle"===t.verticalAlign||"center"===t.verticalAlign?(r.push("display: flex"),r.push("flex-direction: column"),r.push("justify-content: center")):"bottom"===t.verticalAlign&&(r.push("display: flex"),r.push("flex-direction: column"),r.push("justify-content: flex-end")),"float"===t.displayMode&&t.cssFloat&&"none"!==t.cssFloat?(r.push(`float: ${t.cssFloat}`),r.push("margin: 4px 8px")):"block"===t.displayMode&&(r.push("margin-left: auto"),r.push("margin-right: auto")),r.push("box-sizing: border-box"),r.push("overflow: hidden"),r.push("position: relative"),n.style=r.join("; "),["div",n,0]}}});function cv(e,t,n){switch(e){case"ellipse":case"oval":return`<ellipse cx="${t/2}" cy="${n/2}" rx="${t/2}" ry="${n/2}" />`;case"roundRect":return`<rect x="0" y="0" width="${t}" height="${n}" rx="${.1*Math.min(t,n)}" />`;case"triangle":case"isosTriangle":return`<polygon points="${t/2},0 ${t},${n} 0,${n}" />`;case"diamond":return`<polygon points="${t/2},0 ${t},${n/2} ${t/2},${n} 0,${n/2}" />`;case"line":case"straightConnector1":return`<line x1="0" y1="${n/2}" x2="${t}" y2="${n/2}" />`;default:return`<rect x="0" y="0" width="${t}" height="${n}" />`}}function dv(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(e=>`<stop offset="${Math.round(e.position/1e3)}%" stop-color="${e.color}" />`).join("")}catch{return""}let r=t.gradientType||"linear";if("radial"===r||"rectangular"===r||"path"===r)return`<radialGradient id="${e}" cx="50%" cy="50%" r="50%">${n}</radialGradient>`;let o=((t.gradientAngle||0)-90)*Math.PI/180,i=Math.round(50+50*Math.cos(o+Math.PI)),a=Math.round(50+50*Math.sin(o+Math.PI)),l=Math.round(50+50*Math.cos(o)),s=Math.round(50+50*Math.sin(o));return`<linearGradient id="${e}" x1="${i}%" y1="${a}%" x2="${l}%" y2="${s}%">${n}</linearGradient>`}var uv=pf({name:"shape",schemaNodeName:"shape",nodeSpec:{inline:!0,group:"inline",draggable:!0,atom:!0,attrs:{shapeType:{default:"rect"},shapeId:{default:null},width:{default:100},height:{default:80},fillColor:{default:null},fillType:{default:"solid"},gradientType:{default:null},gradientAngle:{default:null},gradientStops:{default:null},outlineWidth:{default:1},outlineColor:{default:"#000000"},outlineStyle:{default:"solid"},transform:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"},shadowColor:{default:null},shadowBlur:{default:null},shadowOffsetX:{default:null},shadowOffsetY:{default:null},glowColor:{default:null},glowRadius:{default:null}},parseDOM:[{tag:"span.docx-shape",getAttrs(e){let t=e;return{shapeType:t.dataset.shapeType||"rect",shapeId:t.dataset.shapeId||void 0,width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,fillColor:t.dataset.fillColor||void 0,fillType:t.dataset.fillType||"solid",gradientType:t.dataset.gradientType||void 0,gradientAngle:t.dataset.gradientAngle?Number(t.dataset.gradientAngle):void 0,gradientStops:t.dataset.gradientStops||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,transform:t.dataset.transform||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0,shadowColor:t.dataset.shadowColor||void 0,shadowBlur:t.dataset.shadowBlur?Number(t.dataset.shadowBlur):void 0,shadowOffsetX:t.dataset.shadowOffsetX?Number(t.dataset.shadowOffsetX):void 0,shadowOffsetY:t.dataset.shadowOffsetY?Number(t.dataset.shadowOffsetY):void 0,glowColor:t.dataset.glowColor||void 0,glowRadius:t.dataset.glowRadius?Number(t.dataset.glowRadius):void 0}}}],toDOM(e){let t=e.attrs,n=t.width||100,r=t.height||80,o={class:"docx-shape","data-shape-type":t.shapeType||"rect"};t.shapeId&&(o["data-shape-id"]=t.shapeId),o["data-width"]=String(n),o["data-height"]=String(r),t.fillColor&&(o["data-fill-color"]=t.fillColor),t.fillType&&(o["data-fill-type"]=t.fillType),t.gradientType&&(o["data-gradient-type"]=t.gradientType),null!=t.gradientAngle&&(o["data-gradient-angle"]=String(t.gradientAngle)),t.gradientStops&&(o["data-gradient-stops"]=t.gradientStops),t.outlineWidth&&(o["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(o["data-outline-color"]=t.outlineColor),t.outlineStyle&&(o["data-outline-style"]=t.outlineStyle),t.transform&&(o["data-transform"]=t.transform),t.displayMode&&(o["data-display-mode"]=t.displayMode),t.cssFloat&&(o["data-css-float"]=t.cssFloat),t.wrapType&&(o["data-wrap-type"]=t.wrapType),t.shadowColor&&(o["data-shadow-color"]=t.shadowColor),null!=t.shadowBlur&&(o["data-shadow-blur"]=String(t.shadowBlur)),null!=t.shadowOffsetX&&(o["data-shadow-offset-x"]=String(t.shadowOffsetX)),null!=t.shadowOffsetY&&(o["data-shadow-offset-y"]=String(t.shadowOffsetY)),t.glowColor&&(o["data-glow-color"]=t.glowColor),null!=t.glowRadius&&(o["data-glow-radius"]=String(t.glowRadius));let i=["display: inline-block",`width: ${n}px`,`height: ${r}px`,"vertical-align: middle","line-height: 0"];if(t.transform&&i.push(`transform: ${t.transform}`),"float"===t.displayMode&&t.cssFloat&&"none"!==t.cssFloat?(i.push(`float: ${t.cssFloat}`),i.push("margin: 4px 8px")):"block"===t.displayMode&&(i.push("display: block"),i.push("margin: 4px auto")),t.shadowColor){let e=t.shadowOffsetX||2,n=t.shadowOffsetY||2,r=t.shadowBlur||4;i.push(`filter: drop-shadow(${e}px ${n}px ${r}px ${t.shadowColor})`)}if(t.glowColor&&t.glowRadius){let e=i.find(e=>e.startsWith("filter:")),n=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(e){let t=i.indexOf(e);i[t]=e+" "+n}else i.push(`filter: ${n}`)}o.style=i.join("; ");let a,l="";if("gradient"===t.fillType&&t.gradientStops){let e=`grad-${t.shapeId||Math.random().toString(36).slice(2,8)}`;a=`url(#${e})`,l=dv(e,t)}else a="none"===t.fillType?"none":t.fillColor||"#ffffff";let s=t.outlineWidth||1,c=t.outlineColor||"#000000",d="dashed"===t.outlineStyle?' stroke-dasharray="8 4"':"dotted"===t.outlineStyle?' stroke-dasharray="2 2"':"",u=cv(t.shapeType||"rect",n,r),p=`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="fill:${a};stroke:${c};stroke-width:${s}${d}">`+(l?`<defs>${l}</defs>`:"")+u+"</svg>",h=document.createElement("span");return Object.entries(o).forEach(([e,t])=>{h.setAttribute(e,t)}),h.innerHTML=p,{dom:h}}}}),pv=pf({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["hr"]}}}),hv=pf({name:"pageBreak",schemaNodeName:"pageBreak",nodeSpec:{group:"block",atom:!0,selectable:!0,parseDOM:[{tag:"div.docx-page-break"}],toDOM(){return["div",{class:"docx-page-break"}]}}}),fv=pf({name:"field",schemaNodeName:"field",nodeSpec:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{fieldType:{default:"UNKNOWN"},instruction:{default:""},displayText:{default:""},fieldKind:{default:"simple"},fldLock:{default:!1},dirty:{default:!1}},parseDOM:[{tag:"span.docx-field",getAttrs(e){let t=e;return{fieldType:t.dataset.fieldType||"UNKNOWN",instruction:t.dataset.instruction||"",displayText:t.textContent||"",fieldKind:t.dataset.fieldKind||"simple",fldLock:"true"===t.dataset.fldLock,dirty:"true"===t.dataset.dirty}}}],toDOM(e){let{fieldType:t,instruction:n,displayText:r,fieldKind:o,fldLock:i,dirty:a}=e.attrs,l=r||"";if(!l)switch(t){case"PAGE":l="{page}";break;case"NUMPAGES":l="{pages}";break;case"DATE":case"TIME":case"CREATEDATE":case"SAVEDATE":l=(new Date).toLocaleDateString();break;case"MERGEFIELD":l=`«${n.replace(/^MERGEFIELD\s+/i,"").replace(/\s*\\.*$/,"")}»`;break;default:l=`{${t}}`}return["span",{class:`docx-field docx-field-${t.toLowerCase()}`,"data-field-type":t,"data-instruction":n,"data-field-kind":o,...i?{"data-fld-lock":"true"}:{},...a?{"data-dirty":"true"}:{},style:"outline: 1px solid rgba(200,200,200,0.4); padding: 0 1px; border-radius: 2px;"},l]}}}),mv=pf({name:"sdt",schemaNodeName:"sdt",nodeSpec:{inline:!0,group:"inline",content:"inline*",attrs:{sdtType:{default:"richText"},alias:{default:null},tag:{default:null},lock:{default:null},placeholder:{default:null},showingPlaceholder:{default:!1},dateFormat:{default:null},listItems:{default:null},checked:{default:null}},parseDOM:[{tag:"span.docx-sdt",getAttrs(e){let t=e;return{sdtType:t.dataset.sdtType||"richText",alias:t.dataset.alias||null,tag:t.dataset.tag||null,lock:t.dataset.lock||null,placeholder:t.dataset.placeholder||null,showingPlaceholder:"true"===t.dataset.showingPlaceholder,dateFormat:t.dataset.dateFormat||null,listItems:t.dataset.listItems||null,checked:"true"===t.dataset.checked||"false"!==t.dataset.checked&&null}}}],toDOM(e){let t=e.attrs,n={class:`docx-sdt docx-sdt-${t.sdtType}`,"data-sdt-type":String(t.sdtType)};return t.alias&&(n["data-alias"]=String(t.alias)),t.tag&&(n["data-tag"]=String(t.tag)),t.lock&&(n["data-lock"]=String(t.lock)),t.placeholder&&(n["data-placeholder"]=String(t.placeholder)),t.showingPlaceholder&&(n["data-showing-placeholder"]="true"),t.dateFormat&&(n["data-date-format"]=String(t.dateFormat)),t.listItems&&(n["data-list-items"]=String(t.listItems)),null!=t.checked&&(n["data-checked"]=String(t.checked)),"checkbox"===t.sdtType?n.style="border: 1px solid #ccc; border-radius: 3px; padding: 0 2px; display: inline;":n.style="border-bottom: 1px dashed #999; padding: 0 1px; display: inline;",["span",n,0]}}}),gv=pf({name:"math",schemaNodeName:"math",nodeSpec:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{display:{default:"inline"},ommlXml:{default:""},plainText:{default:""}},parseDOM:[{tag:"span.docx-math",getAttrs(e){let t=e;return{display:t.dataset.display||"inline",ommlXml:t.dataset.ommlXml||"",plainText:t.textContent||""}}}],toDOM(e){let{display:t,ommlXml:n,plainText:r}=e.attrs,o=r||"[equation]";return["span",{class:`docx-math docx-math-${t}`,"data-display":t,"data-omml-xml":n,style:'font-style: italic; font-family: "Cambria Math", "Latin Modern Math", serif; background: rgba(200,200,255,0.1); padding: 0 2px; border-radius: 2px;'},o]}}});function vv(...e){return(t,n,r)=>{for(let o of e)if(o(t,n,r))return!0;return!1}}var yv=(e,t)=>{let{$cursor:n}=e.selection;if(!n||0!==n.parentOffset||"paragraph"!==n.parent.type.name)return!1;let r=n.parent.attrs,o=null!=r.indentFirstLine&&r.indentFirstLine>0,i=!!r.hangingIndent,a=null!=r.indentLeft&&r.indentLeft>0;if(!o&&!i&&!a)return!1;if(t){let o=n.before(),i=e.tr.setNodeMarkup(o,void 0,{...r,indentFirstLine:null,hangingIndent:null,indentLeft:null});t(i.scrollIntoView())}return!0},bv=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],wv=new Set(["fontFamily","fontSize","textColor"]),kv=(e,t,n)=>{let{$from:r}=e.selection,o="paragraph"===r.parent.type.name?r.parent:null,i=(e.storedMarks||r.marks()).filter(e=>wv.has(e.type.name)),a=null;if(!qh(e,t?e=>{a=e}:void 0,n))return!1;if(t&&null!==a){let n=a,{$from:r}=n.selection,l=r.parent;if("paragraph"===l.type.name){let t={...l.attrs},a=!1;if(o)for(let e of bv){let n=o.attrs[e];null!=n&&null==t[e]&&(t[e]=n,a=!0)}if(t.borders&&(t.borders=null,a=!0),a&&n.setNodeMarkup(r.before(),void 0,t),0===l.textContent.length){let a=i;if(0===a.length&&o){let t=o.attrs.defaultTextFormatting;t&&(a=ig(t,e.schema).filter(e=>wv.has(e.type.name)))}if(a.length>0){let e={...t.defaultTextFormatting??{}},o=!1;for(let t of a)if("fontSize"===t.type.name&&t.attrs.size!==e.fontSize&&(e.fontSize=t.attrs.size,o=!0),"fontFamily"===t.type.name){let n=t.attrs.ascii;n&&(!e.fontFamily||e.fontFamily.ascii!==n)&&(e.fontFamily=Tm(e.fontFamily,{ascii:n,hAnsi:t.attrs.hAnsi}),o=!0)}o&&n.setNodeMarkup(r.before(),void 0,{...t,defaultTextFormatting:e}),n.setStoredMarks(a)}}}t(n.scrollIntoView())}return!0},xv=uf({name:"baseKeymap",priority:df.Low,onSchemaReady(e){return{keyboardShortcuts:{...cf,Enter:kv,Backspace:vv(Nh,yv,Rh),Delete:vv(Nh,Ph),"Mod-a":Uh,Escape:Zh}}}}),Sv=uf({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return{plugins:[Zp(t.onSelectionChange)],commands:{extractSelectionContext:()=>(e,t)=>(Wp(e),!0)}}}}),Cv=new Mn("imageDrag"),Tv=uf({name:"imageDrag",onSchemaReady(e){return{plugins:[new Tn({key:Cv,props:{handleDOMEvents:{dragstart(e,t){let{selection:n}=e.state;if(n instanceof cn&&"image"===n.node.type.name){e.dom.classList.add("pm-image-dragging");let r=t;if(r.dataTransfer){r.dataTransfer.effectAllowed="move";let e=document.createElement("div");e.style.cssText="position: fixed; left: -9999px; top: -9999px; opacity: 0.6; pointer-events: none; border: 2px dashed var(--doc-primary, #2563eb); border-radius: 4px; background: rgba(37, 99, 235, 0.08);",e.style.width=`${n.node.attrs.width||100}px`,e.style.height=`${n.node.attrs.height||100}px`,document.body.appendChild(e),r.dataTransfer.setDragImage(e,0,0),requestAnimationFrame(()=>{document.body.removeChild(e)})}}return!1},dragend(e){return e.dom.classList.remove("pm-image-dragging"),e.dom.querySelectorAll(".pm-drop-indicator").forEach(e=>e.remove()),!1},dragover(e,t){let{selection:n}=e.state;if(n instanceof cn&&"image"===n.node.type.name){let e=t;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move")}return!1},drop(e){return e.dom.classList.remove("pm-image-dragging"),e.dom.querySelectorAll(".pm-drop-indicator").forEach(e=>e.remove()),!1}}}})]}}}),Ev=612;async function _v(e){return await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error??new Error("Failed to read image file")),r.readAsDataURL(e)})}async function Mv(e){return await new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth||1,height:r.naturalHeight||1}),r.onerror=()=>n(new Error("Failed to load pasted image")),r.src=e})}async function Nv(e,t){let n=e.state.schema.nodes.image;if(!n)return;let r=e.state.selection.from;for(let o of t){let t;try{t=await _v(o)}catch{continue}let i=1,a=1;try{({width:i,height:a}=await Mv(t))}catch{i=1,a=1}let l=i,s=a;if(l>Ev){let e=Ev/l;l=Ev,s=Math.max(1,Math.round(s*e))}let c=n.create({src:t,alt:o.name,width:l,height:s,rId:`rId_img_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,wrapType:"inline",displayMode:"inline"}),d=e.state.tr.insert(r,c);r+=c.nodeSize,d.setSelection(ln.create(d.doc,r)),e.dispatch(d.scrollIntoView())}e.focus()}var Iv=uf({name:"imagePaste",onSchemaReady(e){return{plugins:[new Tn({props:{handleDOMEvents:{paste(e,t){let n=t,r=_h(n.clipboardData);return!(0===r.length||!e.state.schema.nodes.image)&&(n.preventDefault(),Nv(e,r).catch(()=>{}),!0)}}}})]}}}),Rv=uf({name:"dropCursor",onSchemaReady(){return{plugins:[Pm({color:"var(--doc-primary, #4285f4)",width:2})]}}}),Av=new Mn("paraIdAllocator");function Bv(){return new Tn({key:Av,appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let r=new Set,o=[];if(n.doc.descendants((e,t)=>{if("paragraph"!==e.type.name)return;let n=e.attrs.paraId;if(!n||r.has(n)){let n=(0,Cm.a)();for(;r.has(n);)n=(0,Cm.a)();r.add(n),o.push({pos:t,attrs:{...e.attrs,paraId:n}})}else r.add(n);return!1}),0===o.length)return null;let i=n.tr;for(let a of o)i.setNodeMarkup(a.pos,void 0,a.attrs);return i.setMeta(Av,"allocated"),i.setMeta("addToHistory",!1),i}})}var Dv=uf({name:"paraIdAllocator",onSchemaReady(){return{plugins:[Bv()]}}}),Fv=uf({name:"bidiShortcut",priority:df.High,onSchemaReady(e){let{manager:t}=e;return{plugins:[new Tn({props:{handleKeyDown(e,n){if("Shift"!==n.key||!n.metaKey&&!n.ctrlKey)return!1;let r=t.getCommands();return"ShiftLeft"===n.code?(n.preventDefault(),r.setLtr()(e.state,e.dispatch),!0):"ShiftRight"===n.code&&(n.preventDefault(),r.setRtl()(e.state,e.dispatch),!0)}}})]}}});function Pv(e){let t={},n=e.split(";");for(let r of n){let e=r.trim();if(!e)continue;let n=e.indexOf(":");if(n<0)continue;let o=e.slice(0,n).trim(),i=e.slice(n+1).trim();o&&i&&(t[o]=i)}return t}function Ov(e,t){let n=e.getAttribute("style")||"",r=Pv(n);for(let[o,i]of Object.entries(t))o in r||e.style.setProperty(o,i)}function Lv(e){let t=e.querySelectorAll("style");if(0===t.length)return;let n=[];for(let r of t){let t=r.textContent||"";if(t.trim())try{let r=e.createElement("style");r.textContent=t,e.head.appendChild(r);let o=r.sheet;if(o)for(let e=0;e<o.cssRules.length;e++){let t=o.cssRules[e];if(t instanceof CSSStyleRule){let e={},r=t.style;for(let t=0;t<r.length;t++){let n=r[t];e[n]=r.getPropertyValue(n)}Object.keys(e).length>0&&n.push({selector:t.selectorText,declarations:e})}}e.head.removeChild(r)}catch{let e,r=/([^{]+)\{([^}]+)\}/g;for(;null!==(e=r.exec(t));){let t=e[1].trim(),r=Pv(e[2]);Object.keys(r).length>0&&n.push({selector:t,declarations:r})}}}if(0!==n.length)for(let{selector:r,declarations:o}of n)try{let t=e.body.querySelectorAll(r);for(let e of t)Ov(e,o)}catch{}}function zv(e){let t=e.body.querySelectorAll('b[id^="docs-internal-guid-"]');for(let n of t){let e=n.parentNode;if(e){for(;n.firstChild;)e.insertBefore(n.firstChild,n);e.removeChild(n)}}}function Vv(e){let t=e.includes("<style"),n=e.includes("docs-internal-guid-");if(!t&&!n)return e;try{let r=(new DOMParser).parseFromString(e,"text/html");if(t){Lv(r);let e=r.querySelectorAll("style");for(let t of e)t.remove()}return n&&zv(r),r.body.innerHTML}catch{return e}}var $v=uf({name:"pasteStyleInliner",priority:df.High,onSchemaReady(){return{plugins:[new Tn({props:{transformPastedHTML(e){return Vv(e)}}})]}}});function jv(e={}){let t=new Set(e.disable||[]),n=[];function r(e,r){t.has(e)||n.push(r)}return r("doc",Ng()),r("text",Ig()),r("paragraph",Qm()),r("history",Rg({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),r("bold",Ag()),r("italic",Bg()),r("underline",Dg()),r("strike",Fg()),r("textColor",Pg()),r("highlight",Og()),r("fontSize",Lg()),r("fontFamily",zg()),r("superscript",Vg()),r("subscript",$g()),r("hyperlink",sg()),r("allCaps",jg()),r("smallCaps",Hg()),r("footnoteRef",Wg()),r("characterSpacing",Zg()),r("emboss",Xg()),r("imprint",Yg()),r("textShadow",Jg()),r("emphasisMark",Qg()),r("textOutline",ev()),r("hidden",tv()),r("rtl",nv()),r("textEffect",rv()),r("comment",Ug()),r("insertion",Kg()),r("deletion",Gg()),r("hardBreak",ov()),r("tab",iv()),r("image",lv()),r("textBox",sv()),r("shape",uv()),r("imageDrag",Tv()),r("imagePaste",Iv()),r("dropCursor",Rv()),r("horizontalRule",pv()),r("pageBreak",hv()),r("field",fv()),r("sdt",mv()),r("math",gv()),t.has("table")||n.push(...Sm()),r("pasteStyleInliner",$v()),r("list",xg()),r("baseKeymap",xv()),r("selectionTracker",Sv({onSelectionChange:e.onSelectionChange})),r("paragraphChangeTracker",Mg()),r("paraIdAllocator",Dv()),r("bidiShortcut",Fv()),n}var Hv=class{constructor(e){Nm(this,"extensions"),Nm(this,"schema",null),Nm(this,"plugins",[]),Nm(this,"commands",{}),this.extensions=[...e].sort((e,t)=>e.config.priority-t.config.priority)}buildSchema(){let e={},t={};for(let n of this.extensions)"node"===n.type?e[n.config.schemaNodeName]=n.config.nodeSpec:"mark"===n.type&&(t[n.config.schemaMarkName]=n.config.markSpec);this.schema=new xe({nodes:e,marks:t})}initializeRuntime(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called before initializeRuntime()");let e={schema:this.schema,manager:this},t=[],n=[],r={};for(let o of this.extensions){let i=o.onSchemaReady(e);i.commands&&Object.assign(r,i.commands),i.keyboardShortcuts&&t.push(i.keyboardShortcuts),i.plugins&&n.push(...i.plugins)}this.plugins=[...n,...t.map(e=>ul(e))],this.commands=r}getSchema(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called first");return this.schema}getPlugins(){return this.plugins}getCommands(){return this.commands}getCommand(e){return this.commands[e]}destroy(){this.plugins=[],this.commands={}}};function Wv(e){if(void 0===e)return;let t=e.map(e=>"string"==typeof e?{name:e,fontFamily:e,category:"other"}:e);if(qv()){let e=new Set,n=new Set;for(let r of t)n.has(r.name)&&!e.has(r.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${r.name}"`),e.add(r.name)),n.add(r.name)}return t}function qv(){return typeof process<"u"&&!1}function Zv(e){return e?.length?e.flatMap(e=>e.content.filter(e=>"run"===e.type).flatMap(e=>"content"in e?e.content:[]).filter(e=>"text"===e.type).map(e=>"text"in e?e.text:"")).join(""):""}function Uv(e){return e?new Date(e).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function Kv(e){return e.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}var Gv=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function Xv(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Gv[Math.abs(t)%Gv.length]}function Yv(e,t=50){return e.length>t?e.slice(0,t)+"...":e}var Jv=176,Qv=8,ey=["disabled","title","aria-label"],ty=["disabled","title","aria-label","aria-expanded"],ny=["disabled","title","aria-label","aria-expanded"],ry={class:"docx-color-picker__button-stack"},oy=["aria-label"],iy={key:0,class:"docx-color-picker__auto-icon docx-color-picker__auto-icon--none"},ay={key:1,class:"docx-color-picker__auto-icon docx-color-picker__auto-icon--auto"},ly={class:"docx-color-picker__section-label"},sy={class:"docx-color-picker__grid"},cy=["title","aria-label","aria-selected","onClick"],dy={class:"docx-color-picker__section-label"},uy={class:"docx-color-picker__grid"},py=["title","aria-label","aria-selected","onClick"],hy={class:"docx-color-picker__section-label"},fy={class:"docx-color-picker__custom"},my=["onKeydown"],gy=["disabled"],vy=Us((0,n.defineComponent)({__name:"ColorPicker",props:{mode:{},value:{},theme:{},disabled:{type:Boolean,default:!1},className:{},style:{},title:{},icon:{},autoLabel:{},splitButton:{type:Boolean,default:!0},defaultColor:{}},emits:["change"],setup(e,{emit:t}){let r=e,o=t,{t:i}=xc(),a=[{nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{nameKey:"colorPicker.colors.red",hex:"FF0000"},{nameKey:"colorPicker.colors.orange",hex:"FFC000"},{nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{nameKey:"colorPicker.colors.green",hex:"00B050"},{nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{nameKey:"colorPicker.colors.blue",hex:"0070C0"},{nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{nameKey:"colorPicker.colors.purple",hex:"7030A0"}];function l(e){return e?"string"==typeof e?"highlight"===r.mode?hh(e)||("none"===e?"transparent":e.startsWith("#")?e:`#${e}`):e.startsWith("#")?e:`#${e}`:uh(e,r.theme):"text"===r.mode||"border"===r.mode?"#000000":"transparent"}function s(e){return/^[0-9A-Fa-f]{6}$/.test(e.replace(/^#/,""))}function c(e){let t=e.replace(/^#/,"");if(6!==t.length)return!1;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return(299*n+587*r+114*o)/1e3>230}function d(e,t){return!!e&&("string"==typeof e?e.replace(/^#/,"").toUpperCase():ph(e,r.theme))===t.toUpperCase()}let u=(0,n.ref)(!1),p=(0,n.ref)(""),h=(0,n.ref)(null),f=(0,n.ref)(null),m=(0,n.ref)(r.defaultColor??("highlight"===r.mode?"FFFF00":"border"===r.mode?{rgb:"000000"}:{rgb:"FF0000"})),g=(0,n.computed)(()=>bh(r.theme?.colorScheme??null)),v=(0,n.computed)(()=>g.value.flatMap((e,t)=>e.map((e,n)=>({...e,key:`${t}-${n}`})))),y=(0,n.computed)(()=>l(r.value)),b=(0,n.computed)(()=>l(m.value)),w=(0,n.computed)(()=>"text"===r.mode?i("formattingBar.fontColor"):"highlight"===r.mode?i("formattingBar.highlightColor"):i("table.borderColor")),k=(0,n.computed)(()=>r.icon??("text"===r.mode?"format_color_text":"highlight"===r.mode?"ink_highlighter":"border_color"));(0,n.watch)(()=>[r.value,r.mode,r.theme],()=>{let e=l(r.value).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(e)&&(p.value=e.toUpperCase())},{immediate:!0});let x=(0,n.ref)({});function S(){let e=h.value;if(!e)return;let t=e.getBoundingClientRect();x.value={top:`${t.bottom+4}px`,left:`${t.left}px`}}function C(){r.disabled||(u.value||S(),u.value=!u.value)}function T(e,t=!0){t&&(m.value=e),o("change",e),u.value=!1}function E(){r.disabled||o("change",m.value)}function _(e){if("highlight"===r.mode)return void T(e.hex);let t={themeColor:e.themeSlot,rgb:e.hex};e.tint&&(t.themeTint=e.tint),e.shade&&(t.themeShade=e.shade),T(t)}function M(e){T("highlight"===r.mode?e:{rgb:e})}function N(){T("highlight"===r.mode?"none":{auto:!0},!1)}function I(){let e=p.value.replace(/^#/,"").toUpperCase();s(e)&&(T("highlight"===r.mode?e:{rgb:e}),p.value="")}function R(e){"INPUT"!==e.target.tagName&&e.preventDefault()}function A(e){if(!u.value)return;let t=e.target;h.value?.contains(t)||f.value?.contains(t)||(u.value=!1)}return(0,n.onMounted)(()=>document.addEventListener("mousedown",A)),(0,n.onBeforeUnmount)(()=>document.removeEventListener("mousedown",A)),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:h,class:(0,n.normalizeClass)(["docx-color-picker",e.className]),style:(0,n.normalizeStyle)(e.style)},[e.splitButton?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(["docx-color-picker__split",{"is-disabled":e.disabled}])},[(0,n.createElementVNode)("button",{type:"button",class:"docx-color-picker__apply",disabled:e.disabled,title:e.title??w.value,"aria-label":e.title??w.value,onMousedown:r[0]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:E},[(0,n.createVNode)(cc,{name:k.value,size:18},null,8,["name"]),(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(["docx-color-picker__bar",{"is-light":"transparent"===b.value||c(b.value)}]),style:(0,n.normalizeStyle)({background:"transparent"===b.value?"#fff":b.value})},null,6)],40,ey),(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-color-picker__arrow",{"is-open":u.value}]),disabled:e.disabled,title:e.title??w.value,"aria-label":e.title??w.value,"aria-haspopup":"true","aria-expanded":u.value,onMousedown:r[1]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:C},[(0,n.createVNode)(cc,{name:"arrow_drop_down",size:18})],42,ty)],2)):((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:1,type:"button",class:(0,n.normalizeClass)(["docx-color-picker__button",{"is-open":u.value}]),disabled:e.disabled,title:e.title??w.value,"aria-label":e.title??w.value,"aria-haspopup":"true","aria-expanded":u.value,onMousedown:r[2]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:C},[(0,n.createElementVNode)("span",ry,[(0,n.createVNode)(cc,{name:k.value,size:18},null,8,["name"]),(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(["docx-color-picker__bar",{"is-light":"transparent"===y.value||c(y.value)}]),style:(0,n.normalizeStyle)({background:"transparent"===y.value?"#fff":y.value})},null,6)]),(0,n.createVNode)(cc,{name:"arrow_drop_down",size:14})],42,ny)),u.value&&!e.disabled?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,ref_key:"panelRef",ref:f,class:"docx-color-picker__panel",style:(0,n.normalizeStyle)(x.value),role:"dialog","aria-label":(0,n.unref)(i)("colorPicker.ariaLabel",{type:w.value}),onMousedown:R},[(0,n.createElementVNode)("button",{type:"button",class:"docx-color-picker__auto",onMousedown:r[3]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:N},["highlight"===e.mode?((0,n.openBlock)(),(0,n.createElementBlock)("span",iy,[...r[10]||=[(0,n.createElementVNode)("span",{class:"docx-color-picker__auto-slash"},null,-1)]])):((0,n.openBlock)(),(0,n.createElementBlock)("span",ay)),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(e.autoLabel??("highlight"===e.mode?(0,n.unref)(i)("colorPicker.noColor"):(0,n.unref)(i)("colorPicker.automatic"))),1)],32),r[12]||=(0,n.createElementVNode)("div",{class:"docx-color-picker__divider"},null,-1),(0,n.createElementVNode)("div",ly,(0,n.toDisplayString)((0,n.unref)(i)("colorPicker.themeColors")),1),(0,n.createElementVNode)("div",sy,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(v.value,t=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:t.key,type:"button",class:(0,n.normalizeClass)(["docx-color-picker__cell",{"is-selected":d(e.value,t.hex)}]),style:(0,n.normalizeStyle)({background:"#"+t.hex}),title:t.label,"aria-label":t.label,"aria-selected":d(e.value,t.hex),onMousedown:r[4]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:e=>_(t)},null,46,cy))),128))]),r[13]||=(0,n.createElementVNode)("div",{class:"docx-color-picker__divider"},null,-1),(0,n.createElementVNode)("div",dy,(0,n.toDisplayString)((0,n.unref)(i)("colorPicker.standardColors")),1),(0,n.createElementVNode)("div",uy,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(a,t=>(0,n.createElementVNode)("button",{key:t.hex,type:"button",class:(0,n.normalizeClass)(["docx-color-picker__cell",{"is-selected":d(e.value,t.hex)}]),style:(0,n.normalizeStyle)({background:"#"+t.hex}),title:(0,n.unref)(i)(t.nameKey),"aria-label":(0,n.unref)(i)(t.nameKey),"aria-selected":d(e.value,t.hex),onMousedown:r[5]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:e=>M(t.hex)},null,46,py)),64))]),r[14]||=(0,n.createElementVNode)("div",{class:"docx-color-picker__divider"},null,-1),(0,n.createElementVNode)("div",hy,(0,n.toDisplayString)((0,n.unref)(i)("colorPicker.customColor")),1),(0,n.createElementVNode)("div",fy,[r[11]||=(0,n.createElementVNode)("span",{class:"docx-color-picker__hash"},"#",-1),(0,n.withDirectives)((0,n.createElementVNode)("input",{"onUpdate:modelValue":r[6]||=e=>p.value=e,type:"text",class:"docx-color-picker__hex",placeholder:"FF0000",maxlength:"6","aria-label":"Custom hex color",onInput:r[7]||=e=>p.value=p.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6),onKeydown:(0,n.withKeys)((0,n.withModifiers)(I,["prevent"]),["enter"]),onMousedown:r[8]||=(0,n.withModifiers)(()=>{},["stop"])},null,40,my),[[n.vModelText,p.value]]),(0,n.createElementVNode)("button",{type:"button",class:"docx-color-picker__apply-btn",disabled:!s(p.value),onMousedown:r[9]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:I},(0,n.toDisplayString)((0,n.unref)(i)("common.apply")),41,gy)])],44,oy)):(0,n.createCommentVNode)("",!0)],6))}}),[["__scopeId","data-v-2cbf59ab"]]),yy=4,by=Us((0,n.defineComponent)({__name:"Popover",props:{open:{type:Boolean},placement:{default:"bottom-left"},panelClass:{},panelStyle:{},closeOnScroll:{type:Boolean,default:!0}},emits:["close","update:open"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(null),a=(0,n.ref)(null),l=(0,n.ref)({position:"fixed"});function s(){let e=i.value;if(!e)return;let t=e.getBoundingClientRect(),n={position:"fixed"};r.placement.startsWith("top")?(n.bottom=`${Math.round(window.innerHeight-t.top+yy)}px`,n.top="auto"):(n.top=`${Math.round(t.bottom+yy)}px`,n.bottom="auto"),r.placement.endsWith("right")?(n.right=`${Math.round(window.innerWidth-t.right)}px`,n.left="auto"):(n.left=`${Math.round(t.left)}px`,n.right="auto"),l.value=n}function c(){o("update:open",!r.open),r.open&&o("close")}function d(){o("update:open",!1),o("close")}function u(e){if(!r.open)return;let t=e.target;i.value?.contains(t)||a.value?.contains(t)||d()}function p(e){"Escape"===e.key&&r.open&&d()}function h(e){!r.closeOnScroll||!r.open||a.value?.contains(e.target)||d()}function f(){r.open&&s()}function m(){document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",h,!0),window.addEventListener("resize",f)}function g(){document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",f)}return(0,n.watch)(()=>r.open,e=>{e?(s(),m()):g()}),(0,n.watch)(()=>r.placement,()=>r.open&&s()),(0,n.onMounted)(()=>{r.open&&(s(),m())}),(0,n.onBeforeUnmount)(g),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"rootRef",ref:i,class:"docx-popover"},[(0,n.renderSlot)(t.$slots,"trigger",{toggle:c,open:e.open},void 0,!0),e.open?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,ref_key:"panelRef",ref:a,class:(0,n.normalizeClass)(["docx-popover__panel",e.panelClass]),style:(0,n.normalizeStyle)([l.value,e.panelStyle??{}]),onMousedown:r[0]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.renderSlot)(t.$slots,"panel",{},void 0,!0)],38)):(0,n.createCommentVNode)("",!0)],512))}}),[["__scopeId","data-v-20a24bb6"]]),wy=["title","onClick"],ky={key:0,class:"editing-mode__label"},xy={class:"editing-mode__panel"},Sy=["onClick"],Cy={class:"editing-mode__option-text"},Ty={class:"editing-mode__option-label"},Ey={class:"editing-mode__option-desc"},_y=Us((0,n.defineComponent)({__name:"EditingModeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){let r=e,o=t,i=[{value:"editing",label:"Editing",icon:"edit_note",desc:"Edit document directly"},{value:"suggesting",label:"Suggesting",icon:"rate_review",desc:"Edits become suggestions"},{value:"viewing",label:"Viewing",icon:"visibility",desc:"Read or print final document"}],a=(0,n.ref)(!1),l=(0,n.ref)(!1),s=(0,n.computed)(()=>i.find(e=>e.value===r.modelValue)??i[0]);function c(e){o("update:modelValue",e),a.value=!1}let d=null;function u(e){l.value=e.matches}return(0,n.onMounted)(()=>{d=window.matchMedia("(max-width: 1400px)"),l.value=d.matches,d.addEventListener("change",u)}),(0,n.onBeforeUnmount)(()=>d?.removeEventListener("change",u)),(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:a.value,placement:"bottom-right","onUpdate:open":r[0]||=e=>a.value=e,onClose:r[1]||=e=>a.value=!1},{trigger:(0,n.withCtx)(({toggle:e})=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["editing-mode__trigger",{"editing-mode__trigger--open":a.value,"editing-mode__trigger--compact":l.value}]),title:`${s.value.label} (Ctrl+Shift+E)`,onClick:(0,n.withModifiers)(e,["prevent"])},[(0,n.createVNode)(cc,{name:s.value.icon,size:18},null,8,["name"]),l.value?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",ky,(0,n.toDisplayString)(s.value.label),1)),(0,n.createVNode)(cc,{name:"arrow_drop_down",size:16})],10,wy)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",xy,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,t=>(0,n.createElementVNode)("button",{key:t.value,type:"button",class:"editing-mode__option",onClick:(0,n.withModifiers)(e=>c(t.value),["prevent"])},[(0,n.createVNode)(cc,{name:t.icon,size:20},null,8,["name"]),(0,n.createElementVNode)("span",Cy,[(0,n.createElementVNode)("span",Ty,(0,n.toDisplayString)(t.label),1),(0,n.createElementVNode)("span",Ey,(0,n.toDisplayString)(t.desc),1)]),t.value===e.modelValue?((0,n.openBlock)(),(0,n.createBlock)(cc,{key:0,name:"check",size:18,class:"editing-mode__check"})):(0,n.createCommentVNode)("",!0)],8,Sy)),64))])]),_:1},8,["open"]))}}),[["__scopeId","data-v-5d5c5f86"]]),My=["disabled","aria-label","title","aria-expanded","onClick"],Ny={class:"docx-icon-grid__panel"},Iy=["title","onClick"],Ry=Us((0,n.defineComponent)({__name:"IconGridDropdown",props:{options:{},activeValue:{},triggerIcon:{},tooltipContent:{},disabled:{type:Boolean},ariaLabel:{}},emits:["select"],setup(e,{emit:t}){let r=t,o=(0,n.ref)(!1);function i(e){r("select",e),o.value=!1}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:o.value,"onUpdate:open":r[0]||=e=>o.value=e,onClose:r[1]||=e=>o.value=!1},{trigger:(0,n.withCtx)(({toggle:t})=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-icon-grid__btn",{"docx-icon-grid__btn--open":o.value}]),disabled:e.disabled,"aria-label":e.ariaLabel??e.tooltipContent,title:e.tooltipContent,"aria-expanded":o.value,"aria-haspopup":"true",onClick:(0,n.withModifiers)(t,["prevent"])},[(0,n.createVNode)(cc,{name:e.triggerIcon,size:20},null,8,["name"]),(0,n.createVNode)(cc,{name:"arrow_drop_down",size:14})],10,My)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Ny,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.options,t=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:t.value,type:"button",class:(0,n.normalizeClass)(["docx-icon-grid__option",{"docx-icon-grid__option--active":e.activeValue===t.value}]),title:t.label,onClick:(0,n.withModifiers)(e=>i(t.value),["prevent"])},[(0,n.createVNode)(cc,{name:t.iconName,size:18},null,8,["name"])],10,Iy))),128))])]),_:1},8,["open"]))}}),[["__scopeId","data-v-435b9662"]]),Ay=(0,n.defineComponent)({__name:"ImageWrapDropdown",props:{imageContext:{},disabled:{type:Boolean}},emits:["change"],setup(e){let t=e,r=[{value:"inline",label:"In line",iconName:"format_image_left"},{value:"wrapRight",label:"Float left",iconName:"format_image_right"},{value:"wrapLeft",label:"Float right",iconName:"format_image_left"},{value:"topAndBottom",label:"Top & bottom",iconName:"horizontal_rule"},{value:"behind",label:"Behind text",iconName:"flip_to_back"},{value:"inFront",label:"In front of text",iconName:"flip_to_front"}],o=(0,n.computed)(()=>{let e=t.imageContext;return"float"===e.displayMode&&"left"===e.cssFloat?"wrapRight":"float"===e.displayMode&&"right"===e.cssFloat?"wrapLeft":e.wrapType}),i=(0,n.computed)(()=>r.find(e=>e.value===o.value)??r[0]);return(t,a)=>((0,n.openBlock)(),(0,n.createBlock)(Ry,{options:r,"active-value":o.value,"trigger-icon":i.value.iconName,"tooltip-content":`Wrap: ${i.value.label}`,disabled:e.disabled,onSelect:a[0]||=e=>t.$emit("change",e)},null,8,["active-value","trigger-icon","tooltip-content","disabled"]))}}),By=(0,n.defineComponent)({__name:"ImageTransformDropdown",props:{disabled:{type:Boolean}},emits:["transform"],setup(e){let t=[{value:"rotateCW",label:"Rotate clockwise",iconName:"rotate_right"},{value:"rotateCCW",label:"Rotate counter-clockwise",iconName:"rotate_left"},{value:"flipH",label:"Flip horizontal",iconName:"swap_horiz"},{value:"flipV",label:"Flip vertical",iconName:"swap_vert"}];return(r,o)=>((0,n.openBlock)(),(0,n.createBlock)(Ry,{options:t,"trigger-icon":"rotate_right","tooltip-content":"Rotate / flip",disabled:e.disabled,onSelect:o[0]||=e=>r.$emit("transform",e)},null,8,["disabled"]))}}),Dy=[{name:"Arial",fontFamily:"Arial",category:"sans-serif"},{name:"Calibri",fontFamily:"Calibri",category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana",category:"sans-serif"},{name:"Open Sans",fontFamily:"Open Sans",category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto",category:"sans-serif"},{name:"Times New Roman",fontFamily:"Times New Roman",category:"serif"},{name:"Georgia",fontFamily:"Georgia",category:"serif"},{name:"Cambria",fontFamily:"Cambria",category:"serif"},{name:"Garamond",fontFamily:"Garamond",category:"serif"},{name:"Courier New",fontFamily:"Courier New",category:"monospace"},{name:"Consolas",fontFamily:"Consolas",category:"monospace"}],Fy=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Py=[{id:"Normal",label:"Normal",previewStyle:{fontSize:"13px"}},{id:"Title",label:"Title",previewStyle:{fontSize:"20px",fontWeight:"bold"}},{id:"Subtitle",label:"Subtitle",previewStyle:{fontSize:"15px",color:"#6b7280"}},{id:"Heading1",label:"Heading 1",previewStyle:{fontSize:"18px",fontWeight:"bold",color:"#4a6c8c"}},{id:"Heading2",label:"Heading 2",previewStyle:{fontSize:"16px",fontWeight:"bold",color:"#4a6c8c"}},{id:"Heading3",label:"Heading 3",previewStyle:{fontSize:"14px",fontWeight:"bold",color:"#4a6c8c"}}],Oy=[{label:"Single",value:240},{label:"1.15",value:276},{label:"1.5",value:360},{label:"Double",value:480}],Ly=[.5,.75,1,1.25,1.5,2];function zy(e){let t=(0,n.ref)(null),r=(0,n.ref)({top:0,left:0});function o(t){switch(t){case"zoom":return e.zoom.value;case"style":return e.style.value;case"font":return e.font.value;case"size":return e.size.value;case"align":return e.align.value;case"spacing":return e.spacing.value;default:return null}}function i(e){let t=o(e);if(!t)return;let n=t.getBoundingClientRect();r.value={top:n.bottom,left:n.left}}let a=(0,n.computed)(()=>({top:r.value.top+"px",left:r.value.left+"px"}));function l(e){t.value!==e&&i(e),t.value=t.value===e?null:e}function s(n){let r=[e.zoom,e.style,e.font,e.size,e.align,e.spacing],o=n.target;r.some(e=>e.value?.contains(o))||(t.value=null)}return(0,n.onMounted)(()=>document.addEventListener("mousedown",s)),(0,n.onBeforeUnmount)(()=>document.removeEventListener("mousedown",s)),{openDropdown:t,dropdownMenuStyle:a,toggleDropdown:l}}var Vy={key:0,class:"basic-toolbar"},$y=["disabled"],jy=["disabled"],Hy=["disabled"],Wy=["disabled"],qy=["onMousedown"],Zy=["onMousedown"],Uy={key:0,class:"toolbar-dropdown__group-label"},Ky=["onMousedown"],Gy=["onMousedown"],Xy=["disabled"],Yy=["onMousedown"],Jy=Us((0,n.defineComponent)({__name:"Toolbar",props:{view:{},getCommands:{type:Function},stateTick:{},zoomPercent:{},isMinZoom:{type:Boolean},isMaxZoom:{type:Boolean},zoomPresets:{},showZoomControl:{type:Boolean},editorMode:{},commentsSidebarOpen:{type:Boolean},imageContext:{},theme:{},fontFamilies:{}},emits:["find-replace","insert-table","insert-image","insert-link","insert-symbol","insert-page-break","insert-toc","page-setup","toggle-outline","zoom-in","zoom-out","zoom-set","toggle-sidebar","apply-style","mode-change","image-wrap-type","image-properties","image-transform"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.computed)(()=>r.zoomPercent??100),a=(0,n.computed)(()=>r.isMinZoom??!1),l=(0,n.computed)(()=>r.isMaxZoom??!1),s=(0,n.computed)(()=>r.zoomPresets??Ly),c=(0,n.computed)(()=>r.showZoomControl??!0),d=(0,n.ref)(null),u=(0,n.ref)(null),p=(0,n.ref)(null),h=(0,n.ref)(null),f=(0,n.ref)(null),m=(0,n.ref)(null),{openDropdown:g,dropdownMenuStyle:v,toggleDropdown:y}=zy({zoom:m,style:d,font:u,size:p,align:h,spacing:f}),b=(0,n.computed)(()=>{r.stateTick;let e=r.view;return e?Wp(e.state):{hasSelection:!1,isMultiParagraph:!1,textFormatting:{},paragraphFormatting:{},startParagraphIndex:0,endParagraphIndex:0,inList:!1,activeCommentIds:[],inInsertion:!1,inDeletion:!1}}),w=(0,n.computed)(()=>{let e=b.value.textFormatting.fontFamily;return e?.ascii||e?.hAnsi||"Arial"}),k=(0,n.computed)(()=>{let e=b.value.textFormatting.fontSize;return e?e/2:11}),x=(0,n.computed)(()=>b.value.paragraphFormatting.alignment||"left"),S=(0,n.computed)(()=>{switch(x.value){case"center":return"format_align_center";case"right":return"format_align_right";case"both":return"format_align_justify";default:return"format_align_left"}}),C=(0,n.computed)(()=>{let e=b.value.paragraphFormatting.styleId||"Normal";return Py.find(t=>t.id===e)?.label||e}),T=(0,n.computed)(()=>{r.stateTick;let e=r.view;return!!e&&$p(e.state)>0}),E=(0,n.computed)(()=>{r.stateTick;let e=r.view;return!!e&&jp(e.state)>0}),_=(0,n.computed)(()=>{let e=b.value,t=e.inList&&(e.listLevel??0)>0,n=(e.paragraphFormatting.indentLeft??0)>0;return t||n}),M=(0,n.computed)(()=>{let e=b.value.textFormatting.color?.rgb;return e?e.replace(/^#/,"").toUpperCase():void 0}),N=(0,n.computed)(()=>{let e=b.value.textFormatting.highlight;if(e&&"none"!==e)return e.replace(/^#/,"").toUpperCase()}),I=(0,n.computed)(()=>Wv(r.fontFamilies)??Dy),R=(0,n.computed)(()=>[{label:"Sans-serif",fonts:I.value.filter(e=>"sans-serif"===e.category)},{label:"Serif",fonts:I.value.filter(e=>"serif"===e.category)},{label:"Monospace",fonts:I.value.filter(e=>"monospace"===e.category)},{label:"Other",fonts:I.value.filter(e=>!e.category||"other"===e.category)}]);function A(e,...t){let n=r.view;if(!n)return;let o=r.getCommands()[e];o?(o(...t)(n.state,e=>n.dispatch(e),n),n.hasFocus()||n.focus(),g.value=null):console.warn("[Toolbar] command not found:",e)}function B(e){A("setFontFamily",e)}function D(e){A("setFontSize",2*e)}function F(){let e=k.value;D(Fy.find(t=>t>e)||e+2)}function P(){let e=k.value;D([...Fy].reverse().find(t=>t<e)||Math.max(1,e-2))}function O(e){"object"==typeof e&&e.auto?A("clearTextColor"):A("setTextColor","string"==typeof e?{rgb:e}:e)}function L(){let e=r.view;e&&(ag(e.state,t=>e.dispatch(t),e),e.hasFocus()||e.focus())}function z(e){A("setHighlight","string"==typeof e?e:e.rgb??"none")}function V(e){o("apply-style",e),g.value=null}function $(e){A("setLineSpacing",e)}function j(e){let t=b.value.paragraphFormatting.lineSpacing;return t?Math.abs(t-e)<10:240===e}return(t,r)=>e.view?((0,n.openBlock)(),(0,n.createElementBlock)("div",Vy,[(0,n.createElementVNode)("button",{title:"Undo (Ctrl+Z)",disabled:!T.value,onMousedown:r[0]||=(0,n.withModifiers)(e=>A("undo"),["prevent"])},[(0,n.createVNode)(cc,{name:"undo"})],40,$y),(0,n.createElementVNode)("button",{title:"Redo (Ctrl+Y)",disabled:!E.value,onMousedown:r[1]||=(0,n.withModifiers)(e=>A("redo"),["prevent"])},[(0,n.createVNode)(cc,{name:"redo"})],40,jy),r[35]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"toolbar-dropdown zoom-group",ref_key:"zoomDropdownRef",ref:m},[(0,n.createElementVNode)("button",{class:"size-btn",onMousedown:r[2]||=(0,n.withModifiers)(e=>t.$emit("zoom-out"),["prevent"]),disabled:a.value,title:"Zoom out"}," − ",40,Hy),(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger zoom-trigger",onMousedown:r[3]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("zoom"),["prevent"]),title:"Zoom level"},(0,n.toDisplayString)(i.value)+"% ",33),(0,n.createElementVNode)("button",{class:"size-btn",onMousedown:r[4]||=(0,n.withModifiers)(e=>t.$emit("zoom-in"),["prevent"]),disabled:l.value,title:"Zoom in"}," + ",40,Wy),"zoom"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu zoom-menu"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e,class:(0,n.normalizeClass)(["toolbar-dropdown__item",{active:i.value===Math.round(100*e)}]),onMousedown:(0,n.withModifiers)(n=>t.$emit("zoom-set",e),["prevent"])},(0,n.toDisplayString)(Math.round(100*e))+"% ",43,qy))),128))],4)):(0,n.createCommentVNode)("",!0)],512)):(0,n.createCommentVNode)("",!0),r[36]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createElementVNode)("div",{class:"toolbar-dropdown",ref_key:"styleDropdownRef",ref:d},[(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger style-trigger",onMousedown:r[5]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("style"),["prevent"]),title:"Paragraph style"},[(0,n.createTextVNode)((0,n.toDisplayString)(C.value)+" ",1),(0,n.createVNode)(cc,{class:"chevron",name:"arrow_drop_down",size:16})],32),"style"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu style-menu"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(Py),e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.id,class:(0,n.normalizeClass)(["toolbar-dropdown__item",{active:(b.value.paragraphFormatting.styleId||"Normal")===e.id}]),style:(0,n.normalizeStyle)(e.previewStyle),onMousedown:(0,n.withModifiers)(t=>V(e.id),["prevent"])},(0,n.toDisplayString)(e.label),47,Zy))),128))],4)):(0,n.createCommentVNode)("",!0)],512),r[37]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createElementVNode)("div",{class:"toolbar-dropdown",ref_key:"fontDropdownRef",ref:u},[(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger font-trigger",onMousedown:r[6]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("font"),["prevent"]),title:"Font family"},[(0,n.createTextVNode)((0,n.toDisplayString)(w.value)+" ",1),(0,n.createVNode)(cc,{class:"chevron",name:"arrow_drop_down",size:16})],32),"font"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu font-menu"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(R.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:e.label},[e.fonts.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Uy,(0,n.toDisplayString)(e.label),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.fonts,e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.name,class:(0,n.normalizeClass)(["toolbar-dropdown__item",{active:w.value===e.name}]),style:(0,n.normalizeStyle)({fontFamily:e.fontFamily}),onMousedown:(0,n.withModifiers)(t=>B(e.name),["prevent"])},(0,n.toDisplayString)(e.name),47,Ky))),128))],64))),128))],4)):(0,n.createCommentVNode)("",!0)],512),(0,n.createElementVNode)("div",{class:"toolbar-dropdown font-size-group",ref_key:"sizeDropdownRef",ref:p},[(0,n.createElementVNode)("button",{class:"size-btn",onMousedown:(0,n.withModifiers)(P,["prevent"]),title:"Decrease font size"}," − ",32),(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger size-trigger",onMousedown:r[7]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("size"),["prevent"]),title:"Font size"},(0,n.toDisplayString)(k.value),33),(0,n.createElementVNode)("button",{class:"size-btn",onMousedown:(0,n.withModifiers)(F,["prevent"]),title:"Increase font size"}," + ",32),"size"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu size-menu"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(Fy),e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e,class:(0,n.normalizeClass)(["toolbar-dropdown__item",{active:k.value===e}]),onMousedown:(0,n.withModifiers)(t=>D(e),["prevent"])},(0,n.toDisplayString)(e),43,Gy))),128))],4)):(0,n.createCommentVNode)("",!0)],512),r[38]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createElementVNode)("button",{title:"Bold (Ctrl+B)",class:(0,n.normalizeClass)({active:b.value.textFormatting.bold}),onMousedown:r[8]||=(0,n.withModifiers)(e=>A("toggleBold"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_bold"})],34),(0,n.createElementVNode)("button",{title:"Italic (Ctrl+I)",class:(0,n.normalizeClass)({active:b.value.textFormatting.italic}),onMousedown:r[9]||=(0,n.withModifiers)(e=>A("toggleItalic"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_italic"})],34),(0,n.createElementVNode)("button",{title:"Underline (Ctrl+U)",class:(0,n.normalizeClass)({active:!!b.value.textFormatting.underline}),onMousedown:r[10]||=(0,n.withModifiers)(e=>A("toggleUnderline"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_underlined"})],34),(0,n.createElementVNode)("button",{title:"Strikethrough",class:(0,n.normalizeClass)({active:b.value.textFormatting.strike}),onMousedown:r[11]||=(0,n.withModifiers)(e=>A("toggleStrike"),["prevent"])},[(0,n.createVNode)(cc,{name:"strikethrough_s"})],34),(0,n.createVNode)(vy,{mode:"text",value:M.value,theme:e.theme??null,onChange:O},null,8,["value","theme"]),(0,n.createVNode)(vy,{mode:"highlight",value:N.value,theme:e.theme??null,onChange:z},null,8,["value","theme"]),(0,n.createElementVNode)("button",{title:"Insert link (Ctrl+K)",onMousedown:r[12]||=(0,n.withModifiers)(e=>t.$emit("insert-link"),["prevent"])},[(0,n.createVNode)(cc,{name:"link"})],32),(0,n.createElementVNode)("button",{title:"Superscript (Ctrl+Shift+=)",class:(0,n.normalizeClass)({active:"superscript"===b.value.textFormatting.vertAlign}),onMousedown:r[13]||=(0,n.withModifiers)(e=>A("toggleSuperscript"),["prevent"])},[(0,n.createVNode)(cc,{name:"superscript"})],34),(0,n.createElementVNode)("button",{title:"Subscript (Ctrl+=)",class:(0,n.normalizeClass)({active:"subscript"===b.value.textFormatting.vertAlign}),onMousedown:r[14]||=(0,n.withModifiers)(e=>A("toggleSubscript"),["prevent"])},[(0,n.createVNode)(cc,{name:"subscript"})],34),r[39]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createElementVNode)("div",{class:"toolbar-dropdown",ref_key:"alignDropdownRef",ref:h},[(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger align-trigger",onMousedown:r[15]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("align"),["prevent"]),title:"Alignment"},[(0,n.createVNode)(cc,{name:S.value},null,8,["name"]),(0,n.createVNode)(cc,{class:"chevron",name:"arrow_drop_down",size:16})],32),"align"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu align-menu"},[(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["toolbar-dropdown__item dropdown-item--icon",{active:"left"===x.value}]),onMousedown:r[16]||=(0,n.withModifiers)(e=>{A("alignLeft"),g.value=null},["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_left",size:18}),r[30]||=(0,n.createTextVNode)(" Left (Ctrl+L) ",-1)],34),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["toolbar-dropdown__item dropdown-item--icon",{active:"center"===x.value}]),onMousedown:r[17]||=(0,n.withModifiers)(e=>{A("alignCenter"),g.value=null},["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_center",size:18}),r[31]||=(0,n.createTextVNode)(" Center (Ctrl+E) ",-1)],34),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["toolbar-dropdown__item dropdown-item--icon",{active:"right"===x.value}]),onMousedown:r[18]||=(0,n.withModifiers)(e=>{A("alignRight"),g.value=null},["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_right",size:18}),r[32]||=(0,n.createTextVNode)(" Right (Ctrl+R) ",-1)],34),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["toolbar-dropdown__item dropdown-item--icon",{active:"both"===x.value}]),onMousedown:r[19]||=(0,n.withModifiers)(e=>{A("alignJustify"),g.value=null},["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_justify",size:18}),r[33]||=(0,n.createTextVNode)(" Justify (Ctrl+J) ",-1)],34)],4)):(0,n.createCommentVNode)("",!0)],512),(0,n.createElementVNode)("button",{title:"Bullet List",class:(0,n.normalizeClass)({active:b.value.inList&&"bullet"===b.value.listType}),onMousedown:r[20]||=(0,n.withModifiers)(e=>A("toggleBulletList"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_list_bulleted"})],34),(0,n.createElementVNode)("button",{title:"Numbered List",class:(0,n.normalizeClass)({active:b.value.inList&&"numbered"===b.value.listType}),onMousedown:r[21]||=(0,n.withModifiers)(e=>A("toggleNumberedList"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_list_numbered"})],34),(0,n.createElementVNode)("button",{title:"Decrease Indent (Shift+Tab)",disabled:!_.value,onMousedown:r[22]||=(0,n.withModifiers)(e=>A("outdent"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_indent_decrease"})],40,Xy),(0,n.createElementVNode)("button",{title:"Increase Indent (Tab)",onMousedown:r[23]||=(0,n.withModifiers)(e=>A("indent"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_indent_increase"})],32),(0,n.createElementVNode)("div",{class:"toolbar-dropdown",ref_key:"spacingDropdownRef",ref:f},[(0,n.createElementVNode)("button",{class:"toolbar-dropdown__trigger",onMousedown:r[24]||=(0,n.withModifiers)(e=>(0,n.unref)(y)("spacing"),["prevent"]),title:"Line spacing"},[(0,n.createVNode)(cc,{name:"format_line_spacing"}),(0,n.createVNode)(cc,{class:"chevron",name:"arrow_drop_down",size:16})],32),"spacing"===(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)((0,n.unref)(v)),class:"toolbar-dropdown__menu"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(Oy),e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.value,class:(0,n.normalizeClass)(["toolbar-dropdown__item",{active:j(e.value)}]),onMousedown:(0,n.withModifiers)(t=>$(e.value),["prevent"])},(0,n.toDisplayString)(e.label),43,Yy))),128))],4)):(0,n.createCommentVNode)("",!0)],512),(0,n.createElementVNode)("button",{title:"Clear formatting",onMousedown:(0,n.withModifiers)(L,["prevent"])},[(0,n.createVNode)(cc,{name:"format_clear"})],32),r[40]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createElementVNode)("button",{title:"Comments & Changes",class:(0,n.normalizeClass)({active:e.commentsSidebarOpen}),onMousedown:r[25]||=(0,n.withModifiers)(e=>t.$emit("toggle-sidebar"),["prevent"])},[(0,n.createVNode)(cc,{name:"comment"})],34),e.imageContext?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[r[34]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createVNode)(Ay,{"image-context":e.imageContext,onChange:r[26]||=e=>t.$emit("image-wrap-type",e)},null,8,["image-context"]),(0,n.createVNode)(By,{onTransform:r[27]||=e=>t.$emit("image-transform",e)}),(0,n.createElementVNode)("button",{title:"Image properties",onMousedown:r[28]||=(0,n.withModifiers)(e=>t.$emit("image-properties"),["prevent"])},[(0,n.createVNode)(cc,{name:"tune"})],32)],64)):(0,n.createCommentVNode)("",!0),(0,n.renderSlot)(t.$slots,"table-context",{},void 0,!0),r[41]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),e.editorMode?((0,n.openBlock)(),(0,n.createBlock)(_y,{key:2,"model-value":e.editorMode,"onUpdate:modelValue":r[29]||=e=>t.$emit("mode-change",e)},null,8,["model-value"])):(0,n.createCommentVNode)("",!0),(0,n.renderSlot)(t.$slots,"toolbar-extra",{},void 0,!0)])):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-25c08b74"]]),Qy=(0,n.defineComponent)({__name:"TableCellFillPicker",props:{disabled:{type:Boolean},theme:{},value:{}},emits:["change"],setup(e,{emit:t}){let r=t,{t:o}=xc();function i(e){"string"==typeof e&&r("change","none"===e?"":e.replace(/^#/,""))}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(vy,{mode:"highlight",value:e.value,theme:e.theme??null,disabled:e.disabled,title:(0,n.unref)(o)("table.cellFillColor"),icon:"format_color_fill","auto-label":(0,n.unref)(o)("colorPicker.noColor"),onChange:i},null,8,["value","theme","disabled","title","auto-label"]))}}),eb=["disabled","onClick"],tb={class:"docx-tbp__panel"},nb=["title","onClick"],rb=Us((0,n.defineComponent)({__name:"TableBorderPicker",props:{disabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){let r=t,o=(0,n.ref)(!1),i=[{value:"all",icon:"border_all",label:"All borders"},{value:"none",icon:"border_clear",label:"No borders"},{value:"box",icon:"border_outer",label:"Outside borders"},{value:"inside",icon:"border_inner",label:"Inside borders"},{value:"top",icon:"border_top",label:"Top border"},{value:"bottom",icon:"border_bottom",label:"Bottom border"},{value:"left",icon:"border_left",label:"Left border"},{value:"right",icon:"border_right",label:"Right border"},{value:"insideH",icon:"border_horizontal",label:"Inside horizontal"},{value:"insideV",icon:"border_vertical",label:"Inside vertical"}];function a(e){r("change",e),o.value=!1}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:o.value,"onUpdate:open":r[0]||=e=>o.value=e,onClose:r[1]||=e=>o.value=!1},{trigger:(0,n.withCtx)(({toggle:t})=>[(0,n.createElementVNode)("button",{type:"button",class:"docx-tbp__btn",disabled:e.disabled,title:"Borders",onClick:(0,n.withModifiers)(t,["prevent"])},[(0,n.createVNode)(cc,{name:"border_all",size:20})],8,eb)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",tb,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,e=>(0,n.createElementVNode)("button",{key:e.value,type:"button",class:"docx-tbp__option",title:e.label,onClick:(0,n.withModifiers)(t=>a(e.value),["prevent"])},[(0,n.createVNode)(cc,{name:e.icon,size:20},null,8,["name"])],8,nb)),64))])]),_:1},8,["open"]))}}),[["__scopeId","data-v-51d7b6e0"]]),ob=(0,n.defineComponent)({__name:"TableBorderColorPicker",props:{disabled:{type:Boolean},theme:{},value:{}},emits:["change"],setup(e,{emit:t}){let r=t,{t:o}=xc();function i(e){"string"==typeof e?r("change",e.replace(/^#/,"")):e.rgb?r("change",e.rgb.replace(/^#/,"")):e.auto&&r("change","000000")}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(vy,{mode:"border",value:e.value,theme:e.theme??null,disabled:e.disabled,title:(0,n.unref)(o)("table.borderColor"),onChange:i},null,8,["value","theme","disabled","title"]))}}),ib=["disabled","onClick"],ab={class:"docx-tbwidth__panel"},lb=["onClick"],sb={class:"docx-tbwidth__label"},cb=Us((0,n.defineComponent)({__name:"TableBorderWidthPicker",props:{disabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){let r=t,o=(0,n.ref)(!1),i=[{label:"0.5pt",eighths:4,previewPx:1},{label:"0.75pt",eighths:6,previewPx:1},{label:"1pt",eighths:8,previewPx:2},{label:"1.5pt",eighths:12,previewPx:2},{label:"2.25pt",eighths:18,previewPx:3},{label:"3pt",eighths:24,previewPx:4},{label:"4.5pt",eighths:36,previewPx:6},{label:"6pt",eighths:48,previewPx:8}];function a(e){r("change",e),o.value=!1}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:o.value,"onUpdate:open":r[0]||=e=>o.value=e,onClose:r[1]||=e=>o.value=!1},{trigger:(0,n.withCtx)(({toggle:t})=>[(0,n.createElementVNode)("button",{type:"button",class:"docx-tbwidth__btn",disabled:e.disabled,title:"Border width",onClick:(0,n.withModifiers)(t,["prevent"])},[(0,n.createVNode)(cc,{name:"line_weight",size:20})],8,ib)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",ab,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,e=>(0,n.createElementVNode)("button",{key:e.eighths,type:"button",class:"docx-tbwidth__option",onClick:(0,n.withModifiers)(t=>a(e.eighths),["prevent"])},[(0,n.createElementVNode)("span",{class:"docx-tbwidth__preview",style:(0,n.normalizeStyle)({borderTopWidth:e.previewPx+"px"})},null,4),(0,n.createElementVNode)("span",sb,(0,n.toDisplayString)(e.label),1)],8,lb)),64))])]),_:1},8,["open"]))}}),[["__scopeId","data-v-c134095d"]]),db=["disabled","title","onClick"],ub=["aria-label"],pb=["disabled"],hb=["disabled"],fb=["disabled"],mb=["disabled"],gb={class:"docx-tmore__section-label"},vb={class:"docx-tmore__icon-row"},yb=["title"],bb=["title"],wb=["title"],kb={class:"docx-tmore__section-label"},xb={class:"docx-tmore__icon-row"},Sb=["title"],Cb=["title"],Tb=["title"],Eb={class:"docx-tmore__grow"},_b={key:0,class:"docx-tmore__sub"},Mb={class:"docx-tmore__margin-grid"},Nb={class:"docx-tmore__field-label"},Ib=["onUpdate:modelValue"],Rb={class:"docx-tmore__grow"},Ab={key:1,class:"docx-tmore__sub"},Bb={class:"docx-tmore__row-field"},Db={class:"docx-tmore__field-label"},Fb={value:"auto"},Pb={value:"atLeast"},Ob={value:"exact"},Lb={key:0,class:"docx-tmore__row-field"},zb={class:"docx-tmore__field-label"},Vb={class:"docx-tmore__grow"},$b={key:2,class:"docx-tmore__sub docx-tmore__sub--list"},jb=Us((0,n.defineComponent)({__name:"TableMoreDropdown",props:{disabled:{type:Boolean,default:!1},canSplit:{type:Boolean,default:!1},canMerge:{type:Boolean,default:!1},rowCount:{default:0},columnCount:{default:0},currentJustification:{default:"left"}},emits:["action","cell-margins","cell-text-direction","row-height"],setup(e,{emit:t}){let r=e,o=t,{t:i}=xc(),a=(0,n.ref)(!1),l=(0,n.ref)(!1),s=(0,n.ref)(!1),c=(0,n.ref)(!1),d=(0,n.reactive)({top:0,bottom:0,left:108,right:108}),u=(0,n.ref)(0),p=(0,n.ref)("atLeast");function h(e){return!!r.disabled||("splitCell"===e?!r.canSplit:"mergeCells"===e?!r.canMerge:"deleteRow"===e?(r.rowCount??0)<=1:"deleteColumn"===e&&(r.columnCount??0)<=1)}function f(e){h(e)||(o("action",e),a.value=!1)}(0,n.watch)(a,e=>{e||(l.value=!1,s.value=!1,c.value=!1)});let m=e=>{let t=Number(e);return Number.isFinite(t)&&t>0?t:0};function g(){o("cell-margins",{top:m(d.top),bottom:m(d.bottom),left:m(d.left),right:m(d.right)}),a.value=!1}function v(){let e=m(u.value);"auto"===p.value||e<=0?o("row-height",{height:null}):o("row-height",{height:e,rule:p.value}),a.value=!1}function y(e){o("cell-text-direction",e),a.value=!1}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:a.value,placement:"bottom-right","onUpdate:open":r[34]||=e=>a.value=e,onClose:r[35]||=e=>a.value=!1},{trigger:(0,n.withCtx)(({toggle:t})=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-tmore__btn",{"docx-tmore__btn--open":a.value}]),disabled:e.disabled,title:(0,n.unref)(i)("tableAdvanced.tableOptions"),onClick:(0,n.withModifiers)(t,["prevent"])},[(0,n.createVNode)(cc,{name:"more_vert",size:20})],10,db)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"docx-tmore__panel",role:"menu","aria-label":(0,n.unref)(i)("tableAdvanced.tableOptionsMenu")},[(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[0]||=(0,n.withModifiers)(e=>f("addRowAbove"),["prevent"])},[(0,n.createVNode)(cc,{name:"add",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.insertRowAbove")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[1]||=(0,n.withModifiers)(e=>f("addRowBelow"),["prevent"])},[(0,n.createVNode)(cc,{name:"add",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.insertRowBelow")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[2]||=(0,n.withModifiers)(e=>f("addColumnLeft"),["prevent"])},[(0,n.createVNode)(cc,{name:"add",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.insertColumnLeft")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[3]||=(0,n.withModifiers)(e=>f("addColumnRight"),["prevent"])},[(0,n.createVNode)(cc,{name:"add",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.insertColumnRight")),1)]),r[38]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",disabled:h("mergeCells"),onClick:r[4]||=(0,n.withModifiers)(e=>f("mergeCells"),["prevent"])},[(0,n.createVNode)(cc,{name:"call_merge",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.mergeCells")),1)],8,pb),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",disabled:h("splitCell"),onClick:r[5]||=(0,n.withModifiers)(e=>f("splitCell"),["prevent"])},[(0,n.createVNode)(cc,{name:"call_split",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.splitCell")),1)],8,hb),r[39]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item docx-tmore__item--danger",disabled:h("deleteRow"),onClick:r[6]||=(0,n.withModifiers)(e=>f("deleteRow"),["prevent"])},[(0,n.createVNode)(cc,{name:"delete",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.deleteRow")),1)],8,fb),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item docx-tmore__item--danger",disabled:h("deleteColumn"),onClick:r[7]||=(0,n.withModifiers)(e=>f("deleteColumn"),["prevent"])},[(0,n.createVNode)(cc,{name:"delete",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.deleteColumn")),1)],8,mb),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item docx-tmore__item--danger",onClick:r[8]||=(0,n.withModifiers)(e=>f("deleteTable"),["prevent"])},[(0,n.createVNode)(cc,{name:"delete",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("table.deleteTable")),1)]),r[40]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("div",gb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.verticalAlignment")),1),(0,n.createElementVNode)("div",vb,[(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__icon-btn",title:(0,n.unref)(i)("tableAdvanced.top"),onMousedown:r[9]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[10]||=(0,n.withModifiers)(e=>f("verticalAlignTop"),["prevent"])},[(0,n.createVNode)(cc,{name:"vertical_align_top",size:16})],40,yb),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__icon-btn",title:(0,n.unref)(i)("tableAdvanced.middle"),onMousedown:r[11]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[12]||=(0,n.withModifiers)(e=>f("verticalAlignMiddle"),["prevent"])},[(0,n.createVNode)(cc,{name:"vertical_align_center",size:16})],40,bb),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__icon-btn",title:(0,n.unref)(i)("tableAdvanced.bottom"),onMousedown:r[13]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[14]||=(0,n.withModifiers)(e=>f("verticalAlignBottom"),["prevent"])},[(0,n.createVNode)(cc,{name:"vertical_align_bottom",size:16})],40,wb)]),r[41]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("div",kb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.tableAlignment")),1),(0,n.createElementVNode)("div",xb,[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-tmore__icon-btn",{"docx-tmore__icon-btn--active":"left"===e.currentJustification}]),title:(0,n.unref)(i)("tableAdvanced.alignTableLeft"),onMousedown:r[15]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[16]||=(0,n.withModifiers)(e=>f("alignTableLeft"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_left",size:16})],42,Sb),(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-tmore__icon-btn",{"docx-tmore__icon-btn--active":"center"===e.currentJustification}]),title:(0,n.unref)(i)("tableAdvanced.alignTableCenter"),onMousedown:r[17]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[18]||=(0,n.withModifiers)(e=>f("alignTableCenter"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_center",size:16})],42,Cb),(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-tmore__icon-btn",{"docx-tmore__icon-btn--active":"right"===e.currentJustification}]),title:(0,n.unref)(i)("tableAdvanced.alignTableRight"),onMousedown:r[19]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:r[20]||=(0,n.withModifiers)(e=>f("alignTableRight"),["prevent"])},[(0,n.createVNode)(cc,{name:"format_align_right",size:16})],42,Tb)]),r[42]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[21]||=(0,n.withModifiers)(e=>l.value=!l.value,["prevent"])},[(0,n.createVNode)(cc,{name:"padding",size:18}),(0,n.createElementVNode)("span",Eb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.cellMargins")),1),(0,n.createVNode)(cc,{name:l.value?"expand_less":"expand_more",size:18},null,8,["name"])]),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",_b,[(0,n.createElementVNode)("div",Mb,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(["top","bottom","left","right"],e=>(0,n.createElementVNode)("label",{key:e,class:"docx-tmore__field"},[(0,n.createElementVNode)("span",Nb,(0,n.toDisplayString)(e),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{type:"number",min:"0",step:"20","onUpdate:modelValue":t=>d[e]=t,class:"docx-tmore__input"},null,8,Ib),[[n.vModelText,d[e],void 0,{number:!0}]]),r[36]||=(0,n.createElementVNode)("span",{class:"docx-tmore__unit"},"tw",-1)])),64))]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__apply",onClick:(0,n.withModifiers)(g,["prevent"])},(0,n.toDisplayString)((0,n.unref)(i)("common.apply")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[22]||=(0,n.withModifiers)(e=>s.value=!s.value,["prevent"])},[(0,n.createVNode)(cc,{name:"height",size:18}),(0,n.createElementVNode)("span",Rb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.rowHeight")),1),(0,n.createVNode)(cc,{name:s.value?"expand_less":"expand_more",size:18},null,8,["name"])]),s.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Ab,[(0,n.createElementVNode)("label",Bb,[(0,n.createElementVNode)("span",Db,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.rule")),1),(0,n.withDirectives)((0,n.createElementVNode)("select",{"onUpdate:modelValue":r[23]||=e=>p.value=e,class:"docx-tmore__select"},[(0,n.createElementVNode)("option",Fb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.heightRules.auto")),1),(0,n.createElementVNode)("option",Pb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.heightRules.atLeast")),1),(0,n.createElementVNode)("option",Ob,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.heightRules.exact")),1)],512),[[n.vModelSelect,p.value]])]),"auto"===p.value?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("label",Lb,[(0,n.createElementVNode)("span",zb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.height")),1),(0,n.withDirectives)((0,n.createElementVNode)("input",{type:"number",min:"0",step:"20","onUpdate:modelValue":r[24]||=e=>u.value=e,class:"docx-tmore__input"},null,512),[[n.vModelText,u.value,void 0,{number:!0}]]),r[37]||=(0,n.createElementVNode)("span",{class:"docx-tmore__unit"},"tw",-1)])),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__apply",onClick:(0,n.withModifiers)(v,["prevent"])},(0,n.toDisplayString)((0,n.unref)(i)("common.apply")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[25]||=(0,n.withModifiers)(e=>c.value=!c.value,["prevent"])},[(0,n.createVNode)(cc,{name:"text_rotation_none",size:18}),(0,n.createElementVNode)("span",Vb,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.textDirection")),1),(0,n.createVNode)(cc,{name:c.value?"expand_less":"expand_more",size:18},null,8,["name"])]),c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",$b,[(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__sub-item",onClick:r[26]||=(0,n.withModifiers)(e=>y(null),["prevent"])},(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.textDirections.horizontal")),1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__sub-item",onClick:r[27]||=(0,n.withModifiers)(e=>y("tbRl"),["prevent"])},(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.textDirections.verticalRL")),1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__sub-item",onClick:r[28]||=(0,n.withModifiers)(e=>y("btLr"),["prevent"])},(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.textDirections.verticalLR")),1)])):(0,n.createCommentVNode)("",!0),r[43]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[29]||=(0,n.withModifiers)(e=>f("toggleHeaderRow"),["prevent"])},[(0,n.createVNode)(cc,{name:"table_rows",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.toggleHeaderRow")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[30]||=(0,n.withModifiers)(e=>f("distributeColumns"),["prevent"])},[(0,n.createVNode)(cc,{name:"view_column",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.distributeColumns")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[31]||=(0,n.withModifiers)(e=>f("autoFit"),["prevent"])},[(0,n.createVNode)(cc,{name:"fit_width",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.autoFit")),1)]),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[32]||=(0,n.withModifiers)(e=>f("toggleNoWrap"),["prevent"])},[(0,n.createVNode)(cc,{name:"wrap_text",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.toggleNoWrap")),1)]),r[44]||=(0,n.createElementVNode)("div",{class:"docx-tmore__separator"},null,-1),(0,n.createElementVNode)("button",{type:"button",class:"docx-tmore__item",onClick:r[33]||=(0,n.withModifiers)(e=>f("tableProperties"),["prevent"])},[(0,n.createVNode)(cc,{name:"settings",size:18}),(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(i)("tableAdvanced.tableProperties")),1)])],8,ub)]),_:1},8,["open"]))}}),[["__scopeId","data-v-dbab3895"]]),Hb=Us((0,n.defineComponent)({__name:"TableToolbar",props:{view:{},getCommands:{type:Function},stateTick:{},theme:{}},setup(e){let t=e,r=(0,n.computed)(()=>{t.stateTick;let e=t.view;return e?Rf(e.state):null}),o=(0,n.computed)(()=>!!r.value?.isInTable),i=(0,n.computed)(()=>{t.stateTick;let e=t.view;if(!e)return!1;let{$from:n}=e.state.selection;for(let t=n.depth;t>0;t--)if("tableCell"===n.node(t).type.name){let e=n.node(t),r=e.attrs.colspan||1,o=e.attrs.rowspan||1;return r>1||o>1}return!1}),a=(0,n.computed)(()=>!!r.value?.hasMultiCellSelection),l=(0,n.computed)(()=>r.value?.rowCount??0),s=(0,n.computed)(()=>r.value?.columnCount??0),c=(0,n.computed)(()=>{let e=r.value?.table?.attrs?.justification;return"center"===e||"right"===e?e:"left"}),d={style:"single",size:4,color:{rgb:"000000"}};function u(e,...n){let r=t.view;if(!r)return!1;let o=t.getCommands()[e];if("function"!=typeof o)return!1;let i=o(...n);return"function"==typeof i&&(i(r.state,e=>r.dispatch(e),r),r.focus(),!0)}function p(e){let t={...d,color:{...d.color}};switch(e){case"all":return void u("setAllTableBorders",t);case"none":return void u("removeTableBorders");case"box":return void u("setOutsideTableBorders",t);case"inside":case"insideH":case"insideV":return void u("setInsideTableBorders",t);case"top":case"bottom":case"left":case"right":return void u("setCellBorder",e,t,!0)}}function h(e){d.color={rgb:e.replace(/^#/,"")},u("setTableBorderColor",e)}function f(e){d.size=e,u("setTableBorderWidth",e)}function m(e){u("setCellFillColor",e)}(0,n.watch)([()=>t.view,()=>t.stateTick],()=>{let e=t.view;if(!e)return;let n=Rf(e.state),r=n.cellBorderColor;!r||!n.isInTable||"object"==typeof r&&"rgb"in r&&"string"==typeof r.rgb&&(d.color={rgb:r.rgb})},{immediate:!0});let g={autoFit:["autoFitContents"],alignTableLeft:["setTableProperties",{justification:"left"}],alignTableCenter:["setTableProperties",{justification:"center"}],alignTableRight:["setTableProperties",{justification:"right"}],verticalAlignTop:["setCellVerticalAlign","top"],verticalAlignMiddle:["setCellVerticalAlign","center"],verticalAlignBottom:["setCellVerticalAlign","bottom"]};function v(e){if("tableProperties"===e)return;let t=g[e];t?u(...t):u(e)}function y(e){u("setCellMargins",e)}function b(e){u("setCellTextDirection",e)}function w(e){u("setRowHeight",e.height,e.rule)}return(t,r)=>o.value?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[r[0]||=(0,n.createElementVNode)("span",{class:"divider"},null,-1),(0,n.createVNode)(rb,{onChange:p}),(0,n.createVNode)(ob,{theme:e.theme??null,onChange:h},null,8,["theme"]),(0,n.createVNode)(cb,{onChange:f}),(0,n.createVNode)(Qy,{theme:e.theme??null,onChange:m},null,8,["theme"]),(0,n.createVNode)(jb,{"can-split":i.value,"can-merge":a.value,"row-count":l.value,"column-count":s.value,"current-justification":c.value,onAction:v,onCellMargins:y,onCellTextDirection:b,onRowHeight:w},null,8,["can-split","can-merge","row-count","column-count","current-justification"])],64)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-56725acf"]]),Wb=(0,n.defineComponent)({__name:"Avatar",props:{name:{default:"U"},size:{default:32}},setup(e){let t=e,r=(0,n.computed)(()=>Kv(t.name||"U")),o=(0,n.computed)(()=>({width:t.size+"px",height:t.size+"px",borderRadius:"50%",backgroundColor:Xv(t.name||"U"),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:32===t.size?"13px":"11px",fontWeight:500,flexShrink:0}));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"docx-avatar",style:(0,n.normalizeStyle)(o.value)},(0,n.toDisplayString)(r.value),5))}}),qb={key:0,class:"reply-thread"},Zb={key:0,class:"reply-thread__more"},Ub={class:"reply-thread__header"},Kb={class:"reply-thread__author-block"},Gb={class:"reply-thread__author"},Xb={class:"reply-thread__date"},Yb=Us((0,n.defineComponent)({__name:"ReplyThread",props:{replies:{},isExpanded:{type:Boolean}},setup(e){let t=e,r=(0,n.computed)(()=>t.isExpanded?t.replies:t.replies.slice(-1)),o=(0,n.computed)(()=>t.isExpanded?0:Math.max(0,t.replies.length-1));return(t,i)=>e.replies.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",qb,[o.value>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",Zb,(0,n.toDisplayString)(o.value)+" "+(0,n.toDisplayString)(1===o.value?"reply":"replies"),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r.value,t=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:t.id,class:(0,n.normalizeClass)(["reply-thread__item",{"reply-thread__item--expanded":e.isExpanded}])},[(0,n.createElementVNode)("div",Ub,[(0,n.createVNode)(Wb,{name:t.author,size:28},null,8,["name"]),(0,n.createElementVNode)("div",Kb,[(0,n.createElementVNode)("div",Gb,(0,n.toDisplayString)(t.author||"Unknown"),1),(0,n.createElementVNode)("div",Xb,(0,n.toDisplayString)((0,n.unref)(Uv)(t.date)),1)])]),(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["reply-thread__body",{"reply-thread__body--clamp":!e.isExpanded}])},(0,n.toDisplayString)((0,n.unref)(Zv)(t.content)),3)],2))),128))])):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-fc8a461d"]]),Jb=["onKeydown"],Qb={class:"reply-input__actions"},ew=["disabled"],tw=Us((0,n.defineComponent)({__name:"ReplyInput",emits:["submit"],setup(e,{emit:t}){let r=t,o=(0,n.ref)(!1),i=(0,n.ref)(""),a=(0,n.ref)(null),l=(0,n.computed)(()=>i.value.trim());function s(){o.value=!0,(0,n.nextTick)(()=>a.value?.focus({preventScroll:!0}))}function c(){o.value=!1,i.value=""}function d(){let e=l.value;e&&r("submit",e),i.value="",o.value=!1}return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{onClick:t[4]||=(0,n.withModifiers)(()=>{},["stop"]),onMousedown:t[5]||=(0,n.withModifiers)(()=>{},["stop"]),class:"reply-input"},[o.value?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.withDirectives)((0,n.createElementVNode)("input",{ref_key:"inputRef",ref:a,"onUpdate:modelValue":t[1]||=e=>i.value=e,type:"text",placeholder:"Reply",class:"reply-input__field reply-input__field--active",onMousedown:t[2]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:[t[3]||=(0,n.withModifiers)(()=>{},["stop"]),(0,n.withKeys)((0,n.withModifiers)(d,["prevent"]),["enter"]),(0,n.withKeys)(c,["esc"])]},null,40,Jb),[[n.vModelText,i.value]]),(0,n.createElementVNode)("div",Qb,[(0,n.createElementVNode)("button",{class:"reply-input__cancel",onClick:(0,n.withModifiers)(c,["stop"])},"Cancel"),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["reply-input__submit",{"reply-input__submit--active":l.value}]),disabled:!l.value,onClick:(0,n.withModifiers)(d,["stop"])},"Reply",10,ew)])],64)):((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:0,readonly:"",placeholder:"Reply",class:"reply-input__field reply-input__field--inactive",onMousedown:t[0]||=(0,n.withModifiers)(()=>{},["stop"]),onClick:(0,n.withModifiers)(s,["stop"])},null,32))],32))}}),[["__scopeId","data-v-aa3d5b08"]]),nw=["data-comment-id"],rw={key:0,class:"comment-card__resolved"},ow={class:"comment-card__head"},iw={class:"comment-card__author-block"},aw={class:"comment-card__author"},lw={class:"comment-card__date"},sw={key:0,class:"comment-card__actions"},cw=["title"],dw={class:"comment-card__body"},uw=Us((0,n.defineComponent)({__name:"CommentCard",props:{comment:{},replies:{},expanded:{type:Boolean}},emits:["click","reply","resolve","unresolve","delete"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(!1);function a(){i.value=!1,o("delete",r.comment.id)}return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["comment-card",{"comment-card--expanded":e.expanded}]),"data-comment-id":e.comment.id,onClick:r[5]||=e=>t.$emit("click"),onMousedown:r[6]||=(0,n.withModifiers)(()=>{},["stop"])},[e.comment.done?((0,n.openBlock)(),(0,n.createElementBlock)("div",rw,[(0,n.createVNode)(cc,{name:"check",size:12}),r[7]||=(0,n.createElementVNode)("span",null,"Resolved",-1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",ow,[(0,n.createVNode)(Wb,{name:e.comment.author,size:32},null,8,["name"]),(0,n.createElementVNode)("div",iw,[(0,n.createElementVNode)("div",aw,(0,n.toDisplayString)(e.comment.author||"Unknown"),1),(0,n.createElementVNode)("div",lw,(0,n.toDisplayString)((0,n.unref)(Uv)(e.comment.date)),1)]),e.expanded?((0,n.openBlock)(),(0,n.createElementBlock)("div",sw,[(0,n.createElementVNode)("button",{class:"comment-card__icon-btn",title:e.comment.done?"Reopen":"Resolve",onClick:r[0]||=(0,n.withModifiers)(n=>e.comment.done?t.$emit("unresolve",e.comment.id):t.$emit("resolve",e.comment.id),["stop"])},[(0,n.createVNode)(cc,{name:e.comment.done?"undo":"check",size:20},null,8,["name"])],8,cw),(0,n.createElementVNode)("button",{class:"comment-card__icon-btn",title:"More options",onClick:r[1]||=(0,n.withModifiers)(e=>i.value=!i.value,["stop"])},[(0,n.createVNode)(cc,{name:"more_vert",size:20})]),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"comment-card__menu",onClick:r[2]||=(0,n.withModifiers)(()=>{},["stop"]),onMousedown:r[3]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("button",{class:"comment-card__menu-item",onClick:a},"Delete")],32)):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",dw,(0,n.toDisplayString)((0,n.unref)(Zv)(e.comment.content)),1),(0,n.createVNode)(Yb,{replies:e.replies,"is-expanded":e.expanded},null,8,["replies","is-expanded"]),e.expanded&&!e.comment.done?((0,n.openBlock)(),(0,n.createBlock)(tw,{key:1,onSubmit:r[4]||=n=>t.$emit("reply",e.comment.id,n)})):(0,n.createCommentVNode)("",!0)],42,nw))}}),[["__scopeId","data-v-b9e94a26"]]),pw=["data-comment-id"],hw=Us((0,n.defineComponent)({__name:"ResolvedCommentMarker",props:{comment:{}},emits:["toggle-expand"],setup(e){return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"resolved-comment-marker","data-comment-id":e.comment.id,"data-comment-resolved":"true",onClick:r[0]||=e=>t.$emit("toggle-expand"),onMousedown:r[1]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createVNode)(cc,{name:"chat_bubble_check",size:20})],40,pw))}}),[["__scopeId","data-v-c3b210c1"]]),fw={class:"tc-card__head"},mw={class:"tc-card__author-block"},gw={class:"tc-card__author"},vw={key:0,class:"tc-card__date"},yw={key:0,class:"tc-card__actions"},bw={class:"tc-card__body"},ww={class:"tc-card__deleted"},kw={class:"tc-card__inserted"},xw=Us((0,n.defineComponent)({__name:"TrackedChangeCard",props:{change:{},expanded:{type:Boolean}},emits:["click","accept","reject","reply"],setup(e){let t=e,r=(0,n.computed)(()=>t.change.author||"Unknown");return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["tc-card",{"tc-card--expanded":e.expanded}]),onClick:o[3]||=e=>t.$emit("click"),onMousedown:o[4]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",fw,[(0,n.createVNode)(Wb,{name:r.value,size:32},null,8,["name"]),(0,n.createElementVNode)("div",mw,[(0,n.createElementVNode)("div",gw,(0,n.toDisplayString)(r.value),1),e.change.date?((0,n.openBlock)(),(0,n.createElementBlock)("div",vw,(0,n.toDisplayString)((0,n.unref)(Uv)(e.change.date)),1)):(0,n.createCommentVNode)("",!0)]),e.expanded?((0,n.openBlock)(),(0,n.createElementBlock)("div",yw,[(0,n.createElementVNode)("button",{class:"tc-card__icon-btn",title:"Accept",onClick:o[0]||=(0,n.withModifiers)(n=>t.$emit("accept",e.change.from,e.change.to),["stop"])},[(0,n.createVNode)(cc,{name:"check",size:20})]),(0,n.createElementVNode)("button",{class:"tc-card__icon-btn",title:"Reject",onClick:o[1]||=(0,n.withModifiers)(n=>t.$emit("reject",e.change.from,e.change.to),["stop"])},[(0,n.createVNode)(cc,{name:"close",size:20})])])):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",bw,["replacement"===e.change.type?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[o[5]||=(0,n.createTextVNode)(" Replaced ",-1),(0,n.createElementVNode)("span",ww,'"'+(0,n.toDisplayString)((0,n.unref)(Yv)(e.change.deletedText||""))+'"',1),o[6]||=(0,n.createTextVNode)(" with ",-1),(0,n.createElementVNode)("span",kw,'"'+(0,n.toDisplayString)((0,n.unref)(Yv)(e.change.text))+'"',1)],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createTextVNode)((0,n.toDisplayString)("insertion"===e.change.type?"Added":"Deleted")+" ",1),(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)("insertion"===e.change.type?"tc-card__inserted":"tc-card__deleted")},' "'+(0,n.toDisplayString)((0,n.unref)(Yv)(e.change.text))+'" ',3)],64))]),e.expanded?((0,n.openBlock)(),(0,n.createBlock)(tw,{key:0,onSubmit:o[2]||=n=>t.$emit("reply",e.change.revisionId,n)})):(0,n.createCommentVNode)("",!0)],34))}}),[["__scopeId","data-v-297b1eb8"]]),Sw=["onKeydown"],Cw={class:"add-comment-card__actions"},Tw=["disabled"],Ew=Us((0,n.defineComponent)({__name:"AddCommentCard",emits:["submit","cancel"],setup(e,{emit:t}){let r=t,o=(0,n.ref)(""),i=(0,n.ref)(null),a=(0,n.computed)(()=>o.value.trim());function l(){a.value&&(r("submit",a.value),o.value="")}function s(){r("cancel"),o.value=""}return(0,n.onMounted)(()=>{i.value?.focus({preventScroll:!0})}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"add-comment-card",onMousedown:t[3]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.withDirectives)((0,n.createElementVNode)("textarea",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:"add-comment-card__field",placeholder:"Add a comment",onMousedown:t[1]||=(0,n.withModifiers)(()=>{},["stop"]),onKeydown:[t[2]||=(0,n.withModifiers)(()=>{},["stop"]),(0,n.withKeys)((0,n.withModifiers)(l,["exact","prevent"]),["enter"]),(0,n.withKeys)(s,["esc"])]},null,40,Sw),[[n.vModelText,o.value]]),(0,n.createElementVNode)("div",Cw,[(0,n.createElementVNode)("button",{class:"add-comment-card__cancel",onClick:s},"Cancel"),(0,n.createElementVNode)("button",{class:(0,n.normalizeClass)(["add-comment-card__submit",{"add-comment-card__submit--active":a.value}]),disabled:!a.value,onClick:l},"Comment",10,Tw)])],32))}}),[["__scopeId","data-v-cc70979b"]]),_w=["data-card-id"],Mw=16,Nw=300,Iw=Us((0,n.defineComponent)({__name:"UnifiedSidebar",props:{isOpen:{type:Boolean},comments:{},trackedChanges:{},isAddingComment:{type:Boolean},showResolved:{type:Boolean},pagesContainer:{},pageWidthPx:{},zoom:{},activeItemId:{},addCommentYPosition:{}},emits:["close","add-comment","cancel-add-comment","comment-reply","comment-resolve","comment-unresolve","comment-delete","accept-change","reject-change","tracked-change-reply","update:activeItemId"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(null),a=(0,n.computed)(()=>void 0===r.activeItemId?i.value:r.activeItemId);function l(e){let t=a.value===e?null:e;i.value=t,o("update:activeItemId",t)}let s=(0,n.computed)(()=>{let e=[],t=r.comments.filter(e=>!e.parentId),n=new Map;for(let i of r.comments)if(null!=i.parentId){let e=n.get(i.parentId)||[];e.push(i),n.set(i.parentId,e)}let o=0;for(let i of t)i.done&&!r.showResolved||e.push({id:`comment-${i.id}`,kind:"comment",anchorSelector:`[data-comment-id="${i.id}"]`,fallbackOrder:o++,comment:i,replies:n.get(i.id)||[]});for(let i=0;i<r.trackedChanges.length;i++){let t=r.trackedChanges[i],n=t.insertionRevisionId??t.revisionId,a="deletion"===t.type?`.docx-deletion[data-revision-id="${t.revisionId}"]`:`.docx-insertion[data-revision-id="${n}"]`;e.push({id:`tc-${t.revisionId}-${i}`,kind:"tracked-change",anchorSelector:a,fallbackOrder:o++,change:t})}return e}),c=(0,n.ref)(null),d=(0,n.ref)(new Map),u=null;function p(){let e=r.pagesContainer,t=s.value;if(!e||0===t.length)return void(d.value=new Map);let n=e.getBoundingClientRect(),o=new Map;for(let r of e.querySelectorAll("[data-comment-id]")){let e=r.dataset.commentId;e&&!o.has(e)&&o.set(e,r)}let i=new Map;for(let r of e.querySelectorAll(".docx-insertion[data-revision-id]")){let e=r.dataset.revisionId;e&&!i.has(e)&&i.set(e,r)}let a=new Map;for(let r of e.querySelectorAll(".docx-deletion[data-revision-id]")){let e=r.dataset.revisionId;e&&!a.has(e)&&a.set(e,r)}let l=[];for(let r of t){let t;if("comment"===r.kind)t=o.get(String(r.comment.id));else if("deletion"===r.change.type)t=a.get(String(r.change.revisionId));else{let e=r.change.insertionRevisionId??r.change.revisionId;t=i.get(String(e))}if(!t)continue;let s=t.getBoundingClientRect();l.push({id:r.id,targetY:s.top-n.top+e.scrollTop})}l.sort((e,t)=>e.targetY-t.targetY);let u=new Map,p=c.value;if(p)for(let r of p.querySelectorAll("[data-card-id]")){let e=r.dataset.cardId;e&&u.set(e,r.offsetHeight)}let h=new Map,f=0;for(let r of l){let e=u.get(r.id)??80,t=Math.max(r.targetY,f+Qv);h.set(r.id,t),f=t+e}d.value=h}let h=(0,n.computed)(()=>{let e=0;for(let t of d.value.values())e=Math.max(e,t);return e+200}),f=(0,n.computed)(()=>{let e=a.value;if(!e)return"";if(e.startsWith("comment-"))return`.paged-editor__pages [data-comment-id="${e.slice(8)}"] { background-color: rgba(255, 212, 0, 0.35) !important; border-bottom: 2px solid rgba(255, 212, 0, 0.7) !important; }`;if(e.startsWith("tc-")){let t=e.split("-")[1];return`\n .paged-editor__pages .docx-insertion[data-revision-id="${s.value.find(t=>t.id===e)?.change?.insertionRevisionId??Number(t)}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }\n .paged-editor__pages .docx-deletion[data-revision-id="${t}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }\n `}return""}),m=(0,n.computed)(()=>{let e=r.addCommentYPosition;return null==e?{position:"static",marginBottom:"8px"}:{position:"absolute",top:e+"px",left:0,right:0,transition:"top 0.15s ease"}}),g=(0,n.computed)(()=>{let e=r.pageWidthPx/2+Mw-Jv,t=d.value.size>0||0===s.value.length;return{position:"absolute",top:"0",left:`calc(50% + ${e}px)`,width:Nw+"px",opacity:+!!t}});function v(e){let t=d.value.get(e);return null==t?{position:"static",marginBottom:"8px"}:{position:"absolute",top:t+"px",left:0,right:0,transition:"top 0.15s ease"}}let y=!1;function b(){y||(y=!0,requestAnimationFrame(()=>{y=!1,p()}))}function w(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)return t;t=t.parentElement}return null}(0,n.watch)(()=>[s.value.length,a.value,r.pagesContainer,r.pageWidthPx,r.zoom],()=>b(),{immediate:!0});let k=null;function x(){k&&k.removeEventListener("scroll",b),k=w(r.pagesContainer),k&&k.addEventListener("scroll",b,{passive:!0})}return(0,n.onMounted)(()=>{b(),r.pagesContainer&&(u=new ResizeObserver(()=>b()),u.observe(r.pagesContainer),x())}),(0,n.watch)(()=>r.pagesContainer,(e,t)=>{u?.disconnect(),u=null,e&&(u=new ResizeObserver(()=>b()),u.observe(e),x())}),(0,n.onBeforeUnmount)(()=>{u?.disconnect(),k&&k.removeEventListener("scroll",b)}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[f.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)("style"),{key:0},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(f.value),1)]),_:1})):(0,n.createCommentVNode)("",!0),e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("aside",{key:1,ref_key:"rootRef",ref:c,class:"unified-sidebar",style:(0,n.normalizeStyle)(g.value),onMousedown:r[9]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",{class:"unified-sidebar__inner",style:(0,n.normalizeStyle)({minHeight:h.value+"px"})},[e.isAddingComment?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"unified-sidebar__addcomment",style:(0,n.normalizeStyle)(m.value)},[(0,n.createVNode)(Ew,{onSubmit:r[0]||=e=>t.$emit("add-comment",e),onCancel:r[1]||=e=>t.$emit("cancel-add-comment")})],4)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:e.id,class:"unified-sidebar__card-slot","data-card-id":e.id,style:(0,n.normalizeStyle)(v(e.id))},["comment"===e.kind&&e.comment.done&&a.value!==e.id?((0,n.openBlock)(),(0,n.createBlock)(hw,{key:0,comment:e.comment,onToggleExpand:t=>l(e.id)},null,8,["comment","onToggleExpand"])):"comment"===e.kind?((0,n.openBlock)(),(0,n.createBlock)(uw,{key:1,comment:e.comment,replies:e.replies,expanded:a.value===e.id,onClick:t=>l(e.id),onReply:r[2]||=(e,n)=>t.$emit("comment-reply",e,n),onResolve:r[3]||=e=>t.$emit("comment-resolve",e),onUnresolve:r[4]||=e=>t.$emit("comment-unresolve",e),onDelete:r[5]||=e=>t.$emit("comment-delete",e)},null,8,["comment","replies","expanded","onClick"])):"tracked-change"===e.kind?((0,n.openBlock)(),(0,n.createBlock)(xw,{key:2,change:e.change,expanded:a.value===e.id,onClick:t=>l(e.id),onAccept:r[6]||=(e,n)=>t.$emit("accept-change",e,n),onReject:r[7]||=(e,n)=>t.$emit("reject-change",e,n),onReply:r[8]||=(e,n)=>t.$emit("tracked-change-reply",e,n)},null,8,["change","expanded","onClick"])):(0,n.createCommentVNode)("",!0)],12,_w))),128))],4)],36)):(0,n.createCommentVNode)("",!0)],64))}}),[["__scopeId","data-v-7996a167"]]),Rw=["title","onClick"],Aw=Us((0,n.defineComponent)({__name:"CommentMarginMarkers",props:{comments:{},pagesContainer:{},zoom:{},pageWidthPx:{},sidebarOpen:{type:Boolean},resolvedCommentIds:{}},emits:["marker-click"],setup(e){let t=e,r=(0,n.computed)(()=>{if(t.sidebarOpen)return[];let e=t.pagesContainer;if(!e)return[];let n=e.getBoundingClientRect(),r=new Map;for(let t of e.querySelectorAll("[data-comment-id]")){let e=t.dataset.commentId;e&&!r.has(e)&&r.set(e,t)}let o=[];for(let i of t.comments){if(null!=i.parentId)continue;let a=r.get(String(i.id));if(!a)continue;let l=a.getBoundingClientRect();o.push({comment:i,isResolved:t.resolvedCommentIds.has(i.id),y:(l.top-n.top+e.scrollTop)/t.zoom})}return o}),o=(0,n.computed)(()=>({position:"absolute",top:0,left:`calc(50% + ${t.pageWidthPx/t.zoom/2+6}px)`,zIndex:30,pointerEvents:"none"}));return(t,i)=>r.value.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-comment-margin-markers",style:(0,n.normalizeStyle)(o.value),onMousedown:i[0]||=(0,n.withModifiers)(()=>{},["stop"])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r.value,r=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:r.comment.id,class:"docx-comment-margin-markers__btn",title:r.isResolved?"Resolved comment":"Comment",style:(0,n.normalizeStyle)({top:r.y*e.zoom+"px"}),onClick:e=>t.$emit("marker-click",r.comment.id)},[(0,n.createVNode)(cc,{name:r.isResolved?"chat_bubble_check":"chat_bubble_outline",size:18},null,8,["name"])],12,Rw))),128))],36)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-a20c82d9"]]),Bw=["aria-valuemax"],Dw={class:"docx-horizontal-ruler__ticks"},Fw=["title","onDblclick"],Pw=12240,Ow=1440,Lw=1440,zw=567,Vw=22,$w="#4285f4",jw="#3367d6",Hw="#2a56c6",Ww=5,qw=Us((0,n.defineComponent)({__name:"HorizontalRuler",props:{sectionProps:{},zoom:{default:1},editable:{type:Boolean,default:!0},showFirstLineIndent:{type:Boolean,default:!0},firstLineIndent:{default:0},hangingIndent:{type:Boolean,default:!1},indentLeft:{default:0},indentRight:{default:0},unit:{default:"inch"},tabStops:{}},emits:["left-margin-change","right-margin-change","first-line-indent-change","indent-left-change","indent-right-change","tab-stop-remove"],setup(e,{emit:t}){let r=e,o=t,i=Math.round(1.6*Ww),a=(0,n.ref)(null),l=(0,n.ref)(null),s=(0,n.ref)(null),c=(0,n.ref)(0),d=(0,n.ref)("");function u(e){return Gs(e)*r.zoom}function p(e){return Math.round(Xs(e/r.zoom))}let h=(0,n.computed)(()=>r.sectionProps?.pageWidth??Pw),f=(0,n.computed)(()=>r.sectionProps?.marginLeft??Ow),m=(0,n.computed)(()=>r.sectionProps?.marginRight??Ow),g=(0,n.computed)(()=>h.value-f.value-m.value),v=(0,n.computed)(()=>u(h.value)),y=(0,n.computed)(()=>u(f.value)),b=(0,n.computed)(()=>u(m.value)),w=(0,n.computed)(()=>u(r.indentLeft)),k=(0,n.computed)(()=>u(r.indentRight)),x=(0,n.computed)(()=>r.hangingIndent?-r.firstLineIndent:r.firstLineIndent),S=(0,n.computed)(()=>u(x.value)),C=(0,n.computed)(()=>y.value+w.value),T=(0,n.computed)(()=>v.value-b.value-k.value),E=(0,n.computed)(()=>y.value+w.value+S.value),_=(0,n.computed)(()=>({position:"relative",width:v.value+"px",height:Vw+"px",backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:l.value?"ew-resize":"default"})),M=(0,n.computed)(()=>({position:"absolute",top:0,left:0,width:y.value+"px",height:Vw+"px",backgroundColor:"rgba(0, 0, 0, 0.02)",borderRight:"1px solid rgba(0,0,0,0.06)",cursor:r.editable?"ew-resize":"default",zIndex:1})),N=(0,n.computed)(()=>({position:"absolute",top:0,right:0,width:b.value+"px",height:Vw+"px",backgroundColor:"rgba(0, 0, 0, 0.02)",borderLeft:"1px solid rgba(0,0,0,0.06)",cursor:r.editable?"ew-resize":"default",zIndex:1})),I=(0,n.computed)(()=>{let e=[];if("inch"===r.unit){let t=Lw/8,n=Math.ceil(h.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>h.value)break;let o=u(n);r%8==0?e.push({position:o,height:10,label:r/8>0?String(r/8):void 0}):r%4==0?e.push({position:o,height:6}):r%2==0?e.push({position:o,height:4}):e.push({position:o,height:2})}}else{let t=zw/10,n=Math.ceil(h.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>h.value)break;let o=u(n);r%10==0?e.push({position:o,height:10,label:r/10>0?String(r/10):void 0}):r%5==0?e.push({position:o,height:6}):e.push({position:o,height:3})}}return e}),R=(0,n.computed)(()=>r.tabStops?.length?r.tabStops.map(e=>{let t=e.position??e.pos??0;return{px:u(t),twips:t,label:A(t)}}):[]);function A(e){return"cm"===r.unit?(e/zw).toFixed(1)+" cm":(e/Lw).toFixed(2)+'"'}function B(e){return l.value===e?Hw:s.value===e?jw:$w}function D(e,t,n){return{position:"absolute",left:t-Ww+"px",width:2*Ww+"px",height:i+2+"px",cursor:r.editable?"ew-resize":"default",zIndex:n?10:4,..."down"===e?{top:0}:{bottom:0}}}function F(e,t){return"down"===e?{position:"absolute",top:"1px",left:0,width:0,height:0,borderLeft:`${Ww}px solid transparent`,borderRight:`${Ww}px solid transparent`,borderTop:`${i}px solid ${t}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:"1px",left:0,width:0,height:0,borderLeft:`${Ww}px solid transparent`,borderRight:`${Ww}px solid transparent`,borderBottom:`${i}px solid ${t}`,transition:"border-bottom-color 0.1s"}}let P=0;function O(e,t){r.editable&&(l.value=e,t.clientX,"leftMargin"===e?P=f.value:"rightMargin"===e?P=m.value:"leftIndent"===e?P=r.indentLeft:"rightIndent"===e?P=r.indentRight:"firstLineIndent"===e&&(P=r.firstLineIndent),c.value=t.clientX-(a.value?.getBoundingClientRect().left??0),d.value=A(P),document.addEventListener("mousemove",L),document.addEventListener("mouseup",z))}function L(e){if(!l.value||!a.value)return;let t=a.value.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;c.value=n;let r=p(n),o=V(l.value,r);d.value=A(o),$(l.value,o)}function z(e){l.value=null,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",z)}function V(e,t){if("leftMargin"===e){let e=h.value-m.value-720;return Math.round(Math.max(0,Math.min(t,e)))}if("rightMargin"===e){let e=h.value-t,n=h.value-f.value-720;return Math.round(Math.max(0,Math.min(e,n)))}if("firstLineIndent"===e){let e=t-(f.value+r.indentLeft),n=g.value-r.indentLeft-r.indentRight-720;return Math.round(Math.max(-r.indentLeft,Math.min(e,n)))}if("leftIndent"===e){let e=t-f.value,n=g.value-r.indentRight-720;return Math.round(Math.max(0,Math.min(e,n)))}let n=h.value-m.value-t,o=g.value-r.indentLeft-720;return Math.round(Math.max(0,Math.min(n,o)))}function $(e,t){switch(e){case"leftMargin":o("left-margin-change",t);break;case"rightMargin":o("right-margin-change",t);break;case"firstLineIndent":o("first-line-indent-change",t);break;case"leftIndent":o("indent-left-change",t);break;case"rightIndent":o("indent-right-change",t);break}}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",z)}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"rulerRef",ref:a,class:"docx-horizontal-ruler",style:(0,n.normalizeStyle)(_.value),role:"slider","aria-label":"Horizontal ruler","aria-valuemin":0,"aria-valuemax":h.value},[(0,n.createElementVNode)("div",{class:"docx-horizontal-ruler__margin",style:(0,n.normalizeStyle)(M.value),onMousedown:r[0]||=(0,n.withModifiers)(t=>e.editable?O("leftMargin",t):null,["prevent","stop"])},null,36),(0,n.createElementVNode)("div",{class:"docx-horizontal-ruler__margin",style:(0,n.normalizeStyle)(N.value),onMousedown:r[1]||=(0,n.withModifiers)(t=>e.editable?O("rightMargin",t):null,["prevent","stop"])},null,36),(0,n.createElementVNode)("div",Dw,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(I.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[(0,n.createElementVNode)("div",{class:"docx-horizontal-ruler__tick-line",style:(0,n.normalizeStyle)({left:e.position+"px",height:e.height+"px"})},null,4),e.label?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-horizontal-ruler__tick-label",style:(0,n.normalizeStyle)({left:e.position+"px"})},(0,n.toDisplayString)(e.label),5)):(0,n.createCommentVNode)("",!0)],64))),128))]),e.showFirstLineIndent?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-ruler-indent",style:(0,n.normalizeStyle)(D("down",E.value,"firstLineIndent"===l.value)),onMousedown:r[2]||=(0,n.withModifiers)(t=>e.editable?O("firstLineIndent",t):null,["prevent","stop"]),onMouseenter:r[3]||=e=>s.value="firstLineIndent",onMouseleave:r[4]||=e=>s.value=null},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(F("down",B("firstLineIndent")))},null,4)],36)):(0,n.createCommentVNode)("",!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"docx-ruler-indent",style:(0,n.normalizeStyle)(D("up",C.value,"leftIndent"===l.value)),onMousedown:r[5]||=(0,n.withModifiers)(e=>O("leftIndent",e),["prevent","stop"]),onMouseenter:r[6]||=e=>s.value="leftIndent",onMouseleave:r[7]||=e=>s.value=null},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(F("up",B("leftIndent")))},null,4)],36)):(0,n.createCommentVNode)("",!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:"docx-ruler-indent",style:(0,n.normalizeStyle)(D("down",T.value,"rightIndent"===l.value)),onMousedown:r[8]||=(0,n.withModifiers)(e=>O("rightIndent",e),["prevent","stop"]),onMouseenter:r[9]||=e=>s.value="rightIndent",onMouseleave:r[10]||=e=>s.value=null},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(F("down",B("rightIndent")))},null,4)],36)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(R.value,(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:r,class:"docx-horizontal-ruler__tab",style:(0,n.normalizeStyle)({left:e.px+"px"}),title:`${e.label}`,onDblclick:(0,n.withModifiers)(n=>t.$emit("tab-stop-remove",e.twips),["prevent"])},"L",44,Fw))),128)),l.value&&d.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:3,class:"docx-horizontal-ruler__tooltip",style:(0,n.normalizeStyle)({left:c.value+"px"})},(0,n.toDisplayString)(d.value),5)):(0,n.createCommentVNode)("",!0)],12,Bw))}}),[["__scopeId","data-v-a27ea349"]]),Zw={class:"docx-vertical-ruler__ticks"},Uw=15840,Kw=1440,Gw=1440,Xw=567,Yw=20,Jw=Us((0,n.defineComponent)({__name:"VerticalRuler",props:{sectionProps:{},zoom:{default:1},editable:{type:Boolean,default:!0},unit:{default:"inch"}},emits:["top-margin-change","bottom-margin-change"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(null),a=(0,n.ref)(null),l=(0,n.ref)(null);function s(e){return Gs(e)*r.zoom}function c(e){return Math.round(Xs(e/r.zoom))}let d=(0,n.computed)(()=>r.sectionProps?.pageHeight??Uw),u=(0,n.computed)(()=>r.sectionProps?.marginTop??Kw),p=(0,n.computed)(()=>r.sectionProps?.marginBottom??Kw),h=(0,n.computed)(()=>s(d.value)),f=(0,n.computed)(()=>s(u.value)),m=(0,n.computed)(()=>s(p.value)),g=(0,n.computed)(()=>({position:"relative",width:Yw+"px",height:h.value+"px",backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:a.value?"ns-resize":"default"})),v=(0,n.computed)(()=>{let e=[];if("inch"===r.unit){let t=Gw/8,n=Math.ceil(d.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>d.value)break;let o=s(n);r%8==0?e.push({position:o,width:10,label:r/8>0?String(r/8):void 0}):r%4==0?e.push({position:o,width:6}):r%2==0?e.push({position:o,width:4}):e.push({position:o,width:2})}}else{let t=Xw/10,n=Math.ceil(d.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>d.value)break;let o=s(n);r%10==0?e.push({position:o,width:10,label:r/10>0?String(r/10):void 0}):r%5==0?e.push({position:o,width:6}):e.push({position:o,width:3})}}return e});function y(e){return{position:"absolute",top:e-5+"px",right:0,width:Yw+"px",height:"10px",cursor:r.editable?"ns-resize":"default",zIndex:null===a.value?1:10}}function b(e){let t=a.value===e;return l.value,{position:"absolute",top:"0px",right:"2px",width:"0",height:"0",borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:"8px solid "+(t?"var(--doc-primary-hover, #1557b0)":"var(--doc-primary, #1a73e8)"),transition:"border-right-color 0.1s"}}let w=0,k=0;function x(e,t){r.editable&&(a.value=e,w=t.clientY,k="topMargin"===e?u.value:p.value,document.addEventListener("mousemove",S),document.addEventListener("mouseup",C))}function S(e){if(!a.value)return;let t=e.clientY-w,n=c("topMargin"===a.value?t:-t),r=d.value-("topMargin"===a.value?p.value:u.value)-720,i=Math.round(Math.max(0,Math.min(k+n,r)));"topMargin"===a.value?o("top-margin-change",i):o("bottom-margin-change",i)}function C(){a.value=null,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C)}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C)}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"rulerRef",ref:i,class:"docx-vertical-ruler",style:(0,n.normalizeStyle)(g.value),role:"slider","aria-label":"Vertical ruler","aria-orientation":"vertical"},[(0,n.createElementVNode)("div",Zw,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(v.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[(0,n.createElementVNode)("div",{class:"docx-vertical-ruler__tick-line",style:(0,n.normalizeStyle)({top:e.position+"px",width:e.width+"px"})},null,4),e.label?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-vertical-ruler__tick-label",style:(0,n.normalizeStyle)({top:e.position+"px"})},(0,n.toDisplayString)(e.label),5)):(0,n.createCommentVNode)("",!0)],64))),128))]),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-vertical-ruler__marker",style:(0,n.normalizeStyle)(y(f.value)),onMousedown:r[0]||=(0,n.withModifiers)(e=>x("topMargin",e),["prevent"]),onMouseenter:r[1]||=e=>l.value="topMargin",onMouseleave:r[2]||=e=>l.value=null},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(b("topMargin"))},null,4)],36)):(0,n.createCommentVNode)("",!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"docx-vertical-ruler__marker",style:(0,n.normalizeStyle)(y(h.value-m.value)),onMousedown:r[3]||=(0,n.withModifiers)(e=>x("bottomMargin",e),["prevent"]),onMouseenter:r[4]||=e=>l.value="bottomMargin",onMouseleave:r[5]||=e=>l.value=null},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(b("bottomMargin"))},null,4)],36)):(0,n.createCommentVNode)("",!0)],4))}}),[["__scopeId","data-v-6e1bbe22"]]),Qw={class:"doc-name"},ek=["value"],tk={key:1,class:"doc-name__text"},nk=Us((0,n.defineComponent)({__name:"DocumentName",props:{modelValue:{},editable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.computed)(()=>(r.modelValue||"").replace(/\.docx$/i,""));function a(e){let t=e.target.value;o("update:modelValue",t.endsWith(".docx")?t:t+".docx")}function l(e){e.target.value.trim()||o("update:modelValue","Untitled document.docx")}return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Qw,[e.editable?((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:0,class:"doc-name__input",value:i.value,onInput:a,onBlur:l,placeholder:"Untitled document"},null,40,ek)):((0,n.openBlock)(),(0,n.createElementBlock)("span",tk,(0,n.toDisplayString)(i.value||"Untitled document"),1))]))}}),[["__scopeId","data-v-d78ee2fa"]]),rk=["disabled","onClick"],ok={key:0,class:"docx-menu-dropdown__separator"},ik=["onMouseenter","onMouseleave"],ak=["disabled","onClick"],lk={class:"docx-menu-dropdown__label"},sk={key:1,class:"docx-menu-dropdown__shortcut"},ck={key:2,class:"docx-menu-dropdown__chevron"},dk={key:0,class:"docx-menu-dropdown__submenu"},uk=Us((0,n.defineComponent)({__name:"MenuDropdown",props:{label:{},items:{},disabled:{type:Boolean},showChevron:{type:Boolean,default:!1}},setup(e){function t(e){return"type"in e&&"separator"===e.type}let r=(0,n.ref)(!1),o=(0,n.ref)(null);function i(){r.value=!1,o.value=null}function a(e){e.disabled||e.submenu||(e.onClick?.(),i())}return(l,s)=>((0,n.openBlock)(),(0,n.createBlock)(by,{open:r.value,"onUpdate:open":s[2]||=e=>r.value=e,onClose:i},{trigger:(0,n.withCtx)(({toggle:t})=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-menu-dropdown__trigger",{"docx-menu-dropdown__trigger--open":r.value}]),disabled:e.disabled,onMousedown:s[0]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:(0,n.withModifiers)(t,["prevent"])},[(0,n.createTextVNode)((0,n.toDisplayString)(e.label)+" ",1),e.showChevron?((0,n.openBlock)(),(0,n.createBlock)(cc,{key:0,name:"arrow_drop_down",size:16})):(0,n.createCommentVNode)("",!0)],42,rk)]),panel:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"docx-menu-dropdown__menu",onMousedown:s[1]||=(0,n.withModifiers)(()=>{},["prevent"])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.items,(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:r},[t(e)?((0,n.openBlock)(),(0,n.createElementBlock)("div",ok)):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"docx-menu-dropdown__wrap",onMouseenter:t=>e.submenu?o.value=r:void 0,onMouseleave:t=>e.submenu?o.value=null:void 0},[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["docx-menu-dropdown__item",{"docx-menu-dropdown__item--disabled":e.disabled}]),disabled:e.disabled,onClick:(0,n.withModifiers)(t=>a(e),["prevent"])},[e.icon?((0,n.openBlock)(),(0,n.createBlock)(cc,{key:0,name:e.icon,size:18},null,8,["name"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("span",lk,(0,n.toDisplayString)(e.label),1),e.shortcut?((0,n.openBlock)(),(0,n.createElementBlock)("span",sk,(0,n.toDisplayString)(e.shortcut),1)):(0,n.createCommentVNode)("",!0),e.submenu?((0,n.openBlock)(),(0,n.createElementBlock)("span",ck,[(0,n.createVNode)(cc,{name:"keyboard_arrow_right",size:16})])):(0,n.createCommentVNode)("",!0)],10,ak),e.submenu&&o.value===r?((0,n.openBlock)(),(0,n.createElementBlock)("div",dk,[(0,n.renderSlot)(l.$slots,"submenu",{item:e,closeMenu:i},void 0,!0)])):(0,n.createCommentVNode)("",!0)],40,ik))],64))),128))],32)]),_:3},8,["open"]))}}),[["__scopeId","data-v-65cffcb2"]]),pk=["aria-selected","onMouseenter"],hk={class:"docx-table-grid-inline__label"},fk=Us((0,n.defineComponent)({__name:"TableGridInline",props:{gridRows:{default:6},gridColumns:{default:6}},emits:["insert"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(0),a=(0,n.ref)(0),l=(0,n.computed)(()=>{let e=[];for(let t=1;t<=r.gridRows;t++)for(let n=1;n<=r.gridColumns;n++)e.push({r:t,c:n});return e});function s(){i.value>0&&a.value>0&&o("insert",i.value,a.value)}return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createElementVNode)("div",{class:"docx-table-grid-inline__grid",style:(0,n.normalizeStyle)({gridTemplateColumns:`repeat(${e.gridColumns}, 18px)`}),role:"grid","aria-label":"Table size selector",onMouseleave:r[0]||=e=>{i.value=0,a.value=0}},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:`${e.r}-${e.c}`,class:(0,n.normalizeClass)(["docx-table-grid-inline__cell",{"docx-table-grid-inline__cell--active":e.r<=i.value&&e.c<=a.value}]),role:"gridcell","aria-selected":e.r<=i.value&&e.c<=a.value,onMouseenter:t=>{i.value=e.r,a.value=e.c},onClick:(0,n.withModifiers)(s,["prevent"])},null,42,pk))),128))],36),(0,n.createElementVNode)("div",hk,(0,n.toDisplayString)(i.value>0&&a.value>0?`${a.value} × ${i.value}`:"Select size"),1)]))}}),[["__scopeId","data-v-ecd8fc63"]]),mk={class:"menu-bar",role:"menubar"},gk=Us((0,n.defineComponent)({__name:"MenuBar",emits:["action","insert-table"],setup(e,{emit:t}){let r=t,{t:o}=xc();function i(e){return()=>r("action",e)}let a=(0,n.computed)(()=>[{icon:"file_upload",label:o("toolbar.open"),shortcut:o("toolbar.openShortcut"),onClick:i("open")},{icon:"file_download",label:o("toolbar.save"),shortcut:o("toolbar.saveShortcut"),onClick:i("save")},{type:"separator"},{icon:"settings",label:o("toolbar.pageSetup"),onClick:i("pageSetup")}]),l=(0,n.computed)(()=>[{icon:"format_textdirection_l_to_r",label:o("toolbar.leftToRight"),onClick:i("dirLTR")},{icon:"format_textdirection_r_to_l",label:o("toolbar.rightToLeft"),onClick:i("dirRTL")}]),s=(0,n.computed)(()=>[{icon:"image",label:o("toolbar.image"),onClick:i("insertImage")},{icon:"grid_on",label:o("toolbar.table"),key:"table",submenu:!0},{type:"separator"},{icon:"page_break",label:o("toolbar.pageBreak"),onClick:i("insertPageBreak")},{icon:"format_list_numbered",label:o("toolbar.tableOfContents"),onClick:i("insertTOC")}]),c=(0,n.computed)(()=>[{label:o("toolbar.reportIssue"),onClick:i("reportIssue")}]);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",mk,[(0,n.createVNode)(uk,{label:(0,n.unref)(o)("toolbar.file"),items:a.value},null,8,["label","items"]),(0,n.createVNode)(uk,{label:(0,n.unref)(o)("toolbar.format"),items:l.value},null,8,["label","items"]),(0,n.createVNode)(uk,{label:(0,n.unref)(o)("toolbar.insert"),items:s.value},{submenu:(0,n.withCtx)(({item:e,closeMenu:t})=>["table"===e.key?((0,n.openBlock)(),(0,n.createBlock)(fk,{key:0,onInsert:(e,n)=>{r("insert-table",e,n),t()}},null,8,["onInsert"])):(0,n.createCommentVNode)("",!0)]),_:1},8,["label","items"]),(0,n.createVNode)(uk,{label:(0,n.unref)(o)("toolbar.help"),items:c.value},null,8,["label","items"])]))}}),[["__scopeId","data-v-31c47d54"]]),vk=class{constructor(e,t=1){Nm(this,"pagesContainer"),Nm(this,"zoom"),this.pagesContainer=e,this.zoom=t}getCoordinatesForPosition(e){let t=this.pagesContainer.getBoundingClientRect(),n=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let o of Array.from(n)){let n=o,r=Number(n.dataset.pmStart),i=Number(n.dataset.pmEnd);if(n.classList.contains("layout-run-tab")){if(e>=r&&e<i){let e=n.getBoundingClientRect(),r=n.closest(".layout-line"),o=r?r.offsetHeight:16;return{x:(e.left-t.left)/this.zoom,y:(e.top-t.top)/this.zoom,height:o/this.zoom}}}else if(e>=r&&e<=i&&o.firstChild?.nodeType===Node.TEXT_NODE){let i=o.firstChild,a=Math.min(e-r,i.length),l=n.ownerDocument;if(!l)continue;let s=l.createRange();s.setStart(i,a),s.setEnd(i,a);let c=s.getBoundingClientRect(),d=n.closest(".layout-line"),u=d?d.offsetHeight:16;return{x:(c.left-t.left)/this.zoom,y:(c.top-t.top)/this.zoom,height:u/this.zoom}}}let r=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let o of Array.from(r)){let n=o.closest(".layout-paragraph");if(!n)continue;let r=Number(n.dataset.pmStart),i=Number(n.dataset.pmEnd);if(e>=r&&e<=i){let e=o.getBoundingClientRect(),n=o.closest(".layout-line"),r=n?n.offsetHeight:16;return{x:(e.left-t.left)/this.zoom,y:(e.top-t.top)/this.zoom,height:r/this.zoom}}}return null}findElementsForRange(e,t){let n=[],r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let o of Array.from(r)){let r=o,i=Number(r.dataset.pmStart);Number(r.dataset.pmEnd)>e&&i<t&&n.push(r)}return n}getRectsForRange(e,t){let n=this.pagesContainer.getBoundingClientRect(),r=[],o=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(o)){let o=i,a=Number(o.dataset.pmStart);if(Number(o.dataset.pmEnd)>e&&a<t){if(o.classList.contains("layout-run-tab")){let e=o.getBoundingClientRect();r.push({x:(e.left-n.left)/this.zoom,y:(e.top-n.top)/this.zoom,width:e.width/this.zoom,height:e.height/this.zoom});continue}if(i.firstChild?.nodeType!==Node.TEXT_NODE)continue;let l=i.firstChild,s=o.ownerDocument;if(!s)continue;let c=Math.max(0,e-a),d=Math.min(l.length,t-a);if(c<d){let e=s.createRange();e.setStart(l,c),e.setEnd(l,d);let t=e.getClientRects();for(let o of Array.from(t))r.push({x:(o.left-n.left)/this.zoom,y:(o.top-n.top)/this.zoom,width:o.width/this.zoom,height:o.height/this.zoom})}}}return r}getContainerOffset(){let e=this.pagesContainer.parentElement;if(!e)return{x:0,y:0};let t=this.pagesContainer.getBoundingClientRect(),n=e.getBoundingClientRect();return{x:(t.left-n.left)/this.zoom,y:(t.top-n.top)/this.zoom}}};function yk(e,t=1){return new vk(e,t)}var bk={selectionOverlay:10,decorationLayer:11,imageOverlay:15,hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4},wk=(x(9577),x(6632),x(4226),x(9486),x(456),new Hv(jv()));wk.buildSchema(),wk.initializeRuntime();var kk=wk,xk=wk.getSchema(),Sk=["square","tight","through"],Ck=["behind","inFront"],Tk=[...Sk,...Ck];function Ek(e){return!!e&&Tk.includes(e)}function _k(e){return"behind"===e||"inFront"===e}function Mk(e){return!!e&&Sk.includes(e)}function Nk(e){return!!e.wrap&&"inline"!==e.wrap.type}function Ik(e){let t=e.wrap?.type??"inline",n=e.wrap?.wrapText,r=e.position?.horizontal?.alignment;return{displayMode:Dk(t),cssFloat:Pk(t,n,r),wrapType:t,wrapText:n,anchorTarget:Nk(e)?"followingBlock":void 0,position:e.position?Ok(e.position):void 0,distTop:null!=e.wrap?.distT?Ys(e.wrap.distT):void 0,distBottom:null!=e.wrap?.distB?Ys(e.wrap.distB):void 0,distLeft:null!=e.wrap?.distL?Ys(e.wrap.distL):void 0,distRight:null!=e.wrap?.distR?Ys(e.wrap.distR):void 0}}function Rk(e){return"followingBlock"===e.anchorTarget||Fk(e)}function Ak(e){let t=e.position;if(t?.horizontal||t?.vertical)return{horizontal:{relativeTo:t.horizontal?.relativeTo??"margin",alignment:t.horizontal?.align,posOffset:t.horizontal?.posOffset},vertical:{relativeTo:t.vertical?.relativeTo??"paragraph",alignment:t.vertical?.align,posOffset:t.vertical?.posOffset}}}function Bk(e){let t=e.wrapType??("float"===e.displayMode?"square":"inline");if(!t||"inline"===t)return;let n={type:t};return e.wrapText&&(n.wrapText=e.wrapText),null!=e.distTop&&(n.distT=Js(e.distTop)),null!=e.distBottom&&(n.distB=Js(e.distBottom)),null!=e.distLeft&&(n.distL=Js(e.distLeft)),null!=e.distRight&&(n.distR=Js(e.distRight)),n}function Dk(e){return"inline"===e?"inline":"topAndBottom"===e?"block":"float"}function Fk(e){return"float"===e.displayMode||Ek(e.wrapType)}function Pk(e,t,n){return"inline"===e||"topAndBottom"===e?"none":"left"===t?"right":"right"===t||"left"===n?"left":"right"===n?"right":"none"}function Ok(e){return{horizontal:e.horizontal?{relativeTo:e.horizontal.relativeTo,posOffset:e.horizontal.posOffset,align:e.horizontal.alignment}:void 0,vertical:e.vertical?{relativeTo:e.vertical.relativeTo,posOffset:e.vertical.posOffset,align:e.vertical.alignment}:void 0}}function Lk(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return{...t};let n={...e};for(let r of Object.keys(t)){let o=t[r];if(void 0!==o){if("fontFamily"===r&&"object"==typeof o&&null!==o){n.fontFamily=Tm(e.fontFamily,o);continue}if("color"===r&&"object"==typeof o&&null!==o){let e=o,t=!!(e.rgb||e.themeColor||e.themeTint||e.themeShade);(!e.auto||t)&&(n.color=e);continue}if("object"==typeof o&&null!==o&&!Array.isArray(o)){n[r]={...e[r]??{},...o};continue}n[r]=o}}return n}var zk={styleId:"Normal",type:"paragraph",name:"Normal",default:!0,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},Vk=class{constructor(e){if(Nm(this,"stylesById"),Nm(this,"docDefaults"),Nm(this,"defaultParagraphStyle"),Nm(this,"defaultTableStyle"),Nm(this,"defaultCharacterStyle"),this.stylesById=new Map,this.docDefaults=e?.docDefaults,e?.styles)for(let t of e.styles)t.styleId&&this.stylesById.set(t.styleId,t);this.defaultParagraphStyle=this.findDefaultStyle("paragraph"),this.defaultTableStyle=this.findDefaultStyle("table"),this.defaultCharacterStyle=this.findDefaultStyle("character")}getStyle(e){return this.stylesById.get(e)}getParagraphStyles(){let e=[];for(let t of this.stylesById.values())"paragraph"===t.type&&!t.hidden&&!t.semiHidden&&e.push(t);return e.sort((e,t)=>{let n=e.uiPriority??99,r=t.uiPriority??99;return n!==r?n-r:(e.name??e.styleId).localeCompare(t.name??t.styleId)})}hasParagraphStyle(e){return"paragraph"===this.stylesById.get(e)?.type}resolveParagraphStyle(e){let t={};if(this.docDefaults?.pPr&&(t.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(t.runFormatting={...this.docDefaults.rPr}),!e)return this.defaultParagraphStyle&&this.mergeStyleIntoResult(t,this.defaultParagraphStyle),t;let n=this.stylesById.get(e);return n?(this.mergeStyleIntoResult(t,n),t):(this.defaultParagraphStyle&&this.mergeStyleIntoResult(t,this.defaultParagraphStyle),t)}getTableStyles(){let e=[];for(let t of this.stylesById.values())"table"===t.type&&!t.hidden&&!t.semiHidden&&e.push(t);return e.sort((e,t)=>{let n=e.uiPriority??99,r=t.uiPriority??99;return n!==r?n-r:(e.name??e.styleId).localeCompare(t.name??t.styleId)})}resolveRunStyle(e){let t={};if(this.docDefaults?.rPr&&(t={...this.docDefaults.rPr}),this.defaultCharacterStyle?.rPr&&(t=this.mergeTextFormatting(t,this.defaultCharacterStyle.rPr)??t),!e)return Object.keys(t).length>0?t:void 0;let n=this.stylesById.get(e);if(!n?.rPr)return Object.keys(t).length>0?t:void 0;let r=this.mergeTextFormatting(t,n.rPr);return r&&Object.keys(r).length>0?r:void 0}getRunStyleOwnProperties(e){if(!e)return;let t=this.stylesById.get(e);return t?.rPr&&Object.keys(t.rPr).length>0?{...t.rPr}:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}getDefaultTableStyle(){return this.defaultTableStyle}getDefaultCharacterStyle(){return this.defaultCharacterStyle}hasStyle(e){return this.stylesById.has(e)}findDefaultStyle(e){for(let t of this.stylesById.values())if(t.type===e&&t.default)return t;if("paragraph"===e)return this.stylesById.get("Normal")??zk}mergeStyleIntoResult(e,t){t.pPr&&(e.paragraphFormatting=this.mergeParagraphFormatting(e.paragraphFormatting,t.pPr)),t.rPr&&(e.runFormatting=this.mergeTextFormatting(e.runFormatting,t.rPr))}mergeParagraphFormatting(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let r of Object.keys(t)){let e=t[r];if(void 0!==e)if("runProperties"===r)n.runProperties=this.mergeTextFormatting(n.runProperties,t.runProperties);else if("borders"===r||"numPr"===r||"frame"===r){let t=n[r],o=e;n[r]={...t||{},...o||{}}}else"tabs"===r&&Array.isArray(e)?n.tabs=[...e]:n[r]=e}return n}mergeTextFormatting(e,t){return Lk(e,t)}};function $k(e){return new Vk(e)}function jk(e){if(!e)return[];let t=[];return e.bold&&t.push(xk.mark("bold")),e.italic&&t.push(xk.mark("italic")),e.underline&&"none"!==e.underline.style&&t.push(xk.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(xk.mark("strike",{double:e.doubleStrike||!1})),e.color&&!e.color.auto&&t.push(xk.mark("textColor",{rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&"none"!==e.highlight&&t.push(xk.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(xk.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(xk.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,eastAsia:e.fontFamily.eastAsia,cs:e.fontFamily.cs,asciiTheme:e.fontFamily.asciiTheme,hAnsiTheme:e.fontFamily.hAnsiTheme,eastAsiaTheme:e.fontFamily.eastAsiaTheme,csTheme:e.fontFamily.csTheme})),"superscript"===e.vertAlign?t.push(xk.mark("superscript")):"subscript"===e.vertAlign&&t.push(xk.mark("subscript")),e.allCaps&&t.push(xk.mark("allCaps")),e.smallCaps&&t.push(xk.mark("smallCaps")),(null!=e.spacing||null!=e.position||null!=e.scale||null!=e.kerning)&&t.push(xk.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(xk.mark("emboss")),e.imprint&&t.push(xk.mark("imprint")),e.shadow&&t.push(xk.mark("textShadow")),e.emphasisMark&&"none"!==e.emphasisMark&&t.push(xk.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(xk.mark("textOutline")),e.hidden&&t.push(xk.mark("hidden")),e.rtl&&t.push(xk.mark("rtl")),e.effect&&"none"!==e.effect&&t.push(xk.mark("textEffect",{effect:e.effect})),t}function Hk(e,t){if(!e)return;if(!t)return e;let n=t.resolveRunStyle(e.styleId);return n?Lk(n,e):e}function Wk(e,t){let n,r="",o="simpleField"===e.type?e.content:e.fieldResult;if(o)for(let l of o)if("run"===l.type){for(let e of l.content)"text"===e.type&&(r+=e.text);!n&&l.formatting&&(n=l.formatting)}let i=Lk(t,n),a=jk(i);return xk.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:r,fieldKind:"simpleField"===e.type?"simple":"complex",fldLock:e.fldLock??!1,dirty:e.dirty??!1},void 0,a)}function qk(e){return xk.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function Zk(e,t,n){let r=[],o=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=Lk(Lk(t,o),e.formatting),a=jk(i);for(let l of e.content){let e=Uk(l,a);r.push(...e)}return r}function Uk(e,t){switch(e.type){case"text":return e.text?[xk.text(e.text,t)]:[];case"break":return"textWrapping"!==e.breakType&&e.breakType?[]:[xk.node("hardBreak",null,void 0,t)];case"tab":return[xk.node("tab",null,void 0,t)];case"drawing":return e.image?[Kk(e.image)]:[];case"shape":{let t=e.shape;return t.textBody&&t.textBody.content.length>0?[]:[Xk(t)]}case"footnoteRef":let n=xk.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return[xk.text(e.id.toString(),[...t,n])];case"endnoteRef":let r=xk.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return[xk.text(e.id.toString(),[...t,r])];default:return[]}}function Kk(e){let t,n=e.size?.width?Ys(e.size.width):void 0,r=e.size?.height?Ys(e.size.height):void 0,o=e.wrap.type,i=e.wrap.wrapText,a=e.position?.horizontal?.alignment;t="inline"===o||"topAndBottom"===o?"none":"square"===o||"tight"===o||"through"===o?"left"===i?"right":"right"===i||"left"===a?"left":"right"===a?"right":"none":"none";let l,s="inline";if(s="inline"===o?"inline":"topAndBottom"===o?"block":_k(o)||t&&"none"!==t?"float":"block",e.transform){let t=[];e.transform.rotation&&t.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&t.push("scaleX(-1)"),e.transform.flipV&&t.push("scaleY(-1)"),t.length>0&&(l=t.join(" "))}let c,d,u,p,h=e.wrap.distT?Ys(e.wrap.distT):void 0,f=e.wrap.distB?Ys(e.wrap.distB):void 0,m=e.wrap.distL?Ys(e.wrap.distL):void 0,g=e.wrap.distR?Ys(e.wrap.distR):void 0;if(e.position&&(c={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0}),e.outline&&e.outline.width){d=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`);let t={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};p=e.outline.style&&t[e.outline.style]||"solid"}let v=e.padding?.top?Ys(e.padding.top):void 0,y=e.padding?.bottom?Ys(e.padding.bottom):void 0,b=e.padding?.left?Ys(e.padding.left):void 0,w=e.padding?.right?Ys(e.padding.right):void 0;return xk.node("image",{src:e.src||"",alt:e.alt,title:e.title,width:n,height:r,rId:e.rId,wrapType:o,displayMode:s,cssFloat:t,transform:l,distTop:h,distBottom:f,distLeft:m,distRight:g,position:c,borderWidth:d,borderColor:u,borderStyle:p,wrapText:i,hlinkHref:e.hlinkHref,cropTop:e.crop?.top,cropRight:e.crop?.right,cropBottom:e.crop?.bottom,cropLeft:e.crop?.left,opacity:e.opacity,effectExtentTop:v,effectExtentBottom:y,effectExtentLeft:b,effectExtentRight:w,layoutInCell:e.layoutInCell,allowOverlap:e.allowOverlap})}function Gk(e,t,n){let r=[],o=e.href||(e.anchor?`#${e.anchor}`:""),i=xk.mark("hyperlink",{href:o,tooltip:e.tooltip,rId:e.rId});for(let a of e.children)if("run"===a.type){let e=a.formatting?.styleId?n?.getRunStyleOwnProperties(a.formatting.styleId):void 0,o=Lk(Lk(t,e),a.formatting),l=[...jk(o),i];for(let t of a.content)r.push(...Uk(t,l))}return r}function Xk(e){let t,n,r,o,i,a,l,s,c=e.size?.width?Ys(e.size.width):100,d=e.size?.height?Ys(e.size.height):80,u="solid";if(e.fill&&(u=e.fill.type,e.fill.color?.rgb&&(t=`#${e.fill.color.rgb}`),"gradient"===e.fill.type&&e.fill.gradient)){let t=e.fill.gradient;n=t.type,r=t.angle,o=JSON.stringify(t.stops.map(e=>({position:e.position,color:e.color.rgb?`#${e.color.rgb}`:"#000000"})))}if(e.outline&&(e.outline.width&&(i=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(a=`#${e.outline.color.rgb}`),l=e.outline.style||"solid"),e.transform){let t=[];e.transform.rotation&&t.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&t.push("scaleX(-1)"),e.transform.flipV&&t.push("scaleY(-1)"),t.length>0&&(s=t.join(" "))}return xk.node("shape",{shapeType:e.shapeType||"rect",shapeId:e.id,width:c,height:d,fillColor:t,fillType:u,gradientType:n,gradientAngle:r,gradientStops:o,outlineWidth:i,outlineColor:a,outlineStyle:l,transform:s})}function Yk(e,t,n,r){let o,i,a=ex(e,t),l=[],s=new Set;t&&(i=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let c=Lk(i,r);for(let d of e.content){if("commentRangeStart"===d.type)s.add(d.id);else if("commentRangeEnd"===d.type)s.delete(d.id);else if("run"===d.type){let e=Zk(d,c,t);s.size>0&&(e=Jk(e,s)),l.push(...e)}else if("hyperlink"===d.type){let e=Gk(d,c,t);l.push(...e)}else if("simpleField"===d.type||"complexField"===d.type){let e=Wk(d,c);e&&l.push(e)}else if("inlineSdt"===d.type){let e=tx(d,c,t);e&&l.push(e)}else if("insertion"===d.type){let e=Qk(d,"insertion",c,t);s.size>0&&(e=Jk(e,s)),l.push(...e)}else if("deletion"===d.type){let e=Qk(d,"deletion",c,t);s.size>0&&(e=Jk(e,s)),l.push(...e)}else if("moveFrom"===d.type){let e=Qk(d,"deletion",c,t);s.size>0&&(e=Jk(e,s)),l.push(...e)}else if("moveTo"===d.type){let e=Qk(d,"insertion",c,t);s.size>0&&(e=Jk(e,s)),l.push(...e)}else if("mathEquation"===d.type){let e=qk(d);e&&l.push(e)}"bookmarkStart"===d.type&&(o||(o=[]),o.push({id:d.id,name:d.name}))}return o&&(a.bookmarks=o),xk.node("paragraph",a,l)}function Jk(e,t){if(0===t.size)return e;let n=[...t][0],r=xk.marks.comment.create({commentId:n});return e.map(e=>e.isText?e.mark(r.addToSet(e.marks)):e)}function Qk(e,t,n,r){let o=[];for(let a of e.content)"run"===a.type?o.push(...Zk(a,n,r)):"hyperlink"===a.type&&o.push(...Gk(a,n,r));let i=xk.marks[t].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null});return o.map(e=>e.isText?e.mark(i.addToSet(e.marks)):e)}function ex(e,t){let n=e.formatting,r=n?.styleId,o={paraId:e.paraId??void 0,textId:e.textId??void 0,styleId:r,numPr:n?.numPr,listNumFmt:e.listRendering?.numFmt,listIsBullet:e.listRendering?.isBullet,listMarker:e.listRendering?.marker,listMarkerHidden:e.listRendering?.markerHidden||void 0,listMarkerFontFamily:e.listRendering?.markerFontFamily||void 0,listMarkerFontSize:e.listRendering?.markerFontSize||void 0,listLevelNumFmts:e.listRendering?.levelNumFmts||void 0,listAbstractNumId:e.listRendering?.abstractNumId,listStartOverride:e.listRendering?.startOverride,_originalFormatting:n||void 0};if(t){let e=t.resolveParagraphStyle(r),i=e.paragraphFormatting,a=e.runFormatting;o.alignment=n?.alignment??i?.alignment,o.spaceBefore=n?.spaceBefore??i?.spaceBefore,o.spaceAfter=n?.spaceAfter??i?.spaceAfter,o.lineSpacing=n?.lineSpacing??i?.lineSpacing,o.lineSpacingRule=n?.lineSpacingRule??i?.lineSpacingRule,n?.spacingExplicit&&(o.spacingExplicit=n.spacingExplicit),o.indentLeft=n?.indentLeft??i?.indentLeft,o.indentRight=n?.indentRight??i?.indentRight,o.indentFirstLine=n?.indentFirstLine??i?.indentFirstLine,o.hangingIndent=n?.hangingIndent??i?.hangingIndent,o.borders=n?.borders??i?.borders,o.shading=n?.shading??i?.shading,o.tabs=n?.tabs??i?.tabs,o.pageBreakBefore=n?.pageBreakBefore??i?.pageBreakBefore,o.keepNext=n?.keepNext??i?.keepNext,o.keepLines=n?.keepLines??i?.keepLines,o.contextualSpacing=n?.contextualSpacing??i?.contextualSpacing,o.outlineLevel=n?.outlineLevel??i?.outlineLevel,o.bidi=n?.bidi??i?.bidi;let l=t.getDefaultCharacterStyle()?.rPr,s=l?Lk(a,l):a,c=Hk(n?.runProperties,t);o.defaultTextFormatting=Lk(s,c),!n?.numPr&&i?.numPr&&0!==i.numPr.numId&&(o.numPr=i.numPr)}else o.alignment=n?.alignment,o.spaceBefore=n?.spaceBefore,o.spaceAfter=n?.spaceAfter,o.lineSpacing=n?.lineSpacing,o.lineSpacingRule=n?.lineSpacingRule,n?.spacingExplicit&&(o.spacingExplicit=n.spacingExplicit),o.indentLeft=n?.indentLeft,o.indentRight=n?.indentRight,o.indentFirstLine=n?.indentFirstLine,o.hangingIndent=n?.hangingIndent,o.borders=n?.borders,o.shading=n?.shading,o.tabs=n?.tabs,o.pageBreakBefore=n?.pageBreakBefore,o.keepNext=n?.keepNext,o.keepLines=n?.keepLines,o.outlineLevel=n?.outlineLevel,o.bidi=n?.bidi,o.defaultTextFormatting=Hk(n?.runProperties,t);if(e.sectionProperties){o._sectionProperties=e.sectionProperties;let t=e.sectionProperties.sectionStart;("nextPage"===t||"continuous"===t||"oddPage"===t||"evenPage"===t)&&(o.sectionBreakType=t)}return e.renderedPageBreakBefore&&(o.renderedPageBreakBefore=!0),o}function tx(e,t,n){let r=e.properties,o=[];for(let i of e.content)if("run"===i.type){let e=Zk(i,t,n);o.push(...e)}else if("hyperlink"===i.type){let e=Gk(i,t,n);o.push(...e)}else if("simpleField"===i.type||"complexField"===i.type){let e=Wk(i,t);e&&o.push(e)}else if("inlineSdt"===i.type){let e=tx(i,t,n);e&&o.push(e)}else if("mathEquation"===i.type){let e=qk(i);e&&o.push(e)}return xk.node("sdt",{sdtType:r.sdtType,alias:r.alias??null,tag:r.tag??null,lock:r.lock??null,placeholder:r.placeholder??null,showingPlaceholder:r.showingPlaceholder??!1,dateFormat:r.dateFormat??null,listItems:r.listItems?JSON.stringify(r.listItems):null,checked:r.checked??null},o.length>0?o:void 0)}function nx(e){function t(e){return"break"===e.type&&"page"===e.breakType}function n(e){if("run"===e.type){for(let n of e.content)if(t(n))return!0;return!1}if("hyperlink"===e.type){for(let t of e.children)if("run"===t.type&&n(t))return!0;return!1}if("insertion"===e.type||"deletion"===e.type){let t=e;for(let e of t.content)if(n(e))return!0;return!1}return!1}for(let r of e.content)if(n(r))return!0;return!1}function rx(e,t,n){if(!e||!t)return;let r=e.getStyle(t);if(!r?.tblStylePr)return;let o=r.tblStylePr.find(e=>e.type===n);if(!o)return;let i=Hk(o.pPr?.runProperties,e),a=Hk(o.rPr,e),l=Lk(i,a);return{tcPr:o.tcPr,rPr:l}}function ox(e,t){if(!e&&!t)return;if(!e)return t;if(!t)return e;let n={},r=e.tcPr,o=t.tcPr;if(r||o){let e={...r??{},...o??{}};(r?.borders||o?.borders)&&(e.borders={...r?.borders??{},...o?.borders??{}}),(r?.shading||o?.shading)&&(e.shading={...r?.shading??{},...o?.shading??{}}),(r?.margins||o?.margins)&&(e.margins={...r?.margins??{},...o?.margins??{}}),n.tcPr=e}return n.rPr=Lk(e.rPr,t.rPr),n}function ix(e){let t=new Map,n=e.rows.length,r=new Map;for(let o=0;o<n;o++){let n=e.rows[o],i=0;for(let e=0;e<n.cells.length;e++){let a=n.cells[e],l=a.formatting?.gridSpan??1,s=a.formatting?.vMerge,c=`${o}-${i}`;if("restart"===s)r.set(i,o),t.set(c,{rowSpan:1,skip:!1});else if("continue"===s){let e=r.get(i);if(void 0!==e){let n=`${e}-${i}`,r=t.get(n);r&&r.rowSpan++}t.set(c,{rowSpan:1,skip:!0})}else r.delete(i),t.set(c,{rowSpan:1,skip:!1});i+=l}}return t}function ax(e,t,n){let r=ix(e),o=e.columnWidths,i=o?.reduce((e,t)=>e+t,0)??0,a=e.formatting?.styleId,l=e.formatting?.look,s=a?t?.getStyle(a):void 0,c=t?.getDefaultTableStyle(),d=e.formatting?.borders??s?.tblPr?.borders??c?.tblPr?.borders,u=e.formatting?.cellMargins??s?.tblPr?.cellMargins??c?.tblPr?.cellMargins??void 0,p=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,h={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o,floating:e.formatting?.floating,cellMargins:p,look:e.formatting?.look,_originalFormatting:e.formatting||void 0},f={wholeTable:rx(t,a,"wholeTable"),firstRow:rx(t,a,"firstRow"),lastRow:rx(t,a,"lastRow"),firstCol:rx(t,a,"firstCol"),lastCol:rx(t,a,"lastCol"),band1Horz:rx(t,a,"band1Horz"),band2Horz:rx(t,a,"band2Horz"),band1Vert:rx(t,a,"band1Vert"),band2Vert:rx(t,a,"band2Vert"),nwCell:rx(t,a,"nwCell"),neCell:rx(t,a,"neCell"),swCell:rx(t,a,"swCell"),seCell:rx(t,a,"seCell")},m=!0!==l?.noHBand,g=!0!==l?.noVBand,v=0,y=e.rows.length,b=o?.length??Math.max(0,...e.rows.map(e=>e.cells.reduce((e,t)=>e+(t.formatting?.gridSpan??1),0))),w=e.rows.map((e,a)=>{let s=0===a&&!!l?.firstRow,c=a===y-1&&!!l?.lastRow,u=!m||s||c?void 0:v%2===0?f.band1Horz:f.band2Horz;return m&&!s&&!c&&v++,lx(e,t,s,o,i,f,u,g,l,d,a,y,b,r,p,n)});return xk.node("table",h,w)}function lx(e,t,n,r,o,i,a,l,s,c,d,u,p,h,f,m){let g={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:!!e.formatting?.header,_originalFormatting:e.formatting||void 0},v=e.cells.length,y=0===d,b=d===(u??1)-1,w=e.formatting?.conditionalFormat,k=w?.firstRow??y,x=w?.lastRow??b,S=p??v,C=0,T=[];for(let E=0;E<e.cells.length;E++){let u,p=e.cells[E],g=p.formatting?.gridSpan??1,v=`${d??0}-${C}`,_=h?.get(v),M=_?.skip??!1,N=_?.rowSpan??1;if(r&&o&&o>0){let e=0;for(let t=0;t<g&&C+t<r.length;t++)e+=r[C+t];u=Math.round(e/o*100)}if(C+=g,M)continue;let I,R=C-g===0,A=C===S,B=p.formatting?.conditionalFormat,D=B?.firstRow??k,F=B?.lastRow??x,P=B?.firstColumn??R,O=B?.lastColumn??A;if(l){let e=s?.firstColumn?1:0,t=C-g-e;t>=0&&(!s?.lastColumn||!O)&&(!s?.firstColumn||!P)&&(I=t%2===0?i?.band1Vert:i?.band2Vert)}B?.oddVBand?I=i?.band1Vert:B?.evenVBand&&(I=i?.band2Vert);let L=a;w?.oddHBand?L=i?.band1Horz:w?.evenHBand&&(L=i?.band2Horz),B?.oddHBand?L=i?.band1Horz:B?.evenHBand&&(L=i?.band2Horz);let z=i?.wholeTable;z=ox(z,L),z=ox(z,I),D&&(s?.firstRow||w?.firstRow||B?.firstRow)&&(z=ox(z,i?.firstRow)),F&&(s?.lastRow||w?.lastRow||B?.lastRow)&&(z=ox(z,i?.lastRow)),P&&(s?.firstColumn||w?.firstColumn||B?.firstColumn)&&(z=ox(z,i?.firstCol)),O&&(s?.lastColumn||w?.lastColumn||B?.lastColumn)&&(z=ox(z,i?.lastCol)),D&&P&&(s?.firstRow||w?.firstRow||B?.firstRow)&&(s?.firstColumn||w?.firstColumn||B?.firstColumn)&&(z=ox(z,i?.nwCell)),D&&O&&(s?.firstRow||w?.firstRow||B?.firstRow)&&(s?.lastColumn||w?.lastColumn||B?.lastColumn)&&(z=ox(z,i?.neCell)),F&&P&&(s?.lastRow||w?.lastRow||B?.lastRow)&&(s?.firstColumn||w?.firstColumn||B?.firstColumn)&&(z=ox(z,i?.swCell)),F&&O&&(s?.lastRow||w?.lastRow||B?.lastRow)&&(s?.lastColumn||w?.lastColumn||B?.lastColumn)&&(z=ox(z,i?.seCell)),T.push(dx(p,t,n,u,z,c,y,b,R,A,N,f,m))}return xk.node("tableRow",g,T)}var sx=["top","bottom","left","right","insideH","insideV"];function cx(e,t){if(!e)return e;let n;for(let r of sx){let o=e[r];if(!o?.color?.themeColor||o.color.auto)continue;let i=ph(o.color,t);i&&(n??(n={...e}),n[r]={...o,color:{rgb:i}})}return n??e}function dx(e,t,n,r,o,i,a,l,s,c,d,u,p){let h=e.formatting,f=d??1,m=h?.width?.value,g=h?.width?.type;void 0===m&&void 0!==r&&(m=r,g="pct");let v=ph(h?.shading?.fill??o?.tcPr?.shading?.fill,p),y=i?{top:a?i.top:i.insideH,bottom:l?i.bottom:i.insideH,left:s?i.left:i.insideV,right:c?i.right:i.insideV}:void 0,b=o?.tcPr?.borders,w=h?.borders,k=cx(y||b||w?{...y??{},...b??{},...w??{}}:void 0,p),x={colspan:h?.gridSpan??1,rowspan:f,width:m,widthType:g,verticalAlign:h?.verticalAlign,backgroundColor:v,textDirection:h?.textDirection,noWrap:h?.noWrap,borders:k,margins:h?.margins?{top:h.margins.top?.value,bottom:h.margins.bottom?.value,left:h.margins.left?.value,right:h.margins.right?.value}:o?.tcPr?.margins?{top:o.tcPr.margins.top?.value,bottom:o.tcPr.margins.bottom?.value,left:o.tcPr.margins.left?.value,right:o.tcPr.margins.right?.value}:u,_originalFormatting:h||void 0,_originalResolvedFill:v},S=[];for(let T of e.content)"paragraph"===T.type?S.push(Yk(T,t,void 0,o?.rPr)):"table"===T.type&&S.push(ax(T,t));0===S.length&&S.push(xk.node("paragraph",{},[]));let C=n?"tableHeader":"tableCell";return xk.node(C,x,S)}function ux(e,t){let n=hx(e),r=Yk(e,t),o=[],i=n.length>0&&0===r.content.size,{anchored:a,inFlow:l}=px(n);for(let s of a)o.push(fx(s,t));i||o.push(r);for(let s of l)o.push(fx(s,t));return o}function px(e){let t=[],n=[];for(let r of e)Nk(r)?t.push(r):n.push(r);return{anchored:t,inFlow:n}}function hx(e){let t=[];for(let n of e.content)if("run"===n.type)for(let e of n.content)if("shape"===e.type&&"shape"in e){let n=e.shape;n.textBody&&n.textBody.content.length>0&&t.push({type:"textBox",id:n.id,size:n.size,position:n.position,wrap:n.wrap,fill:n.fill,outline:n.outline,content:n.textBody.content,margins:n.textBody.margins})}return t}function fx(e,t){let n,r,o,i,a=e.size?.width?Ys(e.size.width):200,l=e.size?.height?Ys(e.size.height):void 0;e.fill?.color?.rgb&&(n=`#${e.fill.color.rgb}`),e.outline&&e.outline.width&&(r=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(o=`#${e.outline.color.rgb}`),i=e.outline.style||"solid");let s=null!=e.margins?.top?Ys(e.margins.top):4,c=null!=e.margins?.bottom?Ys(e.margins.bottom):4,d=null!=e.margins?.left?Ys(e.margins.left):7,u=null!=e.margins?.right?Ys(e.margins.right):7,p=[];for(let h of e.content)p.push(Yk(h,t));return 0===p.length&&p.push(xk.node("paragraph",{},[])),xk.node("textBox",{width:a,height:l,textBoxId:e.id,fillColor:n,outlineWidth:r,outlineColor:o,outlineStyle:i,marginTop:s,marginBottom:c,marginLeft:d,marginRight:u,...Ik(e)},p)}function mx(e,t){let n=e.package.document.content,r=[],o=e.package.theme??null,i=t?.styles?$k(t.styles):null;for(let a of n)if("paragraph"===a.type)r.push(...ux(a,i)),nx(a)&&r.push(xk.node("pageBreak"));else if("table"===a.type){let e=ax(a,i,o);r.push(e)}return 0===r.length&&r.push(xk.node("paragraph",{},[])),xk.node("doc",null,r)}function gx(e,t){let n=[],r=t?.styles?$k(t.styles):null,o=t?.theme??null;for(let i of e)"paragraph"===i.type?n.push(...ux(i,r)):"table"===i.type&&n.push(ax(i,r,o));return 0===n.length&&n.push(xk.node("paragraph",{},[])),xk.node("doc",null,n)}function vx(e,t){return gx(e,t)}function yx(){return xk.node("doc",null,[xk.node("paragraph",{},[])])}x(4979);var bx=x(9970),wx={accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",tx1:"text1",tx2:"text2",bg1:"background1",bg2:"background2",hlink:"hlink",folHlink:"folHlink"},kx={black:"000000",white:"FFFFFF",red:"FF0000",green:"00FF00",blue:"0000FF",yellow:"FFFF00",cyan:"00FFFF",magenta:"FF00FF"};function xx(e,t){let n=(0,bx.i)(t),r=n.find(e=>"a:shade"===e.name);if(r){let t=(0,bx.j)(r,null,"val");t&&(e.themeShade=Math.round(parseInt(t,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase())}let o=n.find(e=>"a:tint"===e.name);if(o){let t=(0,bx.j)(o,null,"val");t&&(e.themeTint=Math.round(parseInt(t,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase())}return e}function Sx(e){if(!e)return;let t=(0,bx.i)(e),n=t.find(e=>"a:srgbClr"===e.name);if(n){let e=(0,bx.j)(n,null,"val");if(e)return xx({rgb:e},n)}let r=t.find(e=>"a:schemeClr"===e.name);if(r){let e=(0,bx.j)(r,null,"val");if(e){let t={themeColor:wx[e]??"dk1"};return xx(t,r)}}let o=t.find(e=>"a:sysClr"===e.name);if(o)return{rgb:(0,bx.j)(o,null,"lastClr")??"000000"};let i=t.find(e=>"a:prstClr"===e.name);if(i){let e=(0,bx.j)(i,null,"val");if(e&&kx[e])return{rgb:kx[e]}}}function Cx(e){if(!e)return;let t=(0,bx.i)(e);if(t.find(e=>"a:noFill"===e.name))return{type:"none"};let n=t.find(e=>"a:solidFill"===e.name);return n?{type:"solid",color:Sx(n)}:t.find(e=>"a:gradFill"===e.name)?{type:"gradient"}:void 0}function Tx(e){let t=e?(0,bx.h)(e,"a:ln"):null;if(!t)return;let n=(0,bx.i)(t);if(n.find(e=>"a:noFill"===e.name))return;let r={},o=(0,bx.j)(t,null,"w");o&&(r.width=parseInt(o,10));let i=n.find(e=>"a:solidFill"===e.name);i&&(r.color=Sx(i));let a=n.find(e=>"a:prstDash"===e.name);if(a){let e=(0,bx.j)(a,null,"val");e&&(r.style=e)}return r}function Ex(e){if(!e)return;let t=(0,bx.j)(e,null,"relativeFrom")??"column",n=(0,bx.h)(e,"wp:align");if(n){let e=(0,bx.k)(n);return{relativeTo:t,alignment:e}}let r=(0,bx.h)(e,"wp:posOffset");if(r){let e=(0,bx.k)(r),n=parseInt(e,10);return{relativeTo:t,posOffset:isNaN(n)?0:n}}return{relativeTo:t}}function _x(e){if(!e)return;let t=(0,bx.j)(e,null,"relativeFrom")??"paragraph",n=(0,bx.h)(e,"wp:align");if(n){let e=(0,bx.k)(n);return{relativeTo:t,alignment:e}}let r=(0,bx.h)(e,"wp:posOffset");if(r){let e=(0,bx.k)(r),n=parseInt(e,10);return{relativeTo:t,posOffset:isNaN(n)?0:n}}return{relativeTo:t}}function Mx(e){let t=(0,bx.h)(e,"wp:positionH"),n=(0,bx.h)(e,"wp:positionV");if(t||n)return{horizontal:Ex(t)??{relativeTo:"column"},vertical:_x(n)??{relativeTo:"paragraph"}}}var Nx=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function Ix(e,t,n){if(!e){let e={type:t?"behind":"inFront"};return void 0!==n?.distT&&(e.distT=n.distT),void 0!==n?.distB&&(e.distB=n.distB),void 0!==n?.distL&&(e.distL=n.distL),void 0!==n?.distR&&(e.distR=n.distR),e}let r,o=(e.name||"").replace("wp:","");switch(o){case"wrapNone":r=t?"behind":"inFront";break;case"wrapSquare":r="square";break;case"wrapTight":r="tight";break;case"wrapThrough":r="through";break;case"wrapTopAndBottom":r="topAndBottom";break;default:r="square"}let i={type:r},a=(0,bx.j)(e,null,"wrapText");a&&(i.wrapText=a);let l=(0,bx.l)(e,null,"distT")??n?.distT,s=(0,bx.l)(e,null,"distB")??n?.distB,c=(0,bx.l)(e,null,"distL")??n?.distL,d=(0,bx.l)(e,null,"distR")??n?.distR;return void 0!==l&&(i.distT=l),void 0!==s&&(i.distB=s),void 0!==c&&(i.distL=c),void 0!==d&&(i.distR=d),i}function Rx(e){let t=(0,bx.i)(e),n="1"===(0,bx.j)(e,null,"behindDoc"),r=t.find(e=>Nx.includes(e.name??"")),o={distT:(0,bx.l)(e,null,"distT")??void 0,distB:(0,bx.l)(e,null,"distB")??void 0,distL:(0,bx.l)(e,null,"distL")??void 0,distR:(0,bx.l)(e,null,"distR")??void 0};return Ix(r??null,n,o)}function Ax(e){if(!e)return{};let t={},n=(0,bx.l)(e,null,"lIns"),r=(0,bx.l)(e,null,"rIns"),o=(0,bx.l)(e,null,"tIns"),i=(0,bx.l)(e,null,"bIns");return(void 0!==n||void 0!==r||void 0!==o||void 0!==i)&&(t.margins={left:n,right:r,top:o,bottom:i}),t}function Bx(e,t,n,r,o,i,a,l){if(!e)return[];let s=[],c=(0,bx.i)(e);for(let d of c){let e=d.name||"",n=e.indexOf(":"),l=n>=0?e.substring(n+1):e;if("p"===l){let e=t(d,r,o,i,a);s.push(e)}}return s}function Dx(e){let t=(0,bx.i)(e).find(e=>"wp:inline"===e.name||"wp:anchor"===e.name);if(!t)return!1;let n=(0,bx.h)(t,"a:graphic");if(!n)return!1;let r=(0,bx.h)(n,"a:graphicData");if(!r)return!1;let o=(0,bx.h)(r,"wps:wsp");return!!o&&null!==(0,bx.h)(o,"wps:txbx")}function Fx(e){let t=(0,bx.i)(e).find(e=>"wp:inline"===e.name||"wp:anchor"===e.name);if(!t)return null;let n="wp:anchor"===t.name,r=(0,bx.h)(t,"a:graphic");if(!r)return null;let o=(0,bx.h)(r,"a:graphicData");if(!o)return null;let i=(0,bx.h)(o,"wps:wsp");if(!i||!(0,bx.h)(i,"wps:txbx"))return null;let a=(0,bx.i)(i),l=a.find(e=>"wps:spPr"===e.name),s=a.find(e=>"wps:bodyPr"===e.name),c=(0,bx.h)(t,"wp:extent"),d=(0,bx.l)(c,null,"cx")??0,u=(0,bx.l)(c,null,"cy")??0,p={width:d,height:u},h=(0,bx.h)(t,"wp:docPr"),f=h?(0,bx.j)(h,null,"id")??void 0:void 0,m=Cx(l??null),g=Tx(l??null),v=Ax(s??null),y={type:"textBox",size:p,content:[]};if(f&&(y.id=f),m&&(y.fill=m),g&&(y.outline=g),v.margins&&(y.margins=v.margins),n){let e=Mx(t);e&&(y.position=e);let n=Rx(t);n&&(y.wrap=n)}return y}function Px(e){let t=(0,bx.h)(e,"wps:txbx");return t?(0,bx.h)(t,"w:txbxContent"):null}function Ox(e){if(!e)return;let t=parseInt(e,10);return isNaN(t)?void 0:t/6e4}function Lx(e,t){let n=(0,bx.i)(e);for(let r of n)if(t.includes(r.name||""))return r;return null}function zx(e){if(!e)return{width:0,height:0};let t=(0,bx.l)(e,null,"cx")??0,n=(0,bx.l)(e,null,"cy")??0;return{width:t,height:n}}function Vx(e){if(!e)return;let t=(0,bx.l)(e,null,"l")??0,n=(0,bx.l)(e,null,"t")??0,r=(0,bx.l)(e,null,"r")??0,o=(0,bx.l)(e,null,"b")??0;return 0!==t||0!==n||0!==r||0!==o?{left:t,top:n,right:r,bottom:o}:void 0}function $x(e){if(!e)return{};let t=(0,bx.j)(e,null,"id")??void 0,n=(0,bx.j)(e,null,"name")??void 0,r=(0,bx.j)(e,null,"descr")??void 0,o=(0,bx.j)(e,null,"title")??void 0,i="1"===(0,bx.j)(e,null,"decorative"),a=(0,bx.e)(e,"a","hlinkClick"),l=a?(0,bx.j)(a,"r","id")??void 0:void 0;return{id:t,name:n,alt:r,title:o,decorative:i||void 0,hlinkRId:l}}function jx(e){if(!e)return;let t=(0,bx.j)(e,null,"rot"),n="1"===(0,bx.j)(e,null,"flipH"),r="1"===(0,bx.j)(e,null,"flipV"),o=Ox(t);if(void 0===o&&!n&&!r)return;let i={};return void 0!==o&&(i.rotation=o),n&&(i.flipH=!0),r&&(i.flipV=!0),i}function Hx(e){let t=(0,bx.h)(e,"a:graphic");if(!t)return{blipFill:null,blip:null};let n=(0,bx.h)(t,"a:graphicData");if(!n)return{blipFill:null,blip:null};let r=(0,bx.h)(n,"pic:pic");if(!r)return{blipFill:null,blip:null};let o=(0,bx.h)(r,"pic:blipFill");return o?{blipFill:o,blip:(0,bx.h)(o,"a:blip")}:{blipFill:null,blip:null}}function Wx(e){if(!e)return;let t=(0,bx.h)(e,"a:srcRect");if(!t)return;let n=e=>{let n=(0,bx.l)(t,null,e);if(void 0!==n&&0!==n)return n/1e5},r=n("l"),o=n("t"),i=n("r"),a=n("b");if(void 0===r&&void 0===o&&void 0===i&&void 0===a)return;let l={};return void 0!==r&&(l.left=r),void 0!==o&&(l.top=o),void 0!==i&&(l.right=i),void 0!==a&&(l.bottom=a),l}function qx(e){if(!e)return;let t=(0,bx.h)(e,"a:alphaModFix");if(!t)return;let n=(0,bx.l)(t,null,"amt");return void 0===n||n>=1e5?void 0:Math.max(0,Math.min(1,n/1e5))}function Zx(e){if(!e)return"";let t=(0,bx.j)(e,"r","embed");if(t)return t;let n=(0,bx.j)(e,null,"embed");if(n)return n;let r=(0,bx.j)(e,"r","link");return r||""}function Ux(e){let t=(0,bx.h)(e,"a:graphic");if(!t)return null;let n=(0,bx.h)(t,"a:graphicData");if(!n)return null;let r=(0,bx.h)(n,"pic:pic");if(!r)return null;let o=(0,bx.h)(r,"pic:spPr");return o?(0,bx.h)(o,"a:xfrm"):null}function Kx(e){if(!e)return e;let t=e.replace(/^\/+/,"");return t.startsWith("media/")?t=`word/${t}`:t.startsWith("word/")||(t=`word/${t}`),t}function Gx(e){let t=e.split(".").pop()?.toLowerCase()??"";return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"}[t]??"application/octet-stream"}function Xx(e,t,n){if(!e||!t)return{};let r=t.get(e);if(!r)return{};let o=r.target;if(!o)return{};let i=Kx(o),a=o.split("/").pop(),l=(e,t)=>{let n=t.toLowerCase();for(let[r,o]of e.entries())if(r.toLowerCase()===n)return o};if(n){let e=l(n,i);if(e)return{src:e.dataUrl||e.base64,mimeType:e.mimeType,filename:a};let t=o.replace(/^\/+/,""),r=l(n,t);if(r)return{src:r.dataUrl||r.base64,mimeType:r.mimeType,filename:a};let s=`word/${t}`,c=l(n,s);if(c)return{src:c.dataUrl||c.base64,mimeType:c.mimeType,filename:a}}return{mimeType:Gx(o),filename:a}}function Yx(e,t,n){let r=(0,bx.h)(e,"wp:extent"),o=zx(r),i=(0,bx.h)(e,"wp:effectExtent"),a=Vx(i),l=(0,bx.h)(e,"wp:docPr"),s=$x(l),{blip:c,blipFill:d}=Hx(e),u=Zx(c),p=Wx(d),h=qx(c),f=Xx(u,t,n),m=Ux(e),g=jx(m),v=(0,bx.l)(e,null,"distT")??void 0,y=(0,bx.l)(e,null,"distB")??void 0,b=(0,bx.l)(e,null,"distL")??void 0,w=(0,bx.l)(e,null,"distR")??void 0,k={type:"inline"};void 0!==v&&(k.distT=v),void 0!==y&&(k.distB=y),void 0!==b&&(k.distL=b),void 0!==w&&(k.distR=w);let x={type:"image",rId:u,size:o,wrap:k};if(s.id&&(x.id=s.id),s.alt&&(x.alt=s.alt),s.title&&(x.title=s.title),s.decorative&&(x.decorative=!0),f.src&&(x.src=f.src),f.mimeType&&(x.mimeType=f.mimeType),f.filename&&(x.filename=f.filename),a&&(x.padding=a),g&&(x.transform=g),p&&(x.crop=p),void 0!==h&&(x.opacity=h),s.hlinkRId&&t){let e=(0,bx.r)(t,s.hlinkRId);e&&(x.hlinkHref=e)}return x}function Jx(e,t,n){let r,o=(0,bx.h)(e,"wp:extent"),i=zx(o),a=(0,bx.h)(e,"wp:effectExtent"),l=Vx(a),s=(0,bx.h)(e,"wp:docPr"),c=$x(s),d="1"===(0,bx.j)(e,null,"behindDoc"),u=(0,bx.j)(e,null,"layoutInCell"),p=null===u?void 0:"1"===u,h=(0,bx.j)(e,null,"allowOverlap"),f=null===h?void 0:"1"===h,m={distT:(0,bx.l)(e,null,"distT")??void 0,distB:(0,bx.l)(e,null,"distB")??void 0,distL:(0,bx.l)(e,null,"distL")??void 0,distR:(0,bx.l)(e,null,"distR")??void 0},g=Lx(e,Nx),v=Ix(g,d,m),y=(0,bx.h)(e,"wp:positionH"),b=(0,bx.h)(e,"wp:positionV"),w=Ex(y),k=_x(b);(w||k)&&(r={horizontal:w??{relativeTo:"column"},vertical:k??{relativeTo:"paragraph"}});let{blip:x,blipFill:S}=Hx(e),C=Zx(x),T=Wx(S),E=qx(x),_=Xx(C,t,n),M=Ux(e),N=jx(M),I={type:"image",rId:C,size:i,wrap:v};if(c.id&&(I.id=c.id),c.alt&&(I.alt=c.alt),c.title&&(I.title=c.title),c.decorative&&(I.decorative=!0),_.src&&(I.src=_.src),_.mimeType&&(I.mimeType=_.mimeType),_.filename&&(I.filename=_.filename),r&&(I.position=r),l&&(I.padding=l),N&&(I.transform=N),T&&(I.crop=T),void 0!==E&&(I.opacity=E),void 0!==p&&(I.layoutInCell=p),void 0!==f&&(I.allowOverlap=f),c.hlinkRId&&t){let e=(0,bx.r)(t,c.hlinkRId);e&&(I.hlinkHref=e)}return I}function Qx(e,t,n){if(Dx(e))return null;let r=(0,bx.i)(e);for(let o of r){let e=o.name||"";if("wp:inline"===e||"wp:anchor"===e)return"wp:inline"===e?Yx(o,t,n):Jx(o,t,n)}return null}function eS(e,t,n){return Qx(e,t,n)}var tS={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},nS={majorFont:{latin:"Calibri Light",ea:"",cs:"",fonts:{}},minorFont:{latin:"Calibri",ea:"",cs:"",fonts:{}}},rS={name:"Office Theme",colorScheme:tS,fontScheme:nS},oS=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function iS(e){if(!e)return null;switch((0,bx.d)(e.name||"")){case"srgbClr":return(0,bx.j)(e,"a","val")??(0,bx.j)(e,null,"val")??null;case"sysClr":{let t=(0,bx.j)(e,"a","lastClr")??(0,bx.j)(e,null,"lastClr");if(t)return t;switch((0,bx.j)(e,"a","val")??(0,bx.j)(e,null,"val")){case"windowText":case"menuText":case"captionText":case"btnText":return"000000";case"window":case"menu":case"btnFace":case"btnHighlight":return"FFFFFF";case"highlight":return"0078D7";case"highlightText":return"FFFFFF";case"grayText":return"808080";default:return null}}case"schemeClr":return(0,bx.j)(e,"a","val")??(0,bx.j)(e,null,"val"),null;default:return null}}function aS(e){let t={...tS};if(!e)return t;for(let n of oS){let r=(0,bx.e)(e,"a",n);if(r){let e=(0,bx.i)(r);if(e.length>0){let r=iS(e[0]);r&&(t[n]=r)}}}return t}function lS(e){let t={latin:"",ea:"",cs:"",fonts:{}};if(!e)return t;let n=(0,bx.e)(e,"a","latin");n&&(t.latin=(0,bx.j)(n,"a","typeface")??(0,bx.j)(n,null,"typeface")??"");let r=(0,bx.e)(e,"a","ea");r&&(t.ea=(0,bx.j)(r,"a","typeface")??(0,bx.j)(r,null,"typeface")??"");let o=(0,bx.e)(e,"a","cs");o&&(t.cs=(0,bx.j)(o,"a","typeface")??(0,bx.j)(o,null,"typeface")??"");let i=(0,bx.f)(e,"a","font");for(let a of i){let e=(0,bx.j)(a,"a","script")??(0,bx.j)(a,null,"script"),n=(0,bx.j)(a,"a","typeface")??(0,bx.j)(a,null,"typeface");e&&n&&(t.fonts=t.fonts||{},t.fonts[e]=n)}return t}function sS(e){let t={...nS};if(!e)return t;let n=(0,bx.e)(e,"a","majorFont");n&&(t.majorFont=lS(n));let r=(0,bx.e)(e,"a","minorFont");return r&&(t.minorFont=lS(r)),t}function cS(e){if(!e)return{...rS};try{let t=(0,bx.c)(e);if(!t)return{...rS};let n=(0,bx.j)(t,"a","name")??(0,bx.j)(t,null,"name")??"Office Theme",r=(0,bx.e)(t,"a","themeElements"),o=(0,bx.e)(r,"a","clrScheme"),i=aS(o),a=(0,bx.e)(r,"a","fontScheme"),l=sS(a);return{name:n,colorScheme:i,fontScheme:l}}catch(Gp){return console.warn("Failed to parse theme:",Gp),{...rS}}}function dS(e,t="latin"){if(!e?.fontScheme?.majorFont)return nS.majorFont?.latin??"Calibri Light";let n=e.fontScheme.majorFont;return"latin"===t?n.latin||"Calibri Light":"ea"===t?n.ea||"":"cs"===t?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri Light"}function uS(e,t="latin"){if(!e?.fontScheme?.minorFont)return nS.minorFont?.latin??"Calibri";let n=e.fontScheme.minorFont;return"latin"===t?n.latin||"Calibri":"ea"===t?n.ea||"":"cs"===t?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri"}function pS(e,t){if(!t)return"Calibri";let n=t.toLowerCase().includes("major"),r=t.toLowerCase().includes("minor"),o="latin",i=t.toLowerCase();return i.includes("eastasia")?o="ea":(i.includes("bidi")||i.includes("cs"))&&(o="cs"),n?dS(e,o):uS(e,r?o:"latin")}function hS(e){if(!e)return;let t=(0,bx.l)(e,"w","w")??0,n=(0,bx.j)(e,"w","type")??"dxa",r="dxa";return("auto"===n||"dxa"===n||"nil"===n||"pct"===n)&&(r=n),{value:t,type:r}}function fS(e){return hS(e)}function mS(e){let t=(0,bx.j)(e,"w","id"),n=t?parseInt(t,10):0,r=((0,bx.j)(e,"w","author")??"").trim(),o=((0,bx.j)(e,"w","date")??"").trim();return{id:Number.isInteger(n)&&n>=0?n:0,author:r.length>0?r:"Unknown",date:o.length>0?o:void 0}}function gS(e){let t=mS(e),n=((0,bx.j)(e,"w","rsid")??"").trim();return n.length>0?{...t,rsid:n}:t}function vS(e){if(!e)return;let t={style:(0,bx.j)(e,"w","val")??"none"},n=(0,bx.l)(e,"w","sz");void 0!==n&&(t.size=n);let r=(0,bx.l)(e,"w","space");void 0!==r&&(t.space=r);let o=(0,bx.j)(e,"w","color"),i=(0,bx.j)(e,"w","themeColor"),a=(0,bx.j)(e,"w","themeTint"),l=(0,bx.j)(e,"w","themeShade");(o||i||a||l)&&(t.color={rgb:o??void 0,themeColor:i,themeTint:a??void 0,themeShade:l??void 0});let s=(0,bx.j)(e,"w","shadow");("1"===s||"true"===s)&&(t.shadow=!0);let c=(0,bx.j)(e,"w","frame");return("1"===c||"true"===c)&&(t.frame=!0),t}function yS(e){if(!e)return;let t={},n=vS((0,bx.e)(e,"w","top"));n&&(t.top=n);let r=vS((0,bx.e)(e,"w","bottom"));r&&(t.bottom=r);let o=vS((0,bx.e)(e,"w","left")??(0,bx.e)(e,"w","start"));o&&(t.left=o);let i=vS((0,bx.e)(e,"w","right")??(0,bx.e)(e,"w","end"));i&&(t.right=i);let a=vS((0,bx.e)(e,"w","insideH"));a&&(t.insideH=a);let l=vS((0,bx.e)(e,"w","insideV"));return l&&(t.insideV=l),0!==Object.keys(t).length?t:void 0}function bS(e){if(!e)return;let t={},n=fS((0,bx.e)(e,"w","top"));n&&(t.top=n);let r=fS((0,bx.e)(e,"w","bottom"));r&&(t.bottom=r);let o=fS((0,bx.e)(e,"w","left")??(0,bx.e)(e,"w","start"));o&&(t.left=o);let i=fS((0,bx.e)(e,"w","right")??(0,bx.e)(e,"w","end"));return i&&(t.right=i),0!==Object.keys(t).length?t:void 0}function wS(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","fill");n&&"auto"!==n&&(t.fill={rgb:n});let r=(0,bx.j)(e,"w","themeFill");if(r){t.fill={themeColor:r};let n=(0,bx.j)(e,"w","themeFillTint");n&&t.fill&&(t.fill.themeTint=n);let o=(0,bx.j)(e,"w","themeFillShade");o&&t.fill&&(t.fill.themeShade=o)}let o=(0,bx.j)(e,"w","color");o&&"auto"!==o&&(t.color={rgb:o});let i=(0,bx.j)(e,"w","val");return i&&(t.pattern=i),0!==Object.keys(t).length?t:void 0}function kS(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","firstRow");("1"===n||"true"===n)&&(t.firstRow=!0);let r=(0,bx.j)(e,"w","lastRow");("1"===r||"true"===r)&&(t.lastRow=!0);let o=(0,bx.j)(e,"w","firstColumn");("1"===o||"true"===o)&&(t.firstColumn=!0);let i=(0,bx.j)(e,"w","lastColumn");("1"===i||"true"===i)&&(t.lastColumn=!0);let a=(0,bx.j)(e,"w","noHBand");("1"===a||"true"===a)&&(t.noHBand=!0);let l=(0,bx.j)(e,"w","noVBand");("1"===l||"true"===l)&&(t.noVBand=!0);let s=(0,bx.j)(e,"w","val");if(s){let e=parseInt(s,16);isNaN(e)||(32&e&&(t.firstRow=!0),64&e&&(t.lastRow=!0),128&e&&(t.firstColumn=!0),256&e&&(t.lastColumn=!0),512&e&&(t.noHBand=!0),1024&e&&(t.noVBand=!0))}return 0!==Object.keys(t).length?t:void 0}function xS(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","horzAnchor");("margin"===n||"page"===n||"text"===n)&&(t.horzAnchor=n);let r=(0,bx.j)(e,"w","vertAnchor");("margin"===r||"page"===r||"text"===r)&&(t.vertAnchor=r);let o=(0,bx.l)(e,"w","tblpX");void 0!==o&&(t.tblpX=o);let i=(0,bx.j)(e,"w","tblpXSpec");i&&(t.tblpXSpec=i);let a=(0,bx.l)(e,"w","tblpY");void 0!==a&&(t.tblpY=a);let l=(0,bx.j)(e,"w","tblpYSpec");l&&(t.tblpYSpec=l);let s=(0,bx.l)(e,"w","topFromText");void 0!==s&&(t.topFromText=s);let c=(0,bx.l)(e,"w","bottomFromText");void 0!==c&&(t.bottomFromText=c);let d=(0,bx.l)(e,"w","leftFromText");void 0!==d&&(t.leftFromText=d);let u=(0,bx.l)(e,"w","rightFromText");return void 0!==u&&(t.rightFromText=u),0!==Object.keys(t).length?t:void 0}function SS(e){switch(e){case"first":return"first";case"even":return"even";default:return"default"}}function CS(e){let t=(0,bx.j)(e,"w","type"),n=(0,bx.j)(e,"r","id")??"";return{type:SS(t),rId:n}}function TS(e){let t=(0,bx.j)(e,"w","type"),n=(0,bx.j)(e,"r","id")??"";return{type:SS(t),rId:n}}function ES(e,t,n,r,o,i){let a=[],l=e.elements??[],s={inHeaderFooter:!0};for(let c of l){if("element"!==c.type)continue;let e=c.name??"";if("w:p"===e||e.endsWith(":p"))a.push(nT(c,t,n,r,o,i,s));else if("w:tbl"===e||e.endsWith(":tbl")){let e=yT(c,t,n,r,o,i,s);a.push(e)}else if("w:sdt"===e||e.endsWith(":sdt")){let e=(c.elements??[]).find(e=>"element"===e.type&&("w:sdtContent"===e.name||e.name?.endsWith(":sdtContent")));if(e){let l=ES(e,t,n,r,o,i);a.push(...l)}}}return a}function _S(e,t="default",n=null,r=null,o=null,i=null,a=null){let l={type:"header",hdrFtrType:t,content:[]};if(!e)return l;let s=(0,bx.a)(e);if(!s)return l;let c=s.elements?.find(e=>"element"===e.type&&("w:hdr"===e.name||e.name?.endsWith(":hdr")));return c&&(l.content=ES(c,n,r,o,i,a)),l}function MS(e,t="default",n=null,r=null,o=null,i=null,a=null){let l={type:"footer",hdrFtrType:t,content:[]};if(!e)return l;let s=(0,bx.a)(e);if(!s)return l;let c=s.elements?.find(e=>"element"===e.type&&("w:ftr"===e.name||e.name?.endsWith(":ftr")));return c&&(l.content=ES(c,n,r,o,i,a)),l}function NS(e){switch(e){case"separator":return"separator";case"continuationSeparator":return"continuationSeparator";case"continuationNotice":return"continuationNotice";default:return"normal"}}function IS(e,t,n,r,o,i){let a=[];for(let l of(0,bx.i)(e)){let e=l.name??"";"w:p"===e?a.push(nT(l,t,n,r,o)):"w:tbl"===e&&a.push(yT(l,t,n,r,o,i))}return a}function RS(e,t,n,r,o,i){let a=(0,bx.l)(e,"w","id")??0,l=(0,bx.j)(e,"w","type"),s=NS(l),c=IS(e,t,n,r,o,i);return{type:"footnote",id:a,noteType:s,content:c}}function AS(e,t=null,n=null,r=null,o=null,i=null){let a=new Map,l=[];if(!e)return BS(a,l);let s=(0,bx.a)(e);if(!s)return BS(a,l);let c=s.elements?.find(e=>"element"===e.type&&("w:footnotes"===e.name||e.name?.endsWith(":footnotes")));if(!c)return BS(a,l);let d=(0,bx.f)(c,"w","footnote");for(let u of d){let e=RS(u,t,n,r,o,i);a.set(e.id,e),l.push(e)}return BS(a,l)}function BS(e,t){return{byId:e,footnotes:t,getFootnote(t){return e.get(t)},hasFootnote(t){return e.has(t)},getNormalFootnotes(){return t.filter(e=>"normal"===e.noteType)},getSeparator(){return t.find(e=>"separator"===e.noteType)},getContinuationSeparator(){return t.find(e=>"continuationSeparator"===e.noteType)}}}function DS(e,t,n,r,o,i){let a=(0,bx.l)(e,"w","id")??0,l=(0,bx.j)(e,"w","type"),s=NS(l),c=IS(e,t,n,r,o,i);return{type:"endnote",id:a,noteType:s,content:c}}function FS(e,t=null,n=null,r=null,o=null,i=null){let a=new Map,l=[];if(!e)return PS(a,l);let s=(0,bx.a)(e);if(!s)return PS(a,l);let c=s.elements?.find(e=>"element"===e.type&&("w:endnotes"===e.name||e.name?.endsWith(":endnotes")));if(!c)return PS(a,l);let d=(0,bx.f)(c,"w","endnote");for(let u of d){let e=DS(u,t,n,r,o,i);a.set(e.id,e),l.push(e)}return PS(a,l)}function PS(e,t){return{byId:e,endnotes:t,getEndnote(t){return e.get(t)},hasEndnote(t){return e.has(t)},getNormalEndnotes(){return t.filter(e=>"normal"===e.noteType)},getSeparator(){return t.find(e=>"separator"===e.noteType)},getContinuationSeparator(){return t.find(e=>"continuationSeparator"===e.noteType)}}}function OS(e){return e?{decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",bullet:"bullet",chicago:"chicago",none:"none"}[e]:void 0}function LS(e){switch(e){case"pageBottom":return"pageBottom";case"beneathText":return"beneathText";case"sectEnd":return"sectEnd";case"docEnd":return"docEnd";default:return}}function zS(e){switch(e){case"sectEnd":return"sectEnd";case"docEnd":return"docEnd";default:return}}function VS(e){switch(e){case"continuous":return"continuous";case"eachSect":return"eachSect";case"eachPage":return"eachPage";default:return}}function $S(e){let t={};if(!e)return t;let n=(0,bx.e)(e,"w","pos");if(n){let e=(0,bx.j)(n,"w","val");t.position=LS(e)}let r=(0,bx.e)(e,"w","numFmt");if(r){let e=(0,bx.j)(r,"w","val");t.numFmt=OS(e)}let o=(0,bx.e)(e,"w","numStart");o&&(t.numStart=(0,bx.l)(o,"w","val")??void 0);let i=(0,bx.e)(e,"w","numRestart");if(i){let e=(0,bx.j)(i,"w","val");t.numRestart=VS(e)}return t}function jS(e){let t={};if(!e)return t;let n=(0,bx.e)(e,"w","pos");if(n){let e=(0,bx.j)(n,"w","val");t.position=zS(e)}let r=(0,bx.e)(e,"w","numFmt");if(r){let e=(0,bx.j)(r,"w","val");t.numFmt=OS(e)}let o=(0,bx.e)(e,"w","numStart");o&&(t.numStart=(0,bx.l)(o,"w","val")??void 0);let i=(0,bx.e)(e,"w","numRestart");if(i){let e=(0,bx.j)(i,"w","val");t.numRestart=VS(e)}return t}function HS(e){let t=[];for(let n of e.content){if("paragraph"!==n.type)continue;let e=[];for(let t of n.content)if("run"===t.type)for(let n of t.content)"text"===n.type&&e.push(n.text);t.push(e.join(""))}return t.join("\n")}function WS(e,t,n,r){if(!e&&!t)return;let o={};return e&&"auto"!==e?o.rgb=e:"auto"===e&&(o.auto=!0),t&&(o.themeColor=t),n&&(o.themeTint=n),r&&(o.themeShade=r),Object.keys(o).length>0?o:void 0}function qS(e){if(!e)return;let t={style:(0,bx.j)(e,"w","val")??"none"},n=(0,bx.l)(e,"w","sz");void 0!==n&&(t.size=n);let r=(0,bx.l)(e,"w","space");void 0!==r&&(t.space=r);let o=(0,bx.j)(e,"w","color"),i=(0,bx.j)(e,"w","themeColor"),a=(0,bx.j)(e,"w","themeTint"),l=(0,bx.j)(e,"w","themeShade"),s=WS(o,i,a,l);s&&(t.color=s);let c=(0,bx.j)(e,"w","shadow");("1"===c||"true"===c)&&(t.shadow=!0);let d=(0,bx.j)(e,"w","frame");return("1"===d||"true"===d)&&(t.frame=!0),t}function ZS(e){switch(e){case"landscape":return"landscape";case"portrait":return"portrait";default:return}}function US(e){switch(e){case"continuous":return"continuous";case"nextPage":return"nextPage";case"oddPage":return"oddPage";case"evenPage":return"evenPage";case"nextColumn":return"nextColumn";default:return}}function KS(e){switch(e){case"top":return"top";case"center":return"center";case"both":return"both";case"bottom":return"bottom";default:return}}function GS(e){switch(e){case"continuous":return"continuous";case"newPage":return"newPage";case"newSection":return"newSection";default:return}}function XS(e,t){let n={};if(!e)return n;let r=(0,bx.e)(e,"w","pgSz");if(r){let e=(0,bx.l)(r,"w","w");void 0!==e&&(n.pageWidth=e);let t=(0,bx.l)(r,"w","h");void 0!==t&&(n.pageHeight=t);let o=(0,bx.j)(r,"w","orient"),i=ZS(o);i&&(n.orientation=i)}let o=(0,bx.e)(e,"w","pgMar");if(o){let e=(0,bx.l)(o,"w","top");void 0!==e&&(n.marginTop=e);let t=(0,bx.l)(o,"w","bottom");void 0!==t&&(n.marginBottom=t);let r=(0,bx.l)(o,"w","left");void 0!==r&&(n.marginLeft=r);let i=(0,bx.l)(o,"w","right");void 0!==i&&(n.marginRight=i);let a=(0,bx.l)(o,"w","header");void 0!==a&&(n.headerDistance=a);let l=(0,bx.l)(o,"w","footer");void 0!==l&&(n.footerDistance=l);let s=(0,bx.l)(o,"w","gutter");void 0!==s&&(n.gutter=s)}let i=(0,bx.e)(e,"w","cols");if(i){let e=(0,bx.l)(i,"w","num");void 0!==e&&(n.columnCount=e);let t=(0,bx.l)(i,"w","space");void 0!==t&&(n.columnSpace=t);let r=(0,bx.j)(i,"w","equalWidth");"1"===r||"true"===r?n.equalWidth=!0:("0"===r||"false"===r)&&(n.equalWidth=!1);let o=(0,bx.j)(i,"w","sep");("1"===o||"true"===o)&&(n.separator=!0);let a=(0,bx.f)(i,"w","col");if(a.length>0){n.columns=[];for(let e of a){let t={},r=(0,bx.l)(e,"w","w");void 0!==r&&(t.width=r);let o=(0,bx.l)(e,"w","space");void 0!==o&&(t.space=o),n.columns.push(t)}void 0===n.columnCount&&(n.columnCount=a.length)}}let a=(0,bx.e)(e,"w","type");if(a){let e=(0,bx.j)(a,"w","val"),t=US(e);t&&(n.sectionStart=t)}let l=(0,bx.e)(e,"w","vAlign");if(l){let e=(0,bx.j)(l,"w","val"),t=KS(e);t&&(n.verticalAlign=t)}let s=(0,bx.e)(e,"w","bidi");s&&(n.bidi=(0,bx.m)(s));let c=(0,bx.f)(e,"w","headerReference");c.length>0&&(n.headerReferences=c.map(e=>CS(e)));let d=(0,bx.f)(e,"w","footerReference");d.length>0&&(n.footerReferences=d.map(e=>TS(e)));let u=(0,bx.e)(e,"w","titlePg");u&&(n.titlePg=(0,bx.m)(u));let p=(0,bx.e)(e,"w","evenAndOddHeaders");p&&(n.evenAndOddHeaders=(0,bx.m)(p));let h=(0,bx.e)(e,"w","lnNumType");if(h){n.lineNumbers={};let e=(0,bx.l)(h,"w","start");void 0!==e&&(n.lineNumbers.start=e);let t=(0,bx.l)(h,"w","countBy");void 0!==t&&(n.lineNumbers.countBy=t);let r=(0,bx.l)(h,"w","distance");void 0!==r&&(n.lineNumbers.distance=r);let o=(0,bx.j)(h,"w","restart"),i=GS(o);i&&(n.lineNumbers.restart=i)}let f=(0,bx.e)(e,"w","pgBorders");if(f){n.pageBorders={};let e=qS((0,bx.e)(f,"w","top"));e&&(n.pageBorders.top=e);let t=qS((0,bx.e)(f,"w","bottom"));t&&(n.pageBorders.bottom=t);let r=qS((0,bx.e)(f,"w","left"));r&&(n.pageBorders.left=r);let o=qS((0,bx.e)(f,"w","right"));o&&(n.pageBorders.right=o);let i=(0,bx.j)(f,"w","display");("allPages"===i||"firstPage"===i||"notFirstPage"===i)&&(n.pageBorders.display=i);let a=(0,bx.j)(f,"w","offsetFrom");("page"===a||"text"===a)&&(n.pageBorders.offsetFrom=a);let l=(0,bx.j)(f,"w","zOrder");("front"===l||"back"===l)&&(n.pageBorders.zOrder=l)}let m=(0,bx.e)(e,"w","background");if(m){n.background={};let e=(0,bx.j)(m,"w","color");e&&"auto"!==e&&(n.background.color={rgb:e});let t=(0,bx.j)(m,"w","themeColor");t&&(n.background.themeColor=t);let r=(0,bx.j)(m,"w","themeTint");r&&(n.background.themeTint=r);let o=(0,bx.j)(m,"w","themeShade");o&&(n.background.themeShade=o)}let g=(0,bx.e)(e,"w","footnotePr");if(g){let e=$S(g);Object.keys(e).length>0&&(n.footnotePr=e)}let v=(0,bx.e)(e,"w","endnotePr");if(v){let e=jS(v);Object.keys(e).length>0&&(n.endnotePr=e)}let y=(0,bx.e)(e,"w","docGrid");if(y){n.docGrid={};let e=(0,bx.j)(y,"w","type");("default"===e||"lines"===e||"linesAndChars"===e||"snapToChars"===e)&&(n.docGrid.type=e);let t=(0,bx.l)(y,"w","linePitch");void 0!==t&&(n.docGrid.linePitch=t);let r=(0,bx.l)(y,"w","charSpace");void 0!==r&&(n.docGrid.charSpace=r)}let b=(0,bx.e)(e,"w","paperSrc");if(b){let e=(0,bx.l)(b,"w","first");void 0!==e&&(n.paperSrcFirst=e);let t=(0,bx.l)(b,"w","other");void 0!==t&&(n.paperSrcOther=t)}return n}function YS(){return{pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0,columnCount:1,columnSpace:720,equalWidth:!0,sectionStart:"nextPage",verticalAlign:"top"}}function JS(e,t){if(!t||0===t.length)return e;let n=new Set((e??[]).map(e=>e.type)),r=t.filter(e=>!n.has(e.type));return 0===r.length?e:[...e??[],...r]}function QS(e){if(e.length<2)return e;let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[n-1].properties,o=e[n].properties,i=JS(o.headerReferences,r.headerReferences),a=JS(o.footerReferences,r.footerReferences),l=void 0!==o.titlePg?o.titlePg:r.titlePg;i!==o.headerReferences||a!==o.footerReferences||l!==o.titlePg?t.push({...e[n],properties:{...o,headerReferences:i,footerReferences:a,titlePg:l}}):t.push(e[n])}return t}function eC(e,t){return!e&&!t||!(!e||!t||e.bold!==t.bold||e.boldCs!==t.boldCs||e.italic!==t.italic||e.italicCs!==t.italicCs||e.strike!==t.strike||e.doubleStrike!==t.doubleStrike||e.smallCaps!==t.smallCaps||e.allCaps!==t.allCaps||e.hidden!==t.hidden||e.emboss!==t.emboss||e.imprint!==t.imprint||e.outline!==t.outline||e.shadow!==t.shadow||e.rtl!==t.rtl||e.cs!==t.cs||e.fontSize!==t.fontSize||e.fontSizeCs!==t.fontSizeCs||e.spacing!==t.spacing||e.position!==t.position||e.scale!==t.scale||e.kerning!==t.kerning||e.vertAlign!==t.vertAlign||e.highlight!==t.highlight||e.effect!==t.effect||e.emphasisMark!==t.emphasisMark||e.styleId!==t.styleId||!tC(e.underline,t.underline)||!nC(e.color,t.color)||!rC(e.shading,t.shading)||!oC(e.fontFamily,t.fontFamily))}function tC(e,t){return!e&&!t||!(!e||!t||e.style!==t.style)&&nC(e.color,t.color)}function nC(e,t){return!e&&!t||!(!e||!t)&&(e.rgb===t.rgb&&e.auto===t.auto&&e.themeColor===t.themeColor&&e.themeTint===t.themeTint&&e.themeShade===t.themeShade)}function rC(e,t){return!e&&!t||!(!e||!t||e.pattern!==t.pattern||!nC(e.color,t.color)||!nC(e.fill,t.fill))}function oC(e,t){return!e&&!t||!(!e||!t)&&(e.ascii===t.ascii&&e.hAnsi===t.hAnsi&&e.eastAsia===t.eastAsia&&e.cs===t.cs&&e.asciiTheme===t.asciiTheme&&e.hAnsiTheme===t.hAnsiTheme&&e.eastAsiaTheme===t.eastAsiaTheme&&e.csTheme===t.csTheme)}function iC(e){return"text"===e.type||"softHyphen"===e.type||"noBreakHyphen"===e.type}function aC(e){return 0===e.content.length||e.content.every(iC)}function lC(e,t){let n=[];for(let r of e)n.push(r);if(n.length>0&&t.length>0&&"text"===n[n.length-1].type&&"text"===t[0].type){let e=n[n.length-1],r=t[0];n[n.length-1]={type:"text",text:e.text+r.text,preserveSpace:e.preserveSpace||r.preserveSpace||void 0};for(let o=1;o<t.length;o++)n.push(t[o])}else for(let r of t)n.push(r);return n}function sC(e){if(e.length<=1)return e;let t=[],n=null;for(let r of e)if(0!==r.content.length){if(null===n){n={...r,content:[...r.content]};continue}aC(n)&&aC(r)&&eC(n.formatting,r.formatting)?n={type:"run",formatting:n.formatting,content:lC(n.content,r.content)}:(t.push(n),n={...r,content:[...r.content]})}return null!==n&&t.push(n),t}function cC(e){if(e.length<=1)return e;let t=[],n=[];function r(){if(n.length>0){let e=sC(n);t.push(...e),n.length=0}}for(let o of e)if("run"===o.type)n.push(o);else if(r(),"hyperlink"===o.type){let e={...o,children:cC(o.children)};t.push(e)}else t.push(o);return r(),t}function dC(e,t,n,r){let o={};return e&&"auto"!==e?o.rgb=e:"auto"===e&&(o.auto=!0),t&&(o.themeColor=t),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function uC(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","color");n&&"auto"!==n&&(t.color={rgb:n});let r=(0,bx.j)(e,"w","fill");r&&"auto"!==r&&(t.fill={rgb:r});let o=(0,bx.j)(e,"w","themeFill");o&&(t.fill=t.fill||{},t.fill.themeColor=o);let i=(0,bx.j)(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=(0,bx.j)(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let l=(0,bx.j)(e,"w","val");return l&&(t.pattern=l),Object.keys(t).length>0?t:void 0}function pC(e,t,n){if(!e)return;let r={},o=(0,bx.e)(e,"w","b");o&&(r.bold=(0,bx.m)(o));let i=(0,bx.e)(e,"w","bCs");i&&(r.boldCs=(0,bx.m)(i));let a=(0,bx.e)(e,"w","i");a&&(r.italic=(0,bx.m)(a));let l=(0,bx.e)(e,"w","iCs");l&&(r.italicCs=(0,bx.m)(l));let s=(0,bx.e)(e,"w","u");if(s){let e=(0,bx.j)(s,"w","val");if(e){r.underline={style:e};let t=(0,bx.j)(s,"w","color"),n=(0,bx.j)(s,"w","themeColor");(t||n)&&(r.underline.color=dC(t,n,(0,bx.j)(s,"w","themeTint"),(0,bx.j)(s,"w","themeShade")))}}let c=(0,bx.e)(e,"w","strike");c&&(r.strike=(0,bx.m)(c));let d=(0,bx.e)(e,"w","dstrike");d&&(r.doubleStrike=(0,bx.m)(d));let u=(0,bx.e)(e,"w","vertAlign");if(u){let e=(0,bx.j)(u,"w","val");("superscript"===e||"subscript"===e||"baseline"===e)&&(r.vertAlign=e)}let p=(0,bx.e)(e,"w","smallCaps");p&&(r.smallCaps=(0,bx.m)(p));let h=(0,bx.e)(e,"w","caps");h&&(r.allCaps=(0,bx.m)(h));let f=(0,bx.e)(e,"w","vanish");f&&(r.hidden=(0,bx.m)(f));let m=(0,bx.e)(e,"w","color");m&&(r.color=dC((0,bx.j)(m,"w","val"),(0,bx.j)(m,"w","themeColor"),(0,bx.j)(m,"w","themeTint"),(0,bx.j)(m,"w","themeShade")));let g=(0,bx.e)(e,"w","highlight");if(g){let e=(0,bx.j)(g,"w","val");e&&(r.highlight=e)}let v=(0,bx.e)(e,"w","shd");v&&(r.shading=uC(v));let y=(0,bx.e)(e,"w","sz");if(y){let e=(0,bx.l)(y,"w","val");void 0!==e&&(r.fontSize=e)}let b=(0,bx.e)(e,"w","szCs");if(b){let e=(0,bx.l)(b,"w","val");void 0!==e&&(r.fontSizeCs=e)}let w=(0,bx.e)(e,"w","rFonts");if(w){r.fontFamily={ascii:(0,bx.j)(w,"w","ascii")??void 0,hAnsi:(0,bx.j)(w,"w","hAnsi")??void 0,eastAsia:(0,bx.j)(w,"w","eastAsia")??void 0,cs:(0,bx.j)(w,"w","cs")??void 0};let e=(0,bx.j)(w,"w","asciiTheme");e&&(r.fontFamily.asciiTheme=e,t&&!r.fontFamily.ascii&&(r.fontFamily.ascii=pS(t,e)));let n=(0,bx.j)(w,"w","hAnsiTheme");n&&(r.fontFamily.hAnsiTheme=n,t&&!r.fontFamily.hAnsi&&(r.fontFamily.hAnsi=pS(t,n)));let o=(0,bx.j)(w,"w","eastAsiaTheme");o&&(r.fontFamily.eastAsiaTheme=o,t&&!r.fontFamily.eastAsia&&(r.fontFamily.eastAsia=pS(t,o)));let i=(0,bx.j)(w,"w","cstheme");i&&(r.fontFamily.csTheme=i,t&&!r.fontFamily.cs&&(r.fontFamily.cs=pS(t,i)))}let k=(0,bx.e)(e,"w","spacing");if(k){let e=(0,bx.l)(k,"w","val");void 0!==e&&(r.spacing=e)}let x=(0,bx.e)(e,"w","position");if(x){let e=(0,bx.l)(x,"w","val");void 0!==e&&(r.position=e)}let S=(0,bx.e)(e,"w","w");if(S){let e=(0,bx.l)(S,"w","val");void 0!==e&&(r.scale=e)}let C=(0,bx.e)(e,"w","kern");if(C){let e=(0,bx.l)(C,"w","val");void 0!==e&&(r.kerning=e)}let T=(0,bx.e)(e,"w","effect");if(T){let e=(0,bx.j)(T,"w","val");e&&(r.effect=e)}let E=(0,bx.e)(e,"w","em");if(E){let e=(0,bx.j)(E,"w","val");e&&(r.emphasisMark=e)}let _=(0,bx.e)(e,"w","emboss");_&&(r.emboss=(0,bx.m)(_));let M=(0,bx.e)(e,"w","imprint");M&&(r.imprint=(0,bx.m)(M));let N=(0,bx.e)(e,"w","outline");N&&(r.outline=(0,bx.m)(N));let I=(0,bx.e)(e,"w","shadow");I&&(r.shadow=(0,bx.m)(I));let R=(0,bx.e)(e,"w","rtl");R&&(r.rtl=(0,bx.m)(R));let A=(0,bx.e)(e,"w","cs");A&&(r.cs=(0,bx.m)(A));let B=(0,bx.e)(e,"w","rStyle");if(B){let e=(0,bx.j)(B,"w","val");e&&(r.styleId=e)}return Object.keys(r).length>0?r:void 0}function hC(e){let t=(0,bx.j)(e,"w","id"),n=t?parseInt(t,10):0,r=((0,bx.j)(e,"w","author")??"").trim(),o=((0,bx.j)(e,"w","date")??"").trim(),i=((0,bx.j)(e,"w","rsid")??"").trim();return{id:Number.isInteger(n)&&n>=0?n:0,author:r.length>0?r:"Unknown",date:o.length>0?o:void 0,rsid:i.length>0?i:void 0}}function fC(e,t,n,r){if(!e)return;let o=(0,bx.f)(e,"w","rPrChange").map(e=>{let n=(0,bx.e)(e,"w","rPr");return{type:"runPropertyChange",info:hC(e),previousFormatting:pC(n,t),currentFormatting:r}}).filter(e=>e.previousFormatting||e.currentFormatting);return o.length>0?o:void 0}function mC(e){let t=(0,bx.k)(e),n="preserve"===(0,bx.j)(e,"xml","space");return{type:"text",text:t,preserveSpace:n||void 0}}function gC(){return{type:"tab"}}function vC(e){let t=(0,bx.j)(e,"w","type"),n=(0,bx.j)(e,"w","clear"),r={type:"break"};return("page"===t||"column"===t||"textWrapping"===t)&&(r.breakType=t),("none"===n||"left"===n||"right"===n||"all"===n)&&(r.clear=n),r}function yC(e){let t=(0,bx.j)(e,"w","font")??"",n=(0,bx.j)(e,"w","char")??"";return{type:"symbol",font:t,char:n}}function bC(e){return{type:"footnoteRef",id:(0,bx.l)(e,"w","id")??0}}function wC(e){return{type:"endnoteRef",id:(0,bx.l)(e,"w","id")??0}}function kC(e){let t=(0,bx.j)(e,"w","fldCharType"),n="true"===(0,bx.j)(e,"w","fldLock")||"1"===(0,bx.j)(e,"w","fldLock"),r="true"===(0,bx.j)(e,"w","dirty")||"1"===(0,bx.j)(e,"w","dirty"),o="begin";return"separate"===t?o="separate":"end"===t&&(o="end"),{type:"fieldChar",charType:o,fldLock:n||void 0,dirty:r||void 0}}function xC(e){return{type:"instrText",text:(0,bx.k)(e)}}function SC(e,t,n){let r=eS(e,t??void 0,n??void 0);return r?{type:"drawing",image:r}:null}function CC(e){if(!e)return"";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function TC(e,t,n){let r=[],o=(0,bx.i)(e);for(let i of o)switch(CC(i.name)){case"t":r.push(mC(i));break;case"tab":r.push(gC());break;case"br":r.push(vC(i));break;case"sym":r.push(yC(i));break;case"footnoteReference":r.push(bC(i));break;case"endnoteReference":r.push(wC(i));break;case"fldChar":r.push(kC(i));break;case"instrText":r.push(xC(i));break;case"softHyphen":r.push({type:"softHyphen"});break;case"noBreakHyphen":r.push({type:"noBreakHyphen"});break;case"drawing":let e=SC(i,t,n);e&&r.push(e);break;case"pict":case"object":break;case"rPr":break;case"lastRenderedPageBreak":break;case"cr":r.push({type:"break",breakType:"textWrapping"});break;case"AlternateContent":{let e=(0,bx.i)(i).find(e=>"Choice"===CC(e.name))??(0,bx.i)(i).find(e=>"Fallback"===CC(e.name));if(e)for(let o of(0,bx.i)(e))if("drawing"===CC(o.name)){let e=SC(o,t,n);e?.image?.src&&r.push(e)}break}}return r}function EC(e,t,n,r=null,o=null){let i={type:"run",content:[]},a=(0,bx.e)(e,"w","rPr");return a&&(i.formatting=pC(a,n),i.propertyChanges=fC(a,n,t,i.formatting)),i.content=TC(e,r,o),i}function _C(e,t,n,r){let o={};return e&&"auto"!==e?o.rgb=e:"auto"===e&&(o.auto=!0),t&&(o.themeColor=t),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function MC(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","color");n&&"auto"!==n&&(t.color={rgb:n});let r=(0,bx.j)(e,"w","fill");r&&"auto"!==r&&(t.fill={rgb:r});let o=(0,bx.j)(e,"w","themeFill");o&&(t.fill=t.fill||{},t.fill.themeColor=o);let i=(0,bx.j)(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=(0,bx.j)(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let l=(0,bx.j)(e,"w","val");return l&&(t.pattern=l),Object.keys(t).length>0?t:void 0}function NC(e){if(!e)return;let t=(0,bx.j)(e,"w","val");if(!t)return;let n={style:t},r=(0,bx.j)(e,"w","color"),o=(0,bx.j)(e,"w","themeColor");(r||o)&&(n.color=_C(r,o,(0,bx.j)(e,"w","themeTint"),(0,bx.j)(e,"w","themeShade")));let i=(0,bx.l)(e,"w","sz");void 0!==i&&(n.size=i);let a=(0,bx.l)(e,"w","space");void 0!==a&&(n.space=a);let l=(0,bx.j)(e,"w","shadow");l&&(n.shadow="1"===l||"true"===l);let s=(0,bx.j)(e,"w","frame");return s&&(n.frame="1"===s||"true"===s),n}function IC(e){if(!e)return;let t=(0,bx.f)(e,"w","tab");if(0===t.length)return;let n=[];for(let r of t){let e=(0,bx.l)(r,"w","pos"),t=(0,bx.j)(r,"w","val");if(void 0!==e&&t){let o={position:e,alignment:t},i=(0,bx.j)(r,"w","leader");i&&(o.leader=i),n.push(o)}}return n.length>0?n:void 0}function RC(e){if(!e)return;let t={},n=(0,bx.l)(e,"w","w");void 0!==n&&(t.width=n);let r=(0,bx.l)(e,"w","h");void 0!==r&&(t.height=r);let o=(0,bx.j)(e,"w","hAnchor");("text"===o||"margin"===o||"page"===o)&&(t.hAnchor=o);let i=(0,bx.j)(e,"w","vAnchor");("text"===i||"margin"===i||"page"===i)&&(t.vAnchor=i);let a=(0,bx.l)(e,"w","x");void 0!==a&&(t.x=a);let l=(0,bx.l)(e,"w","y");void 0!==l&&(t.y=l);let s=(0,bx.j)(e,"w","xAlign");s&&(t.xAlign=s);let c=(0,bx.j)(e,"w","yAlign");c&&(t.yAlign=c);let d=(0,bx.j)(e,"w","wrap");return d&&(t.wrap=d),Object.keys(t).length>0?t:void 0}function AC(e,t,n){if(!e)return;let r={},o=(0,bx.e)(e,"w","jc");if(o){let e=(0,bx.j)(o,"w","val");e&&(r.alignment=e)}let i=(0,bx.e)(e,"w","bidi");i&&(r.bidi=(0,bx.m)(i));let a=(0,bx.e)(e,"w","spacing");if(a){let e=(0,bx.l)(a,"w","before");void 0!==e&&(r.spaceBefore=e);let t=(0,bx.l)(a,"w","after");void 0!==t&&(r.spaceAfter=t);let n=(0,bx.l)(a,"w","line");void 0!==n&&(r.lineSpacing=n);let o={};void 0!==e&&(o.before=!0),void 0!==t&&(o.after=!0),(o.before||o.after)&&(r.spacingExplicit=o);let i=(0,bx.j)(a,"w","lineRule");i&&(r.lineSpacingRule=i);let l=(0,bx.j)(a,"w","beforeAutospacing");l&&(r.beforeAutospacing="1"===l||"true"===l);let s=(0,bx.j)(a,"w","afterAutospacing");s&&(r.afterAutospacing="1"===s||"true"===s)}let l=(0,bx.e)(e,"w","ind");if(l){let e=(0,bx.l)(l,"w","left");void 0!==e&&(r.indentLeft=e);let t=(0,bx.l)(l,"w","right");void 0!==t&&(r.indentRight=t);let n=(0,bx.l)(l,"w","firstLine");void 0!==n&&(r.indentFirstLine=n);let o=(0,bx.l)(l,"w","hanging");void 0!==o&&(r.indentFirstLine=-o,r.hangingIndent=!0);let i=(0,bx.l)(l,"w","start");void 0!==i&&void 0===r.indentLeft&&(r.indentLeft=i);let a=(0,bx.l)(l,"w","end");void 0!==a&&void 0===r.indentRight&&(r.indentRight=a)}let s=(0,bx.e)(e,"w","pBdr");if(s){let e={},t=NC((0,bx.e)(s,"w","top"));t&&(e.top=t);let n=NC((0,bx.e)(s,"w","bottom"));n&&(e.bottom=n);let o=NC((0,bx.e)(s,"w","left"));o&&(e.left=o);let i=NC((0,bx.e)(s,"w","right"));i&&(e.right=i);let a=NC((0,bx.e)(s,"w","between"));a&&(e.between=a);let l=NC((0,bx.e)(s,"w","bar"));l&&(e.bar=l),Object.keys(e).length>0&&(r.borders=e)}let c=(0,bx.e)(e,"w","shd");c&&(r.shading=MC(c));let d=(0,bx.e)(e,"w","tabs");d&&(r.tabs=IC(d));let u=(0,bx.e)(e,"w","keepNext");u&&(r.keepNext=(0,bx.m)(u));let p=(0,bx.e)(e,"w","keepLines");p&&(r.keepLines=(0,bx.m)(p));let h=(0,bx.e)(e,"w","widowControl");h&&(r.widowControl=(0,bx.m)(h));let f=(0,bx.e)(e,"w","pageBreakBefore");f&&(r.pageBreakBefore=(0,bx.m)(f));let m=(0,bx.e)(e,"w","contextualSpacing");m&&(r.contextualSpacing=(0,bx.m)(m));let g=(0,bx.e)(e,"w","numPr");if(g){let e=(0,bx.e)(g,"w","numId"),t=(0,bx.e)(g,"w","ilvl");if(e||t){if(r.numPr={},e){let t=(0,bx.l)(e,"w","val");void 0!==t&&(r.numPr.numId=t)}if(t){let e=(0,bx.l)(t,"w","val");void 0!==e&&(r.numPr.ilvl=e)}}}let v=(0,bx.e)(e,"w","outlineLvl");if(v){let e=(0,bx.l)(v,"w","val");void 0!==e&&(r.outlineLevel=e)}let y=(0,bx.e)(e,"w","pStyle");if(y){let e=(0,bx.j)(y,"w","val");e&&(r.styleId=e)}let b=(0,bx.e)(e,"w","framePr");b&&(r.frame=RC(b));let w=(0,bx.e)(e,"w","suppressLineNumbers");w&&(r.suppressLineNumbers=(0,bx.m)(w));let k=(0,bx.e)(e,"w","suppressAutoHyphens");k&&(r.suppressAutoHyphens=(0,bx.m)(k));let x=(0,bx.e)(e,"w","rPr");return x&&(r.runProperties=pC(x,t)),Object.keys(r).length>0?r:void 0}function BC(e){if(!e)return"";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function DC(e){let t=(0,bx.l)(e,"w","id")??0,n=(0,bx.j)(e,"w","name")??"",r={type:"bookmarkStart",id:t,name:n},o=(0,bx.l)(e,"w","colFirst");void 0!==o&&(r.colFirst=o);let i=(0,bx.l)(e,"w","colLast");return void 0!==i&&(r.colLast=i),r}function FC(e){return{type:"bookmarkEnd",id:(0,bx.l)(e,"w","id")??0}}function PC(e,t,n=null,r=null,o=null){let i={type:"hyperlink",children:[]},a=(0,bx.j)(e,"r","id");if(a&&(i.rId=a,t)){let e=t.get(a);e&&((0,bx.q)(e),i.href=e.target)}let l=(0,bx.j)(e,"w","anchor");l&&(i.anchor=l,i.href||(i.href=`#${l}`));let s=(0,bx.j)(e,"w","tooltip");s&&(i.tooltip=s);let c=(0,bx.j)(e,"w","tgtFrame");c&&(i.target=c);let d=(0,bx.j)(e,"w","history");("1"===d||"true"===d)&&(i.history=!0);let u=(0,bx.j)(e,"w","docLocation");u&&(i.docLocation=u);let p=(0,bx.i)(e);for(let h of p)switch(BC(h.name)){case"r":i.children.push(EC(h,n,r,t,o));break;case"bookmarkStart":i.children.push(DC(h));break;case"bookmarkEnd":i.children.push(FC(h));break}return i}function OC(e){let t=(0,bx.l)(e,"w","id")??0,n=(0,bx.j)(e,"w","name")??"",r={type:"bookmarkStart",id:t,name:n},o=(0,bx.l)(e,"w","colFirst");void 0!==o&&(r.colFirst=o);let i=(0,bx.l)(e,"w","colLast");return void 0!==i&&(r.colLast=i),r}function LC(e){return{type:"bookmarkEnd",id:(0,bx.l)(e,"w","id")??0}}function zC(e){let t={sdtType:"richText"};if(!e||!e.elements)return t;for(let n of e.elements)if("element"===n.type)switch(n.name?.replace(/^w:/,"")??""){case"alias":t.alias=(0,bx.j)(n,"w","val")??void 0;break;case"tag":t.tag=(0,bx.j)(n,"w","val")??void 0;break;case"lock":t.lock=(0,bx.j)(n,"w","val")??"unlocked";break;case"placeholder":{let e=(0,bx.e)(n,"w","docPart");if(e){let n=(0,bx.e)(e,"w","val");t.placeholder=n?(0,bx.j)(n,"w","val")??void 0:void 0}break}case"showingPlcHdr":t.showingPlaceholder=!0;break;case"text":t.sdtType="plainText";break;case"date":t.sdtType="date",t.dateFormat=(0,bx.j)(n,"w","fullDate")??void 0;break;case"dropDownList":t.sdtType="dropdown",t.listItems=VC(n);break;case"comboBox":t.sdtType="comboBox",t.listItems=VC(n);break;case"checkbox":{t.sdtType="checkbox";let e=(0,bx.e)(n,"w14","checked")??(0,bx.e)(n,"w","checked");t.checked=!!e&&("1"===(0,bx.j)(e,"w14","val")||"1"===(0,bx.j)(e,"w","val"));break}case"picture":t.sdtType="picture";break;case"docPartObj":t.sdtType="buildingBlockGallery";break;case"group":t.sdtType="group";break}return t}function VC(e){let t=[];for(let n of e.elements??[])"element"===n.type&&("w:listItem"===n.name||n.name?.endsWith(":listItem"))&&t.push({displayText:(0,bx.j)(n,"w","displayText")??"",value:(0,bx.j)(n,"w","value")??""});return t}function $C(e){let t="";if("text"===e.type&&"string"==typeof e.text)return e.text;if(e.elements)for(let n of e.elements)if("t"===(n.name?.replace(/^.*:/,"")??"")&&n.elements)for(let e of n.elements)"text"===e.type&&"string"==typeof e.text&&(t+=e.text);else t+=$C(n);return t}function jC(e){if(!e)return"";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function HC(e){let t=new Set(["hyperlink","smartTag","sdt","sdtContent","fldSimple","customXml","ins","del","moveFrom","moveTo"]),n=new Set(["pPr","proofErr","bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","commentReference","permStart","permEnd","rsidR"]),r=new Set(["t","tab","br","cr","sym","drawing","pict","object","softHyphen","noBreakHyphen","fldChar","instrText","pgNum","separator","continuationSeparator","footnoteRef","endnoteRef","footnoteReference","endnoteReference","ptab","monthShort","monthLong","yearShort","yearLong","dayShort","dayLong"]),o=!1;function i(e){for(let a of(0,bx.i)(e)){let e=jC(a.name);if(!n.has(e)){if("lastRenderedPageBreak"===e){o=!0;continue}if("r"===e){for(let e of(0,bx.i)(a)){let t=jC(e.name);if("rPr"!==t){if("lastRenderedPageBreak"===t){o=!0;continue}if("br"===t&&"page"===(0,bx.j)(e,"w","type"))return"forced";if(r.has(t))return"visible"}}continue}if(t.has(e)){let e=i(a);if("continue"!==e)return e;continue}return"continue"}}return"continue"}let a=i(e);return"forced"===a||"visible"===a&&o}function WC(e,t){if(!e)return`w:${t}`;let n=e.indexOf(":");return n<0?t:`${e.substring(0,n+1)}${t}`}function qC(e){if("element"!==e.type)return e;let t=jC(e.name),n=e.name;return"delText"===t?n=WC(e.name,"t"):"delInstrText"===t&&(n=WC(e.name,"instrText")),{...e,name:n,elements:e.elements?.map(qC)}}function ZC(e){let t=(0,bx.j)(e,"w","id"),n=t?parseInt(t,10):0,r=(0,bx.j)(e,"w","author"),o=(0,bx.j)(e,"w","date"),i=r?.trim()??"",a=o?.trim()??"";return{id:Number.isInteger(n)&&n>=0?n:0,author:i.length>0?i:"Unknown",date:a.length>0?a:void 0}}function UC(e){let t=ZC(e),n=((0,bx.j)(e,"w","rsid")??"").trim();return n.length>0?{...t,rsid:n}:t}function KC(e,t,n,r){if(!e)return;let o=(0,bx.f)(e,"w","pPrChange").map(e=>{let n=(0,bx.e)(e,"w","pPr");return{type:"paragraphPropertyChange",info:UC(e),previousFormatting:AC(n,t),currentFormatting:r}}).filter(e=>e.previousFormatting||e.currentFormatting);return o.length>0?o:void 0}function GC(e,t,n,r,o){return PC(e,t,n,r,o)}function XC(e){return OC(e)}function YC(e){return LC(e)}function JC(e){let t=e.trim().match(/^\\?([A-Z]+)/i);if(!t)return"UNKNOWN";let n=t[1].toUpperCase();return["PAGE","NUMPAGES","NUMWORDS","NUMCHARS","DATE","TIME","CREATEDATE","SAVEDATE","PRINTDATE","AUTHOR","TITLE","SUBJECT","KEYWORDS","COMMENTS","FILENAME","FILESIZE","TEMPLATE","DOCPROPERTY","DOCVARIABLE","REF","PAGEREF","NOTEREF","HYPERLINK","TOC","TOA","INDEX","SEQ","STYLEREF","AUTONUM","AUTONUMLGL","AUTONUMOUT","IF","MERGEFIELD","NEXT","NEXTIF","ASK","SET","QUOTE","INCLUDETEXT","INCLUDEPICTURE","SYMBOL","ADVANCE","EDITTIME","REVNUM","SECTION","SECTIONPAGES","USERADDRESS","USERNAME","USERINITIALS"].includes(n)?n:"UNKNOWN"}function QC(e,t,n,r,o){let i=(0,bx.j)(e,"w","instr")??"",a=JC(i),l={type:"simpleField",instruction:i,fieldType:a,content:[]},s=(0,bx.j)(e,"w","fldLock");("1"===s||"true"===s)&&(l.fldLock=!0);let c=(0,bx.j)(e,"w","dirty");("1"===c||"true"===c)&&(l.dirty=!0);let d=(0,bx.i)(e);for(let u of d)"r"===jC(u.name)&&l.content.push(EC(u,t,n,r,o));return l}function eT(e,t,n,r,o,i,a="default"){let l=[],s=(0,bx.i)(e),c=!1,d="",u=[],p=[],h=!1,f=!1,m=!1;for(let g of s){let e=jC(g.name);switch(e){case"r":{let e="deletion"===a?qC(g):g,r=EC(e,t,n,o,i),s=!1,v=!1,y=!1,b="";for(let t of r.content)"fieldChar"===t.type?"begin"===t.charType?(s=!0,t.fldLock&&(f=!0),t.dirty&&(m=!0)):"separate"===t.charType?v=!0:"end"===t.charType&&(y=!0):"instrText"===t.type&&(b+=t.text);if(s&&(c=!0,h=!1,d="",u=[],p=[],f=!1,m=!1),c){if(b&&(d+=b),v&&(h=!0),h&&!y?v||p.push(r):!h&&!s&&u.push(r),y){let e={type:"complexField",instruction:d.trim(),fieldType:JC(d),fieldCode:u,fieldResult:p};f&&(e.fldLock=!0),m&&(e.dirty=!0),l.push(e),c=!1}}else l.push(r);break}case"hyperlink":l.push(GC(g,o,t,n,i));break;case"bookmarkStart":l.push(XC(g));break;case"bookmarkEnd":l.push(YC(g));break;case"fldSimple":l.push(QC(g,t,n,o,i));break;case"pPr":break;case"proofErr":case"permStart":case"permEnd":case"customXml":break;case"sdt":{let e=(g.elements??[]).find(e=>"element"===e.type&&("w:sdtPr"===e.name||e.name?.endsWith(":sdtPr"))),r=(g.elements??[]).find(e=>"element"===e.type&&("w:sdtContent"===e.name||e.name?.endsWith(":sdtContent")));if(r){let s=eT(r,t,n,null,o,i,a),c={type:"inlineSdt",properties:zC(e??null),content:s.filter(e=>"run"===e.type||"hyperlink"===e.type||"simpleField"===e.type||"complexField"===e.type||"inlineSdt"===e.type||"mathEquation"===e.type)};l.push(c)}break}case"ins":{let e=ZC(g),r=eT(g,t,n,null,o,i),a={type:"insertion",info:e,content:r.filter(e=>"run"===e.type||"hyperlink"===e.type)};l.push(a);break}case"del":{let e=ZC(g),r=eT(g,t,n,null,o,i,"deletion"),a={type:"deletion",info:e,content:r.filter(e=>"run"===e.type||"hyperlink"===e.type)};l.push(a);break}case"moveFrom":{let e=ZC(g),r=eT(g,t,n,null,o,i,"deletion"),a={type:"moveFrom",info:e,content:r.filter(e=>"run"===e.type||"hyperlink"===e.type)};l.push(a);break}case"moveTo":{let e=ZC(g),r=eT(g,t,n,null,o,i),a={type:"moveTo",info:e,content:r.filter(e=>"run"===e.type||"hyperlink"===e.type)};l.push(a);break}case"smartTag":break;case"moveFromRangeStart":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10),t=(0,bx.j)(g,"w","name")??"";l.push({type:"moveFromRangeStart",id:e,name:t});break}case"moveFromRangeEnd":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10);l.push({type:"moveFromRangeEnd",id:e});break}case"moveToRangeStart":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10),t=(0,bx.j)(g,"w","name")??"";l.push({type:"moveToRangeStart",id:e,name:t});break}case"moveToRangeEnd":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10);l.push({type:"moveToRangeEnd",id:e});break}case"commentRangeStart":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10);l.push({type:"commentRangeStart",id:e});break}case"commentRangeEnd":{let e=parseInt((0,bx.j)(g,"w","id")??"0",10);l.push({type:"commentRangeEnd",id:e});break}case"oMath":case"oMathPara":{let t="oMathPara"===e,n=(0,bx.b)(g),r=$C(g),o={type:"mathEquation",display:t?"block":"inline",ommlXml:n,plainText:r||void 0};l.push(o);break}}}return l}function tT(e){let t="";for(let n of e.content)if("run"===n.type)for(let e of n.content)"text"===e.type?t+=e.text:"tab"===e.type?t+="\t":"break"===e.type&&("page"===e.breakType?t+="\f":t+="\n");else if("hyperlink"===n.type){for(let e of n.children)if("run"===e.type)for(let n of e.content)"text"===n.type&&(t+=n.text)}else if("simpleField"===n.type){for(let e of n.content)if("run"===e.type)for(let n of e.content)"text"===n.type&&(t+=n.text)}else if("complexField"===n.type)for(let e of n.fieldResult)for(let n of e.content)"text"===n.type&&(t+=n.text);return t}function nT(e,t,n,r,o=null,i=null,a){let l={type:"paragraph",content:[]},s=(0,bx.j)(e,"w14","paraId")??(0,bx.j)(e,"w","paraId");s&&(l.paraId=s);let c=(0,bx.j)(e,"w14","textId")??(0,bx.j)(e,"w","textId");c&&(l.textId=c),!a?.inHeaderFooter&&HC(e)&&(l.renderedPageBreakBefore=!0);let d=(0,bx.e)(e,"w","pPr");if(d){l.formatting=AC(d,n),l.propertyChanges=KC(d,n,t,l.formatting);let e=(0,bx.e)(d,"w","sectPr");e&&(l.sectionProperties=XS(e))}let u=eT(e,t,n,r,o,i);l.content=cC(u);let p=l.formatting?.numPr;if(!p&&l.formatting?.styleId&&t){let e=t.get(l.formatting.styleId);e?.pPr?.numPr&&(p=e.pPr.numPr,l.formatting||(l.formatting={}),l.formatting.numPr=p)}if(p&&r){let{numId:e,ilvl:t=0}=p;if(void 0!==e&&0!==e){let n=r.getLevel(e,t);if(n){let o=[];for(let n=0;n<=t;n+=1){let t=r.getLevel(e,n);o.push(t?.numFmt??"decimal")}let i=r.getInstance(e),a=i?.levelOverrides?.find(e=>e.ilvl===t);if(l.listRendering={level:t,numId:e,marker:n.lvlText,isBullet:"bullet"===n.numFmt,numFmt:n.numFmt,markerHidden:n.rPr?.hidden||void 0,markerFontFamily:n.rPr?.fontFamily?.ascii||n.rPr?.fontFamily?.hAnsi||void 0,markerFontSize:n.rPr?.fontSize?n.rPr.fontSize/2:void 0,levelNumFmts:o,abstractNumId:i?.abstractNumId,startOverride:a?.startOverride},n.pPr){l.formatting||(l.formatting={});let e=d?(0,bx.e)(d,"w","ind"):null,t=null!=e&&(null!==(0,bx.j)(e,"w","left")||null!==(0,bx.j)(e,"w","start")),r=null!=e&&(null!==(0,bx.j)(e,"w","firstLine")||null!==(0,bx.j)(e,"w","hanging"));!t&&void 0!==n.pPr.indentLeft&&(l.formatting.indentLeft=n.pPr.indentLeft),r||(void 0!==n.pPr.indentFirstLine&&(l.formatting.indentFirstLine=n.pPr.indentFirstLine),void 0!==n.pPr.hangingIndent&&(l.formatting.hangingIndent=n.pPr.hangingIndent))}}}}return l}function rT(e){if(!e)return;let t={},n=fS((0,bx.e)(e,"w","tblW"));n&&(t.width=n);let r=(0,bx.e)(e,"w","jc");if(r){let e=(0,bx.j)(r,"w","val");("left"===e||"center"===e||"right"===e||"start"===e)&&(t.justification="start"===e?"left":e)}let o=fS((0,bx.e)(e,"w","tblCellSpacing"));o&&(t.cellSpacing=o);let i=fS((0,bx.e)(e,"w","tblInd"));i&&(t.indent=i);let a=yS((0,bx.e)(e,"w","tblBorders"));a&&(t.borders=a);let l=bS((0,bx.e)(e,"w","tblCellMar"));l&&(t.cellMargins=l);let s=(0,bx.e)(e,"w","tblLayout");if(s){let e=(0,bx.j)(s,"w","type");("fixed"===e||"autofit"===e)&&(t.layout=e)}let c=(0,bx.e)(e,"w","tblStyle");if(c){let e=(0,bx.j)(c,"w","val");e&&(t.styleId=e)}let d=kS((0,bx.e)(e,"w","tblLook"));d&&(t.look=d);let u=wS((0,bx.e)(e,"w","shd"));u&&(t.shading=u);let p=(0,bx.e)(e,"w","tblOverlap");if(p){let e=(0,bx.j)(p,"w","val");("never"===e||"overlap"===e)&&(t.overlap=e)}let h=xS((0,bx.e)(e,"w","tblpPr"));return h&&(t.floating=h),(0,bx.m)((0,bx.e)(e,"w","bidiVisual"))&&(t.bidi=!0),0!==Object.keys(t).length?t:void 0}function oT(e,t){if(!e)return;let n=(0,bx.f)(e,"w","tblPrChange").map(e=>{let n=(0,bx.e)(e,"w","tblPr");return{type:"tablePropertyChange",info:gS(e),previousFormatting:rT(n),currentFormatting:t}}).filter(e=>e.previousFormatting||e.currentFormatting);return n.length>0?n:void 0}function iT(e,t){if(!e)return;let n=(0,bx.f)(e,"w","trPrChange").map(e=>{let n=(0,bx.e)(e,"w","trPr");return{type:"tableRowPropertyChange",info:gS(e),previousFormatting:cT(n),currentFormatting:t}}).filter(e=>e.previousFormatting||e.currentFormatting);return n.length>0?n:void 0}function aT(e,t){if(!e)return;let n=(0,bx.f)(e,"w","tcPrChange").map(e=>{let n=(0,bx.e)(e,"w","tcPr");return{type:"tableCellPropertyChange",info:gS(e),previousFormatting:uT(n),currentFormatting:t}}).filter(e=>e.previousFormatting||e.currentFormatting);return n.length>0?n:void 0}function lT(e){if(!e)return;let t=(0,bx.e)(e,"w","ins");if(t)return{type:"tableRowInsertion",info:mS(t)};let n=(0,bx.e)(e,"w","del");return n?{type:"tableRowDeletion",info:mS(n)}:void 0}function sT(e){if(!e)return;let t=(0,bx.e)(e,"w","cellIns");if(t)return{type:"tableCellInsertion",info:mS(t)};let n=(0,bx.e)(e,"w","cellDel");if(n)return{type:"tableCellDeletion",info:mS(n)};let r=(0,bx.e)(e,"w","cellMerge");return r?{type:"tableCellMerge",info:mS(r)}:void 0}function cT(e){if(!e)return;let t={},n=(0,bx.e)(e,"w","trHeight");if(n){let e=(0,bx.l)(n,"w","val");void 0!==e&&e>0&&(t.height={value:e,type:"dxa"});let r=(0,bx.j)(n,"w","hRule");("auto"===r||"atLeast"===r||"exact"===r)&&(t.heightRule=r)}(0,bx.m)((0,bx.e)(e,"w","tblHeader"))&&(t.header=!0),(0,bx.m)((0,bx.e)(e,"w","cantSplit"))&&(t.cantSplit=!0);let r=(0,bx.e)(e,"w","jc");if(r){let e=(0,bx.j)(r,"w","val");("left"===e||"center"===e||"right"===e)&&(t.justification=e)}(0,bx.m)((0,bx.e)(e,"w","hidden"))&&(t.hidden=!0);let o=dT((0,bx.e)(e,"w","cnfStyle"));return o&&(t.conditionalFormat=o),0!==Object.keys(t).length?t:void 0}function dT(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","firstRow");("1"===n||"true"===n)&&(t.firstRow=!0);let r=(0,bx.j)(e,"w","lastRow");("1"===r||"true"===r)&&(t.lastRow=!0);let o=(0,bx.j)(e,"w","firstColumn");("1"===o||"true"===o)&&(t.firstColumn=!0);let i=(0,bx.j)(e,"w","lastColumn");("1"===i||"true"===i)&&(t.lastColumn=!0);let a=(0,bx.j)(e,"w","oddHBand");("1"===a||"true"===a)&&(t.oddHBand=!0);let l=(0,bx.j)(e,"w","evenHBand");("1"===l||"true"===l)&&(t.evenHBand=!0);let s=(0,bx.j)(e,"w","oddVBand");("1"===s||"true"===s)&&(t.oddVBand=!0);let c=(0,bx.j)(e,"w","evenVBand");("1"===c||"true"===c)&&(t.evenVBand=!0);let d=(0,bx.j)(e,"w","firstRowFirstColumn");("1"===d||"true"===d)&&(t.nwCell=!0);let u=(0,bx.j)(e,"w","firstRowLastColumn");("1"===u||"true"===u)&&(t.neCell=!0);let p=(0,bx.j)(e,"w","lastRowFirstColumn");("1"===p||"true"===p)&&(t.swCell=!0);let h=(0,bx.j)(e,"w","lastRowLastColumn");("1"===h||"true"===h)&&(t.seCell=!0);let f=(0,bx.j)(e,"w","val");return f&&12===f.length&&("1"===f[0]&&(t.firstRow=!0),"1"===f[1]&&(t.lastRow=!0),"1"===f[2]&&(t.firstColumn=!0),"1"===f[3]&&(t.lastColumn=!0),"1"===f[4]&&(t.oddVBand=!0),"1"===f[5]&&(t.evenVBand=!0),"1"===f[6]&&(t.oddHBand=!0),"1"===f[7]&&(t.evenHBand=!0),"1"===f[8]&&(t.nwCell=!0),"1"===f[9]&&(t.neCell=!0),"1"===f[10]&&(t.swCell=!0),"1"===f[11]&&(t.seCell=!0)),0!==Object.keys(t).length?t:void 0}function uT(e){if(!e)return;let t={},n=fS((0,bx.e)(e,"w","tcW"));n&&(t.width=n);let r=yS((0,bx.e)(e,"w","tcBorders"));r&&(t.borders=r);let o=bS((0,bx.e)(e,"w","tcMar"));o&&(t.margins=o);let i=wS((0,bx.e)(e,"w","shd"));i&&(t.shading=i);let a=(0,bx.e)(e,"w","vAlign");if(a){let e=(0,bx.j)(a,"w","val");("top"===e||"center"===e||"bottom"===e)&&(t.verticalAlign=e)}let l=(0,bx.e)(e,"w","textDirection");if(l){let e=(0,bx.j)(l,"w","val");e&&(t.textDirection=e)}let s=(0,bx.e)(e,"w","gridSpan");if(s){let e=(0,bx.l)(s,"w","val");void 0!==e&&e>1&&(t.gridSpan=e)}let c=(0,bx.e)(e,"w","vMerge");c&&("restart"===(0,bx.j)(c,"w","val")?t.vMerge="restart":t.vMerge="continue"),(0,bx.m)((0,bx.e)(e,"w","tcFitText"))&&(t.fitText=!0),(0,bx.m)((0,bx.e)(e,"w","noWrap"))&&(t.noWrap=!0),(0,bx.m)((0,bx.e)(e,"w","hideMark"))&&(t.hideMark=!0);let d=dT((0,bx.e)(e,"w","cnfStyle"));return d&&(t.conditionalFormat=d),0!==Object.keys(t).length?t:void 0}function pT(e,t,n,r,o,i,a){let l=[],s=e.elements||[];for(let c of s){if(!c.name)continue;let e=c.name.split(":").pop();if("p"===e){let e=nT(c,t,n,r,o,i,a);l.push(e)}else if("tbl"===e){let e=yT(c,t,n,r,o,i,a);l.push(e)}}return 0===l.length&&l.push({type:"paragraph",content:[]}),l}function hT(e,t,n,r,o,i,a){let l={type:"tableCell",content:[]},s=(0,bx.e)(e,"w","tcPr"),c=uT(s);return c&&(l.formatting=c),l.propertyChanges=aT(s,c),l.structuralChange=sT(s),l.content=pT(e,t,n,r,o,i,a),l}function fT(e,t,n,r,o,i,a){let l={type:"tableRow",cells:[]},s=(0,bx.e)(e,"w","trPr"),c=cT(s);c&&(l.formatting=c),l.propertyChanges=iT(s,c),l.structuralChange=lT(s);let d=(0,bx.f)(e,"w","tc");for(let u of d){let e=hT(u,t,n,r,o,i,a);l.cells.push(e)}return l}function mT(e){if(!e)return;let t=[],n=(0,bx.f)(e,"w","gridCol");for(let r of n){let e=(0,bx.l)(r,"w","w")??0;t.push(e)}return t.length>0&&t.every(e=>e<=0)?void 0:t.length>0?t:void 0}function gT(e){return e.cells.reduce((e,t)=>e+(t.formatting?.gridSpan??1),0)}function vT(e){let t=Math.max(e.columnWidths?.length??0,...e.rows.map(e=>gT(e)));if(!(t<=1))for(let n of e.rows){if(1!==n.cells.length)continue;let e=n.cells[0];(e.formatting?.gridSpan??1)>=t||e.formatting?.vMerge||null==e.formatting?.gridSpan&&(e.formatting={...e.formatting??{},gridSpan:t})}}function yT(e,t,n,r,o,i,a){let l={type:"table",rows:[]},s=(0,bx.e)(e,"w","tblPr"),c=rT(s);c&&(l.formatting=c),l.propertyChanges=oT(s,c);let d=mT((0,bx.e)(e,"w","tblGrid"));d&&(l.columnWidths=d);let u=(0,bx.f)(e,"w","tr");for(let p of u){let e=fT(p,t,n,r,o,i,a);l.rows.push(e)}return vT(l),l}function bT(e){if(!e||""===e.trim())return"•";let t=e.charCodeAt(0),n={183:"•",111:"○",167:"■",252:"✓",110:"■",113:"○",117:"◆",118:"❖",168:"✓",251:"✓",254:"✓",61623:"•",61550:"■",61551:"○",61607:"■",61692:"✓",8226:"•",9679:"●",9675:"○",9632:"■",9633:"□",9670:"◆",9671:"◇",8211:"–",8212:"—",62:">",45:"-"};return n[t]?n[t]:t>=57344&&t<=63743||t<32||t>=127&&t<160?"•":e}function wT(e){let t=e.listRendering;t&&t.isBullet&&(t.marker=bT(t.marker||""))}var kT=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function xT(e){let t,n=[];for(kT.lastIndex=0;null!==(t=kT.exec(e));){let e=t[1].trim();e&&!n.includes(e)&&n.push(e)}return n}function ST(e){let t=[];for(let n of e)if("paragraph"===n.type){let e=tT(n),r=xT(e);for(let n of r)t.includes(n)||t.push(n)}else if("table"===n.type){let e=CT(n);for(let n of e)t.includes(n)||t.push(n)}return t}function CT(e){let t=[];for(let n of e.rows)for(let e of n.cells)for(let n of e.content)if("paragraph"===n.type){let e=tT(n),r=xT(e);for(let n of r)t.includes(n)||t.push(n)}else if("table"===n.type){let e=CT(n);for(let n of e)t.includes(n)||t.push(n)}return t}function TT(e,t,n,r,o,i,a){if(0===e.content.length)return;let l=(0,bx.i)(t),s=0;function c(t){if(!Dx(t))return;let l=Fx(t);if(!l)return;let c=(0,bx.n)(t,"wps","wsp");if(c){let e=Px(c);e&&(l.content=Bx(e,nT,null,n,r,o,i??void 0,a??void 0))}let d={type:"shape",shapeType:"rect",size:l.size,position:l.position,wrap:l.wrap,fill:l.fill,outline:l.outline,textBody:{content:l.content,margins:l.margins}};l.id&&(d.id=l.id);let u={type:"shape",shape:d},p=s;if(p>=e.content.length){p=-1;for(let t=e.content.length-1;t>=0;t--)if("run"===e.content[t].type){p=t;break}}if(p>=0){let t=e.content[p];"run"===t.type&&t.content.push(u)}}for(let d of l){if("r"!==(0,bx.d)(d.name??""))continue;let e=(0,bx.i)(d);for(let t of e){let e=(0,bx.d)(t.name??"");if("drawing"===e)c(t);else if("AlternateContent"===e){let e=(0,bx.i)(t),n=e.find(e=>"Choice"===(0,bx.d)(e.name??""))??e.find(e=>"Fallback"===(0,bx.d)(e.name??""));if(n)for(let t of(0,bx.i)(n))"drawing"===(0,bx.d)(t.name??"")&&c(t)}}s++}}function ET(e,t,n,r,o,i){let a=[],l=(0,bx.i)(e);for(let s of l){let e=s.name??"";if("w:p"===e||e.endsWith(":p")){let e=nT(s,t,n,r,o,i);TT(e,s,t,n,r,o,i),wT(e),a.push(e)}else if("w:tbl"===e||e.endsWith(":tbl")){let e=yT(s,t,n,r,o,i);a.push(e)}else if("w:sdt"===e||e.endsWith(":sdt")){let e=(s.elements??[]).find(e=>"element"===e.type&&("w:sdtContent"===e.name||e.name?.endsWith(":sdtContent")));if(e){let l=ET(e,t,n,r,o,i);a.push(...l)}}}return a}function _T(e,t){let n=[],r=[];for(let o of e)r.push(o),"paragraph"===o.type&&o.sectionProperties&&(n.push({properties:o.sectionProperties,content:r}),r=[]);return(r.length>0||0===n.length)&&n.push({properties:t??YS(),content:r}),n}function MT(e,t=null,n=null,r=null,o=null,i=null){let a={content:[]};if(!e)return a;let l=(0,bx.a)(e);if(!l)return a;let s=(l.elements??[]).find(e=>"element"===e.type&&("w:document"===e.name||e.name?.endsWith(":document")));if(!s)return a;let c=(0,bx.e)(s,"w","body");if(!c)return a;a.content=ET(c,t,n,r,o,i);let d=(0,bx.e)(c,"w","sectPr");d&&(a.finalSectionProperties=XS(d));let u=_T(a.content,a.finalSectionProperties);return a.sections=QS(u),a.finalSectionProperties&&a.sections.length>0&&(a.finalSectionProperties=a.sections[a.sections.length-1].properties),a}var NT=new Set,IT=new Map,RT=new Set;function AT(e,t=[400,700],n=["normal","italic"]){let r=encodeURIComponent(e),o=[];for(let a of n){let e="italic"===a?1:0;for(let n of t)o.push(`${e},${n}`)}o.sort();let i=o.join(";");return`https://fonts.googleapis.com/css2?family=${r}:ital,wght@${i}&display=swap`}async function BT(e,t){if(typeof document>"u")return!1;let n=e.trim();if(NT.has(n))return!0;let r=IT.get(n);if(r)return r;let o=(async()=>{0;try{let e=AT(n,t?.weights,t?.styles),r=document.createElement("link");return r.rel="stylesheet",r.href=e,!!await new Promise(e=>{r.onload=()=>e(!0),r.onerror=()=>e(!1),document.head.appendChild(r),setTimeout(()=>e(!1),5e3)})&&(await FT(n,3e3),NT.add(n),DT([n]),!0)}catch(e){return console.warn(`Failed to load font "${n}":`,e),!1}finally{IT.delete(n),0===IT.size&&!1}})();return IT.set(n,o),o}function DT(e){for(let t of RT)try{t(e)}catch(Dm){console.warn("Font load callback error:",Dm)}}async function FT(e,t){if("fonts"in document)try{let n=`400 16px "${e}"`;return await Promise.race([document.fonts.load(n),new Promise(e=>setTimeout(e,t))]),document.fonts.check(n)}catch{}return await new Promise(e=>setTimeout(e,100)),!0}var PT={Calibri:"Carlito",Cambria:"Caladea",Arial:"Arimo","Times New Roman":"Tinos","Courier New":"Cousine",Garamond:"EB Garamond","Book Antiqua":"EB Garamond",Georgia:"Tinos",Verdana:"Open Sans",Tahoma:"Open Sans","Trebuchet MS":"Source Sans Pro","Century Gothic":"Poppins","Franklin Gothic":"Libre Franklin",Palatino:"EB Garamond","Palatino Linotype":"EB Garamond","Lucida Sans":"Open Sans","Segoe UI":"Open Sans",Impact:"Anton","Comic Sans MS":"Comic Neue",Consolas:"Inconsolata","Lucida Console":"Inconsolata",Monaco:"Fira Code"};function OT(e){let t=e.trim();return PT[t]||t}async function LT(e){let t=e.trim(),n=OT(t);if(n!==t){let e=await BT(n);return e&&NT.add(t),e}return BT(n)}async function zT(e){let t=[...new Set(e.map(e=>e.trim()))];await Promise.all(t.map(e=>LT(e)))}async function VT(e){if(e instanceof ArrayBuffer)return e;if(e instanceof Uint8Array){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}if(e instanceof Blob)return e.arrayBuffer();throw new TypeError("Unsupported DocxInput type: "+typeof e)}var $T=x(8220);async function jT(e){let t=await $T.loadAsync(e),n={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,commentsExtensibleXml:null,commentsExtendedXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:t,originalBuffer:e};for(let[r,o]of Object.entries(t.files)){if(o.dir)continue;let e=r.toLowerCase();if(e.endsWith(".xml")||e.endsWith(".rels")){let t=await o.async("text");if(n.allXml.set(r,t),"word/document.xml"===e)n.documentXml=t;else if("word/styles.xml"===e)n.stylesXml=t;else if("word/theme/theme1.xml"===e)n.themeXml=t;else if("word/numbering.xml"===e)n.numberingXml=t;else if("word/fonttable.xml"===e)n.fontTableXml=t;else if("word/settings.xml"===e)n.settingsXml=t;else if("word/websettings.xml"===e)n.webSettingsXml=t;else if("word/footnotes.xml"===e)n.footnotesXml=t;else if("word/endnotes.xml"===e)n.endnotesXml=t;else if("word/comments.xml"===e)n.commentsXml=t;else if("word/commentsextensible.xml"===e)n.commentsExtensibleXml=t;else if("word/commentsextended.xml"===e)n.commentsExtendedXml=t;else if("word/_rels/document.xml.rels"===e)n.documentRels=t;else if("_rels/.rels"===e)n.packageRels=t;else if("[content_types].xml"===e)n.contentTypesXml=t;else if("docprops/core.xml"===e)n.corePropsXml=t;else if("docprops/app.xml"===e)n.appPropsXml=t;else if("docprops/custom.xml"===e)n.customPropsXml=t;else if(e.match(/^word\/header\d+\.xml$/)){let e=r.split("/").pop()||r;n.headers.set(e,t)}else if(e.match(/^word\/footer\d+\.xml$/)){let e=r.split("/").pop()||r;n.footers.set(e,t)}}else if(e.startsWith("word/media/")){let e=await o.async("arraybuffer");n.media.set(r,e)}else if(e.startsWith("word/fonts/")){let e=await o.async("arraybuffer");n.fonts.set(r,e)}}return n}function HT(e){switch(e.toLowerCase().split(".").pop()){case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tif":case"tiff":return"image/tiff";case"wmf":return"image/x-wmf";case"emf":return"image/x-emf";case"svg":return"image/svg+xml";case"webp":return"image/webp";default:return"application/octet-stream"}}function WT(e,t,n,r){let o={};return e&&"auto"!==e?o.rgb=e:"auto"===e&&(o.auto=!0),t&&(o.themeColor=t),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function qT(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","color");n&&"auto"!==n&&(t.color={rgb:n});let r=(0,bx.j)(e,"w","fill");r&&"auto"!==r&&(t.fill={rgb:r});let o=(0,bx.j)(e,"w","themeFill");o&&(t.fill=t.fill||{},t.fill.themeColor=o);let i=(0,bx.j)(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=(0,bx.j)(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let l=(0,bx.j)(e,"w","val");return l&&(t.pattern=l),Object.keys(t).length>0?t:void 0}function ZT(e,t){if(!e)return;let n={},r=(0,bx.e)(e,"w","b");r&&(n.bold=(0,bx.m)(r));let o=(0,bx.e)(e,"w","bCs");o&&(n.boldCs=(0,bx.m)(o));let i=(0,bx.e)(e,"w","i");i&&(n.italic=(0,bx.m)(i));let a=(0,bx.e)(e,"w","iCs");a&&(n.italicCs=(0,bx.m)(a));let l=(0,bx.e)(e,"w","u");if(l){let e=(0,bx.j)(l,"w","val");if(e){n.underline={style:e};let t=(0,bx.j)(l,"w","color"),r=(0,bx.j)(l,"w","themeColor");(t||r)&&(n.underline.color=WT(t,r,(0,bx.j)(l,"w","themeTint"),(0,bx.j)(l,"w","themeShade")))}}let s=(0,bx.e)(e,"w","strike");s&&(n.strike=(0,bx.m)(s));let c=(0,bx.e)(e,"w","dstrike");c&&(n.doubleStrike=(0,bx.m)(c));let d=(0,bx.e)(e,"w","vertAlign");if(d){let e=(0,bx.j)(d,"w","val");("superscript"===e||"subscript"===e||"baseline"===e)&&(n.vertAlign=e)}let u=(0,bx.e)(e,"w","smallCaps");u&&(n.smallCaps=(0,bx.m)(u));let p=(0,bx.e)(e,"w","caps");p&&(n.allCaps=(0,bx.m)(p));let h=(0,bx.e)(e,"w","vanish");h&&(n.hidden=(0,bx.m)(h));let f=(0,bx.e)(e,"w","color");f&&(n.color=WT((0,bx.j)(f,"w","val"),(0,bx.j)(f,"w","themeColor"),(0,bx.j)(f,"w","themeTint"),(0,bx.j)(f,"w","themeShade")));let m=(0,bx.e)(e,"w","highlight");if(m){let e=(0,bx.j)(m,"w","val");e&&(n.highlight=e)}let g=(0,bx.e)(e,"w","shd");g&&(n.shading=qT(g));let v=(0,bx.e)(e,"w","sz");if(v){let e=(0,bx.l)(v,"w","val");void 0!==e&&(n.fontSize=e)}let y=(0,bx.e)(e,"w","szCs");if(y){let e=(0,bx.l)(y,"w","val");void 0!==e&&(n.fontSizeCs=e)}let b=(0,bx.e)(e,"w","rFonts");if(b){n.fontFamily={ascii:(0,bx.j)(b,"w","ascii")??void 0,hAnsi:(0,bx.j)(b,"w","hAnsi")??void 0,eastAsia:(0,bx.j)(b,"w","eastAsia")??void 0,cs:(0,bx.j)(b,"w","cs")??void 0};let e=(0,bx.j)(b,"w","asciiTheme");e&&(n.fontFamily.asciiTheme=e,t&&!n.fontFamily.ascii&&(n.fontFamily.ascii=pS(t,e)));let r=(0,bx.j)(b,"w","hAnsiTheme");r&&(n.fontFamily.hAnsiTheme=r,t&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=pS(t,r)));let o=(0,bx.j)(b,"w","eastAsiaTheme");o&&(n.fontFamily.eastAsiaTheme=o,t&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=pS(t,o)));let i=(0,bx.j)(b,"w","cstheme");i&&(n.fontFamily.csTheme=i,t&&!n.fontFamily.cs&&(n.fontFamily.cs=pS(t,i)))}let w=(0,bx.e)(e,"w","spacing");if(w){let e=(0,bx.l)(w,"w","val");void 0!==e&&(n.spacing=e)}let k=(0,bx.e)(e,"w","position");if(k){let e=(0,bx.l)(k,"w","val");void 0!==e&&(n.position=e)}let x=(0,bx.e)(e,"w","w");if(x){let e=(0,bx.l)(x,"w","val");void 0!==e&&(n.scale=e)}let S=(0,bx.e)(e,"w","kern");if(S){let e=(0,bx.l)(S,"w","val");void 0!==e&&(n.kerning=e)}let C=(0,bx.e)(e,"w","effect");if(C){let e=(0,bx.j)(C,"w","val");e&&(n.effect=e)}let T=(0,bx.e)(e,"w","em");if(T){let e=(0,bx.j)(T,"w","val");e&&(n.emphasisMark=e)}let E=(0,bx.e)(e,"w","emboss");E&&(n.emboss=(0,bx.m)(E));let _=(0,bx.e)(e,"w","imprint");_&&(n.imprint=(0,bx.m)(_));let M=(0,bx.e)(e,"w","outline");M&&(n.outline=(0,bx.m)(M));let N=(0,bx.e)(e,"w","shadow");N&&(n.shadow=(0,bx.m)(N));let I=(0,bx.e)(e,"w","rtl");I&&(n.rtl=(0,bx.m)(I));let R=(0,bx.e)(e,"w","cs");R&&(n.cs=(0,bx.m)(R));let A=(0,bx.e)(e,"w","rStyle");if(A){let e=(0,bx.j)(A,"w","val");e&&(n.styleId=e)}return Object.keys(n).length>0?n:void 0}function UT(e){if(!e)return;let t=(0,bx.j)(e,"w","val");if(!t)return;let n={style:t},r=(0,bx.j)(e,"w","color"),o=(0,bx.j)(e,"w","themeColor");(r||o)&&(n.color=WT(r,o,(0,bx.j)(e,"w","themeTint"),(0,bx.j)(e,"w","themeShade")));let i=(0,bx.l)(e,"w","sz");void 0!==i&&(n.size=i);let a=(0,bx.l)(e,"w","space");void 0!==a&&(n.space=a);let l=(0,bx.j)(e,"w","shadow");l&&(n.shadow="1"===l||"true"===l);let s=(0,bx.j)(e,"w","frame");return s&&(n.frame="1"===s||"true"===s),n}function KT(e){if(!e)return;let t=(0,bx.f)(e,"w","tab");if(0===t.length)return;let n=[];for(let r of t){let e=(0,bx.l)(r,"w","pos"),t=(0,bx.j)(r,"w","val");if(void 0!==e&&t){let o={position:e,alignment:t},i=(0,bx.j)(r,"w","leader");i&&(o.leader=i),n.push(o)}}return n.length>0?n:void 0}function GT(e,t){if(!e)return;let n={},r=(0,bx.e)(e,"w","jc");if(r){let e=(0,bx.j)(r,"w","val");e&&(n.alignment=e)}let o=(0,bx.e)(e,"w","bidi");o&&(n.bidi=(0,bx.m)(o));let i=(0,bx.e)(e,"w","spacing");if(i){let e=(0,bx.l)(i,"w","before");void 0!==e&&(n.spaceBefore=e);let t=(0,bx.l)(i,"w","after");void 0!==t&&(n.spaceAfter=t);let r=(0,bx.l)(i,"w","line");void 0!==r&&(n.lineSpacing=r);let o=(0,bx.j)(i,"w","lineRule");o&&(n.lineSpacingRule=o);let a=(0,bx.j)(i,"w","beforeAutospacing");a&&(n.beforeAutospacing="1"===a||"true"===a);let l=(0,bx.j)(i,"w","afterAutospacing");l&&(n.afterAutospacing="1"===l||"true"===l)}let a=(0,bx.e)(e,"w","ind");if(a){let e=(0,bx.l)(a,"w","left");void 0!==e&&(n.indentLeft=e);let t=(0,bx.l)(a,"w","right");void 0!==t&&(n.indentRight=t);let r=(0,bx.l)(a,"w","firstLine");void 0!==r&&(n.indentFirstLine=r);let o=(0,bx.l)(a,"w","hanging");void 0!==o&&(n.indentFirstLine=-o,n.hangingIndent=!0)}let l=(0,bx.e)(e,"w","pBdr");if(l){let e={},t=UT((0,bx.e)(l,"w","top"));t&&(e.top=t);let r=UT((0,bx.e)(l,"w","bottom"));r&&(e.bottom=r);let o=UT((0,bx.e)(l,"w","left"));o&&(e.left=o);let i=UT((0,bx.e)(l,"w","right"));i&&(e.right=i);let a=UT((0,bx.e)(l,"w","between"));a&&(e.between=a);let s=UT((0,bx.e)(l,"w","bar"));s&&(e.bar=s),Object.keys(e).length>0&&(n.borders=e)}let s=(0,bx.e)(e,"w","shd");s&&(n.shading=qT(s));let c=(0,bx.e)(e,"w","tabs");c&&(n.tabs=KT(c));let d=(0,bx.e)(e,"w","keepNext");d&&(n.keepNext=(0,bx.m)(d));let u=(0,bx.e)(e,"w","keepLines");u&&(n.keepLines=(0,bx.m)(u));let p=(0,bx.e)(e,"w","widowControl");p&&(n.widowControl=(0,bx.m)(p));let h=(0,bx.e)(e,"w","pageBreakBefore");h&&(n.pageBreakBefore=(0,bx.m)(h));let f=(0,bx.e)(e,"w","contextualSpacing");f&&(n.contextualSpacing=(0,bx.m)(f));let m=(0,bx.e)(e,"w","numPr");if(m){let e=(0,bx.e)(m,"w","numId"),t=(0,bx.e)(m,"w","ilvl");if(e||t){if(n.numPr={},e){let t=(0,bx.l)(e,"w","val");void 0!==t&&(n.numPr.numId=t)}if(t){let e=(0,bx.l)(t,"w","val");void 0!==e&&(n.numPr.ilvl=e)}}}let g=(0,bx.e)(e,"w","outlineLvl");if(g){let e=(0,bx.l)(g,"w","val");void 0!==e&&(n.outlineLevel=e)}let v=(0,bx.e)(e,"w","pStyle");if(v){let e=(0,bx.j)(v,"w","val");e&&(n.styleId=e)}let y=(0,bx.e)(e,"w","suppressLineNumbers");y&&(n.suppressLineNumbers=(0,bx.m)(y));let b=(0,bx.e)(e,"w","suppressAutoHyphens");b&&(n.suppressAutoHyphens=(0,bx.m)(b));let w=(0,bx.e)(e,"w","rPr");return w&&(n.runProperties=ZT(w,t)),Object.keys(n).length>0?n:void 0}function XT(e){if(!e)return;let t=(0,bx.l)(e,"w","w"),n=(0,bx.j)(e,"w","type");return void 0!==t&&n?{value:t,type:n}:void 0}function YT(e){if(!e)return;let t={},n=UT((0,bx.e)(e,"w","top"));n&&(t.top=n);let r=UT((0,bx.e)(e,"w","bottom"));r&&(t.bottom=r);let o=UT((0,bx.e)(e,"w","left"));o&&(t.left=o);let i=UT((0,bx.e)(e,"w","right"));i&&(t.right=i);let a=UT((0,bx.e)(e,"w","insideH"));a&&(t.insideH=a);let l=UT((0,bx.e)(e,"w","insideV"));return l&&(t.insideV=l),Object.keys(t).length>0?t:void 0}function JT(e){if(!e)return;let t={},n=XT((0,bx.e)(e,"w","top"));n&&(t.top=n);let r=XT((0,bx.e)(e,"w","bottom"));r&&(t.bottom=r);let o=XT((0,bx.e)(e,"w","left"));o&&(t.left=o);let i=XT((0,bx.e)(e,"w","right"));return i&&(t.right=i),Object.keys(t).length>0?t:void 0}function QT(e){if(!e)return;let t={},n=(0,bx.j)(e,"w","val");if(n){let e=parseInt(n,16);isNaN(e)||(t.firstRow=0!==(32&e),t.lastRow=0!==(64&e),t.firstColumn=0!==(128&e),t.lastColumn=0!==(256&e),t.noHBand=0!==(512&e),t.noVBand=0!==(1024&e))}let r=(0,bx.j)(e,"w","firstColumn");r&&(t.firstColumn="1"===r);let o=(0,bx.j)(e,"w","firstRow");o&&(t.firstRow="1"===o);let i=(0,bx.j)(e,"w","lastColumn");i&&(t.lastColumn="1"===i);let a=(0,bx.j)(e,"w","lastRow");a&&(t.lastRow="1"===a);let l=(0,bx.j)(e,"w","noHBand");l&&(t.noHBand="1"===l);let s=(0,bx.j)(e,"w","noVBand");return s&&(t.noVBand="1"===s),Object.keys(t).length>0?t:void 0}function eE(e,t){if(!e)return;let n={},r=(0,bx.e)(e,"w","tblW");r&&(n.width=XT(r));let o=(0,bx.e)(e,"w","jc");if(o){let e=(0,bx.j)(o,"w","val");("left"===e||"center"===e||"right"===e)&&(n.justification=e)}let i=(0,bx.e)(e,"w","tblCellSpacing");i&&(n.cellSpacing=XT(i));let a=(0,bx.e)(e,"w","tblInd");a&&(n.indent=XT(a));let l=(0,bx.e)(e,"w","tblBorders");l&&(n.borders=YT(l));let s=(0,bx.e)(e,"w","tblCellMar");s&&(n.cellMargins=JT(s));let c=(0,bx.e)(e,"w","tblLayout");if(c){let e=(0,bx.j)(c,"w","type");("fixed"===e||"autofit"===e)&&(n.layout=e)}let d=(0,bx.e)(e,"w","tblStyle");if(d){let e=(0,bx.j)(d,"w","val");e&&(n.styleId=e)}let u=(0,bx.e)(e,"w","tblLook");u&&(n.look=QT(u));let p=(0,bx.e)(e,"w","shd");p&&(n.shading=qT(p));let h=(0,bx.e)(e,"w","bidiVisual");return h&&(n.bidi=(0,bx.m)(h)),Object.keys(n).length>0?n:void 0}function tE(e){if(!e)return;let t={},n=(0,bx.e)(e,"w","trHeight");if(n){t.height=XT(n);let e=(0,bx.j)(n,"w","hRule");e&&(t.heightRule=e)}let r=(0,bx.e)(e,"w","tblHeader");r&&(t.header=(0,bx.m)(r));let o=(0,bx.e)(e,"w","cantSplit");o&&(t.cantSplit=(0,bx.m)(o));let i=(0,bx.e)(e,"w","jc");if(i){let e=(0,bx.j)(i,"w","val");("left"===e||"center"===e||"right"===e)&&(t.justification=e)}let a=(0,bx.e)(e,"w","hidden");return a&&(t.hidden=(0,bx.m)(a)),Object.keys(t).length>0?t:void 0}function nE(e,t){if(!e)return;let n={},r=(0,bx.e)(e,"w","tcW");r&&(n.width=XT(r));let o=(0,bx.e)(e,"w","tcBorders");o&&(n.borders=YT(o));let i=(0,bx.e)(e,"w","tcMar");i&&(n.margins=JT(i));let a=(0,bx.e)(e,"w","shd");a&&(n.shading=qT(a));let l=(0,bx.e)(e,"w","vAlign");if(l){let e=(0,bx.j)(l,"w","val");("top"===e||"center"===e||"bottom"===e)&&(n.verticalAlign=e)}let s=(0,bx.e)(e,"w","textDirection");if(s){let e=(0,bx.j)(s,"w","val");e&&(n.textDirection=e)}let c=(0,bx.e)(e,"w","gridSpan");if(c){let e=(0,bx.l)(c,"w","val");void 0!==e&&(n.gridSpan=e)}let d=(0,bx.e)(e,"w","vMerge");if(d){let e=(0,bx.j)(d,"w","val");n.vMerge="restart"===e?"restart":"continue"}let u=(0,bx.e)(e,"w","tcFitText");u&&(n.fitText=(0,bx.m)(u));let p=(0,bx.e)(e,"w","noWrap");p&&(n.noWrap=(0,bx.m)(p));let h=(0,bx.e)(e,"w","hideMark");return h&&(n.hideMark=(0,bx.m)(h)),Object.keys(n).length>0?n:void 0}function rE(e,t){let n={styleId:(0,bx.j)(e,"w","styleId")??"",type:(0,bx.j)(e,"w","type")??"paragraph"},r=(0,bx.j)(e,"w","default");r&&(n.default="1"===r||"true"===r);let o=(0,bx.e)(e,"w","name");o&&(n.name=(0,bx.j)(o,"w","val")??void 0);let i=(0,bx.e)(e,"w","basedOn");i&&(n.basedOn=(0,bx.j)(i,"w","val")??void 0);let a=(0,bx.e)(e,"w","next");a&&(n.next=(0,bx.j)(a,"w","val")??void 0);let l=(0,bx.e)(e,"w","link");l&&(n.link=(0,bx.j)(l,"w","val")??void 0);let s=(0,bx.e)(e,"w","uiPriority");if(s){let e=(0,bx.l)(s,"w","val");void 0!==e&&(n.uiPriority=e)}let c=(0,bx.e)(e,"w","hidden");c&&(n.hidden=(0,bx.m)(c));let d=(0,bx.e)(e,"w","semiHidden");d&&(n.semiHidden=(0,bx.m)(d));let u=(0,bx.e)(e,"w","unhideWhenUsed");u&&(n.unhideWhenUsed=(0,bx.m)(u));let p=(0,bx.e)(e,"w","qFormat");p&&(n.qFormat=(0,bx.m)(p));let h=(0,bx.e)(e,"w","personal");h&&(n.personal=(0,bx.m)(h));let f=(0,bx.e)(e,"w","pPr");f&&(n.pPr=GT(f,t));let m=(0,bx.e)(e,"w","rPr");m&&(n.rPr=ZT(m,t));let g=(0,bx.e)(e,"w","tblPr");g&&(n.tblPr=eE(g));let v=(0,bx.e)(e,"w","trPr");v&&(n.trPr=tE(v));let y=(0,bx.e)(e,"w","tcPr");y&&(n.tcPr=nE(y));let b=(0,bx.f)(e,"w","tblStylePr");if(b.length>0){n.tblStylePr=[];for(let e of b){let r=(0,bx.j)(e,"w","type");if(r){let o={type:r},i=(0,bx.e)(e,"w","pPr");i&&(o.pPr=GT(i,t));let a=(0,bx.e)(e,"w","rPr");a&&(o.rPr=ZT(a,t));let l=(0,bx.e)(e,"w","tblPr");l&&(o.tblPr=eE(l));let s=(0,bx.e)(e,"w","trPr");s&&(o.trPr=tE(s));let c=(0,bx.e)(e,"w","tcPr");c&&(o.tcPr=nE(c)),n.tblStylePr.push(o)}}}return n}function oE(e,t){if(!e)return;let n={},r=(0,bx.e)(e,"w","rPrDefault");if(r){let e=(0,bx.e)(r,"w","rPr");e&&(n.rPr=ZT(e,t))}let o=(0,bx.e)(e,"w","pPrDefault");if(o){let e=(0,bx.e)(o,"w","pPr");e&&(n.pPr=GT(e,t))}return n.rPr||n.pPr?n:void 0}function iE(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let r of Object.keys(t)){let e=t[r];if(void 0!==e)if("runProperties"===r)n.runProperties=Lk(n.runProperties,t.runProperties);else if("borders"===r||"numPr"===r||"frame"===r){let t=n[r],o=e;n[r]={...t||{},...o||{}}}else"tabs"===r&&Array.isArray(e)?n.tabs=[...e]:n[r]=e}return n}function aE(e,t,n,r=new Set){if(r.has(e.styleId)||(r.add(e.styleId),!e.basedOn))return e;let o=t.get(e.basedOn);if(!o)return e;let i=aE(o,t,n,r),a={...e,pPr:iE(i.pPr,e.pPr),rPr:Lk(i.rPr,e.rPr)};return"table"===e.type&&((i.tblPr||e.tblPr)&&(a.tblPr={...i.tblPr||{},...e.tblPr||{}}),(i.trPr||e.trPr)&&(a.trPr={...i.trPr||{},...e.trPr||{}}),(i.tcPr||e.tcPr)&&(a.tcPr={...i.tcPr||{},...e.tcPr||{}})),a}function lE(e,t){let n=new Map;try{let r=(0,bx.c)(e);if(!r)return n;let o=(0,bx.f)(r,"w","style");for(let e of o){let r=rE(e,t);r.styleId&&n.set(r.styleId,r)}for(let[e,i]of n){let r=aE(i,n,t);n.set(e,r)}}catch(r){console.warn("Failed to parse styles:",r)}return n}function sE(e,t){let n={styles:[]};try{let r=(0,bx.c)(e);if(!r)return n;let o=(0,bx.e)(r,"w","docDefaults");n.docDefaults=oE(o,t);let i=(0,bx.e)(r,"w","latentStyles");i&&(n.latentStyles={defLockedState:"1"===(0,bx.j)(i,"w","defLockedState"),defUIPriority:(0,bx.l)(i,"w","defUIPriority"),defSemiHidden:"1"===(0,bx.j)(i,"w","defSemiHidden"),defUnhideWhenUsed:"1"===(0,bx.j)(i,"w","defUnhideWhenUsed"),defQFormat:"1"===(0,bx.j)(i,"w","defQFormat"),count:(0,bx.l)(i,"w","count")});let a=lE(e,t);n.styles=Array.from(a.values())}catch(r){console.warn("Failed to parse style definitions:",r)}return n}function cE(e){let t={abstractNums:[],nums:[]};if(!e)return yE(t);let n=(0,bx.c)(e);if(!n)return yE(t);let r=(0,bx.f)(n,"w","abstractNum");for(let i of r){let e=dE(i);e&&t.abstractNums.push(e)}let o=(0,bx.f)(n,"w","num");for(let i of o){let e=uE(i);e&&t.nums.push(e)}return yE(t)}function dE(e){let t=(0,bx.j)(e,"w","abstractNumId");if(null===t)return null;let n=parseInt(t,10);if(isNaN(n))return null;let r={abstractNumId:n,levels:[]},o=(0,bx.e)(e,"w","multiLevelType");if(o){let e=(0,bx.j)(o,"w","val");("hybridMultilevel"===e||"multilevel"===e||"singleLevel"===e)&&(r.multiLevelType=e)}let i=(0,bx.e)(e,"w","name");i&&(r.name=(0,bx.j)(i,"w","val")??void 0);let a=(0,bx.e)(e,"w","numStyleLink");a&&(r.numStyleLink=(0,bx.j)(a,"w","val")??void 0);let l=(0,bx.e)(e,"w","styleLink");l&&(r.styleLink=(0,bx.j)(l,"w","val")??void 0);let s=(0,bx.f)(e,"w","lvl");for(let c of s){let e=pE(c);e&&r.levels.push(e)}return r.levels.sort((e,t)=>e.ilvl-t.ilvl),r}function uE(e){let t=(0,bx.j)(e,"w","numId");if(null===t)return null;let n=parseInt(t,10);if(isNaN(n))return null;let r=(0,bx.e)(e,"w","abstractNumId");if(!r)return null;let o=(0,bx.j)(r,"w","val");if(null===o)return null;let i=parseInt(o,10);if(isNaN(i))return null;let a={numId:n,abstractNumId:i},l=(0,bx.f)(e,"w","lvlOverride");if(l.length>0){a.levelOverrides=[];for(let e of l){let t=(0,bx.j)(e,"w","ilvl");if(null===t)continue;let n=parseInt(t,10);if(isNaN(n))continue;let r={ilvl:n},o=(0,bx.e)(e,"w","startOverride");if(o){let e=(0,bx.j)(o,"w","val");if(null!==e){let t=parseInt(e,10);isNaN(t)||(r.startOverride=t)}}let i=(0,bx.e)(e,"w","lvl");i&&(r.lvl=pE(i)??void 0),a.levelOverrides.push(r)}}return a}function pE(e){let t=(0,bx.j)(e,"w","ilvl");if(null===t)return null;let n=parseInt(t,10);if(isNaN(n)||n<0||n>8)return null;let r={ilvl:n,numFmt:"decimal",lvlText:""},o=(0,bx.e)(e,"w","start");if(o){let e=(0,bx.j)(o,"w","val");if(null!==e){let t=parseInt(e,10);isNaN(t)||(r.start=t)}}let i=(0,bx.e)(e,"w","numFmt");if(i){let e=(0,bx.j)(i,"w","val");e&&(r.numFmt=hE(e))}let a=(0,bx.e)(e,"w","lvlText");a&&(r.lvlText=(0,bx.j)(a,"w","val")??"");let l=(0,bx.e)(e,"w","lvlJc");if(l){let e=(0,bx.j)(l,"w","val");("left"===e||"center"===e||"right"===e)&&(r.lvlJc=e)}let s=(0,bx.e)(e,"w","suff");if(s){let e=(0,bx.j)(s,"w","val");("tab"===e||"space"===e||"nothing"===e)&&(r.suffix=e)}let c=(0,bx.e)(e,"w","isLgl");c&&(r.isLgl=(0,bx.m)(c));let d=(0,bx.e)(e,"w","lvlRestart");if(d){let e=(0,bx.j)(d,"w","val");if(null!==e){let t=parseInt(e,10);isNaN(t)||(r.lvlRestart=t)}}let u=(0,bx.e)(e,"w","legacy");u&&(r.legacy={legacy:(0,bx.m)(u),legacySpace:(0,bx.l)(u,"w","legacySpace"),legacyIndent:(0,bx.l)(u,"w","legacyIndent")});let p=(0,bx.e)(e,"w","pPr");p&&(r.pPr=fE(p));let h=(0,bx.e)(e,"w","rPr");return h&&(r.rPr=vE(h)),r}function hE(e){return{decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",hex:"hex",chicago:"chicago",bullet:"bullet",none:"none",decimalZero:"decimalZero",ganada:"ganada",chosung:"chosung",ideographDigital:"ideographDigital",japaneseCounting:"japaneseCounting",aiueo:"aiueo",iroha:"iroha",decimalFullWidth:"decimalFullWidth",decimalHalfWidth:"decimalHalfWidth",japaneseLegal:"japaneseLegal",japaneseDigitalTenThousand:"japaneseDigitalTenThousand",decimalEnclosedCircle:"decimalEnclosedCircle",decimalFullWidth2:"decimalFullWidth2",aiueoFullWidth:"aiueoFullWidth",irohaFullWidth:"irohaFullWidth",decimalEnclosedFullstop:"decimalEnclosedFullstop",decimalEnclosedParen:"decimalEnclosedParen",decimalEnclosedCircleChinese:"decimalEnclosedCircleChinese",ideographEnclosedCircle:"ideographEnclosedCircle",ideographTraditional:"ideographTraditional",ideographZodiac:"ideographZodiac",ideographZodiacTraditional:"ideographZodiacTraditional",taiwaneseCounting:"taiwaneseCounting",ideographLegalTraditional:"ideographLegalTraditional",taiwaneseCountingThousand:"taiwaneseCountingThousand",taiwaneseDigital:"taiwaneseDigital",chineseCounting:"chineseCounting",chineseLegalSimplified:"chineseLegalSimplified",chineseCountingThousand:"chineseCountingThousand",koreanDigital:"koreanDigital",koreanCounting:"koreanCounting",koreanLegal:"koreanLegal",koreanDigital2:"koreanDigital2",vietnameseCounting:"vietnameseCounting",russianLower:"russianLower",russianUpper:"russianUpper",numberInDash:"numberInDash",hebrew1:"hebrew1",hebrew2:"hebrew2",arabicAlpha:"arabicAlpha",arabicAbjad:"arabicAbjad",hindiVowels:"hindiVowels",hindiConsonants:"hindiConsonants",hindiNumbers:"hindiNumbers",hindiCounting:"hindiCounting",thaiLetters:"thaiLetters",thaiNumbers:"thaiNumbers",thaiCounting:"thaiCounting"}[e]??"decimal"}function fE(e){let t={},n=(0,bx.e)(e,"w","ind");if(n){let e=(0,bx.l)(n,"w","left"),r=(0,bx.l)(n,"w","right"),o=(0,bx.l)(n,"w","start"),i=(0,bx.l)(n,"w","end"),a=(0,bx.l)(n,"w","firstLine"),l=(0,bx.l)(n,"w","hanging"),s=e??o,c=r??i;void 0!==s&&(t.indentLeft=s),void 0!==c&&(t.indentRight=c),void 0!==l?(t.indentFirstLine=-l,t.hangingIndent=!0):void 0!==a&&(t.indentFirstLine=a)}let r=(0,bx.e)(e,"w","tabs");if(r){t.tabs=[];let e=(0,bx.f)(r,"w","tab");for(let n of e){let e=(0,bx.l)(n,"w","pos"),r=(0,bx.j)(n,"w","val"),o=(0,bx.j)(n,"w","leader");void 0!==e&&r&&t.tabs.push({position:e,alignment:mE(r),leader:gE(o)})}}return t}function mE(e){switch(e){case"left":return"left";case"center":return"center";case"right":return"right";case"decimal":return"decimal";case"bar":return"bar";case"clear":return"clear";case"num":return"num";default:return"left"}}function gE(e){if(e)switch(e){case"none":return"none";case"dot":return"dot";case"hyphen":return"hyphen";case"underscore":return"underscore";case"heavy":return"heavy";case"middleDot":return"middleDot";default:return}}function vE(e){let t={},n=(0,bx.e)(e,"w","rFonts");n&&(t.fontFamily={ascii:(0,bx.j)(n,"w","ascii")??void 0,hAnsi:(0,bx.j)(n,"w","hAnsi")??void 0,eastAsia:(0,bx.j)(n,"w","eastAsia")??void 0,cs:(0,bx.j)(n,"w","cs")??void 0});let r=(0,bx.e)(e,"w","sz");if(r){let e=(0,bx.l)(r,"w","val");void 0!==e&&(t.fontSize=e)}let o=(0,bx.e)(e,"w","color");if(o){let e=(0,bx.j)(o,"w","val"),n=(0,bx.j)(o,"w","themeColor");"auto"===e?t.color={auto:!0}:n?t.color={themeColor:n,themeTint:(0,bx.j)(o,"w","themeTint")??void 0,themeShade:(0,bx.j)(o,"w","themeShade")??void 0}:e&&(t.color={rgb:e})}let i=(0,bx.e)(e,"w","b");i&&(t.bold=(0,bx.m)(i));let a=(0,bx.e)(e,"w","i");a&&(t.italic=(0,bx.m)(a));let l=(0,bx.e)(e,"w","vanish");return l&&(t.hidden=(0,bx.m)(l)),t}function yE(e){let t=new Map;for(let r of e.abstractNums)t.set(r.abstractNumId,r);let n=new Map;for(let r of e.nums)n.set(r.numId,r);return{definitions:e,getLevel(e,r){let o=n.get(e);if(!o)return null;if(o.levelOverrides){let e=o.levelOverrides.find(e=>e.ilvl===r);if(e){if(e.lvl)return e.lvl;let n=t.get(o.abstractNumId);if(n){let t=n.levels.find(e=>e.ilvl===r);if(t&&void 0!==e.startOverride)return{...t,start:e.startOverride}}}}let i=t.get(o.abstractNumId);if(!i)return null;if(i.numStyleLink&&0===i.levels.length)for(let n of t.values())if(n.styleLink===i.numStyleLink&&n.levels.length>0){i=n;break}return i.levels.find(e=>e.ilvl===r)??null},getAbstract(e){return t.get(e)??null},getInstance(e){return n.get(e)??null},hasNumbering(e){return n.has(e)}}}function bE(e){let t=new Map,n=(0,bx.a)(e);if(!n)return t;let r=(0,bx.e)(n,"w16cex","commentsExtensible")??n;for(let o of(0,bx.i)(r)){if("comment"!==(o.name?.replace(/^.*:/,"")??""))continue;let e=(0,bx.j)(o,"w16cex","paraId")??(0,bx.j)(o,"w15","paraId")??o.attributes?.["w16cex:paraId"]??o.attributes?.["w15:paraId"],n=(0,bx.j)(o,"w16cex","dateUtc")??(0,bx.j)(o,"w15","dateUtc")??o.attributes?.["w16cex:dateUtc"]??o.attributes?.["w15:dateUtc"];e&&n&&t.set(String(e).toUpperCase(),String(n))}return t}function wE(e){let t=new Map,n=new Map,r=(0,bx.a)(e);if(!r)return{parentByParaId:t,doneByParaId:n};let o=(0,bx.e)(r,"w15","commentsEx")??r;for(let i of(0,bx.i)(o)){if("commentEx"!==(i.name?.replace(/^.*:/,"")??""))continue;let e=(0,bx.j)(i,"w15","paraId")??i.attributes?.["w15:paraId"],r=(0,bx.j)(i,"w15","paraIdParent")??i.attributes?.["w15:paraIdParent"],o=(0,bx.j)(i,"w15","done")??i.attributes?.["w15:done"];if(e){let i=String(e).toUpperCase();r&&t.set(i,String(r).toUpperCase()),"1"===o&&n.set(i,!0)}}return{parentByParaId:t,doneByParaId:n}}function kE(e,t,n,r,o,i,a){if(!e)return[];let l=(0,bx.a)(e);if(!l)return[];let s=i?bE(i):new Map,c=a?wE(a):null,d=(0,bx.e)(l,"w","comments")??l,u=(0,bx.i)(d),p=[],h=[];for(let f of u){if("comment"!==(f.name?.replace(/^.*:/,"")??""))continue;let e=parseInt((0,bx.j)(f,"w","id")??"0",10),i=(0,bx.j)(f,"w","author")??"Unknown",a=(0,bx.j)(f,"w","initials"),l=null!=a?String(a):void 0,d=(0,bx.j)(f,"w","date"),u=null!=d?String(d):void 0,m=(0,bx.j)(f,"w14","paraId")??f.attributes?.["w14:paraId"]??(0,bx.j)(f,"w","paraId"),g=(m?s.get(String(m).toUpperCase()):void 0)??u,v=(0,bx.j)(f,"w","done")??f.attributes?.["w:done"],y="1"===v||"true"===v||void 0,b=(0,bx.j)(f,"w16cid","parentId")??(0,bx.j)(f,"w","parentId")??f.attributes?.["w16cid:parentId"]??f.attributes?.["w:parentId"],w=null!=b?parseInt(String(b),10):void 0,k=[],x="";for(let s of(0,bx.i)(f))if("p"===(s.name?.replace(/^.*:/,"")??"")){let e=nT(s,t,n,null,r,o);k.push(e);let i=(0,bx.j)(s,"w14","paraId")??s.attributes?.["w14:paraId"];i&&(x=String(i).toUpperCase())}null==y&&c&&x&&c.doneByParaId.get(x)&&(y=!0),h.push(x),p.push({id:e,author:i,initials:l,date:g,content:k,...null!=y?{done:y}:{},...null==w||isNaN(w)?{}:{parentId:w}})}if(c&&c.parentByParaId.size>0){let e=new Map;for(let t=0;t<p.length;t++){let n=h[t];n&&e.set(n,p[t].id)}for(let t=0;t<p.length;t++){if(null!=p[t].parentId)continue;let n=h[t];if(!n)continue;let r=c.parentByParaId.get(n);if(!r)continue;let o=e.get(r);null!=o&&(p[t]={...p[t],parentId:o})}}return p}async function xE(e,t={}){let n=e instanceof ArrayBuffer?e:await VT(e),{onProgress:r=()=>{},preloadFonts:o=!0,parseHeadersFooters:i=!0,parseNotes:a=!0,detectVariables:l=!0}=t,s=[];try{let d=function(e,t){let n=performance.now(),r=t(),o=performance.now()-n;return p.push({stage:e,ms:o}),o>1e3&&console.warn(`[parseDocx] ${e} took ${Math.round(o)}ms`),r};let u=performance.now(),p=[];async function h(e,t){let n=performance.now(),r=await t(),o=performance.now()-n;return p.push({stage:e,ms:o}),o>1e3&&console.warn(`[parseDocx] ${e} took ${Math.round(o)}ms`),r}r("Extracting DOCX...",0);let f=await h("unzip",()=>jT(n));r("Extracted DOCX",10),r("Parsing relationships...",10);let m=d("relationships",()=>f.documentRels?(0,bx.p)(f.documentRels):new Map);r("Parsed relationships",15),r("Parsing theme...",15);let g=d("theme",()=>cS(f.themeXml));r("Parsed theme",20),r("Parsing styles...",20);let v,y=null;d("styles",()=>{f.stylesXml&&(y=lE(f.stylesXml,g),v=sE(f.stylesXml,g))}),r("Parsed styles",30),r("Parsing numbering...",30);let b=d("numbering",()=>cE(f.numberingXml));r("Parsed numbering",35),r("Processing media files...",35);let w=d("media",()=>SE(f,m));r("Processed media",40),r("Parsing document body...",40);let k,x,S,C,T={content:[]};if(d("documentBody",()=>{f.documentXml?T=MT(f.documentXml,y,g,b,m,w):s.push("No document.xml found in DOCX")}),r("Parsed document body",55),i){r("Parsing headers/footers...",55);let I=d("headersFooters",()=>TE(f,y,g,b,m,w));k=I.headers,x=I.footers,r("Parsed headers/footers",65)}else r("Skipping headers/footers",65);if(a){r("Parsing footnotes/endnotes...",65);let R=d("footnotesEndnotes",()=>EE(f,y,g,b,m,w));S=R.footnotes,C=R.endnotes,r("Parsed footnotes/endnotes",75)}else r("Skipping footnotes/endnotes",75);r("Parsing comments...",75);let E,_=d("comments",()=>kE(f.commentsXml,y,g,m,w,f.commentsExtensibleXml,f.commentsExtendedXml));_.length>0&&(T.comments=_),l?(r("Detecting template variables...",75),E=d("variables",()=>ST(T.content)),r("Detected variables",80)):r("Skipping variable detection",80),o?(r("Loading fonts...",80),await h("fonts",()=>_E(g,v,T)),r("Loaded fonts",95)):r("Skipping font loading",95),r("Assembling document...",95);let M={package:{document:T,styles:v,theme:g,numbering:b.definitions,headers:k,footers:x,footnotes:S,endnotes:C,relationships:m,media:w},originalBuffer:n,templateVariables:E,warnings:s.length>0?s:void 0},N=performance.now()-u;if(N>2e3){let A=p.filter(e=>e.ms>100).map(e=>`${e.stage}: ${Math.round(e.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(N)}ms`+(A?` (${A})`:""))}return r("Complete",100),M}catch(c){let B=c instanceof Error?c.message:String(c);throw console.error("[parseDocx] Failed to parse DOCX:",B,c),new Error(`Failed to parse DOCX: ${B}`)}}function SE(e,t){let n=new Map;for(let[r,o]of e.media.entries()){let e=r.split("/").pop()||r,t=HT(r),i=new Uint8Array(o),a="";for(let n=0;n<i.length;n++)a+=String.fromCharCode(i[n]);let l=btoa(a),s=`data:${t};base64,${l}`,c={path:r,filename:e,mimeType:t,data:o,dataUrl:s};n.set(r,c);let d=r.replace(/^word\//,"");d!==r&&n.set(d,c)}return n}function CE(e,t){let n=t.toLowerCase();for(let[r,o]of e.entries())if(r.toLowerCase()===n)return o}function TE(e,t,n,r,o,i){let a=new Map,l=new Map;for(let[s,c]of o.entries())if(c.type===bx.o.header&&c.target){let l=c.target.split("/").pop()||c.target,d=CE(e.headers,l);if(d){let c=`word/_rels/${l}.rels`,u=CE(e.allXml,c),p=u?(0,bx.p)(u):o,h=_S(d,"default",t,n,r,p,i);a.set(s,h)}}else if(c.type===bx.o.footer&&c.target){let a=c.target.split("/").pop()||c.target,d=CE(e.footers,a);if(d){let c=`word/_rels/${a}.rels`,u=CE(e.allXml,c),p=u?(0,bx.p)(u):o,h=MS(d,"default",t,n,r,p,i);l.set(s,h)}}return{headers:a,footers:l}}function EE(e,t,n,r,o,i){let a=AS(e.footnotesXml,t,n,r,o,i),l=FS(e.endnotesXml,t,n,r,o,i);return{footnotes:a.getNormalFootnotes(),endnotes:l.getNormalEndnotes()}}async function _E(e,t,n){let r=new Set;if(e?.fontScheme){let{majorFont:t,minorFont:n}=e.fontScheme;t?.latin&&r.add(t.latin),n?.latin&&r.add(n.latin)}if(t?.docDefaults?.rPr?.fontFamily?.ascii&&r.add(t.docDefaults.rPr.fontFamily.ascii),t?.styles)for(let o of t.styles)o.rPr?.fontFamily?.ascii&&r.add(o.rPr.fontFamily.ascii),o.rPr?.fontFamily?.hAnsi&&r.add(o.rPr.fontFamily.hAnsi);if(n.content)for(let o of n.content)if("paragraph"===o.type)for(let e of o.content)"run"===e.type&&e.formatting?.fontFamily&&(e.formatting.fontFamily.ascii&&r.add(e.formatting.fontFamily.ascii),e.formatting.fontFamily.hAnsi&&r.add(e.formatting.fontFamily.hAnsi));if(r.size>0)try{await zT(Array.from(r))}catch(Qp){console.warn("Failed to load some fonts:",Qp)}}function ME(e){let t=new Map,n=new Map;return e.descendants(e=>{let r=e.marks.find(e=>"insertion"===e.type.name),o=e.marks.find(e=>"deletion"===e.type.name);if(r){let e=Number(r.attrs.revisionId);Number.isFinite(e)&&t.set(e,(t.get(e)??0)+1)}if(o){let e=Number(o.attrs.revisionId);Number.isFinite(e)&&n.set(e,(n.get(e)??0)+1)}}),{insertionById:t,deletionById:n}}function NE(e){return e.attrs.href||""}function IE(e){let t=e.filter(e=>"hyperlink"!==e.type.name);return 0===t.length?"":t.map(e=>`${e.type.name}:${JSON.stringify(e.attrs)}`).sort().join("|")}function RE(e){let t={};for(let n of e)switch(n.type.name){case"bold":t.bold=!0,t.boldCs=!0;break;case"italic":t.italic=!0,t.italicCs=!0;break;case"underline":{let e=n.attrs;t.underline={style:e.style||"single",color:e.color};break}case"strike":n.attrs.double?t.doubleStrike=!0:t.strike=!0;break;case"textColor":{let e=n.attrs;t.color={rgb:e.rgb,themeColor:e.themeColor,themeTint:e.themeTint,themeShade:e.themeShade};break}case"highlight":t.highlight=n.attrs.color;break;case"fontSize":t.fontSize=n.attrs.size,t.fontSizeCs=n.attrs.size;break;case"fontFamily":{let e=n.attrs;t.fontFamily={ascii:e.ascii,hAnsi:e.hAnsi,eastAsia:e.eastAsia||void 0,cs:e.cs||e.ascii||void 0,asciiTheme:e.asciiTheme,hAnsiTheme:e.hAnsiTheme||void 0,eastAsiaTheme:e.eastAsiaTheme||void 0,csTheme:e.csTheme||void 0};break}case"superscript":t.vertAlign="superscript";break;case"subscript":t.vertAlign="subscript";break;case"allCaps":t.allCaps=!0;break;case"smallCaps":t.smallCaps=!0;break;case"characterSpacing":null!=n.attrs.spacing&&(t.spacing=n.attrs.spacing),null!=n.attrs.position&&(t.position=n.attrs.position),null!=n.attrs.scale&&(t.scale=n.attrs.scale),null!=n.attrs.kerning&&(t.kerning=n.attrs.kerning);break;case"emboss":t.emboss=!0;break;case"imprint":t.imprint=!0;break;case"textShadow":t.shadow=!0;break;case"emphasisMark":t.emphasisMark=n.attrs.type||"dot";break;case"textOutline":t.outline=!0;break;case"hidden":t.hidden=!0;break;case"rtl":t.rtl=!0;break;case"textEffect":t.effect=n.attrs.effect||"blinkBackground";break}return t}function AE(e){let t=e.attrs.href;return t?.startsWith("#")?{type:"hyperlink",anchor:t.substring(1),tooltip:e.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:t,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function BE(e,t){let n=t.marks.filter(e=>"hyperlink"!==e.type.name);t.isText&&t.text?e.children.push(DE(t.text,n)):"tab"===t.type.name?e.children.push(OE()):"hardBreak"===t.type.name&&e.children.push(PE())}function DE(e,t){let n=RE(t),r={type:"text",text:e};return{type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[r]}}function FE(e,t){let n=e.content[e.content.length-1];n&&"text"===n.type?n.text+=t:e.content.push({type:"text",text:t})}function PE(){return{type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function OE(){return{type:"run",content:[{type:"tab"}]}}function LE(e,t){let n=e.attrs,r=t&&t.length>0?RE(t):void 0,o=n.displayText||"";if(!o)switch(n.fieldType){case"PAGE":o="1";break;case"NUMPAGES":o="1";break;default:o=" ";break}let i={type:"run",content:[{type:"text",text:o}],...r&&Object.keys(r).length>0?{formatting:r}:{}};return"complex"===n.fieldKind?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function zE(e){let t=e.attrs;return{type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function VE(e){let t=e.attrs,n={type:t.wrapType||"inline"};void 0!==t.distTop&&(n.distT=Js(t.distTop)),void 0!==t.distBottom&&(n.distB=Js(t.distBottom)),void 0!==t.distLeft&&(n.distL=Js(t.distLeft)),void 0!==t.distRight&&(n.distR=Js(t.distRight)),t.wrapText&&(n.wrapText=t.wrapText);let r={type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:Js(t.width||0),height:Js(t.height||0)},wrap:n};if(t.transform){let e=t.transform,n={},o=e.match(/rotate\(([-\d.]+)deg\)/);o&&(n.rotation=parseFloat(o[1])),e.includes("scaleX(-1)")&&(n.flipH=!0),e.includes("scaleY(-1)")&&(n.flipV=!0),(n.rotation||n.flipH||n.flipV)&&(r.transform=n)}if(t.position?.horizontal&&t.position?.vertical){let e=t.position;r.position={horizontal:{relativeTo:e.horizontal.relativeTo||"column",alignment:e.horizontal.align,posOffset:e.horizontal.posOffset},vertical:{relativeTo:e.vertical.relativeTo||"paragraph",alignment:e.vertical.align,posOffset:e.vertical.posOffset}}}if(t.borderWidth&&t.borderWidth>0){let e={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};r.outline={width:Js(t.borderWidth),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&e[t.borderStyle]||"solid"}}if(t.hlinkHref&&(r.hlinkHref=t.hlinkHref),void 0!==t.cropTop||void 0!==t.cropRight||void 0!==t.cropBottom||void 0!==t.cropLeft){let e={};void 0!==t.cropTop&&null!==t.cropTop&&(e.top=t.cropTop),void 0!==t.cropRight&&null!==t.cropRight&&(e.right=t.cropRight),void 0!==t.cropBottom&&null!==t.cropBottom&&(e.bottom=t.cropBottom),void 0!==t.cropLeft&&null!==t.cropLeft&&(e.left=t.cropLeft),Object.keys(e).length>0&&(r.crop=e)}if(void 0!==t.opacity&&null!==t.opacity&&t.opacity<1&&(r.opacity=t.opacity),void 0!==t.layoutInCell&&null!==t.layoutInCell&&(r.layoutInCell=t.layoutInCell),void 0!==t.allowOverlap&&null!==t.allowOverlap&&(r.allowOverlap=t.allowOverlap),t.effectExtentTop||t.effectExtentBottom||t.effectExtentLeft||t.effectExtentRight){let e={};t.effectExtentTop&&(e.top=Js(t.effectExtentTop)),t.effectExtentBottom&&(e.bottom=Js(t.effectExtentBottom)),t.effectExtentLeft&&(e.left=Js(t.effectExtentLeft)),t.effectExtentRight&&(e.right=Js(t.effectExtentRight)),Object.keys(e).length>0&&(r.padding=e)}return{type:"run",content:[{type:"drawing",image:r}]}}function $E(e){let t=e.attrs,n={type:"shape",shapeType:t.shapeType||"rect",id:t.shapeId||void 0,size:{width:t.width?Js(t.width):0,height:t.height?Js(t.height):0}};if("gradient"===t.fillType&&t.gradientStops)try{let e=JSON.parse(t.gradientStops);n.fill={type:"gradient",gradient:{type:t.gradientType||"linear",angle:t.gradientAngle||void 0,stops:e.map(e=>({position:e.position,color:{rgb:e.color.replace("#","")}}))}}}catch{n.fill={type:"solid",color:{rgb:(t.fillColor||"000000").replace("#","")}}}else t.fillColor?n.fill={type:t.fillType||"solid",color:{rgb:t.fillColor.replace("#","")}}:"none"===t.fillType&&(n.fill={type:"none"});if(t.outlineWidth&&t.outlineWidth>0){let e={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:Js(t.outlineWidth),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&e[t.outlineStyle]||"solid"}}return{type:"run",content:[{type:"shape",shape:n}]}}function jE(e,t){let n=e.attrs,r=HE(qE(e,t),e),o=n.bookmarks;if(o&&o.length>0){let e=o.map(e=>({type:"bookmarkStart",id:e.id,name:e.name})),t=o.map(e=>({type:"bookmarkEnd",id:e.id}));r=[...e,...r,...t]}let i={type:"paragraph",paraId:n.paraId||void 0,textId:n.textId||void 0,formatting:WE(n),content:r};return n.renderedPageBreakBefore&&(i.renderedPageBreakBefore=!0),n._sectionProperties?i.sectionProperties=n._sectionProperties:n.sectionBreakType&&(i.sectionProperties={sectionStart:n.sectionBreakType}),i}function HE(e,t){let n=new Set;if(t.forEach(e=>{for(let t of e.marks)"comment"===t.type.name&&n.add(t.attrs.commentId)}),0===n.size)return e;let r=[],o=new Set,i=0;t.forEach(t=>{let n=new Set;for(let e of t.marks)"comment"===e.type.name&&n.add(e.attrs.commentId);for(let e of[...o])n.has(e)||(r.push({type:"commentRangeEnd",id:e}),o.delete(e));for(let e of n)o.has(e)||(r.push({type:"commentRangeStart",id:e}),o.add(e));i<e.length&&r.push(e[i]),i++});for(let a of o)r.push({type:"commentRangeEnd",id:a});return r}function WE(e){if(e._originalFormatting){let t=e._originalFormatting,n={...t};return e.alignment!==(t.alignment||void 0)&&(n.alignment=e.alignment||void 0),e.numPr!==t.numPr&&JSON.stringify(e.numPr)!==JSON.stringify(t.numPr)&&(n.numPr=e.numPr||void 0),e.styleId!==(t.styleId||void 0)&&(n.styleId=e.styleId||void 0),e.pageBreakBefore!==(t.pageBreakBefore||void 0)&&(n.pageBreakBefore=e.pageBreakBefore||void 0),e.bidi!==(t.bidi||void 0)&&(n.bidi=e.bidi||void 0),n}if(e.alignment||e.spaceBefore||e.spaceAfter||e.lineSpacing||e.indentLeft||e.indentRight||e.indentFirstLine||e.numPr||e.styleId||e.borders||e.shading||e.tabs||null!=e.outlineLevel||e.contextualSpacing||e.bidi)return{alignment:e.alignment||void 0,spaceBefore:e.spaceBefore||void 0,spaceAfter:e.spaceAfter||void 0,lineSpacing:e.lineSpacing||void 0,lineSpacingRule:e.lineSpacingRule||void 0,indentLeft:e.indentLeft||void 0,indentRight:e.indentRight||void 0,indentFirstLine:e.indentFirstLine||void 0,hangingIndent:e.hangingIndent||void 0,numPr:e.numPr||void 0,styleId:e.styleId||void 0,borders:e.borders||void 0,shading:e.shading||void 0,tabs:e.tabs||void 0,outlineLevel:e.outlineLevel??void 0,contextualSpacing:e.contextualSpacing||void 0,bidi:e.bidi||void 0}}function qE(e,t){let n=[],r=t??ME(e),o=null,i=null,a=null;return e.forEach(e=>{let t=e.marks.find(e=>"footnoteRef"===e.type.name);if(t){o&&(n.push(o),o=null,i=null),a&&(n.push(a),a=null);let e={type:"endnote"===t.attrs.noteType?"endnoteRef":"footnoteRef",id:parseInt(t.attrs.id,10)||0};return void n.push({type:"run",content:[e]})}let l=e.marks.find(e=>"insertion"===e.type.name),s=e.marks.find(e=>"deletion"===e.type.name);if(l||s){o&&(n.push(o),o=null,i=null),a&&(n.push(a),a=null);let t=l||s,c=e.marks.filter(e=>"insertion"!==e.type.name&&"deletion"!==e.type.name),d=RE(c),u={type:"run",content:e.isText&&e.text?[{type:"text",text:e.text}]:[],...Object.keys(d).length>0?{formatting:d}:{}},p={id:t.attrs.revisionId,author:t.attrs.author||"Unknown",date:t.attrs.date||void 0},h=p.id,f=(r.insertionById.get(h)??0)>0,m=(r.deletionById.get(h)??0)>0,g=f&&m;return void(l?g?n.push({type:"moveTo",info:p,content:[u]}):n.push({type:"insertion",info:p,content:[u]}):g?n.push({type:"moveFrom",info:p,content:[u]}):n.push({type:"deletion",info:p,content:[u]}))}let c=e.marks.find(e=>"hyperlink"===e.type.name);if(c){let t=NE(c),r=a?.href||(a?.anchor?`#${a.anchor}`:"");return a&&r===t||(o&&(n.push(o),o=null,i=null),a&&n.push(a),a=AE(c)),void BE(a,e)}if(a&&(n.push(a),a=null),e.isText){let t=IE(e.marks);o&&i===t?FE(o,e.text||""):(o&&n.push(o),o=DE(e.text||"",e.marks),i=t)}else"hardBreak"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push(PE())):"image"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push(VE(e))):"shape"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push($E(e))):"tab"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push(OE())):"field"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push(LE(e,e.marks))):"sdt"===e.type.name?(o&&(n.push(o),o=null,i=null),n.push(ZE(e))):"math"===e.type.name&&(o&&(n.push(o),o=null,i=null),n.push(zE(e)))}),o&&n.push(o),a&&n.push(a),n}function ZE(e){let t=e.attrs,n={sdtType:t.sdtType??"richText",alias:t.alias??void 0,tag:t.tag??void 0,lock:t.lock??void 0,placeholder:t.placeholder??void 0,showingPlaceholder:t.showingPlaceholder??void 0,dateFormat:t.dateFormat??void 0,listItems:t.listItems?JSON.parse(t.listItems):void 0,checked:null!=t.checked?t.checked:void 0},r=qE(e).filter(e=>"run"===e.type||"hyperlink"===e.type||"simpleField"===e.type||"complexField"===e.type||"inlineSdt"===e.type||"mathEquation"===e.type);return{type:"inlineSdt",properties:n,content:r}}function UE(e){for(let t of e)for(let e of t.cells){let t=e.formatting?.borders;if(t){let e=t.top||t.left||t.right||t.bottom||t.insideH||t.insideV;return e?{top:t.top??e,bottom:t.bottom??e,left:t.left??e,right:t.right??e,insideH:t.insideH??t.bottom??e,insideV:t.insideV??t.right??e}:void 0}}}function KE(e,t){let n=[],r=[],o=0;for(let i=0;i<e.childCount;i++){let a=e.child(i),l=0;a.forEach(e=>{if("tableCell"!==e.type.name&&"tableHeader"!==e.type.name)return;for(;n[i]?.[l];)l++;let a=e.attrs.rowspan||1,s=e.attrs.colspan||1;r.push({row:i,col:l,rowspan:a,colspan:s,cell:JE(e,t)});for(let t=i;t<i+a;t++){let e=n[t]??[];n[t]=e;for(let t=l;t<l+s;t++)e[t]=!0}l+=s,o=Math.max(o,l)})}return{anchors:r,totalCols:o}}function GE(e,t){let n=e.attrs,{anchors:r,totalCols:o}=KE(e,t),i=new Map,a=new Map;for(let c of r){i.set(`${c.row}-${c.col}`,c);for(let e=c.row;e<c.row+c.rowspan;e++)for(let t=c.col;t<c.col+c.colspan;t++)a.set(`${e}-${t}`,c)}let l=[];for(let c=0;c<e.childCount;c++){let t=e.child(c),n=[];for(let e=0;e<o;){let t=i.get(`${c}-${e}`);if(t){let r={...t.cell.formatting??{}};t.colspan>1?r.gridSpan=t.colspan:delete r.gridSpan,t.rowspan>1?r.vMerge="restart":delete r.vMerge,n.push({...t.cell,formatting:Object.keys(r).length?r:void 0}),e+=t.colspan;continue}let r=a.get(`${c}-${e}`);if(!r){e++;continue}let o={...r.cell.formatting??{}};r.colspan>1?o.gridSpan=r.colspan:delete o.gridSpan,o.vMerge="continue",n.push({...r.cell,content:[],formatting:o}),e+=r.colspan}l.push({type:"tableRow",formatting:YE(t.attrs),cells:n})}let s=XE(n)||void 0;if(!s?.borders){let e=UE(l);if(e){if(!s)return{type:"table",columnWidths:n.columnWidths||void 0,formatting:{borders:e},rows:l};s.borders=e}}return{type:"table",columnWidths:n.columnWidths||void 0,formatting:s,rows:l}}function XE(e){if(e._originalFormatting){let t=e._originalFormatting,n={...t};e.styleId!==(t.styleId||void 0)&&(n.styleId=e.styleId||void 0),e.justification!==(t.justification||void 0)&&(n.justification=e.justification||void 0),e.floating!==(t.floating||void 0)&&(n.floating=e.floating||void 0),e.look!==(t.look||void 0)&&(n.look=e.look||void 0);let r=t.width?.value,o=t.width?.type;return(e.width!==r||e.widthType!==o)&&(null!=e.width||e.widthType?n.width={value:e.width??0,type:e.widthType||"dxa"}:n.width=void 0),e.cellMargins&&(n.cellMargins={top:null!=e.cellMargins.top?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:null!=e.cellMargins.bottom?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:null!=e.cellMargins.left?{value:e.cellMargins.left,type:"dxa"}:void 0,right:null!=e.cellMargins.right?{value:e.cellMargins.right,type:"dxa"}:void 0}),n}if(!(e.styleId||null!=e.width||e.widthType||e.justification||e.floating||e.cellMargins||e.look))return;let t,n=e.cellMargins?{top:null!=e.cellMargins.top?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:null!=e.cellMargins.bottom?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:null!=e.cellMargins.left?{value:e.cellMargins.left,type:"dxa"}:void 0,right:null!=e.cellMargins.right?{value:e.cellMargins.right,type:"dxa"}:void 0}:void 0;return(null!=e.width||e.widthType)&&(t={value:e.width??0,type:e.widthType||"dxa"}),{styleId:e.styleId||void 0,width:t,justification:e.justification||void 0,floating:e.floating||void 0,cellMargins:n,look:e.look||void 0}}function YE(e){if(e._originalFormatting){let t=e._originalFormatting,n={...t};return e.height!==(t.height?.value||void 0)&&(n.height=e.height?{value:e.height,type:"dxa"}:void 0),e.heightRule!==(t.heightRule||void 0)&&(n.heightRule=e.heightRule||void 0),e.isHeader!==(t.header||void 0)&&(n.header=e.isHeader||void 0),n}if(e.height||e.isHeader)return{height:e.height?{value:e.height,type:"dxa"}:void 0,heightRule:e.heightRule||void 0,header:e.isHeader||void 0}}function JE(e,t){let n=e.attrs,r=[];return e.forEach(e=>{"paragraph"===e.type.name?r.push(jE(e,t)):"table"===e.type.name&&r.push(GE(e,t))}),{type:"tableCell",formatting:QE(n),content:r}}function QE(e){if(e._originalFormatting){let t=e._originalFormatting,n={...t};if(e.colspan>1&&(n.gridSpan=e.colspan),null!=e.width&&(n.width={value:e.width,type:e.widthType||"dxa"}),e.verticalAlign!==(t.verticalAlign||void 0)&&(n.verticalAlign=e.verticalAlign||void 0),e.backgroundColor?e._originalResolvedFill===e.backgroundColor&&t.shading?n.shading=t.shading:n.shading={fill:{rgb:e.backgroundColor}}:t.shading&&(n.shading=void 0),e.borders&&(n.borders=e.borders),e.margins){let t=e.margins,r={};null!=t.top&&(r.top={value:t.top,type:"dxa"}),null!=t.bottom&&(r.bottom={value:t.bottom,type:"dxa"}),null!=t.left&&(r.left={value:t.left,type:"dxa"}),null!=t.right&&(r.right={value:t.right,type:"dxa"}),n.margins=r}return e.textDirection!==(t.textDirection||void 0)&&(n.textDirection=e.textDirection||void 0),n}if(!(e.colspan>1||e.rowspan>1||null!=e.width||e.verticalAlign||e.backgroundColor||e.borders||e.margins||e.textDirection))return;let t;if(e.margins){let n=e.margins;t={},null!=n.top&&(t.top={value:n.top,type:"dxa"}),null!=n.bottom&&(t.bottom={value:n.bottom,type:"dxa"}),null!=n.left&&(t.left={value:n.left,type:"dxa"}),null!=n.right&&(t.right={value:n.right,type:"dxa"})}return{gridSpan:e.colspan>1?e.colspan:void 0,width:null!=e.width?{value:e.width,type:e.widthType||"dxa"}:void 0,verticalAlign:e.verticalAlign||void 0,textDirection:e.textDirection||void 0,shading:e.backgroundColor?{fill:{rgb:e.backgroundColor}}:void 0,borders:e.borders,margins:t}}function e_(e){let t=e.attrs,n=[];e.forEach(e=>{"paragraph"===e.type.name&&n.push(jE(e))});let r={type:"shape",shapeType:"rect",id:t.textBoxId||void 0,size:{width:t.width?Js(t.width):0,height:t.height?Js(t.height):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:null!=t.marginTop?Js(t.marginTop):void 0,bottom:null!=t.marginBottom?Js(t.marginBottom):void 0,left:null!=t.marginLeft?Js(t.marginLeft):void 0,right:null!=t.marginRight?Js(t.marginRight):void 0}}},o=Ak(t);o&&(r.position=o);let i=Bk(t);if(i&&(r.wrap=i),t.fillColor&&(r.fill={type:"solid",color:{rgb:t.fillColor.replace("#","")}}),t.outlineWidth&&t.outlineWidth>0){let e={solid:"solid",dotted:"dot",dashed:"dash"};r.outline={width:Js(t.outlineWidth),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&e[t.outlineStyle]||"solid"}}return{type:"run",content:[{type:"shape",shape:r}]}}function t_(e){return{type:"paragraph",content:[e_(e)]}}function n_(e,t){let n={content:r_(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections,comments:t?.package.document.comments};return t?{...t,package:{...t.package,document:n}}:{package:{document:n}}}function r_(e){let t=[],n=ME(e),r=[],o=()=>{for(let e of r)t.push({type:"paragraph",content:[e]});r=[]};return e.forEach(e=>{if("paragraph"===e.type.name){let o=jE(e,n);r.length>0&&(o.content=[...r,...o.content],r=[]),t.push(o)}else if("table"===e.type.name)o(),t.push(GE(e,n));else if("textBox"===e.type.name){let n=e.attrs;Rk(n)?r.push(e_(e)):(o(),t.push(t_(e)))}else"pageBreak"===e.type.name&&(o(),t.push(o_()))}),o(),t}function o_(){return{type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function i_(e){return r_(e)}var a_={top:4,bottom:4,left:7,right:7},l_=200;function s_(e,t){let n=e.kind??"<unknown>";throw new Error(`${t}: unhandled FlowBlock kind "${n}". Add the case alongside the other FlowBlock switches (see types.ts).`)}function c_(e){return e/1440*96}function d_(e,t,n){if(!n||t<=n)return{width:e,height:t};let r=n/t;return{width:Math.round(e*r),height:n}}var u_=0;function p_(){return"block-"+ ++u_}function h_(e,t){let n={};for(let r of e)switch(r.type.name){case"bold":n.bold=!0;break;case"italic":n.italic=!0;break;case"underline":{let e=r.attrs;if(e.style||e.color){let r=e.color?uh(e.color,t):void 0;n.underline={style:e.style,color:r}}else n.underline=!0;break}case"strike":n.strike=!0;break;case"textColor":{let e=r.attrs;(e.themeColor||e.rgb)&&(n.color=uh({rgb:e.rgb,themeColor:e.themeColor,themeTint:e.themeTint,themeShade:e.themeShade},t));break}case"highlight":n.highlight=gh(r.attrs.color);break;case"fontSize":{let e=r.attrs;n.fontSize=e.size/2;break}case"fontFamily":{let e=r.attrs;n.fontFamily=e.ascii||e.hAnsi;break}case"characterSpacing":{let e=r.attrs;null!=e.spacing&&0!==e.spacing&&(n.letterSpacing=c_(e.spacing)),null!=e.position&&0!==e.position&&(n.positionPx=ec(e.position)),null!=e.scale&&100!==e.scale&&(n.horizontalScale=e.scale),null!=e.kerning&&e.kerning>0&&(n.kerningMinPt=tc(e.kerning));break}case"allCaps":n.allCaps=!0;break;case"smallCaps":n.smallCaps=!0;break;case"emboss":n.emboss=!0;break;case"imprint":n.imprint=!0;break;case"textShadow":n.textShadow=!0;break;case"textOutline":n.textOutline=!0;break;case"hidden":n.hidden=!0;break;case"rtl":n.rtl=!0;break;case"textEffect":{let e=r.attrs.effect;("blinkBackground"===e||"lights"===e||"antsBlack"===e||"antsRed"===e||"shimmer"===e||"sparkle"===e)&&(n.textEffect=e);break}case"emphasisMark":{let e=r.attrs.type;n.emphasisMark="dot"===e||"comma"===e||"circle"===e||"underDot"===e?e:"dot";break}case"superscript":n.superscript=!0;break;case"subscript":n.subscript=!0;break;case"hyperlink":{let e=r.attrs;n.hyperlink={href:e.href,tooltip:e.tooltip};break}case"footnoteRef":{let e=r.attrs,t="string"==typeof e.id?parseInt(e.id,10):e.id;"endnote"===e.noteType?n.endnoteRefId=t:n.footnoteRefId=t;break}case"comment":{let e=r.attrs.commentId;e&&(n.commentIds||(n.commentIds=[]),n.commentIds.push(e));break}case"insertion":n.isInsertion=!0,n.changeAuthor=r.attrs.author,n.changeDate=r.attrs.date,n.changeRevisionId=r.attrs.revisionId;break;case"deletion":n.isDeletion=!0,n.changeAuthor=r.attrs.author,n.changeDate=r.attrs.date,n.changeRevisionId=r.attrs.revisionId;break}return n}function f_(e){let t=e.defaultTextFormatting;if(!t)return{};let n={};if(t.fontFamily){let e=t.fontFamily.ascii||t.fontFamily.hAnsi;e&&(n.fontFamily=e)}return null!=t.fontSize&&(n.fontSize=t.fontSize/2),n}function m_(e){e.hyperlink&&(e.hyperlink={...e.hyperlink,noDefaultStyle:!0},delete e.color,delete e.underline)}function g_(e,t,n){let r=[],o=t+1,i=n.theme,a=f_(e.attrs),l=e.attrs.styleId,s="string"==typeof l&&/^TOC\d*$/i.test(l);function c(e,t){if(e.isText&&e.text){let n=h_(e.marks,i);s&&m_(n);let o={kind:"text",text:e.text,...a,...n,pmStart:t,pmEnd:t+e.nodeSize};r.push(o)}else if("hardBreak"===e.type.name)r.push({kind:"lineBreak",pmStart:t,pmEnd:t+e.nodeSize});else if("tab"===e.type.name){let n=h_(e.marks,i),o={kind:"tab",...a,...n,pmStart:t,pmEnd:t+e.nodeSize};r.push(o)}else if("image"===e.type.name){let o=e.attrs,i=d_(o.width||100,o.height||100,n.pageContentHeight),a={kind:"image",src:o.src,width:i.width,height:i.height,alt:o.alt,transform:o.transform,wrapType:o.wrapType,displayMode:o.displayMode,cssFloat:o.cssFloat,distTop:o.distTop,distBottom:o.distBottom,distLeft:o.distLeft,distRight:o.distRight,position:o.position,cropTop:o.cropTop,cropRight:o.cropRight,cropBottom:o.cropBottom,cropLeft:o.cropLeft,opacity:o.opacity,pmStart:t,pmEnd:t+e.nodeSize};r.push(a)}else if("field"===e.type.name){let n=e.attrs.fieldType,o="PAGE"===n?"PAGE":"NUMPAGES"===n?"NUMPAGES":"DATE"===n?"DATE":"TIME"===n?"TIME":"OTHER",l=h_(e.marks,i);s&&m_(l),r.push({kind:"field",fieldType:o,fallback:e.attrs.displayText||"",...a,...l,pmStart:t,pmEnd:t+e.nodeSize})}else if("math"===e.type.name){let n=e.attrs.plainText||"[equation]";r.push({kind:"text",text:n,italic:!0,fontFamily:"Cambria Math",pmStart:t,pmEnd:t+e.nodeSize})}else if("sdt"===e.type.name){let n=t+1;e.forEach((e,t)=>{c(e,n+t)})}}return e.forEach((e,t)=>{c(e,o+t)}),r}function v_(e){return Math.max(1,Math.round(e/8*1.333))}var y_={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",wave:"solid",doubleWave:"double",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function b_(e,t){if(!e||!e.style||"none"===e.style||"nil"===e.style)return;let n={style:y_[e.style]||"solid",width:v_(e.size??0),color:e.color?uh(e.color,t):"#000000"};return void 0!==e.space&&(n.space=Qs(e.space)),n}function w_(e,t){let n=e.borders;if(!n)return;let r={},o=["top","bottom","left","right"];for(let i of o){let e=n[i],o=e?b_(e,t):void 0;r[i]=o??{width:0,style:"none"}}return Object.keys(r).length>0?r:void 0}function k_(e,t){let n=[];for(let r=0;r<=t;r+=1){let t=e[r]??0;if(t<=0)break;n.push(t)}return 0===n.length?"1.":`${n.join(".")}.`}var x_=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function S_(e,t){if(e<=0)return"";let n=e,r="";for(let[o,i]of x_)for(;n>=o;)r+=i,n-=o;return t?r:r.toLowerCase()}function C_(e,t){if(e<=0)return"";let n=e,r="";for(;n>0;){let e=(n-1)%26;r=String.fromCharCode(65+e)+r,n=Math.floor((n-1)/26)}return t?r:r.toLowerCase()}function T_(e,t){if(e<=0)return"";switch(t){case"upperRoman":return S_(e,!0);case"lowerRoman":return S_(e,!1);case"upperLetter":return C_(e,!0);case"lowerLetter":return C_(e,!1);case"decimalZero":return e<10?`0${e}`:String(e);case"none":return"";default:return String(e)}}function E_(e,t,n){return e.replace(/%(\d)([.):\]])?/g,(e,r,o="")=>{let i=parseInt(r,10)-1;if(i<0)return"";let a=t[i]??0,l=n?.[i]??"decimal",s=T_(a,l);return s?s+o:""})}function __(e,t,n){let r=e.numPr;if(!r)return null;let o=r.numId;if(null==o||0===o)return null;if(e.listIsBullet)return bT(e.listMarker||"");let i=r.ilvl??0,a=e.listAbstractNumId??o,l=t.get(a)??new Array(9).fill(0),s=`${o}:${i}`;n.has(s)||(n.add(s),null!=e.listStartOverride&&(l[i]=e.listStartOverride-1)),l[i]=(l[i]??0)+1;for(let c=i+1;c<l.length;c+=1)l[c]=0;return t.set(a,l),e.listMarker&&e.listMarker.includes("%")?E_(e.listMarker,l,e.listLevelNumFmts??void 0):e.listMarker?e.listMarker:k_(l,i)}var M_="Calibri",N_=11;function I_(e,t,n,r){let o={};if(e.alignment){let t=e.alignment;"both"===t||"distribute"===t?o.alignment="justify":"left"===t?o.alignment="left":"center"===t?o.alignment="center":"right"===t&&(o.alignment="right")}(null!=e.spaceBefore||null!=e.spaceAfter||null!=e.lineSpacing)&&(o.spacing={},null!=e.spaceBefore&&(o.spacing.before=c_(e.spaceBefore)),null!=e.spaceAfter&&(o.spacing.after=c_(e.spaceAfter)),null!=e.lineSpacing&&("exact"===e.lineSpacingRule||"atLeast"===e.lineSpacingRule?(o.spacing.line=c_(e.lineSpacing),o.spacing.lineUnit="px",o.spacing.lineRule=e.lineSpacingRule):(o.spacing.line=e.lineSpacing/240,o.spacing.lineUnit="multiplier",o.spacing.lineRule="auto"))),e.spacingExplicit&&(o.spacingExplicit=e.spacingExplicit);let i=e.indentLeft,a=e.indentFirstLine,l=e.hangingIndent;if(e.numPr?.numId&&null==i&&(i=720*((e.numPr.ilvl??0)+1),null==a&&(a=-360,l=!0)),(null!=i||null!=e.indentRight||null!=a)&&(o.indent={},null!=i&&(o.indent.left=c_(i)),null!=e.indentRight&&(o.indent.right=c_(e.indentRight)),null!=a&&(l?o.indent.hanging=Math.abs(c_(a)):o.indent.firstLine=c_(a))),e.styleId&&(o.styleId=e.styleId),e.borders){let n=e.borders;o.borders={};let r=e=>e?b_(e,t):void 0;n.top&&(o.borders.top=r(n.top)),n.bottom&&(o.borders.bottom=r(n.bottom)),n.left&&(o.borders.left=r(n.left)),n.right&&(o.borders.right=r(n.right)),n.between&&(o.borders.between=r(n.between)),n.bar&&(o.borders.bar=r(n.bar)),!o.borders.top&&!o.borders.bottom&&!o.borders.left&&!o.borders.right&&!o.borders.between&&!o.borders.bar&&delete o.borders}let s=ph(e.shading?.fill,t);s&&(o.shading=`#${s}`),e.tabs&&e.tabs.length>0&&(o.tabs=e.tabs.map(e=>({val:R_(e.alignment),pos:e.position,leader:e.leader}))),e.pageBreakBefore&&(o.pageBreakBefore=!0),e.keepNext&&(o.keepNext=!0),e.keepLines&&(o.keepLines=!0),e.contextualSpacing&&(o.contextualSpacing=!0),e.bidi&&(o.bidi=!0),e.styleId&&(o.styleId=e.styleId),e.numPr&&(o.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl});let c=n&&r?__(e,n,r):null;null!=c?o.listMarker=c:e.listMarker&&(o.listMarker=e.listMarker),null!=e.listIsBullet&&(o.listIsBullet=e.listIsBullet),e.listMarkerHidden&&(o.listMarkerHidden=!0),e.listMarkerFontFamily&&(o.listMarkerFontFamily=e.listMarkerFontFamily),e.listMarkerFontSize&&(o.listMarkerFontSize=e.listMarkerFontSize);let d=e.defaultTextFormatting;return d&&(null!=d.fontSize&&(o.defaultFontSize=d.fontSize/2),d.fontFamily&&(o.defaultFontFamily=d.fontFamily.ascii||d.fontFamily.hAnsi)),o}function R_(e){switch(e){case"left":return"start";case"right":return"end";case"center":return"center";case"decimal":return"decimal";case"bar":return"bar";case"clear":return"clear";case"num":return"start";default:return"start"}}function A_(e,t,n){let r=e.attrs,o=g_(e,t,n),i=I_(r,n.theme,n.listCounters,n.listSeenNumIds);return{kind:"paragraph",id:p_(),runs:o,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function B_(e,t,n,r){let o=[],i=t+1;e.forEach(e=>{"paragraph"===e.type.name?o.push(A_(e,i,n)):"table"===e.type.name&&o.push(F_(e,i,n)),i+=e.nodeSize});let a=e.attrs,l=a.width,s=a.widthType,c=!l||s&&"dxa"!==s&&"auto"!==s?void 0:c_(l),d=a.margins,u=(e,t)=>{if(null!=e){let t=c_(e);if(t>0)return t}if(null!=t){let e=c_(t);if(e>=0)return e}return 0},p={top:u(d?.top,r?.top),right:u(d?.right,r?.right),bottom:u(d?.bottom,r?.bottom),left:u(d?.left,r?.left)};return{id:p_(),blocks:o,colSpan:a.colspan,rowSpan:a.rowspan,width:c,widthValue:l,widthType:s,verticalAlign:a.verticalAlign,background:a.backgroundColor?`#${a.backgroundColor}`:void 0,borders:w_(a,n.theme),padding:p,noWrap:a.noWrap||void 0}}function D_(e,t,n,r){let o=[],i=t+1;e.forEach(e=>{("tableCell"===e.type.name||"tableHeader"===e.type.name)&&o.push(B_(e,i,n,r)),i+=e.nodeSize});let a=e.attrs;return{id:p_(),cells:o,height:a.height?c_(a.height):void 0,heightRule:a.heightRule??void 0,isHeader:a.isHeader}}function F_(e,t,n){let r=[],o=t+1,i=e.attrs.cellMargins;e.forEach(e=>{"tableRow"===e.type.name&&r.push(D_(e,o,n,i)),o+=e.nodeSize});let a=e.attrs.columnWidths?.map(c_),l=e.attrs.width,s=e.attrs.widthType;if(!a&&r.length>0){let e=r[0].cells.map(e=>e.width);e.every(e=>void 0!==e&&e>0)&&(a=e)}let c=e.attrs.justification,d=e.attrs._originalFormatting,u=d?.indent?.value&&"dxa"===d.indent.type?c_(d.indent.value):void 0,p=e.attrs.floating,h=p?{horzAnchor:p.horzAnchor,vertAnchor:p.vertAnchor,tblpX:void 0!==p.tblpX?c_(p.tblpX):void 0,tblpXSpec:p.tblpXSpec,tblpY:void 0!==p.tblpY?c_(p.tblpY):void 0,tblpYSpec:p.tblpYSpec,topFromText:void 0!==p.topFromText?c_(p.topFromText):void 0,bottomFromText:void 0!==p.bottomFromText?c_(p.bottomFromText):void 0,leftFromText:void 0!==p.leftFromText?c_(p.leftFromText):void 0,rightFromText:void 0!==p.rightFromText?c_(p.rightFromText):void 0}:void 0;return{kind:"table",id:p_(),rows:r,columnWidths:a,width:l,widthType:s,justification:c,indent:u,floating:h,pmStart:t,pmEnd:t+e.nodeSize}}function P_(e,t,n){let r=e.attrs,o=r.wrapType,i="behind"===o||"inFront"===o,a=d_(r.width||100,r.height||100,n);return{kind:"image",id:p_(),src:r.src,width:a.width,height:a.height,alt:r.alt,transform:r.transform,anchor:i?{isAnchored:!0,offsetH:r.distLeft,offsetV:r.distTop,behindDoc:"behind"===o}:void 0,hlinkHref:r.hlinkHref,pmStart:t,pmEnd:t+e.nodeSize}}function O_(e,t,n){let r=e.attrs,o=[];return e.forEach((e,r)=>{if("paragraph"===e.type.name){let i=A_(e,t+1+r,n);o.push(i)}}),{kind:"textBox",id:p_(),width:r.width??l_,height:r.height??void 0,fillColor:r.fillColor,outlineWidth:r.outlineWidth,outlineColor:r.outlineColor,outlineStyle:r.outlineStyle,margins:{top:r.marginTop??a_.top,bottom:r.marginBottom??a_.bottom,left:r.marginLeft??a_.left,right:r.marginRight??a_.right},content:o,displayMode:r.displayMode,cssFloat:r.cssFloat,wrapType:r.wrapType,wrapText:r.wrapText,anchorTarget:r.anchorTarget,position:r.position,distTop:r.distTop,distBottom:r.distBottom,distLeft:r.distLeft,distRight:r.distRight,pmStart:t,pmEnd:t+e.nodeSize}}function L_(e,t={}){let n={...t,defaultFont:t.defaultFont??M_,defaultSize:t.defaultSize??N_},r=[],o=0,i={top:1440,bottom:1440,left:1440,right:1440};return n.listCounters||(n.listCounters=new Map),n.listSeenNumIds||(n.listSeenNumIds=new Set),e.forEach((e,t)=>{let a=o+t;switch(e.type.name){case"paragraph":{let t=A_(e,a,n),o=e.attrs;r.push(t);let l=o._sectionProperties;if(l||o.sectionBreakType){let e={kind:"sectionBreak",id:p_(),type:l?.sectionStart??o.sectionBreakType};if(l){if((void 0!==l.pageWidth||void 0!==l.pageHeight)&&(e.pageSize={w:c_(l.pageWidth??12240),h:c_(l.pageHeight??15840)}),void 0!==l.marginTop||void 0!==l.marginBottom||void 0!==l.marginLeft||void 0!==l.marginRight){let t={top:l.marginTop??i.top,bottom:l.marginBottom??i.bottom,left:l.marginLeft??i.left,right:l.marginRight??i.right};e.margins={top:c_(t.top),bottom:c_(t.bottom),left:c_(t.left),right:c_(t.right)},i=t}let t=l.columnCount??1;if(t>1){let n={count:t,gap:c_(l.columnSpace??720),equalWidth:l.equalWidth??!0,separator:l.separator};e.columns=n}}r.push(e)}}break;case"table":r.push(F_(e,a,n));break;case"image":r.push(P_(e,a,n.pageContentHeight));break;case"textBox":r.push(O_(e,a,n));break;case"horizontalRule":case"pageBreak":{let t={kind:"pageBreak",id:p_(),pmStart:a,pmEnd:a+e.nodeSize};r.push(t);break}}}),r}var z_=96,V_=11,$_="Calibri",j_=1,H_=.8,W_=.2,q_=null;function Z_(){if(!q_){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(q_=e.getContext("2d"),!q_)throw new Error("Failed to get 2D context from canvas")}return q_}var U_=new Map;function K_(e){let t=U_.get(e);if(void 0===t){let n=Jp(e);t={cssFallback:n.cssFallback,singleLineRatio:n.singleLineRatio},U_.set(e,t)}return t}function G_(e){return K_(e).cssFallback}function X_(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let n=e.fontSize??V_,r=Q_(n);t.push(`${r}px`);let o=e.fontFamily??$_;return t.push(G_(o)),t.join(" ")}function Y_(e){let t=e.fontSize??V_,n=e.fontFamily??$_,r=Q_(t),o=r*H_,i=r*W_,a=r*j_;try{let t=Z_();t.font=X_(e);let n=t.measureText("Hg");"number"==typeof n.actualBoundingBoxAscent&&"number"==typeof n.actualBoundingBoxDescent&&(o=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent)}catch{}a=Math.max(a,o+i);let l=K_(n).singleLineRatio;return{fontSize:t,ascent:o,descent:i,lineHeight:a,fontFamily:n,singleLineRatio:l}}function J_(e,t){if(!e)return 0;let n=Z_();n.font=X_(t);let r=n.measureText(e).width;return t.letterSpacing&&e.length>1&&(r+=t.letterSpacing*(e.length-1)),r}function Q_(e){return e*z_/72}function eM(e,t){return e.map(e=>{let n,r=e.x-e.distLeft,o=e.x+e.width+e.distRight,i=e.y-e.distTop,a=e.y+e.height+e.distBottom,l=0,s=0,c=e.wrapText??"bothSides";"right"===c?l=lM(o):"left"===c?s=sM(r,t):"largest"===c?({leftMargin:l,rightMargin:s}=aM(r,o,t)):oM(r,o,t)?n=iM(r,o,t):"left"===e.side?l=lM(o):s=sM(r,t);let d=IM(l,s,t);return{leftMargin:d.leftMargin,rightMargin:d.rightMargin,topY:i,bottomY:a,segments:n}})}function tM(e,t){return e.segments?.reduce((e,t)=>e+t.availableWidth,0)??t-e.leftMargin-e.rightMargin}function nM(e,t,n,r){if(!n||0===n.length)return{leftMargin:0,rightMargin:0};let o,i=0,a=0,l=r+e,s=l+t;for(let c of n)if(!(s<=c.topY||l>=c.bottomY)){if(c.segments?.length){o=o?rM(o,c.segments):c.segments;continue}i=Math.max(i,c.leftMargin),a=Math.max(a,c.rightMargin)}return{leftMargin:i,rightMargin:a,segments:o}}function rM(e,t){let n=[];for(let r of e)for(let e of t){let t=Math.max(r.leftOffset,e.leftOffset),o=Math.min(r.leftOffset+r.availableWidth,e.leftOffset+e.availableWidth);o>t&&n.push({leftOffset:t,availableWidth:o-t})}return n}function oM(e,t,n){return e>0&&t<n}function iM(e,t,n){return[{leftOffset:0,availableWidth:Math.max(0,e)},{leftOffset:Math.max(0,t),availableWidth:Math.max(0,n-t)}].filter(e=>e.availableWidth>1)}function aM(e,t,n){let r=Math.max(0,e);return Math.max(0,n-t)>=r?{leftMargin:lM(t),rightMargin:0}:{leftMargin:0,rightMargin:sM(e,n)}}function lM(e){return Math.max(0,e)}function sM(e,t){return Math.max(0,t-e)}function cM(e){return e/1440*96}function dM(e){return e/96*1440}function uM(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:r=0}=e,o=t.filter(e=>"clear"!==e.val).filter(e=>e.pos>=r),i=t.filter(e=>"clear"===e.val).map(e=>e.pos),a=o.reduce((e,t)=>Math.max(e,t.pos),0),l=[...o];r>0&&!o.some(e=>e.pos<=r)&&(i.some(e=>Math.abs(e-r)<20)||l.push({val:"start",pos:r,leader:"none"}));let s=a>0?Math.max(a,r):r,c=r+14400;for(;s<c;){s+=n;let e=o.some(e=>Math.abs(e.pos-s)<20),t=i.some(e=>Math.abs(e-s)<20),a=r>0&&Math.abs(s-r)<20;!e&&!t&&!a&&l.push({val:"start",pos:s,leader:"none"})}return l.sort((e,t)=>e.pos-t.pos)}function pM(e,t,n={}){let{defaultTabInterval:r=720}=t,o=dM(e),i=uM(t).find(e=>e.pos>o);if(!i){let t=cM(r),n=t-e%t;return n<=0&&(n=t),{width:n,alignment:"default"}}let a=cM(i.pos)-e;if("center"===i.val)a-=(n.followingWidth??0)/2;else if("end"===i.val)a-=n.followingWidth??0;else if("decimal"===i.val)a-=n.decimalPrefixWidth??0;else if("bar"===i.val)return{width:0,leader:i.leader,alignment:"bar"};if(a<1){let t=cM(r),n=t-e%t;return n<=0&&(n=t),{width:n,alignment:"default"}}return{width:a,leader:i.leader,alignment:i.val}}var hM=11,fM="Calibri",mM=1.15,gM=1,vM=.5;function yM(e,t,n,r=!1){let o=1,i=e.length,a=0;for(;o<=i;){let r=o+i>>>1;J_(e.slice(0,r),t)<=n?(a=r,o=r+1):i=r-1}return r&&0===a?1:a}function bM(e){return{fontFamily:e.fontFamily??fM,fontSize:e.fontSize??hM,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function wM(e,t,n){let r,o=Q_(e),i=n?.ascent??.8*o,a=n?.descent??.2*o,l=n?.singleLineRatio??1.15,s=o*l;if("exact"===t?.lineRule&&void 0!==t.line)r=t.line;else if("atLeast"===t?.lineRule&&void 0!==t.line){let e=s*gM;r=Math.max(t.line,e)}else r=void 0!==t?.line&&"multiplier"===t?.lineUnit?s*t.line:void 0!==t?.line&&"px"===t?.lineUnit?t.line:s*gM;return{ascent:i,descent:a,lineHeight:r}}function kM(e,t,n){let r=Y_({fontSize:e,fontFamily:n??fM}),o=wM(e,t,r),i=t?.lineRule??"auto";if("auto"===i||"atLeast"===i){let t=Q_(e),n=Math.max(o.lineHeight,t*mM);if(n!==o.lineHeight)return{...o,lineHeight:n}}return o}function xM(e){return"text"===e.kind}function SM(e){return"tab"===e.kind}function CM(e){return"image"===e.kind}function TM(e){return"lineBreak"===e.kind}function EM(e){return"field"===e.kind}function _M(e){return!e.text||0===e.text.replace(/\u00a0/g," ").trim().length}function MM(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e[r];if(SM(t)||TM(t))break;if(xM(t))n+=J_(t.text||"",bM(t));else if(EM(t)){let e={fontFamily:t.fontFamily??fM,fontSize:t.fontSize??hM,bold:t.bold,italic:t.italic};n+=J_(t.fallback||"1",e)}else CM(t)&&(n+=t.width||0)}return n}function NM(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];(" "===r||"-"===r||"\t"===r)&&t.push(n+1)}return t}function IM(e,t,n){let r=Math.max(1,n),o=Math.max(0,e),i=Math.max(0,t);return o>=r||i>=r||o+i>=r?{leftMargin:0,rightMargin:0}:{leftMargin:o,rightMargin:i}}function RM(e,t,n){let r=e.runs,o=e.attrs,i=o?.spacing,a=n?.floatingZones,l=n?.paragraphYOffset??0,s=o?.indent,c=s?.left??0,d=s?.right??0,u=(s?.firstLine??0)-(s?.hanging??0),p=Math.max(1,t-c-d),h=Math.max(1,p-u),f=0,m=Q_(hM)*gM,g=nM(0,m,a,l),v=Math.max(1,tM(g,h)),y=[];if(0===r.length){if(o?.suppressEmptyParagraphHeight)return y.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,ascent:0,descent:0,lineHeight:0}),{kind:"paragraph",lines:y,totalHeight:0};let e=o?.defaultFontSize??hM,t=o?.defaultFontFamily??fM,n=kM(e,i,t);y.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...n});let r=n.lineHeight;return i?.before&&(r+=i.before),i?.after&&(r+=i.after),{kind:"paragraph",lines:y,totalHeight:r}}if(1===r.length&&xM(r[0])&&_M(r[0])){let e=r[0],t=e.fontSize??o?.defaultFontSize??hM,n=e.fontFamily??o?.defaultFontFamily??fM,a=kM(t,i,n);y.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...a});let l=a.lineHeight;return i?.before&&(l+=i.before),i?.after&&(l+=i.after),{kind:"paragraph",lines:y,totalHeight:l}}let b={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:hM,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:v,leftOffset:g.leftMargin,rightOffset:g.rightMargin,segmentZones:g.segments},w=()=>{let e=wM(b.maxFontSize,i,b.maxFontMetrics),t={...e};if(b.maxImageHeightPx>t.lineHeight){let e=b.maxImageHeightPx,n=t.descent;t.lineHeight=e+2*n,t.ascent=e+n}let n={fromRun:b.fromRun,fromChar:b.fromChar,toRun:b.toRun,toChar:b.toChar,width:b.width,...t};b.leftOffset>0&&(n.leftOffset=b.leftOffset),b.rightOffset>0&&(n.rightOffset=b.rightOffset),b.segmentZones?.length&&(n.segments=k(n,b.segmentZones)),y.push(n),f+=e.lineHeight},k=(e,t)=>{let n=t[0],o=t[1];if(!n)return;if(!o||e.width<=n.availableWidth+vM)return[{fromRun:e.fromRun,fromChar:e.fromChar,toRun:e.toRun,toChar:e.toChar,width:e.width,leftOffset:n.leftOffset,availableWidth:n.availableWidth}];if(e.fromRun!==e.toRun)return;let i=r[e.fromRun];if(!i||!xM(i))return;let a=i,l=a.text.slice(e.fromChar,e.toChar),s=bM(a),c=yM(l,s,n.availableWidth);if(c<=0||c>=l.length)return;let d=e.fromChar+c,u=l.slice(0,c),p=l.slice(c);return[{fromRun:e.fromRun,fromChar:e.fromChar,toRun:e.toRun,toChar:d,width:J_(u,s),leftOffset:n.leftOffset,availableWidth:n.availableWidth},{fromRun:e.fromRun,fromChar:d,toRun:e.toRun,toChar:e.toChar,width:J_(p,s),leftOffset:o.leftOffset,availableWidth:o.availableWidth}]},x=(e,t)=>{w();let n=Q_(hM)*gM,r=nM(f,n,a,l),o=Math.max(1,tM(r,p));b={fromRun:e,fromChar:t,toRun:e,toChar:t,width:0,maxFontSize:hM,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:o,leftOffset:r.leftMargin,rightOffset:r.rightMargin,segmentZones:r.segments}},S=e=>{let t=e.fontSize??hM;(!b.maxFontMetrics||t>b.maxFontSize)&&(b.maxFontSize=t,b.maxFontMetrics=Y_(e))};for(let E=0;E<r.length;E++){let e=r[E];if(TM(e))b.toRun=E,b.toChar=0,x(E+1,0);else{if(SM(e)){let t=bM(e);S(t);let n=MM(r,E),i=b.width+(b.leftOffset??0),a=0===y.length,l=c+(a?u:0)+i,s={explicitStops:o?.tabs,leftIndent:dM(c)},d=pM(l,s,{followingWidth:n}).width;if(i+d>b.availableWidth+vM){let e=b.availableWidth-i-n;e>1&&(d=e)}b.width+d>b.availableWidth+vM&&(x(E,0),S(t)),b.width+=d,b.toRun=E,b.toChar=1;continue}if(CM(e)){let t=e.wrapType,n="float"===e.displayMode||Mk(t);if(e.position&&n){b.toRun=E,b.toChar=1;continue}if("topAndBottom"===t||"block"===e.displayMode){b.width>0&&x(E,0);let t=e.height,n=e.distTop??6,r=e.distBottom??6;b.toRun=E,b.toChar=1,b.maxImageHeightPx=t+n+r,x(E+1,0);continue}let r=e.width,o=e.height;o>b.maxImageHeightPx&&(b.maxImageHeightPx=o),b.width+r>b.availableWidth+vM&&x(E,0),b.width+=r,b.toRun=E,b.toChar=1;continue}if(EM(e)){let t=e.fallback||"1",n={fontFamily:e.fontFamily??fM,fontSize:e.fontSize??hM,bold:e.bold,italic:e.italic};S(n);let r=J_(t,n);b.width>0&&b.width+r>b.availableWidth+vM&&(x(E,0),S(n)),b.width+=r,b.toRun=E,b.toChar=1;continue}if(xM(e)){let t=e,n=t.text,r=bM(t);if(S(r),!n||0===n.length){b.toRun=E,b.toChar=0;continue}let o=NM(n),i=0;for(;i<n.length;){let e=n.length;for(let n of o)if(n>i){e=n;break}let t=n.slice(i,e),a=J_(t,r);if(a>b.availableWidth+vM){let n=0;for(;n<t.length;){let e=b.availableWidth-b.width+vM,o=t.slice(n),a=yM(o,r,e);if(0===a){if(b.width>0){x(E,i+n),S(r);continue}a=1}let l=n+a,s=t.slice(n,l),c=J_(s,r);b.width+=c,b.toRun=E,b.toChar=i+l,n=l,n<t.length&&(x(E,i+n),S(r))}i=e;continue}b.width>0&&b.width+a>b.availableWidth+vM&&(x(E,i),S(r)),b.width+=a,b.toRun=E,b.toChar=e,i=e}}}}w();let C=y.reduce((e,t)=>e+t.lineHeight,0);o?.listMarker&&!o?.listMarkerHidden&&0===(s?.hanging??0)&&y.length>0&&(C+=y[0].lineHeight);let T=C;return i?.before&&(T+=i.before),i?.after&&(T+=i.after),{kind:"paragraph",lines:y,totalHeight:T}}new Map;new Map;new Map;function AM(e,t,n){if(e&&!(e<=0)){if("pct"===t)return n*e/5e3;if(!t||"dxa"===t||"auto"===t)return Gs(e)}}function BM(e){return Math.max(1,...e.rows.map(e=>e.cells.reduce((e,t)=>e+Math.max(1,t.colSpan??1),0)))}function DM(e,t,n){if(t<=0)return[];let r=n>0?n/t:0;if(0===e.length)return Array(t).fill(r);let o=e.slice(0,t),i=t-o.length;if(i>0){let e=o.filter(e=>e>0),t=e.length>0?e.reduce((e,t)=>e+t,0)/e.length:r;o=o.concat(Array(i).fill(t))}let a=o.reduce((e,t)=>e+(t>0?t:0),0),l=o.filter(e=>e<=0).length;if(a<=0)return Array(t).fill(r);if(0===l)return o;let s=Math.max(0,n-a),c=s>0?s/l:a/Math.max(1,t-l);return o.map(e=>e>0?e:c)}function FM(e){if("paragraph"!==e.kind)return!1;let t=e.attrs;return!!t&&!!(t.borders?.top||t.borders?.bottom||t.spacingExplicit?.before||t.spacingExplicit?.after)}function PM(e){return OM(e)}function OM(e){let t=new Set;for(let n=1;n<e.length;n++){let r=e[n-1],o=e[n];"table"===r.kind&&"paragraph"===o.kind&&(o.runs.length>0||FM(o)||t.add(n))}return e.map((e,n)=>{if("table"===e.kind)return LM(e);if("paragraph"!==e.kind)return e;let r=t.has(n),o=e.attrs?.spacingExplicit,i=null!=e.attrs?.spacing?.before,a=null!=e.attrs?.spacing?.after,l=i&&!o?.before,s=a&&!o?.after,c=l||s;if(!c&&!r)return e;let d=e.attrs;return c&&d?.spacing&&(d={...d,spacing:{...d.spacing,before:o?.before?d.spacing.before:void 0,after:o?.after?d.spacing.after:void 0}}),r&&(d={...d??{},suppressEmptyParagraphHeight:!0}),{...e,attrs:d}})}function LM(e){let t=!1,n=e.rows.map(e=>{let n=!1,r=e.cells.map(e=>{let t=OM(e.blocks);return t.some((t,n)=>t!==e.blocks[n])?(n=!0,{...e,blocks:t}):e});return n?(t=!0,{...e,cells:r}):e});return t?{...e,rows:n}:e}function zM(e){return e?.align??e?.alignment}function VM(e,t,n,r){let o="header"===r.section?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-n,i=e.position?.vertical;if(!i)return t;let a=zM(i),l=void 0!==i.posOffset?Ys(i.posOffset):void 0;if("page"===i.relativeTo){if(void 0!==l)return l-o;if("top"===a)return-o;if("bottom"===a)return r.pageSize.h-e.height-o;if("center"===a)return(r.pageSize.h-e.height)/2-o}if("margin"===i.relativeTo){let t=r.margins.top,n=r.pageSize.h-r.margins.top-r.margins.bottom;if(void 0!==l)return t+l-o;if("top"===a)return t-o;if("bottom"===a)return t+n-e.height-o;if("center"===a)return t+(n-e.height)/2-o}return void 0!==l?t+l:t}function $M(e,t,n,r){let o=0,i=n,a=0;for(let l=0;l<e.length;l++){let s=e[l],c=t[l];if(s&&c)if("paragraph"===s.kind&&"paragraph"===c.kind){let e=a,t=e+c.totalHeight;o=Math.min(o,e),i=Math.max(i,t);for(let a of s.runs){if("image"!==a.kind||!a.position)continue;let t=VM(a,e,n,r);o=Math.min(o,t),i=Math.max(i,t+a.height)}a=t}else if("table"===s.kind&&"table"===c.kind){let e=a+c.totalHeight;o=Math.min(o,a),i=Math.max(i,e),a=e}else if("image"===s.kind&&"image"===c.kind){let e=a+c.height;o=Math.min(o,a),i=Math.max(i,e),a=e}else if("textBox"===s.kind&&"textBox"===c.kind){let e=a+c.height;o=Math.min(o,a),i=Math.max(i,e),a=e}}return{visualTop:o,visualBottom:i}}function jM(e,t,n,r){if(!e||!e.content||0===e.content.length)return;let o=gx(e.content,{styles:r.styles??void 0,theme:r.theme??null}),i=L_(o,{theme:r.theme??void 0});if(0===i.length)return;let a=PM(i),l=r.measureBlocks(a,t),s=l.reduce((e,t)=>"paragraph"===t.kind||"table"===t.kind?e+t.totalHeight:"image"===t.kind||"textBox"===t.kind?e+t.height:e,0),{visualTop:c,visualBottom:d}=$M(i,l,s,n);return{blocks:a,measures:l,height:s,visualTop:c,visualBottom:d}}var HM=7,WM=0;function qM(e,t){if("paragraph"!==e.kind||"paragraph"!==t.kind)return"totalHeight"in t?t.totalHeight:"height"in t?t.height:0;let n=e.runs.filter(e=>"text"!==e.kind||e.text.length>0);if(!(1===t.lines.length&&n.length>0&&n.every(e=>"image"===e.kind)))return t.totalHeight;let r=n.reduce((e,t)=>"image"===t.kind?Math.max(e,t.height):e,0),o=e.attrs?.spacing?.before??0,i=e.attrs?.spacing?.after??0;return o+r+i}function ZM(e){let t=e?.borders?.top?.width??0,n=e?.borders?.bottom?.width??0;return t+n}function UM(e,t,n){let r=e.columnWidths??[],o=AM(e.width,e.widthType,t),i=BM(e),a=o??t;if(e.rows.length>0&&(r=DM(r,i,a)),r.length>0&&o){let e=r.reduce((e,t)=>e+t,0);if(e>0&&Math.abs(e-o)>1){let t=o/e;r=r.map(e=>e*t)}}let l=new Map;for(let u=0;u<e.rows.length;u++){let t=e.rows[u];if(!t)continue;let n=0,r=l.get(u)??new Set;for(;r.has(n);)n++;for(let e of t.cells){let t=e.colSpan??1,o=e.rowSpan??1;if(o>1)for(let e=u+1;e<u+o;e++){l.has(e)||l.set(e,new Set);let r=l.get(e);for(let e=0;e<t;e++)r.add(n+e)}for(n+=t;r.has(n);)n++}}let s=e.rows.map((e,t)=>{let o=0,i=l.get(t)??new Set;for(;i.has(o);)o++;return{cells:e.cells.map(e=>{let t=e.colSpan??1,l=0;for(let n=0;n<t&&o+n<r.length;n++)l+=r[o+n]??0;for(0===l&&(l=(e.width&&e.width>0?e.width:AM(e.widthValue,e.widthType,a))??100),o+=t;i.has(o);)o++;let s=e.padding?.left??HM,c=e.padding?.right??HM,d=Math.max(1,l-s-c);return{blocks:e.blocks.map(e=>n(e,d)),width:l,height:0,colSpan:e.colSpan,rowSpan:e.rowSpan}}),height:0}});for(let u=0;u<s.length;u++){let t=s[u],n=e.rows[u]?.cells,r=0,o=0;for(let e=0;e<t.cells.length;e++){let i=t.cells[e],a=n?.[e],l=0;for(let e=0;e<i.blocks.length;e++){let t=a?.blocks[e],n=i.blocks[e];!t||!n||(l+=qM(t,n))}i.height=l;let s=a?.padding?.top??WM,c=a?.padding?.bottom??WM;i.height+=s+c,r=Math.max(r,i.height),o=Math.max(o,ZM(a))}let i=e.rows[u],a=i?.height,l=i?.heightRule;t.height=a&&"exact"===l?a:a?Math.max(r+o,a):r+o}let c=s.reduce((e,t)=>e+t.height,0),d=r.reduce((e,t)=>e+t,0)||o||t;return{kind:"table",rows:s,columnWidths:r,totalWidth:d,totalHeight:c}}function KM(e){return Math.round(e/1440*96)}function GM(e){return{w:e?.pageWidth?KM(e.pageWidth):816,h:e?.pageHeight?KM(e.pageHeight):1056}}function XM(e){return{top:e?.marginTop?KM(e.marginTop):96,right:e?.marginRight?KM(e.marginRight):96,bottom:e?.marginBottom?KM(e.marginBottom):96,left:e?.marginLeft?KM(e.marginLeft):96,header:e?.headerDistance?KM(e.headerDistance):48,footer:e?.footerDistance?KM(e.footerDistance):48}}function YM(e,t){let n={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return n;let r=e.package.headers,o=e.package.footers,i=null,a=null,l=null,s=null;if(r&&t?.headerReferences){let e=t.headerReferences.find(e=>"default"===e.type);e?.rId&&(i=r.get(e.rId)??null);let n=t.headerReferences.find(e=>"first"===e.type);n?.rId&&(l=r.get(n.rId)??null)}if(o&&t?.footerReferences){let e=t.footerReferences.find(e=>"default"===e.type);e?.rId&&(a=o.get(e.rId)??null);let n=t.footerReferences.find(e=>"first"===e.type);n?.rId&&(s=o.get(n.rId)??null)}return t?.titlePg||(!i&&l&&(i=l),!a&&s&&(a=s)),{header:i,footer:a,firstHeader:l,firstFooter:s}}function JM(e,t,n,r){let o=e-t-n,i=(r.count-1)*r.gap;return(o-i)/r.count}function QM(e){let t,n,r={...e.pageSize},o={...e.margins},i=e.columns??{count:1,gap:0},a=!1,l=[],s=[];function c(){return r.h-o.bottom}function d(){return c()-o.top}function u(){return r.w-o.left-o.right}if(d()<=0)throw new Error("Paginator: page size and margins yield no content area");let p=JM(r.w,o.left,o.right,i),h=o.top;function f(e){return o.left+e*(p+i.gap)}function m(){(t||n)&&(t&&(r=t),n&&(o=n),t=void 0,n=void 0,p=JM(r.w,o.left,o.right,i));let a=l.length+1,d=o.top,u=c(),f=e.footnoteReservedHeights?.get(a)??0,m=u-f,g={number:a,fragments:[],margins:{...o},size:{...r},footnoteReservedHeight:f>0?f:void 0,columns:i.count>1?{...i}:void 0},v={page:g,cursorY:d,columnIndex:0,topMargin:d,contentBottom:m,trailingSpacing:0};return l.push(g),s.push(v),h=d,e.onNewPage&&e.onNewPage(v),v}function g(){return 0===s.length?m():s[s.length-1]}function v(e){return e.contentBottom-e.cursorY}function y(e,t){let n=t||g();return v(n)>=e}function b(e){return e.columnIndex<i.count-1?(e.columnIndex+=1,e.cursorY=h,e.trailingSpacing=0,e):m()}function w(e){let t=g(),n=Number.isFinite(e)&&e>0?e:0;for(;!y(n,t);){let e=t.contentBottom-t.topMargin;if(n>e)return a||(a=!0,console.warn(`Paginator: fragment height ${n.toFixed(0)}px exceeds page content height ${e.toFixed(0)}px; placing with overflow.`)),t.cursorY!==t.topMargin&&(t=b(t)),t;t=b(t)}return t}function k(e,t,n=0,r=0){let o=Math.max(n,g().trailingSpacing),i=o+t,a=w(i),l=o,s=f(a.columnIndex),c=a.cursorY+l;return e.x=s,e.y=c,a.page.fragments.push(e),a.cursorY=c+t,a.trailingSpacing=r,{state:a,x:s,y:c}}function x(){if(s.length>0){let e=s[s.length-1];if(0===e.page.fragments.length&&e.cursorY===e.topMargin)return e}return m()}function S(){let e=g();return b(e)}function C(e){i=e,p=JM(r.w,o.left,o.right,i);let t=g();t.page.columns=i.count>1?{...i}:void 0,h=t.cursorY,t.columnIndex=0}function T(e,a,l=!0){if(!l)return t=e?{...e}:t,void(n=a?{...a}:n);if(e&&(r={...e}),a&&(o={...a}),d()<=0)throw new Error("Paginator: section page size and margins yield no content area");p=JM(r.w,o.left,o.right,i),t=void 0,n=void 0}return{pages:l,states:s,get columnWidth(){return p},get columns(){return{...i}},getCurrentState:g,getAvailableHeight:()=>v(g()),getContentWidth:u,fits:e=>y(e),ensureFits:w,addFragment:k,forcePageBreak:x,forceColumnBreak:S,getColumnX:f,updateColumns:C,updatePageLayout:T}}function eN(e){let t=new Map,n=new Set;for(let r=0;r<e.length;r++){if(n.has(r))continue;let o=e[r];if("paragraph"!==o.kind||!o.attrs?.keepNext)continue;let i=[r],a=r;for(let t=r+1;t<e.length;t++){let r=e[t];if("sectionBreak"===r.kind||"pageBreak"===r.kind||"columnBreak"===r.kind||"paragraph"!==r.kind)break;if(!r.attrs?.keepNext)break;i.push(t),a=t,n.add(t)}let l=a+1,s=-1;if(l<e.length){let t=e[l];"sectionBreak"!==t.kind&&"pageBreak"!==t.kind&&"columnBreak"!==t.kind&&(s=l)}t.set(r,{startIndex:r,endIndex:a,memberIndices:i,anchorIndex:s})}return t}function tN(e,t,n){let r=0;for(let o of e.memberIndices){let e=t[o],i=n[o];if("paragraph"!==e.kind||"paragraph"!==i.kind)continue;let a=e,l=i,s=a.attrs?.spacing?.before??0;r+=s,r+=l.totalHeight;let c=a.attrs?.spacing?.after??0;r+=c}if(-1!==e.anchorIndex){let t=n[e.anchorIndex];if("paragraph"===t?.kind){let e=t;e.lines.length>0&&(r+=e.lines[0].lineHeight)}}return r}function nN(e){let t=new Set;for(let n of e.values())for(let e=1;e<n.memberIndices.length;e++)t.add(n.memberIndices[e]);return t}function rN(e){return"paragraph"===e.kind&&!0===e.attrs?.pageBreakBefore}function oN(e){return"float"===e.displayMode||Ek(e.wrapType)}function iN(e){return oN(e)&&!_k(e.wrapType)&&"topAndBottom"!==e.wrapType}function aN(e,t){for(let n=0;n<e.pages.length;n++)for(let r of e.pages[n].fragments){if(null==r.pmStart)continue;let e=r.pmStart,o=r.pmEnd??e+1;if(t>=e&&t<o)return n}return null}var lN={w:816,h:1056},sN={top:96,right:96,bottom:96,left:96},cN={count:1,gap:0};function dN(e,t,n){let r=[],o=[],i=t;for(let a=0;a<e.length;a++){if("sectionBreak"!==e[a].kind)continue;let t=e[a],n={pageSize:t.pageSize??i.pageSize,margins:t.margins??i.margins,columns:t.columns};r.push(n),o.push(a),i=n}return r.push(n),{configs:r,breakIndices:o}}function uN(e){if(0===e.runs.length)return!0;if(1!==e.runs.length)return!1;let t=e.runs[0];return"text"===t.kind&&""===(t.text??"")}function pN(e){let t=e.attrs?.spacing?.before??0;return uN(e)&&!e.attrs?.spacingExplicit?.before?0:t}function hN(e){let t=e.attrs?.spacing?.after??0;return uN(e)&&!e.attrs?.spacingExplicit?.after?0:t}function fN(e){for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if("paragraph"!==n.kind||"paragraph"!==r.kind)continue;let o=n.attrs,i=r.attrs;o?.contextualSpacing&&i?.contextualSpacing&&o.styleId&&o.styleId===i.styleId&&(o.spacing&&(o.spacing={...o.spacing,after:0}),i.spacing&&(i.spacing={...i.spacing,before:0}))}}function mN(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let r=n.pageSize??lN,o={top:n.margins?.top??sN.top,right:n.margins?.right??sN.right,bottom:n.margins?.bottom??sN.bottom,left:n.margins?.left??sN.left,header:n.margins?.header??n.margins?.top??sN.top,footer:n.margins?.footer??n.margins?.bottom??sN.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...o},a=n.finalPageSize??r,l=n.finalMargins??i;if(r.w-i.left-i.right<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s={pageSize:r,margins:i,columns:n.columns},c={pageSize:a,margins:l,columns:n.columns},{configs:d,breakIndices:u}=dN(e,s,c),p=[...u.map(t=>e[t].type),n.bodyBreakType],h=d[0]??s,f=QM({pageSize:h.pageSize,margins:h.margins,columns:h.columns??cN,footnoteReservedHeights:n.footnoteReservedHeights});fN(e);let m=eN(e),g=nN(m),v=0;for(let y=0;y<e.length;y++){let n=e[y],r=t[y];rN(n)&&f.forcePageBreak();let o=m.get(y);if(o&&!g.has(y)){let n=tN(o,e,t),r=f.getCurrentState(),i=f.getAvailableHeight(),a=r.contentBottom-r.topMargin;n<=a&&n>i&&r.page.fragments.length>0&&f.forcePageBreak()}switch(n.kind){case"paragraph":gN(n,r,f,f.getContentWidth());break;case"table":n.floating?wN(n,r,f,f.getContentWidth()):bN(n,r,f);break;case"image":kN(n,r,f);break;case"textBox":SN(n,r,f);break;case"pageBreak":f.forcePageBreak();break;case"columnBreak":f.forceColumnBreak();break;case"sectionBreak":{let e=p[v+1]??p[v];CN(n,f,d[v+1]??h,e),v++;break}default:s_(n,"runLayoutPipeline")}}return 0===f.pages.length&&f.getCurrentState(),{pageSize:r,pages:f.pages,columns:n.columns,pageGap:n.pageGap}}function gN(e,t,n,r){if("paragraph"!==t.kind)throw new Error("layoutParagraph: expected paragraph measure");let o=t.lines;if(0===o.length){let t=pN(e),o=hN(e),i=n.getCurrentState(),a={kind:"paragraph",blockId:e.id,x:n.getColumnX(i.columnIndex),y:i.cursorY+t,width:r,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};return void n.addFragment(a,0,t,o)}let i=pN(e),a=hN(e),l=0;for(;l<o.length;){let t=n.getCurrentState(),s=n.getAvailableHeight(),c=0,d=0;for(let e=l;e<o.length;e++){let t=o[e].lineHeight,n=c+t;if(!((0===l&&e===l?n+i:n)<=s||0===d))break;c=n,d++}let u=0===l,p=l+d>=o.length,h=u?i:0,f=p?a:0,m={kind:"paragraph",blockId:e.id,x:n.getColumnX(t.columnIndex),y:0,width:r,height:c,fromLine:l,toLine:l+d,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!p},g=n.addFragment(m,c,h,f);m.y=g.y,l+=d,l<o.length&&n.ensureFits(o[l].lineHeight)}}function vN(e){let t=0;for(let n of e.rows){if(!n.isHeader)break;t++}return t}function yN(e,t){let n=0;for(let r=0;r<t&&r<e.rows.length;r++)n+=e.rows[r].height;return n}function bN(e,t,n){if("table"!==t.kind)throw new Error("layoutTable: expected table measure");let r=t.rows;if(0===r.length)return;let o=vN(e),i=yN(t,o),a=0;for(;a<r.length;){let l=n.getCurrentState(),s=n.getAvailableHeight(),c=0===a,d=c?l.trailingSpacing:0,u=s-d,p=!c&&o>0?i:0,h=0,f=0;for(let e=a;e<r.length;e++){let t=r[e].height;if(!(h+t+p<=u||0===f))break;h+=t,f++}let m=h+p,g=a+f>=r.length,v=n.getColumnX(l.columnIndex);"center"===e.justification?v+=(n.columnWidth-t.totalWidth)/2:"right"===e.justification?v=v+n.columnWidth-t.totalWidth:e.indent&&(v+=e.indent);let y={kind:"table",blockId:e.id,x:v,y:0,width:t.totalWidth,height:m,fromRow:a,toRow:a+f,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!c,continuesOnNext:!g,headerRowCount:!c&&o>0?o:void 0},b=n.addFragment(y,m,0,0);if(y.y=b.y,y.x=v,a+=f,a<r.length){let e=r[a].height+(o>0?i:0);n.ensureFits(e)}}}function wN(e,t,n,r){if("table"!==t.kind)throw new Error("layoutFloatingTable: expected table measure");let o=n.getCurrentState(),i=e.floating,a=o.page,l=a.margins,s=t.totalWidth,c=t.totalHeight,d=a.size.h-l.top-l.bottom,u=l.left,p=l.top;"page"===i?.horzAnchor&&(u=0),"page"===i?.vertAnchor&&(p=0);let h=n.getColumnX(o.columnIndex);if(void 0!==i?.tblpX)h=u+i.tblpX;else if(i?.tblpXSpec){let e=i.tblpXSpec;"left"===e||"inside"===e?h=u:"right"===e||"outside"===e?h=u+r-s:"center"===e&&(h=u+(r-s)/2)}else"center"===e.justification?h=u+(r-s)/2:"right"===e.justification&&(h=u+r-s);let f=o.cursorY,m=!1;if(void 0!==i?.tblpY)f=p+i.tblpY,m=!0;else if(i?.tblpYSpec){m=!0;let e=i.tblpYSpec;"top"===e?f=p:"bottom"===e?f=p+d-c:"center"===e&&(f=p+(d-c)/2)}m||(f=n.ensureFits(c).cursorY);let g=l.left,v=l.left+r-s;Number.isFinite(v)&&(h=Math.max(g,Math.min(h,v)));let y={kind:"table",blockId:e.id,x:h,y:f,width:s,height:c,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:!0};o.page.fragments.push(y)}function kN(e,t,n){if("image"!==t.kind)throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored)return void xN(e,t,n);let r=n.ensureFits(t.height),o={kind:"image",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(o,t.height,0,0);o.y=i.y}function xN(e,t,n){let r=n.getCurrentState(),o=e.anchor,i=o.offsetH??n.getColumnX(r.columnIndex),a=o.offsetV??r.cursorY,l={kind:"image",blockId:e.id,x:i,y:a,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:!0,zIndex:o.behindDoc?-1:1};r.page.fragments.push(l)}function SN(e,t,n){if("textBox"!==t.kind)throw new Error("layoutTextBox: expected textBox measure");if(oN(e)){let r=n.getCurrentState(),o={kind:"textBox",blockId:e.id,x:n.getColumnX(r.columnIndex),y:r.cursorY,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:!0,zIndex:"behind"===e.wrapType?-1:1};return void r.page.fragments.push(o)}let r=n.ensureFits(t.height),o={kind:"textBox",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(o,t.height,0,0);o.y=i.y}function CN(e,t,n,r){switch(r??"nextPage"){case"nextPage":t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak();break;case"evenPage":t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break;case"oddPage":t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break;case"continuous":t.updatePageLayout(n.pageSize,n.margins,!1);break}t.updateColumns(n.columns??cN)}var TN={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image",line:"layout-line",run:"layout-run"};function EN(e){return"paragraph"===e.kind}function _N(e){return"table"===e.kind}function MN(e){return"image"===e.kind}function NN(e){e.style.position="absolute",e.style.overflow="hidden"}function IN(e,t,n){let r=n.createElement("div");return r.className=`${TN.fragment} ${TN.paragraph}`,NN(r),r.dataset.blockId=String(e.blockId),r.dataset.fromLine=String(e.fromLine),r.dataset.toLine=String(e.toLine),void 0!==e.pmStart&&(r.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(r.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(r.dataset.continuesFromPrev="true"),e.continuesOnNext&&(r.dataset.continuesOnNext="true"),r}function RN(e,t,n){let r=n.createElement("div");return r.className=`${TN.fragment} ${TN.table}`,NN(r),r.dataset.blockId=String(e.blockId),r.dataset.fromRow=String(e.fromRow),r.dataset.toRow=String(e.toRow),void 0!==e.pmStart&&(r.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(r.dataset.pmEnd=String(e.pmEnd)),r}function AN(e,t,n){let r=n.createElement("div");return r.className=`${TN.fragment} ${TN.image}`,NN(r),r.dataset.blockId=String(e.blockId),void 0!==e.pmStart&&(r.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(r.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(r.dataset.anchored="true"),void 0!==e.zIndex&&(r.style.zIndex=String(e.zIndex)),r}function BN(e,t,n={}){let r=n.document??document;if(EN(e))return IN(e,t,r);if(_N(e))return RN(e,t,r);if(MN(e))return AN(e,t,r);let o=r.createElement("div");o.className=TN.fragment,NN(o);let i=e;return void 0!==i.blockId&&(o.dataset.blockId=String(i.blockId)),i.kind&&(o.dataset.kind=i.kind),o}var DN={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function FN(e){return"text"===e.kind}function PN(e){return"tab"===e.kind}function ON(e){return"image"===e.kind}function LN(e){return"lineBreak"===e.kind}function zN(e){return"field"===e.kind}function VN(e){return!_k(e.wrapType)&&"topAndBottom"!==e.wrapType}function $N(e){return"behind"===e.wrapType}function jN(e){return!!Ek(e.wrapType)||"float"===e.displayMode}function HN(e){return"left"===e?"right":"right"===e?"left":"bothSides"}var WN={image:"layout-image",imageAnchored:"layout-image-anchored"};function qN(e){return!!(e.cropTop||e.cropRight||e.cropBottom||e.cropLeft||null!=e.opacity&&e.opacity<1)}function ZN(e,t){let n=t.cropTop??0,r=t.cropRight??0,o=t.cropBottom??0,i=t.cropLeft??0;(n||r||o||i)&&(e.style.clipPath=`inset(${100*n}% ${100*r}% ${100*o}% ${100*i}%)`),null!=t.opacity&&t.opacity<1&&(e.style.opacity=String(Math.max(0,t.opacity)))}function UN(e,t,n,r,o={}){let i=o.document??document,a=i.createElement("div");a.className=WN.image,e.isAnchored&&a.classList.add(WN.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",void 0!==e.zIndex&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),void 0!==e.pmStart&&(a.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(a.dataset.pmEnd=String(e.pmEnd));let l=i.createElement("img");if(l.src=t.src,l.alt=t.alt??"",l.style.width="100%",l.style.height="100%",l.style.objectFit="contain",l.style.display="block",t.transform&&(l.style.transform=t.transform),l.draggable=!1,t.hlinkHref){let e=i.createElement("a");e.href=t.hlinkHref,e.target="_blank",e.rel="noopener noreferrer",e.style.display="block",e.style.width="100%",e.style.height="100%",e.appendChild(l),a.appendChild(e)}else a.appendChild(l);return a}function KN(e,t,n){if(t.fontFamily&&(e.style.fontFamily=Jp(t.fontFamily).cssFallback),t.fontSize){let n=96*t.fontSize/72;e.style.fontSize=`${n}px`}if(t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.allCaps&&(e.style.textTransform="uppercase"),t.smallCaps&&(e.style.fontVariant="small-caps"),t.positionPx&&(e.style.verticalAlign=`${t.positionPx}px`),t.horizontalScale&&100!==t.horizontalScale&&(e.style.display="inline-block",e.style.transform=`scaleX(${t.horizontalScale/100})`,e.style.transformOrigin="left center"),t.kerningMinPt&&t.kerningMinPt>0&&(t.fontSize??11)>=t.kerningMinPt&&(e.style.fontKerning="normal"),t.emboss&&(e.style.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),t.imprint&&(e.style.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),t.textShadow&&!t.emboss&&!t.imprint&&(e.style.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),t.textOutline&&(e.style.webkitTextStroke="1px currentColor",e.style.webkitTextFillColor="transparent"),t.emphasisMark){let n="comma"===t.emphasisMark?"filled sesame":"circle"===t.emphasisMark?"filled circle":"filled dot",r="underDot"===t.emphasisMark?"under right":"over right";e.style.textEmphasis=`${n}`,e.style.textEmphasisPosition=r,e.style.webkitTextEmphasis=n,e.style.webkitTextEmphasisPosition=r}t.highlight&&(e.style.backgroundColor=t.highlight);let r=[];if(t.underline&&(r.push("underline"),"object"==typeof t.underline&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&r.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(e=>!n||!n.has(e));null!=r&&(e.style.backgroundColor="rgba(255, 212, 0, 0.15)",e.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",e.dataset.commentId=String(r))}t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),null!=t.changeRevisionId&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",r.includes("line-through")||r.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),null!=t.changeRevisionId&&(e.dataset.revisionId=String(t.changeRevisionId))),r.length>0&&(e.style.textDecorationLine=r.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em"),t.hidden&&(e.classList.add("docx-hidden"),e.style.opacity="0.4",e.style.textDecoration="underline dotted"),t.rtl&&e.setAttribute("dir","rtl"),t.textEffect&&(e.classList.add("docx-text-effect",`docx-text-effect-${t.textEffect}`),e.dataset.effect=t.textEffect)}function GN(e,t,n){void 0!==t&&(e.dataset.pmStart=String(t)),void 0!==n&&(e.dataset.pmEnd=String(n))}function XN(e,t,n){let r=t.createElement("span");if(r.className=`${DN.run} ${DN.text}`,KN(r,e,n),GN(r,e.pmStart,e.pmEnd),e.hyperlink){let n=t.createElement("a");n.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(n.target="_blank",n.rel="noopener noreferrer"),e.hyperlink.tooltip&&(n.title=e.hyperlink.tooltip),n.textContent=e.text,n.style.color="inherit",n.style.textDecoration="inherit",e.hyperlink.noDefaultStyle||(e.color||(n.style.color="#0563c1",r.style.color="#0563c1"),e.underline||(n.style.textDecoration="underline")),r.appendChild(n)}else r.textContent=e.text;return r}var YN=1e3;function JN(e,t,n,r){let o=t.createElement("span");o.className=`${DN.run} ${DN.tab}`,o.style.display="inline-block",o.style.width=`${n}px`,GN(o,e.pmStart,e.pmEnd);let i=r&&"none"!==r?QN(r):null;if(i){o.style.position="relative",o.textContent="";let e=t.createElement("span");e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.overflow="hidden",e.style.whiteSpace="nowrap",e.textContent=i.repeat(YN),o.appendChild(e)}else o.textContent=" ";return o}function QN(e){switch(e){case"dot":return".";case"hyphen":return"-";case"underscore":return"_";case"middleDot":return"·";case"heavy":return"_";default:return null}}function eI(e){if(!e)return 0;let t=e.match(/rotate\(([-\d.]+)deg\)/);return t?(parseFloat(t[1])%360+360)%360:0}function tI(e,t,n){if(0===n||180===n)return{w:e,h:t};if(90===n||270===n)return{w:t,h:e};let r=n*Math.PI/180,o=Math.abs(Math.sin(r)),i=Math.abs(Math.cos(r));return{w:e*i+t*o,h:e*o+t*i}}function nI(e,t){let n=t.createElement("img");n.className=`${DN.run} ${DN.image}`,n.src=e.src,n.width=e.width,n.height=e.height,n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform,n.style.transformOrigin="center center"),qN(e)&&ZN(n,e);let r=eI(e.transform);if(0!==r){let o=tI(e.width,e.height,r),i=t.createElement("span");return i.style.display="inline-block",i.style.position="relative",i.style.width=`${o.w}px`,i.style.height=`${o.h}px`,i.style.verticalAlign="middle",n.style.position="absolute",n.style.left=(o.w-e.width)/2+"px",n.style.top=(o.h-e.height)/2+"px",GN(i,e.pmStart,e.pmEnd),i.appendChild(n),i}return n.style.display="inline-block",n.style.verticalAlign="middle",GN(n,e.pmStart,e.pmEnd),n}function rI(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let r=t.createElement("img");r.src=e.src,r.width=e.width,r.height=e.height,r.style.marginLeft="auto",r.style.marginRight="auto",e.alt&&(r.alt=e.alt),e.transform&&(r.style.transform=e.transform,r.style.transformOrigin="center center"),qN(e)&&ZN(r,e);let o=eI(e.transform);if(0!==o){let t=tI(e.width,e.height,o);n.style.height=`${t.h}px`,n.style.position="relative",r.style.position="absolute",r.style.left="50%",r.style.top="50%",r.style.marginLeft=-e.width/2+"px",r.style.marginRight="0",r.style.marginTop=-e.height/2+"px"}return GN(n,e.pmStart,e.pmEnd),n.appendChild(r),n}function oI(e,t){return jN(e)||"block"===e.displayMode||"topAndBottom"===e.wrapType?rI(e,t):nI(e,t)}function iI(e,t){let n=t.createElement("br");return n.className=`${DN.run} ${DN.lineBreak}`,GN(n,e.pmStart,e.pmEnd),n}function aI(e,t,n){let r=e.fallback??"";switch(e.fieldType){case"PAGE":r=String(n.pageNumber);break;case"NUMPAGES":r=String(n.totalPages);break;case"DATE":r=(new Date).toLocaleDateString();break;case"TIME":r=(new Date).toLocaleTimeString();break}let o={...e,text:r};return XN(o,t,n?.resolvedCommentIds)}function lI(e,t,n){if(FN(e))return XN(e,t,n?.resolvedCommentIds);if(PN(e))return JN(e,t,48,void 0);if(ON(e))return oI(e,t);if(LN(e))return iI(e,t);if(zN(e)&&n)return aI(e,t,n);let r=t.createElement("span");return r.className=DN.run,r}function sI(e,t){let n=[],r=e.runs;for(let o=t.fromRun;o<=t.toRun;o++){let e=r[o];if(e)if(FN(e)){let r=o===t.fromRun?t.fromChar:0,i=o===t.toRun?t.toChar:e.text.length;if(r>0||i<e.text.length){let t=e.text.slice(r,i);n.push({...e,text:t,pmStart:void 0!==e.pmStart?e.pmStart+r:void 0,pmEnd:void 0!==e.pmStart?e.pmStart+i:void 0})}else n.push(e)}else n.push(e)}return n}function cI(e){return[e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function dI(e){return{val:e.val,pos:e.pos,leader:e.leader}}function uI(e,t,n){let r="";for(let o=t+1;o<e.length;o++){let t=e[o];if(FN(t))r+=t.text;else if(zN(t))"PAGE"===t.fieldType&&n?r+=String(n.pageNumber):"NUMPAGES"===t.fieldType&&n?r+=String(n.totalPages):r+=t.fallback??"";else if(PN(t)||LN(t))break}return r}var pI=.5;function hI(e,t,n,r){let o=0;for(let i=t+1;i<e.length;i++){let t=e[i];if(PN(t)||LN(t))break;if(FN(t))o+=n(t.text||"",t.fontSize,t.fontFamily,t.bold,t.italic);else if(zN(t)){let e;e="PAGE"===t.fieldType&&r?String(r.pageNumber):"NUMPAGES"===t.fieldType&&r?String(r.totalPages):t.fallback??"",o+=n(e,t.fontSize,t.fontFamily,t.bold,t.italic)}else ON(t)&&!jN(t)&&(o+=t.width||0)}return o}function fI(e){let t=e.createElement("canvas").getContext("2d");return(e,n=11,r="Calibri",o=!1,i=!1)=>{if(!t)return 7*e.length;let a=Jp(r).cssFallback,l=96*n/72,s=[];return i&&s.push("italic"),o&&s.push("bold"),s.push(`${l}px`,a),t.font=s.join(" "),t.measureText(e).width}}function mI(e,t,n,r,o){let i=r.createElement("div");i.className=DN.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=sI(e,t);if(1===a.length&&ON(a[0])){let e=a[0].position?.horizontal?.align??n;i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center"===e?"center":"right"===e?"flex-end":"flex-start",i.dataset.flexLine="true"}if(0===a.length){let e=r.createElement("span");return e.className=`${DN.run} layout-empty-run`,e.innerHTML=" ",i.appendChild(e),i}let l="justify"===n,s=!1;l&&o&&(s=!o.isLastLine||o.paragraphEndsWithLineBreak,s&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${o.availableWidth}px`)),i.style.whiteSpace="pre";let c=a.some(e=>FN(e)&&e.highlight);i.style.overflow=c?"hidden":"visible";let d,u=a.some(PN),p=fI(r);if(u){let e=o?.tabStops?.map(dI),t=o?.leftIndentPx?Math.round(15*o.leftIndentPx):0;d={explicitStops:e,leftIndent:t}}let h=0,f=o?.leftIndentPx??0;if(o?.isFirstLine){let e=o?.firstLineIndentPx??0;h=f+e}else h=f;for(let m=0;m<a.length;m++){let e=a[m];if(PN(e)&&d){let t=hI(a,m,p,o?.context),n=uI(a,m,o?.context),l=n.indexOf("."),s=l>=0?p(n.slice(0,l)):0,c=pM(h,d,{followingWidth:t,decimalPrefixWidth:s}),u=o?.lineRightEdgePx,f=t,g=!1;for(let e=m+1;e<a.length&&!LN(a[e]);e++)if(PN(a[e])){g=!0;break}if(void 0!==u&&"end"===c.alignment&&!g&&h+c.width+f>=u-pI){i.style.display="flex",i.style.alignItems="baseline",i.style.whiteSpace="nowrap",i.style.textIndent="0",i.dataset.flexLine="true",o?.isFirstLine&&o.firstLineIndentPx&&o.firstLineIndentPx<0&&i.firstElementChild instanceof HTMLElement&&(i.firstElementChild.style.marginLeft=`${o.firstLineIndentPx}px`);let t=JN(e,r,0,c.leader);t.style.flex="1 1 0",t.style.minWidth="0",t.style.width="auto",i.appendChild(t);for(let e=m+1;e<a.length;e++){let t=a[e];if(PN(t)||LN(t))break;if(FN(t))i.appendChild(XN(t,r,o?.context?.resolvedCommentIds));else if(zN(t)&&o?.context)i.appendChild(aI(t,r,o.context));else if(ON(t)){if(jN(t))continue;let e=cI(t);o?.renderedInlineImageKeys?.has(e)||(o?.renderedInlineImageKeys?.add(e),i.appendChild(oI(t,r)))}else i.appendChild(lI(t,r,o?.context))}break}let v=c.width;void 0!==u&&h+v+f>u&&(v=Math.max(1,u-h-f));let y=JN(e,r,v,c.leader);i.appendChild(y),h+=v}else if(FN(e)){let n=XN(e,r,o?.context?.resolvedCommentIds);if(e.highlight){let r=1.2*(e.fontSize?96*e.fontSize/72:14.67),o=Math.max(0,t.lineHeight-r);if(o>0){let e=o/2;n.style.paddingTop=`${e}px`,n.style.paddingBottom=`${e}px`}}i.appendChild(n);let a=e.fontSize||11,l=e.fontFamily||"Calibri";h+=p(e.text,a,l,e.bold,e.italic)}else if(ON(e)){if(jN(e))continue;let t=cI(e);if(o?.renderedInlineImageKeys?.has(t))continue;o?.renderedInlineImageKeys?.add(t);let n=oI(e,r);i.appendChild(n),"block"!==e.displayMode&&"topAndBottom"!==e.wrapType&&(h+=e.width)}else if(LN(e)){let t=iI(e,r);i.appendChild(t)}else if(zN(e)&&o?.context){let t=aI(e,r,o.context);i.appendChild(t);let n=e.fallback??"";"PAGE"===e.fieldType?n=String(o.context.pageNumber):"NUMPAGES"===e.fieldType&&(n=String(o.context.totalPages));let a=e.fontSize||11,l=e.fontFamily||"Calibri";h+=p(n,a,l,e.bold,e.italic)}else{let t=lI(e,r,o?.context);i.appendChild(t)}}return i}function gI(e,t){return!e&&!t||!(!e||!t)&&(e.style===t.style&&e.width===t.width&&e.color===t.color)}function vI(e,t){return!(!e&&!t||!e||!t)&&(gI(e.top,t.top)&&gI(e.bottom,t.bottom)&&gI(e.left,t.left)&&gI(e.right,t.right)&&gI(e.between,t.between))}function yI(e,t,n,r,o={}){let i=o.document??document,a=i.createElement("div");a.className=DN.fragment,a.style.position="absolute"===r.positioning?"absolute":"relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),GN(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");let l=n.lines.slice(e.fromLine,e.toLine),s=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId);let c=t.attrs?.bidi;c&&(a.dir="rtl"),s?a.style.textAlign="center"===s?"center":"right"===s?"right":"left"===s?"left":c?"right":"left":c&&(a.style.textAlign="right");let d=t.attrs?.indent,u=0,p=0;d&&(c?(d.left&&d.left>0&&(p=d.left),d.right&&d.right>0&&(u=d.right)):(d.left&&d.left>0&&(u=d.left),d.right&&d.right>0&&(p=d.right)));let h=t.attrs?.borders;if(h){let e=e=>{switch(e){case"single":return"solid";case"double":return"double";case"dotted":return"dotted";case"dashed":return"dashed";case"thick":return"solid";case"wave":return"wavy";case"dashSmallGap":return"dashed";case"nil":case"none":return"none";default:return"solid"}};a.style.boxSizing="border-box";let t=t=>`${t.width}px ${e(t.style)} ${t.color}`,n=vI(o.prevBorders,h),r=vI(h,o.nextBorders),l=n?h.between:h.top,s=r?void 0:h.bottom,c=i.createElement("div");if(c.className="layout-paragraph-border",c.style.position="absolute",c.style.pointerEvents="none",c.style.boxSizing="border-box",c.style.left=u-(h.left?.space??0)+"px",c.style.right=p-(h.right?.space??0)+"px",c.style.top=-(l?.space??0)+"px",c.style.bottom=-(s?.space??0)+"px",l&&(c.style.borderTop=t(l)),s&&(c.style.borderBottom=t(s)),h.left&&(c.style.borderLeft=t(h.left)),h.right&&(c.style.borderRight=t(h.right)),(l||s||h.left||h.right)&&a.appendChild(c),h.bar){let e=i.createElement("div");e.style.position="absolute",e.style.left="-8px",e.style.top="0",e.style.bottom="0",e.style.borderLeft=t(h.bar),a.style.position="relative",a.appendChild(e)}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let f=e.width-u-p,m="lineBreak"===t.runs[t.runs.length-1]?.kind,g=n.lines.length,v=0;d?.hanging&&d.hanging>0?v=-d.hanging:d?.firstLine&&d.firstLine>0&&(v=d.firstLine);let y=o.renderedInlineImageKeys??new Set;for(let b=0;b<l.length;b++){let n=l[b],o=e.fromLine+b,c=o===g-1,h=0===o&&!e.continuesFromPrev,w=n.leftOffset??0,k=n.rightOffset??0,x=f;if(h){let e=d?.hanging&&d.hanging>0,t=d?.firstLine&&d.firstLine>0;e&&d?.hanging?x=f+d.hanging:t&&d?.firstLine&&(x=f-d.firstLine)}if(bI(n,t)){let e=i.createElement("div");e.className=`${DN.line} layout-line-split`,e.style.position="relative",e.style.height=`${n.lineHeight}px`,e.style.lineHeight=`${n.lineHeight}px`;for(let o of n.segments){let a={fromRun:o.fromRun,fromChar:o.fromChar,toRun:o.toRun,toChar:o.toChar,width:o.width,ascent:n.ascent,descent:n.descent,lineHeight:n.lineHeight},l=mI(t,a,s,i,{availableWidth:o.availableWidth,isLastLine:c,isFirstLine:h,paragraphEndsWithLineBreak:m,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:h?v:0,context:r,renderedInlineImageKeys:y});l.className+=" layout-line-segment",l.style.position="absolute",l.style.left=`${o.leftOffset}px`,l.style.top="0",l.style.width=`${o.availableWidth}px`,e.appendChild(l)}a.appendChild(e);continue}let S=mI(t,n,s,i,{availableWidth:x-w-k,isLastLine:c,isFirstLine:h,paragraphEndsWithLineBreak:m,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:h?v:0,context:r,renderedInlineImageKeys:y,lineRightEdgePx:e.width-p-k});if(w>0||k>0){w>0&&(S.style.marginLeft=`${w}px`),k>0&&(S.style.marginRight=`${k}px`);let e=x-w-k;e>0&&(S.style.width=`${e}px`)}let C=d?.hanging&&d.hanging>0,T=d?.firstLine&&d.firstLine>0,E="true"===S.dataset.flexLine;if(h?u>0&&C?(S.style.paddingLeft=`${u}px`,E||(S.style.textIndent=`-${d.hanging}px`)):u>0&&T?(S.style.paddingLeft=`${u}px`,S.style.textIndent=`${d.firstLine}px`):u>0?S.style.paddingLeft=`${u}px`:T&&(S.style.textIndent=`${d.firstLine}px`):u>0?S.style.paddingLeft=`${u}px`:C&&(S.style.paddingLeft=`${d.hanging}px`),p>0&&(S.style.paddingRight=`${p}px`),h&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let e,r=Math.max(0,u-(d?.hanging??0));if(S.style.paddingLeft=`${r}px`,S.style.textIndent="0",!t.attrs.listMarkerFontFamily||!t.attrs.listMarkerFontSize)for(let i=n.fromRun;i<=n.toRun;i++){let n=t.runs[i];if(n&&"text"===n.kind){e=n;break}}let o=t.attrs.listMarkerFontFamily??e?.fontFamily??t.attrs.defaultFontFamily,l=t.attrs.listMarkerFontSize??e?.fontSize??t.attrs.defaultFontSize,s=wI(t.attrs.listMarker,d,i,o,l);if((d?.hanging??0)>0)S.insertBefore(s,S.firstChild);else{let e=i.createElement("div");e.className="layout-line layout-list-marker-line",e.style.height=`${n.lineHeight}px`,e.style.lineHeight=`${n.lineHeight}px`,e.appendChild(s),a.appendChild(e)}}a.appendChild(S)}return a}function bI(e,t){return(e.segments?.length??0)>1&&!t.attrs?.listMarker}function wI(e,t,n,r,o){let i=n.createElement("span");if(i.className="layout-list-marker",r&&(i.style.fontFamily=Jp(r).cssFallback),o){let e=96*o/72;i.style.fontSize=`${e}px`}i.textContent=e,i.style.textAlign="left",i.style.boxSizing="border-box";let a=t?.hanging??0;return i.style.display="inline-block",a>0&&(i.style.minWidth=`${a}px`),i}function kI(e,t,n){let r=t.createElement("div");r.className=n.layerClass,r.style.position="absolute",r.style.top="0",r.style.left="0","inset0"===n.sizing?(r.style.right="0",r.style.bottom="0"):(r.style.width="100%",r.style.height="100%",r.style.overflow="hidden"),r.style.pointerEvents="none","front"===n.layerMode&&(r.style.zIndex="10");for(let o of e){let e=t.createElement("div");e.className=n.itemClass,e.style.position="absolute",e.style.pointerEvents="auto",e.style.top=`${o.y}px`,e.style.left=`${o.x}px`,void 0!==o.pmStart&&(e.dataset.pmStart=String(o.pmStart)),void 0!==o.pmEnd&&(e.dataset.pmEnd=String(o.pmEnd));let i=t.createElement("img");i.src=o.src,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.style.display="block",o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform,i.style.transformOrigin="center center"),qN(o)&&ZN(i,o),e.appendChild(i),r.appendChild(e)}return r}var xI={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content",resizeHandle:"layout-table-resize-handle",rowResizeHandle:"layout-table-row-resize-handle",tableEdgeHandleBottom:"layout-table-edge-handle-bottom",tableEdgeHandleRight:"layout-table-edge-handle-right"};function SI(e,t,n){let r=[],o=0;for(let i=0;i<e.blocks.length;i++){let a=e.blocks[i];if("paragraph"!==a?.kind){let e=t.blocks[i];e&&"table"===e.kind&&(o+=e.totalHeight??0);continue}let l=a;for(let e of l.runs){if("image"!==e.kind)continue;let t=e;if(!jN(t))continue;let i=t.position,a=t.distTop??0,l=t.distBottom??0,s=t.distLeft??12,c=t.distRight??12,d="left",u=0;if(i?.horizontal){let e=i.horizontal;"right"===e.align?(d="right",u=n-t.width):"left"===e.align?u=0:"center"===e.align?u=(n-t.width)/2:void 0!==e.posOffset&&(u=Ys(e.posOffset),d=u>n/2?"right":"left")}else"right"===t.cssFloat&&(d="right",u=n-t.width);let p=o;if(i?.vertical){let e=i.vertical;void 0!==e.posOffset?p=o+Ys(e.posOffset):"top"===e.align&&(p=0)}u=Math.max(0,Math.min(u,n-t.width)),r.push({src:t.src,width:t.width,height:t.height,alt:t.alt,transform:t.transform,x:u,y:p,side:d,distTop:a,distBottom:l,distLeft:s,distRight:c,wrapText:HN(t.cssFloat),wrapType:t.wrapType,pmStart:t.pmStart,pmEnd:t.pmEnd})}let s=t.blocks[i];s&&"paragraph"===s.kind&&(o+=s.totalHeight)}return r}function CI(e,t,n,r){let o=r.createElement("div");o.className=xI.cellContent,o.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,l=Math.max(0,t.width-i-a);o.style.width=`${l}px`;let s,c=SI(e,t,l);if(c.length>0){s=c.filter(VN).map(e=>{let t=e.x+e.width+e.distRight,n=e.y-e.distTop,r=e.y+e.height+e.distBottom,o=0,i=0,a=e.wrapText??"bothSides";return"right"===a?o=t:"left"===a?i=l-(e.x-e.distLeft):"left"===e.side?o=t:i=l-(e.x-e.distLeft),{leftMargin:o,rightMargin:i,topY:n,bottomY:r}});let e=c.filter($N);e.length>0&&o.appendChild(kI(e,r,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}))}let d=0,u=0;for(let h=0;h<e.blocks.length;h++){let i=e.blocks[h],a=t.blocks[h];if("paragraph"===i?.kind&&"paragraph"===a?.kind){let e=i,t=a,c=e.attrs?.spacing,p=Math.max(u,c?.before??0);d+=p,s&&s.length>0&&(t=RM(e,l,{floatingZones:s,paragraphYOffset:d}));let h={blockId:e.id,width:l,height:t.totalHeight,fromLine:0,toLine:t.lines.length,pmStart:e.pmStart,pmEnd:e.pmEnd},f={...n,insideTableCell:!0},m=yI(h,e,t,f,{document:r});m.style.position="relative",p>0&&(m.style.marginTop=`${p}px`),o.appendChild(m),d+=t.totalHeight,u=c?.after??0}else if("table"===i?.kind&&"table"===a?.kind){let e=i,t=a,l=u,s=TI(e,t,n,r);s.style.position="relative",l>0&&(s.style.marginTop=`${l}px`),o.appendChild(s),d+=l+(a.totalHeight??0),u=0}}u>0&&(o.style.paddingBottom=`${u}px`);let p=c.filter(e=>!$N(e));return p.length>0&&o.appendChild(kI(p,r,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),o}function TI(e,t,n,r){let o=r.createElement("div");o.className=`${xI.table} layout-nested-table`,o.style.position="relative",o.style.width=`${t.totalWidth}px`,o.style.display="block","center"===e.justification?(o.style.marginLeft="auto",o.style.marginRight="auto"):"right"===e.justification?o.style.marginLeft="auto":e.indent&&(o.style.marginLeft=`${e.indent}px`),o.dataset.blockId=String(e.id),void 0!==e.pmStart&&(o.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(o.dataset.pmEnd=String(e.pmEnd));let i=[],a=0;for(let c=0;c<t.rows.length;c++)i.push(a),a+=t.rows[c]?.height??0;i.push(a);let l=new Map,s=0;for(let c=0;c<e.rows.length;c++){let a=e.rows[c],d=t.rows[c];if(!a||!d)continue;let u=MI(a,d,c,s,t.columnWidths,e.rows.length,n,r,l,i);o.appendChild(u),s+=d.height}return o.style.height=`${s}px`,o}function EI(e,t,n){let r=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(n&&"none"!==n.style&&"nil"!==n.style&&0!==n.width){let t=n.width??1,o=n.color??"#000000",i=n.style??"solid";e.style[r]=`${t}px ${i} ${o}`}else e.style[r]="none"}function _I(e,t,n,r,o,i,a){let l=a.createElement("div");l.className=xI.cell,l.style.position="absolute",l.style.left=`${n}px`,l.style.top="0",l.style.width=`${t.width}px`,l.style.height=`${r}px`,l.style.overflow="hidden",l.style.boxSizing="border-box";let s=e.padding?.top??1,c=e.padding?.right??7,d=e.padding?.bottom??1,u=e.padding?.left??7;if(l.style.padding=`${s}px ${c}px ${d}px ${u}px`,e.borders&&(o.isFirstRow&&EI(l,"top",e.borders.top),EI(l,"right",e.borders.right),EI(l,"bottom",e.borders.bottom),o.isFirstCol&&EI(l,"left",e.borders.left)),e.background&&(l.style.backgroundColor=e.background),e.noWrap&&(l.style.whiteSpace="nowrap"),e.verticalAlign)switch(l.style.display="flex",l.style.flexDirection="column",e.verticalAlign){case"top":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"bottom":l.style.justifyContent="flex-end";break}let p=CI(e,t,i,a);if(l.appendChild(p),e.blocks.length>0){let t=e.blocks[0],n=e.blocks[e.blocks.length-1];t&&"pmStart"in t&&void 0!==t.pmStart&&(l.dataset.pmStart=String(t.pmStart)),n&&"pmEnd"in n&&void 0!==n.pmEnd&&(l.dataset.pmEnd=String(n.pmEnd))}return l}function MI(e,t,n,r,o,i,a,l,s,c,d){let u=l.createElement("div");u.className=xI.row,u.style.position="absolute",u.style.left="0",u.style.top=`${r}px`,u.style.width="100%",u.style.height=`${t.height}px`,u.dataset.rowIndex=String(n);let p=new Set;if(s)for(let[,m]of s)if(m.startRow<n&&m.startRow+m.rowSpan>n)for(let e=0;e<m.colSpan;e++)p.add(m.columnIndex+e);let h=0,f=0;for(;p.has(f);)h+=o[f]??0,f++;for(let m=0;m<e.cells.length;m++){let r=e.cells[m],i=t.cells[m];if(!r||!i)continue;let g=r.colSpan??1,v=r.rowSpan??1,y=t.height;if(v>1&&c){y=0;for(let e=n;e<n+v&&e<c.length-1;e++)y+=(c[e+1]??0)-(c[e]??0);0===y&&(y=t.height*v)}let b=0===n||!0===d,w=0===f;o.length;let k=_I(r,i,h,y,{isFirstRow:b,isFirstCol:w},a,l);if(k.dataset.cellIndex=String(m),k.dataset.columnIndex=String(f),v>1&&(k.dataset.rowSpan=String(v)),u.appendChild(k),v>1&&s){let e=`${n}-${f}`;s.set(e,{cell:r,cellMeasure:i,columnIndex:f,startRow:n,rowSpan:v,colSpan:g,x:h,totalHeight:y})}for(let e=0;e<g&&f+e<o.length;e++)h+=o[f+e]??0;for(f+=g;p.has(f);)h+=o[f]??0,f++}return u}function NI(e,t,n,r,o={}){let i=o.document??document,a=i.createElement("div");a.className=xI.table,a.style.position="flow"===r.positioning?"relative":"absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),void 0!==e.pmStart&&(a.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(a.dataset.pmEnd=String(e.pmEnd));let l=0;for(let f=0;f<n.columnWidths.length-1;f++){l+=n.columnWidths[f]??0;let t=i.createElement("div");t.className=xI.resizeHandle,t.style.position="absolute",t.style.left=l-3+"px",t.style.top="0",t.style.width="6px",t.style.height="100%",t.style.cursor="col-resize",t.style.zIndex="10",t.dataset.columnIndex=String(f),t.dataset.tableBlockId=String(e.blockId),void 0!==e.pmStart&&(t.dataset.tablePmStart=String(e.pmStart)),a.appendChild(t)}let s=[],c=0;for(let f=0;f<n.rows.length;f++)s.push(c),c+=n.rows[f]?.height??0;s.push(c);let d=new Map,u=e.headerRowCount??0,p=0;if(u>0&&e.continuesFromPrev)for(let f=0;f<u;f++){let e=t.rows[f],o=n.rows[f];if(!e||!o)continue;let l=MI(e,o,f,p,n.columnWidths,t.rows.length,r,i,d,s,0===f);l.dataset.repeatedHeader="true",a.appendChild(l),p+=o.height}for(let f=e.fromRow;f<e.toRow;f++){let o=t.rows[f],l=n.rows[f];if(!o||!l)continue;let c=!(u>0&&e.continuesFromPrev)&&(e.continuesFromPrev&&f===e.fromRow),h=MI(o,l,f,p,n.columnWidths,t.rows.length,r,i,d,s,c);a.appendChild(h),p+=l.height}let h=0;for(let f=e.fromRow;f<e.toRow;f++)if(h+=n.rows[f]?.height??0,f<e.toRow-1){let t=i.createElement("div");t.className=xI.rowResizeHandle,t.style.position="absolute",t.style.left="0",t.style.top=h-3+"px",t.style.width="100%",t.style.height="6px",t.style.cursor="row-resize",t.style.zIndex="10",t.dataset.rowIndex=String(f),t.dataset.tableBlockId=String(e.blockId),void 0!==e.pmStart&&(t.dataset.tablePmStart=String(e.pmStart)),a.appendChild(t)}if(e.toRow===t.rows.length){let n=i.createElement("div");n.className=xI.tableEdgeHandleBottom,n.style.position="absolute",n.style.left="0",n.style.top=h-3+"px",n.style.width="100%",n.style.height="6px",n.style.cursor="row-resize",n.style.zIndex="10",n.dataset.rowIndex=String(t.rows.length-1),n.dataset.tableBlockId=String(e.blockId),n.dataset.isEdge="bottom",void 0!==e.pmStart&&(n.dataset.tablePmStart=String(e.pmStart)),a.appendChild(n)}if(e.toRow===t.rows.length){let t=n.columnWidths.reduce((e,t)=>e+t,0),r=i.createElement("div");r.className=xI.tableEdgeHandleRight,r.style.position="absolute",r.style.left=t-3+"px",r.style.top="0",r.style.width="6px",r.style.height="100%",r.style.cursor="col-resize",r.style.zIndex="10",r.dataset.columnIndex=String(n.columnWidths.length-1),r.dataset.tableBlockId=String(e.blockId),r.dataset.isEdge="right",void 0!==e.pmStart&&(r.dataset.tablePmStart=String(e.pmStart)),a.appendChild(r)}return a}var II={textBox:"layout-textbox"};function RI(e,t,n,r,o={}){let i=o.document??document,a=i.createElement("div");if(a.className=II.textBox,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",AI(a,e),t.fillColor&&(a.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let e=t.outlineStyle||"solid",n=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${e} ${n}`}let l=t.margins??a_;a.style.padding=`${l.top}px ${l.right}px ${l.bottom}px ${l.left}px`,a.dataset.blockId=String(e.blockId),void 0!==e.pmStart&&(a.dataset.pmStart=String(e.pmStart)),void 0!==e.pmEnd&&(a.dataset.pmEnd=String(e.pmEnd));let s=e.width-l.left-l.right,c=0;for(let d=0;d<t.content.length;d++){let e=t.content[d],o=n.innerMeasures[d];if(!o)continue;let l={blockId:e.id,width:s,height:o.totalHeight,pmStart:e.pmStart,pmEnd:e.pmEnd,fromLine:0,toLine:o.lines.length},u=yI(l,e,o,{...r,positioning:"flow"},{document:i});a.appendChild(u),c+=o.totalHeight}return a}function AI(e,t){!t.isFloating&&void 0===t.zIndex||(e.style.zIndex=String(t.zIndex??10))}function BI(e){return{pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function DI(e,t,n,r){let{x:o,side:i}=FI(e,n,r),a=OI(e,t,r);return{x:o,y:a,side:i}}function FI(e,t,n){let r=e.position?.horizontal;if(!r)return"right"===e.cssFloat?{x:t-e.width,side:"right"}:{x:0,side:"left"};let o=PI(r.relativeTo,t,n);if("right"===r.align)return{x:o.size?o.base+o.size-e.width:0,side:"right"};if("left"===r.align)return{x:o.base,side:"left"};if("center"===r.align)return{x:o.size?o.base+(o.size-e.width)/2:0,side:"left"};if(void 0!==r.posOffset){let e=o.base+Ys(r.posOffset);return{x:e,side:e>t/2?"right":"left"}}return{x:o.base,side:"left"}}function PI(e,t,n){let r=n?.pageWidth??0,o=n?.marginLeft??0;switch(e){case"page":return{base:-o,size:r};case"leftMargin":return{base:-o,size:o};case"rightMargin":return{base:t,size:o};case"character":return{base:0,size:0};default:return{base:0,size:t}}}function OI(e,t,n){let r=e.position?.vertical;if(!r)return t;let o=LI(r.relativeTo,t,n);return"top"===r.align?o.base:"center"===r.align?o.size?o.base+(o.size-e.height)/2:t:"bottom"===r.align?o.size?o.base+o.size-e.height:t:void 0!==r.posOffset?o.base+Ys(r.posOffset):"paragraph"===r.relativeTo||"line"===r.relativeTo?t:o.base}function LI(e,t,n){let r=n?.pageHeight??0,o=n?.marginTop??0,i=n?.contentHeight??0;switch(e){case"paragraph":case"line":return{base:t,size:0};case"page":return{base:-o,size:r};case"topMargin":return{base:-o,size:o};case"bottomMargin":return{base:i,size:o};default:return{base:0,size:i}}}function zI(e){return e?.align??e?.alignment}function VI(e,t){let n=e.position.vertical;if(!n)return e.paragraphY;let r=zI(n),o=void 0!==n.posOffset?Ys(n.posOffset):void 0;if("page"===n.relativeTo){if(void 0!==o)return o-t.flowTop;if("top"===r)return-t.flowTop;if("bottom"===r)return t.pageHeight-e.height-t.flowTop;if("center"===r)return(t.pageHeight-e.height)/2-t.flowTop}if("margin"===n.relativeTo){let n=t.margins.top,i=t.pageHeight-t.margins.top-t.margins.bottom;if(void 0!==o)return n+o-t.flowTop;if("top"===r)return n-t.flowTop;if("bottom"===r)return n+i-e.height-t.flowTop;if("center"===r)return n+(i-e.height)/2-t.flowTop}return void 0!==o?e.paragraphY+o:e.paragraphY}function $I(e,t,n){let r=t.position.horizontal;if(!r)return void(e.style.left="0");let o=zI(r);if("page"===r.relativeTo){if(void 0!==r.posOffset)return void(e.style.left=Ys(r.posOffset)-n.flowLeft+"px");if("right"===o)return void(e.style.left=n.pageWidth-t.width-n.flowLeft+"px");if("center"===o)return void(e.style.left=(n.pageWidth-t.width)/2-n.flowLeft+"px");if("left"===o)return void(e.style.left=-n.flowLeft+"px")}void 0===r.posOffset?e.style.left="right"!==o?"center"!==o?"0":(n.contentWidth-t.width)/2+"px":n.contentWidth-t.width+"px":e.style.left=`${Ys(r.posOffset)}px`}function jI(e,t){let n=e.tblpY??0;"page"===e.vertAnchor?n-=t.flowTop:"margin"===e.vertAnchor&&(n+=t.margins.top-t.flowTop);let r=e.tblpX??0;return"page"===e.horzAnchor?r-=t.flowLeft:"margin"===e.horzAnchor&&(r+=t.margins.left-t.flowLeft),{left:r,top:n}}function HI(e,t,n,r){let o=n.document??document,i=o.createElement("div");i.style.position="relative";let a=t.contentWidth??600,l=[],s=0;for(let c=0;c<e.blocks.length;c++){let n=e.blocks[c],d=e.measures[c];if(n&&d)if("paragraph"===n.kind&&"paragraph"===d.kind){let e=n,r=d,c=e.attrs?.spacing?.before??0,u=s,p=[];for(let t of e.runs)if("image"===t.kind&&"position"in t&&t.position){let e=t;l.push({src:e.src,width:e.width,height:e.height,alt:e.alt,paragraphY:u,position:e.position})}else p.push(t);let h={...e,runs:p},f={blockId:e.id,width:a,height:r.totalHeight,fromLine:0,toLine:r.lines.length},m=yI(f,h,r,{...t,positioning:"absolute"},{document:o});m.style.top=`${s+c}px`,m.style.left="0",m.style.width=`${a}px`,i.appendChild(m),s+=r.totalHeight}else if("table"===n.kind&&"table"===d.kind){let e={blockId:n.id,width:d.totalWidth,height:d.totalHeight,fromRow:0,toRow:d.rows.length,pmStart:n.pmStart,pmEnd:n.pmEnd},a=NI(e,n,d,{...t,positioning:"absolute"},{document:o});if(n.floating){let{left:e,top:t}=jI(n.floating,r);a.style.top=`${t}px`,a.style.left=`${e}px`,i.appendChild(a)}else a.style.top=`${s}px`,a.style.left="0",i.appendChild(a),s+=d.totalHeight}}for(let c of l){let e=o.createElement("img");e.src=c.src,e.width=c.width,e.height=c.height,c.alt&&(e.alt=c.alt),e.style.position="absolute",e.style.display="block",e.style.width=`${c.width}px`,e.style.height=`${c.height}px`,e.style.maxWidth="none",e.style.maxHeight="none",$I(e,c,r),e.style.top=`${VI(c,r)}px`,i.appendChild(e)}return i}var WI=12,qI=6;function ZI(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}var UI=8;function KI(e){let t=[];for(let n of e)if("paragraph"===n.kind)for(let e of n.runs)"text"===e.kind&&null!=e.footnoteRefId&&t.push({footnoteId:e.footnoteRefId,pmPos:e.pmStart??0});return t}function GI(e,t){let n=new Map;if(0===t.length)return n;for(let r of t)for(let t of e){let e=!1;for(let o of t.fragments){let i=o.pmStart??-1,a=o.pmEnd??-1;if(i>=0&&a>=0&&r.pmPos>=i&&r.pmPos<a){let o=n.get(t.number)??[];o.includes(r.footnoteId)||o.push(r.footnoteId),n.set(t.number,o),e=!0;break}}if(e)break}return n}function XI(e,t){if(0===e.length)return[{kind:"paragraph",id:`fn-empty-${t}`,runs:[{kind:"text",text:`${t} `,fontSize:UI,superscript:!0}]}];let n=e.map(e=>{if("paragraph"!==e.kind)return e;let t=e;return{...t,runs:t.runs.map(e=>"text"!==e.kind&&"tab"!==e.kind||null!=e.fontSize?e:{...e,fontSize:UI})}}),r=n[0];if("paragraph"===r.kind){let e={kind:"text",text:`${t} `,fontSize:UI,superscript:!0};n[0]={...r,runs:[e,...r.runs]}}return n}function YI(e,t,n,r){let o=vx(e.content,{styles:r.styles??void 0,theme:r.theme??null}),i=L_(o,{theme:r.theme??void 0}),a=XI(i,t),l=r.measureBlocks(a,n),s=l.reduce((e,t)=>"paragraph"===t.kind||"table"===t.kind?e+t.totalHeight:"image"===t.kind||"textBox"===t.kind?e+t.height:e,0);return{id:e.id,displayNumber:t,blocks:a,measures:l,height:s}}function JI(e,t,n,r){let o=new Map,i=new Map;for(let s of e)("normal"===s.noteType||null==s.noteType)&&i.set(s.id,s);let a=1,l=new Set;for(let s of t){if(l.has(s.footnoteId))continue;l.add(s.footnoteId);let e=i.get(s.footnoteId);e&&(o.set(s.footnoteId,YI(e,a,n,r)),a++)}return o}function QI(e,t){let n=new Map;for(let[r,o]of e){let e=0;for(let n of o){let r=t.get(n);r&&(e+=r.height)}e>0&&(e+=WI,n.set(r,e))}return n}function eR(e){let{blocks:t,measures:n,layoutOpts:r,footnoteRefs:o,footnoteContentMap:i,initialLayout:a}=e,l=GI(a.pages,o),s=QI(l,i);if(0===s.size)return{layout:a,pageFootnoteMap:l,converged:!0};let c=a,d=!1;for(let u=0;u<qI;u++){c=mN(t,n,{...r,footnoteReservedHeights:s});let e=GI(c.pages,o),a=QI(e,i);if(l=e,ZI(s,a)){s=a,d=!0;break}s=a}d||(c=mN(t,n,{...r,footnoteReservedHeights:s}),l=GI(c.pages,o),console.warn(`[docx-editor] footnote layout did not stabilize within ${qI} passes; settling with best-effort reservation. If footnotes appear misplaced, please file a bug with the document.`));for(let[u,p]of l){let e=c.pages.find(e=>e.number===u);e&&(e.footnoteIds=p)}return{layout:c,pageFootnoteMap:l,converged:d}}function tR(e,t,n){let r=new Map;if(!n?.package?.footnotes)return r;let o=new Map;for(let i of n.package.footnotes)i.noteType&&"normal"!==i.noteType||o.set(i.id,i);for(let[i,a]of e){let e=[];for(let n of a){let r=o.get(n);if(!r)continue;let i=t.get(n),a=i?.displayNumber??0;e.push({displayNumber:String(a),text:HS(r),content:i})}e.length>0&&r.set(i,e)}return r}function nR(e,t,n,r){let o=r.createElement("div");o.className="layout-footnote-content",o.style.position="relative",o.style.width=`${t}px`,o.style.height=`${e.height}px`;let i=0;for(let a=0;a<e.blocks.length;a++){let l=e.blocks[a],s=e.measures[a];if(l&&s)if("paragraph"===l.kind&&"paragraph"===s.kind){let e=l.attrs?.spacing?.before??0,a={blockId:l.id,width:t,height:s.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromLine:0,toLine:s.lines.length},c=yI(a,l,s,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:r});c.style.top=`${i+e}px`,c.style.left="0",c.style.width=`${t}px`,c.style.height=`${s.totalHeight}px`,o.appendChild(c),i+=s.totalHeight}else if("table"===l.kind&&"table"===s.kind){let e={blockId:l.id,width:s.totalWidth,height:s.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromRow:0,toRow:s.rows.length},a=NI(e,l,s,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:r});a.style.top=`${i}px`,a.style.left="0",o.appendChild(a),i+=s.totalHeight}else if("image"===l.kind&&"image"===s.kind){let e={blockId:l.id,width:s.width,height:s.height,pmStart:l.pmStart,pmEnd:l.pmEnd},t=UN(e,l,s,{...n},{document:r});t.style.top=`${i}px`,t.style.left="0",o.appendChild(t),i+=s.height}else if("textBox"===l.kind&&"textBox"===s.kind){let e={blockId:l.id,width:s.width,height:s.height,pmStart:l.pmStart,pmEnd:l.pmEnd},a=RI(e,l,s,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:r});a.style.top=`${i}px`,a.style.left="0",o.appendChild(a),i+=s.height}}return o}function rR(e,t){let n=t.createElement("div");n.style.fontSize="10px",n.style.lineHeight="1.3",n.style.marginBottom="4px",n.style.color="#000";let r=t.createElement("sup");r.textContent=e.displayNumber,r.style.fontSize="7px",r.style.marginRight="2px",n.appendChild(r);let o=t.createTextNode(" "+e.text);return n.appendChild(o),n}function oR(e){let t=WI;for(let n of e)n.content&&(t+=n.content.height);return t}function iR(e,t,n,r){let o=r.createElement("div");o.className="layout-footnote-area",o.style.width=`${t}px`;let i=r.createElement("div"),a=.5,l=(WI-a)/2;i.style.width="33%",i.style.height=`${a}px`,i.style.backgroundColor="#000",i.style.marginBottom=`${l}px`,i.style.marginTop=`${l}px`,o.appendChild(i);for(let s of e)o.appendChild(s.content?nR(s.content,t,n,r):rR(s,r));return o}function aR(e,t,n){let r={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:n.resolvedCommentIds},o={...n};if(n.titlePg&&1===e.number&&(o.headerContent=n.firstPageHeaderContent,o.footerContent=n.firstPageFooterContent),n.footnotesByPage){let t=n.footnotesByPage.get(e.number);t&&t.length>0&&(o.footnoteArea=t)}return{context:r,pageOptions:o}}function lR(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let e=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;void 0!==n.pmStart&&(e+=`,ps:${n.pmStart}`),void 0!==n.pmEnd&&(e+=`,pe:${n.pmEnd}`),"paragraph"===n.kind?e+=`,fl:${n.fromLine},tl:${n.toLine}`:"table"===n.kind&&(e+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(e)}return t.join("|")}function sR(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height},${e.headerContent.visualTop??0},${e.headerContent.visualBottom??e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height},${e.footerContent.visualTop??0},${e.footerContent.visualBottom??e.footerContent.height}`),e.firstPageHeaderContent&&t.push(`fp-hdr:${e.firstPageHeaderContent.blocks.length},${e.firstPageHeaderContent.height}`),e.firstPageFooterContent&&t.push(`fp-ftr:${e.firstPageFooterContent.blocks.length},${e.firstPageFooterContent.height}`),e.titlePg&&t.push("titlePg"),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),void 0!==e.headerDistance&&t.push(`hd:${e.headerDistance}`),void 0!==e.footerDistance&&t.push(`fd:${e.footerDistance}`),t.join("|")}function cR(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)"}var dR=2,uR=8;function pR(e,t,n={}){let r=e.length,o=n.pageGap??24,i=t,a=i.__pageRenderState,l=sR(n),s=r>=uR;if(a&&a.optionsHash===l&&s){let o=a.pageStates,l=a.pageDataMap,s=i.__pageObserver,c=[];for(let t of e)c.push(lR(t));let d=a.totalPages!==r,u=Math.min(o.length,e.length);for(let t=0;t<u;t++){let i=o[t],a=c[t];if(i.fingerprint===a&&!d){let n=l.get(i.element);n&&(n.page=e[t]);continue}let s=i.element,u=l.get(s);u&&(u.page=e[t],u.rendered&&fR(s,l,r,n)),i.fingerprint=a,vR(s,e[t].size.w,e[t].size.h,n),s.dataset.pageNumber=String(e[t].number)}if(e.length>o.length){let r=n.document??document;for(let i=o.length;i<e.length;i++){let a=e[i],d=r.createElement("div");d.className=n.pageClassName??gR.page,d.dataset.pageNumber=String(a.number),d.dataset.pageIndex=String(i),vR(d,a.size.w,a.size.h,n),t.appendChild(d),o.push({element:d,fingerprint:c[i]}),l.set(d,{page:a,index:i,rendered:!1}),s&&s.observe(d)}}if(e.length<o.length){for(let n=o.length-1;n>=e.length;n--){let e=o[n].element;s&&s.unobserve(e),l.delete(e),t.removeChild(e)}o.length=e.length}for(let e=0;e<o.length;e++){let t=l.get(o[e].element);t&&(t.index=e)}return a.totalPages=r,a.currentOptions=n,"incremental"}let c=i.__pageObserver;c&&(c.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,cR(t,o);let d=[],u=[];for(let m=0;m<e.length;m++){let o=e[m];if(u.push(lR(o)),s){let e=(n.document??document).createElement("div");e.className=n.pageClassName??gR.page,e.dataset.pageNumber=String(o.number),e.dataset.pageIndex=String(m),vR(e,o.size.w,o.size.h,n),t.appendChild(e),d.push(e)}else{let{context:e,pageOptions:i}=aR(o,r,n),a=TR(o,e,i);t.appendChild(a),d.push(a)}}if(!s)return"full";let p=new Map;for(let m=0;m<e.length;m++)p.set(d[m],{page:e[m],index:m,rendered:!1});let h=new IntersectionObserver(e=>{let t=i.__pageRenderState;if(!t)return;let{currentOptions:n,totalPages:r,pageDataMap:o}=t;for(let i of e){let e=i.target,a=o.get(e);if(a&&i.isIntersecting){hR(e,o,r,n);for(let e=-dR;e<=dR;e++){let i=a.index+e;i>=0&&i<t.pageStates.length&&i!==a.index&&hR(t.pageStates[i].element,o,r,n)}}}let a=window.innerHeight,l=3*a,s=new Set;for(let[i,c]of o){if(!c.rendered)continue;let e=i.getBoundingClientRect();e.bottom>-l&&e.top<a+l&&s.add(c.index)}for(let[i,c]of o){if(!c.rendered)continue;let e=!1;for(let t of s)if(Math.abs(c.index-t)<=dR+1){e=!0;break}!e&&s.size>0&&mR(i,o)}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let m of d)h.observe(m);i.__pageObserver=h,i.__pageRenderState={pageStates:d.map((e,t)=>({element:e,fingerprint:u[t]})),totalPages:r,optionsHash:l,pageDataMap:p,currentOptions:n};let f=Math.min(e.length,dR+3);for(let m=0;m<f;m++)hR(d[m],p,r,n);return"full"}function hR(e,t,n,r){let o=t.get(e);if(!o||o.rendered)return;let{context:i,pageOptions:a}=aR(o.page,n,r),l=TR(o.page,i,a);for(;l.firstChild;)e.appendChild(l.firstChild);o.rendered=!0}function fR(e,t,n,r){let o=t.get(e);if(!o)return;let{context:i,pageOptions:a}=aR(o.page,n,r),l=TR(o.page,i,a).querySelector(`.${gR.content}`),s=e.querySelector(`.${gR.content}`);l&&s?e.replaceChild(l,s):(e.innerHTML="",o.rendered=!1,hR(e,t,n,r))}function mR(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=!1)}var gR={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function vR(e,t,n,r){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=r.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily=Jp("Calibri").cssFallback,e.style.fontSize=1056/72+"px",e.style.color="#000000",r.showBorders&&(e.style.border="1px solid #ccc"),r.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)")}function yR(e,t){switch(t??"allPages"){case"firstPage":return 1===e;case"notFirstPage":return 1!==e;default:return!0}}function bR(e){return void 0!==e?.space?Qs(e.space):0}function wR(e,t,n,r){if(!t||"none"===t.style||"nil"===t.style)return;let o=xh(t,n,r);for(let[l,s]of Object.entries(o))e.style[l]=String(s);let i=`border${n}Style`,a=`border${n}Width`;if("double"===e.style[i]){let t=parseFloat(e.style[a]);(!Number.isFinite(t)||t<3)&&(e.style[a]="3px")}}function kR(e,t,n){let r=t.pageBorders;if(!r||!yR(e.number,r.display)||![r.top,r.bottom,r.left,r.right].some(e=>e&&"none"!==e.style&&"nil"!==e.style))return null;let o=r.offsetFrom??"text",i=bR(r.top),a=bR(r.right),l=bR(r.bottom),s=bR(r.left),c=n.createElement("div");return c.className="layout-page-border",c.style.position="absolute",c.style.pointerEvents="none",c.style.boxSizing="border-box",c.style.zIndex="back"===r.zOrder?"0":"20","page"===o?(c.style.top=`${i}px`,c.style.right=`${a}px`,c.style.bottom=`${l}px`,c.style.left=`${s}px`):(c.style.top=`${Math.max(0,e.margins.top-i)}px`,c.style.right=`${Math.max(0,e.margins.right-a)}px`,c.style.bottom=`${Math.max(0,e.margins.bottom-l)}px`,c.style.left=`${Math.max(0,e.margins.left-s)}px`),wR(c,r.top,"Top",t.theme),wR(c,r.bottom,"Bottom",t.theme),wR(c,r.left,"Left",t.theme),wR(c,r.right,"Right",t.theme),c}function xR(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible"}function SR(e,t,n){e.style.position="absolute",e.style.left=t.x-n.left+"px",e.style.top=t.y-n.top+"px",e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`)}function CR(e,t,n,r){let o=[];for(let i of e.runs){if("image"!==i.kind)continue;let e=i;if(!jN(e))continue;let a=e.distTop??0,l=e.distBottom??0,s=e.distLeft??12,c=e.distRight??12,{x:d,y:u,side:p}=DI(e,t,n,r);o.push({src:e.src,width:e.width,height:e.height,alt:e.alt,transform:e.transform,side:p,x:d,y:u,distTop:a,distBottom:l,distLeft:s,distRight:c,pmStart:e.pmStart,pmEnd:e.pmEnd,wrapText:HN(e.cssFloat),wrapType:e.wrapType,cropTop:e.cropTop,cropRight:e.cropRight,cropBottom:e.cropBottom,cropLeft:e.cropLeft,opacity:e.opacity})}return o}function TR(e,t,n={}){let r=n.document??document,o=r.createElement("div");o.className=n.pageClassName??gR.page,o.dataset.pageNumber=String(e.number),vR(o,e.size.w,e.size.h,n);let i=kR(e,n,r);i&&"back"===n.pageBorders?.zOrder&&o.appendChild(i);let a=r.createElement("div");a.className=gR.content,xR(a,e);let l=BI(e),s=l.contentWidth,c=[],d=[];for(let v of e.fragments)if("paragraph"===v.kind&&n.blockLookup){let t=n.blockLookup.get(String(v.blockId));if("paragraph"===t?.block.kind){let n=t.block,r=v.y-e.margins.top,o=CR(n,r,s,l);c.push(...o)}}for(let v of c)VN(v)&&d.push({side:v.side,x:v.x,y:v.y,width:v.width,height:v.height,distTop:v.distTop,distBottom:v.distBottom,distLeft:v.distLeft,distRight:v.distRight,wrapText:v.wrapText,wrapType:v.wrapType});if(n.blockLookup)for(let v of e.fragments){if("table"!==v.kind)continue;let t=n.blockLookup.get(String(v.blockId));if("table"!==t?.block.kind)continue;let r=t.block.floating;if(!r)continue;let o=v.x-e.margins.left,i=v.y-e.margins.top,a=r.topFromText??0,l=r.bottomFromText??0,c=r.leftFromText??12,u=r.rightFromText??12,p=o<s/2?"left":"right";d.push({side:p,x:o,y:i,width:v.width,height:v.height,distTop:a,distBottom:l,distLeft:c,distRight:u})}if(n.blockLookup)for(let v of e.fragments){if("textBox"!==v.kind)continue;let t=n.blockLookup.get(String(v.blockId));if("textBox"!==t?.block.kind)continue;let r=t.block;if(!oN(r))continue;let o=v.y-e.margins.top,i=DI({width:v.width,height:v.height,position:r.position,cssFloat:r.cssFloat},o,s,l);v.x=e.margins.left+i.x,v.y=e.margins.top+i.y,iN(r)&&d.push({side:i.side,x:i.x,y:i.y,width:v.width,height:v.height,distTop:r.distTop??0,distBottom:r.distBottom??0,distLeft:r.distLeft??12,distRight:r.distRight??12,wrapText:r.wrapText,wrapType:r.wrapType})}let u=d.length>0?eM(d,s):[],p=c.filter($N),h=c.filter(e=>!$N(e));if(p.length>0){let e=kI(p,r,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});a.appendChild(e)}let f,m=e=>{if("paragraph"!==e.kind||!n.blockLookup||!e.blockId)return;let t=n.blockLookup.get(String(e.blockId));return"paragraph"===t?.block.kind?t.block.attrs?.borders:void 0},g=new Map;for(let v=0;v<e.fragments.length;v++){let o,i=e.fragments[v],l={...t,section:"body",contentWidth:s},c=i.y-e.margins.top;if(n.blockLookup&&i.blockId){let t=n.blockLookup.get(String(i.blockId));if("paragraph"===i.kind&&"paragraph"===t?.block.kind&&"paragraph"===t?.measure.kind){let n=t.block,a=v+1<e.fragments.length?m(e.fragments[v+1]):void 0,d=String(i.blockId),p=g.get(d);p||(p=new Set,g.set(d,p));let h=t.measure;u.length>0&&(h=RM(n,s,{floatingZones:u,paragraphYOffset:c})),o=yI(i,n,h,l,{document:r,prevBorders:f,nextBorders:a,renderedInlineImageKeys:p}),f=n.attrs?.borders}else"table"===i.kind&&"table"===t?.block.kind&&"table"===t?.measure.kind?(o=NI(i,t.block,t.measure,l,{document:r}),f=void 0):"image"===i.kind&&"image"===t?.block.kind&&"image"===t?.measure.kind?(o=UN(i,t.block,t.measure,l,{document:r}),f=void 0):"textBox"===i.kind&&"textBox"===t?.block.kind&&"textBox"===t?.measure.kind?(o=RI(i,t.block,t.measure,l,{document:r}),f=void 0):(o=BN(i,l,{document:r}),f=void 0)}else o=BN(i,l,{document:r}),f=void 0;SR(o,i,{left:e.margins.left,top:e.margins.top}),a.appendChild(o)}if(h.length>0){let e=kI(h,r,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});a.appendChild(e)}if(e.columns&&e.columns.separator&&e.columns.count>1){let t=e.columns.count,n=e.columns.gap,o=(s-(t-1)*n)/t,i=e.size.h-e.margins.top-e.margins.bottom;for(let e=0;e<t-1;e++){let t=(e+1)*o+e*n+n/2,l=r.createElement("div");l.style.position="absolute",l.style.left=`${t}px`,l.style.top="0",l.style.height=`${i}px`,l.style.width="0.5px",l.style.backgroundColor="#000",l.style.pointerEvents="none",a.appendChild(l)}}if(n.footnoteArea&&n.footnoteArea.length>0){let o=iR(n.footnoteArea,s,t,r);o.style.position="absolute";let i=Math.max(e.footnoteReservedHeight??0,oR(n.footnoteArea)),l=e.size.h-e.margins.bottom-e.margins.top;o.style.top=`${Math.max(-e.margins.top,l-i)}px`,o.style.left="0",o.style.right="0",a.appendChild(o)}o.appendChild(a);{let i=n.headerDistance??e.margins.header??48,a=e.size.w-e.margins.left-e.margins.right,l=Math.max(e.margins.top-i,48),s=n.headerContent?.visualTop??0,c=n.headerContent?.visualBottom??n.headerContent?.height??0,d=Math.max(c-s,24),u=c>l,p=r.createElement("div");p.className=gR.header,p.style.position="absolute",p.style.top=`${i+s}px`,p.style.left=`${e.margins.left}px`,p.style.right=`${e.margins.right}px`,p.style.width=`${a}px`,p.style.height=`${d}px`,p.style.minHeight=`${d}px`;let h=!u;if(n.headerContent&&n.headerContent.blocks.length>0){let r={flowTop:i,flowLeft:e.margins.left,contentWidth:a,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},o=HI(n.headerContent,{...t,section:"header",contentWidth:a},n,r);o.style.top=-s+"px",o.querySelector("img")&&(h=!1),p.appendChild(o)}h&&(p.style.maxHeight=`${l}px`,p.style.overflow="hidden"),o.appendChild(p)}{let i=n.footerDistance??e.margins.footer??48,a=e.size.w-e.margins.left-e.margins.right,l=Math.max(e.margins.bottom-i,48),s=n.footerContent?.visualTop??0,c=n.footerContent?.visualBottom??n.footerContent?.height??0,d=Math.max(c-s,24),u=d>l,p=r.createElement("div");p.className=gR.footer,p.style.position="absolute",p.style.top=e.size.h-i-d+"px",p.style.left=`${e.margins.left}px`,p.style.right=`${e.margins.right}px`,p.style.width=`${a}px`,p.style.height=`${d}px`,p.style.minHeight=`${d}px`;let h=!u;if(n.footerContent&&n.footerContent.blocks.length>0){let r={flowTop:e.size.h-i-(n.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:a,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},o=HI(n.footerContent,{...t,section:"footer",contentWidth:a},n,r);o.style.top=-s+"px",o.querySelector("img")&&(h=!1),p.appendChild(o)}h&&(p.style.maxHeight=`${l}px`,p.style.overflow="hidden"),o.appendChild(p)}return i&&"back"!==n.pageBorders?.zOrder&&o.appendChild(i),o}var ER=24;function _R(e,t){switch(e.kind){case"paragraph":return RM(e,t);case"table":return UM(e,t,_R);case"image":{let t=e;return{kind:"image",width:t.width??100,height:t.height??100}}case"textBox":{let t=e,n=t.margins??a_,r=(t.width??l_)-n.left-n.right,o=t.content.map(e=>RM(e,r)),i=o.reduce((e,t)=>e+t.totalHeight,0),a=t.height??i+n.top+n.bottom;return{kind:"textBox",width:t.width??l_,height:a,innerMeasures:o}}case"pageBreak":return{kind:"pageBreak"};case"columnBreak":return{kind:"columnBreak"};case"sectionBreak":return{kind:"sectionBreak"};default:s_(e,"vue useDocxEditor measureBlock")}}function MR(e,t){return e.map(e=>_R(e,t))}function NR(e){let{hiddenContainer:t,pagesContainer:r,readOnly:o=!1,pageGap:i=ER,onChange:a,onError:l,onSelectionUpdate:s,externalPlugins:c=[],syncCoordinator:d}=e,u=(0,n.shallowRef)(null),p=(0,n.shallowRef)(null),h=(0,n.shallowRef)(null),f=(0,n.ref)(!1),m=(0,n.ref)(null),g=(0,n.shallowRef)(null),v=kk;function y(e){let t=r.value;if(!t||!u.value)return;let n=d?.getStateSeq()??0;d?.onLayoutStart();let o=u.value.package?.document,a=o?.sections?.[0]?.properties??o?.finalSectionProperties??null,s=o?.finalSectionProperties??a,c=GM(a),p=XM(a),h=GM(s),f=XM(s),m=c.w-p.left-p.right,v=c.h-p.top-p.bottom,y=u.value.package?.theme??null,b=u.value.package?.styles??null;try{let n=L_(e.doc,{theme:y,pageContentHeight:v}),r=MR(n,m),{header:o,footer:l,firstHeader:s,firstFooter:d}=YM(u.value,a),w={section:"header",pageSize:c,margins:p},k={section:"footer",pageSize:c,margins:p},x={styles:b,theme:y,measureBlocks:MR},S=jM(o,m,w,x),C=jM(l,m,k,x),T=!0===a?.titlePg,E=T?jM(s,m,w,x):void 0,_=T?jM(d,m,k,x):void 0,M=p.header??48,N=p.footer??48,I=p.top-M,R=p.bottom-N,A=e=>e?e.visualBottom??e.height:0,B=e=>e?Math.max((e.visualBottom??e.height)-(e.visualTop??0),e.height):0,D=Math.max(A(S),A(E)),F=Math.max(B(C),B(_)),P=D>I,O=F>R;if(P||O){let e=e=>{let t={...e};return P&&(t.top=Math.max(e.top,M+D)),O&&(t.bottom=Math.max(e.bottom,N+F)),t};p=e(p),f=e(f);for(let t of n){if("sectionBreak"!==t.kind)continue;let n=t;n.margins&&=e(n.margins)}}let L={pageSize:c,margins:p,finalPageSize:h,finalMargins:f,pageGap:i},z=KI(n),V=z.length>0&&!!u.value.package?.footnotes,$=mN(n,r,L),j=new Map,H=new Map;if(V){H=JI(u.value.package.footnotes,z,m,{styles:b,theme:y,measureBlocks:MR});let e=eR({blocks:n,measures:r,layoutOpts:L,footnoteRefs:z,footnoteContentMap:H,initialLayout:$});$=e.layout,j=e.pageFootnoteMap}g.value=$;let W=new Map;for(let e=0;e<n.length;e++){let t=n[e],o=r[e];t&&o&&W.set(String(t.id),{block:t,measure:o})}let q=V?tR(j,H,u.value):void 0;pR($.pages,t,{pageGap:i,showShadow:!0,pageBackground:"#fff",blockLookup:W,theme:y,headerContent:S,footerContent:C,firstPageHeaderContent:E,firstPageFooterContent:_,titlePage:T,footnotesByPage:q}),t.style.overflowY="auto",t.style.minHeight="0";for(let e of Array.from(t.children))e.style.flexShrink="0"}catch(e){console.error("[useDocxEditor] Layout pipeline error:",e),l?.(e instanceof Error?e:Error(String(e)))}finally{d?.onLayoutComplete(n)}}function b(){let e=t.value;if(!e)return;let r=u.value?mx(u.value,{styles:u.value.package?.styles??void 0}):yx(),i=[...c,...v.getPlugins()??[]],l=Sn.create({doc:r,schema:v.getSchema(),plugins:i});h.value=l;let m=new qa(e,{state:l,editable:()=>!(0,n.unref)(o),dispatchTransaction(e){if(!m)return;let t=m.state.apply(e);if(m.updateState(t),h.value=t,e.docChanged){d?.incrementStateSeq(),y(t);try{if(u.value){let e=n_(t.doc,u.value);u.value=e,a?.(e)}}catch(e){console.error("[useDocxEditor] fromProseDoc error:",e)}}d?.requestRender(),s?.()}});p.value=m,f.value=!0,y(l),d?.requestRender()}function w(){p.value&&=(p.value.destroy(),null),h.value=null,f.value=!1}async function k(e){m.value=null,f.value=!1;try{let t;t=e instanceof Blob||e instanceof File?await e.arrayBuffer():e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e,u.value=await xE(t),w(),b()}catch(e){let t=e instanceof Error?e:Error(String(e));m.value=t.message,l?.(t)}}function S(e){m.value=null,u.value=e,w(),b()}async function C(){if(!p.value||!u.value)return null;let e,{repackDocx:t,createDocx:n}=await x.e(642).then(x.bind(x,1642)),{injectReplyRangeMarkers:r,injectTCReplyRangeMarkers:o}=await x.e(947).then(x.bind(x,1947)),i=n_(p.value.state.doc,u.value),a=i.package.document?.comments??[];return i.package.document?.content&&a.length>0&&(r(i.package.document.content,a),o(i.package.document.content,a)),e=i.originalBuffer?await t(i):await n(i),new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}function T(){p.value?.focus()}function E(){w(),u.value=null}function _(){return u.value}function M(){return v.getCommands()}return(0,n.onBeforeUnmount)(()=>{E()}),{editorView:p,editorState:h,isReady:f,parseError:m,layout:g,loadBuffer:k,loadDocument:S,save:C,focus:T,destroy:E,getDocument:_,getCommands:M,reLayout(){p.value&&y(p.value.state)}}}var IR=.25,RR=4,AR=.1,BR=[.25,.5,.75,1,1.25,1.5,2,3,4];function DR(e=1){let t=(0,n.ref)(Math.max(IR,Math.min(RR,e))),r=(0,n.computed)(()=>Math.round(100*t.value)),o=(0,n.computed)(()=>t.value<=IR),i=(0,n.computed)(()=>t.value>=RR);function a(e){t.value=Math.max(IR,Math.min(RR,Math.round(100*e)/100))}function l(){a(t.value+AR)}function s(){a(t.value-AR)}function c(){a(1)}function d(e){(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?l():s())}function u(e){(e.ctrlKey||e.metaKey)&&(e.shiftKey||e.altKey||("="===e.key||"+"===e.key?(e.preventDefault(),l()):"-"===e.key?(e.preventDefault(),s()):"0"===e.key&&(e.preventDefault(),c())))}function p(){(0,n.onMounted)(()=>document.addEventListener("keydown",u)),(0,n.onBeforeUnmount)(()=>document.removeEventListener("keydown",u))}return{zoom:t,zoomPercent:r,isMinZoom:o,isMaxZoom:i,setZoom:a,zoomIn:l,zoomOut:s,resetZoom:c,handleWheel:d,handleKeyDown:u,installShortcuts:p,ZOOM_PRESETS:BR}}var FR=15,PR=300,OR=200,LR=15;function zR(){let e={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidths:{left:0,right:0}},t={active:!1,startY:0,handle:null,rowIndex:0,isEdge:!1,tablePmStart:0,origHeight:0},n={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidth:0},r=null;function o(){return e.active||t.active||n.active}function i(o,i){let a=o.target;return!!a?.classList&&(a.classList.contains("layout-table-resize-handle")?(o.preventDefault(),o.stopPropagation(),r=i,e.active=!0,e.startX=o.clientX,e.handle=a,a.classList.add("dragging"),e.columnIndex=parseInt(a.dataset.columnIndex??"0",10),e.tablePmStart=parseInt(a.dataset.tablePmStart??"0",10),VR(i,e),!0):a.classList.contains("layout-table-row-resize-handle")||a.classList.contains("layout-table-edge-handle-bottom")?(o.preventDefault(),o.stopPropagation(),r=i,t.active=!0,t.startY=o.clientY,t.handle=a,t.isEdge="bottom"===a.dataset.isEdge,a.classList.add("dragging"),t.rowIndex=parseInt(a.dataset.rowIndex??"0",10),t.tablePmStart=parseInt(a.dataset.tablePmStart??"0",10),$R(i,t,a),!0):!!a.classList.contains("layout-table-edge-handle-right")&&(o.preventDefault(),o.stopPropagation(),r=i,n.active=!0,n.startX=o.clientX,n.handle=a,a.classList.add("dragging"),n.columnIndex=parseInt(a.dataset.columnIndex??"0",10),n.tablePmStart=parseInt(a.dataset.tablePmStart??"0",10),jR(i,n),!0))}function a(r){if(e.active&&e.handle){r.preventDefault();let t=r.clientX-e.startX,n=parseFloat(e.handle.style.left);e.handle.style.left=`${n+t}px`,e.startX=r.clientX;let o=Math.round(t*FR),i=e.origWidths.left+o,a=e.origWidths.right-o;return void(i>=PR&&a>=PR&&(e.origWidths={left:i,right:a}))}if(t.active&&t.handle){r.preventDefault();let e=r.clientY-t.startY,n=parseFloat(t.handle.style.top);t.handle.style.top=`${n+e}px`,t.startY=r.clientY;let o=Math.round(e*FR),i=t.origHeight+o;return void(i>=OR&&(t.origHeight=i))}if(n.active&&n.handle){r.preventDefault();let e=r.clientX-n.startX,t=parseFloat(n.handle.style.left);n.handle.style.left=`${t+e}px`,n.startX=r.clientX;let o=Math.round(e*FR),i=n.origWidth+o;i>=PR&&(n.origWidth=i)}}function l(o){return e.active?(e.active=!1,e.handle?.classList.remove("dragging"),r&&HR(r,e),void(e.handle=null)):t.active?(t.active=!1,t.handle?.classList.remove("dragging"),r&&WR(r,t),void(t.handle=null)):void(n.active&&(n.active=!1,n.handle?.classList.remove("dragging"),r&&qR(r,n),n.handle=null))}function s(){return document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)}}return{tryStartResize:i,install:s,isResizing:o}}function VR(e,t){let n=e.state.doc.resolve(t.tablePmStart+1);for(let r=n.depth;r>=0;r--){let e=n.node(r);if("table"===e.type.name){let n=e.attrs.columnWidths;return void(n&&void 0!==n[t.columnIndex]&&void 0!==n[t.columnIndex+1]&&(t.origWidths={left:n[t.columnIndex],right:n[t.columnIndex+1]}))}}}function $R(e,t,n){let r=e.state.doc.resolve(t.tablePmStart+1);for(let o=r.depth;o>=0;o--){let e=r.node(o);if("table"===e.type.name){let r=null,o=0;if(e.forEach(e=>{o===t.rowIndex&&(r=e),o++}),r){let e=r.attrs.height;if(e)t.origHeight=e;else{let e=n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`),r=e?e.getBoundingClientRect().height:30;t.origHeight=Math.round(r*LR)}}return}}}function jR(e,t){let n=e.state.doc.resolve(t.tablePmStart+1);for(let r=n.depth;r>=0;r--){let e=n.node(r);if("table"===e.type.name){let n=e.attrs.columnWidths;return void(n&&void 0!==n[t.columnIndex]&&(t.origWidth=n[t.columnIndex]))}}}function HR(e,t){let n=e.state.doc.resolve(t.tablePmStart+1);for(let r=n.depth;r>=0;r--){let o=n.node(r);if("table"!==o.type.name)continue;let i=n.before(r),a=e.state.tr,l=[...o.attrs.columnWidths||[]];l[t.columnIndex]=t.origWidths.left,l[t.columnIndex+1]=t.origWidths.right,a.setNodeMarkup(i,void 0,{...o.attrs,columnWidths:l});let s=i+1;return o.forEach(e=>{let n=s+1,r=0;e.forEach(e=>{let o=e.attrs.colspan||1;if(r===t.columnIndex||r===t.columnIndex+1){let o=r===t.columnIndex?t.origWidths.left:t.origWidths.right;a.setNodeMarkup(a.mapping.map(n),void 0,{...e.attrs,width:o,widthType:"dxa",colwidth:null})}n+=e.nodeSize,r+=o}),s+=e.nodeSize}),void e.dispatch(a)}}function WR(e,t){let n=e.state.doc.resolve(t.tablePmStart+1);for(let r=n.depth;r>=0;r--){let o=n.node(r);if("table"!==o.type.name)continue;let i=n.before(r),a=e.state.tr,l=i+1,s=0;return o.forEach(e=>{s===t.rowIndex&&a.setNodeMarkup(a.mapping.map(l),void 0,{...e.attrs,height:t.origHeight,heightRule:"atLeast"}),l+=e.nodeSize,s++}),void e.dispatch(a)}}function qR(e,t){let n=e.state.doc.resolve(t.tablePmStart+1);for(let r=n.depth;r>=0;r--){let o=n.node(r);if("table"!==o.type.name)continue;let i=n.before(r),a=e.state.tr,l=[...o.attrs.columnWidths||[]];l[t.columnIndex]=t.origWidth,a.setNodeMarkup(i,void 0,{...o.attrs,columnWidths:l});let s=i+1;return o.forEach(e=>{let n=s+1,r=0;e.forEach(e=>{let o=e.attrs.colspan||1;r===t.columnIndex&&a.setNodeMarkup(a.mapping.map(n),void 0,{...e.attrs,width:t.origWidth,widthType:"dxa",colwidth:null}),n+=e.nodeSize,r+=o}),s+=e.nodeSize}),void e.dispatch(a)}}async function ZR(e){let t=e.target;if(!t||!t.files)return null;let n=t.files[0];return t.value="",n?{buffer:await n.arrayBuffer(),name:n.name.replace(/\.docx$/i,"")}:null}var UR=/[\p{L}\p{N}\p{M}_''\-]/u,KR=/\s/;function GR(e){return!(!e||0===e.length)&&UR.test(e)}function XR(e){return!(!e||0===e.length)&&KR.test(e)}function YR(e,t){if(!e||0===e.length)return[0,0];t=Math.max(0,Math.min(t,e.length-1));let n=e[t];if(XR(n)){let n=t,r=t;for(;n>0&&XR(e[n-1]);)n--;for(;r<e.length&&XR(e[r]);)r++;return[n,r]}if(GR(n)){let n=t,r=t;for(;n>0&&GR(e[n-1]);)n--;for(;r<e.length&&GR(e[r]);)r++;return[n,r]}return[t,t+1]}var JR=".layout-page-content";function QR(e){return Array.from(e.querySelectorAll(`${JR} span[data-pm-start][data-pm-end]`))}function eA(e,t,n,r=1){let o=document.elementsFromPoint(t,n),i=o.find(e=>e.classList.contains("layout-page"));if(!i)return null;let a=o.find(e=>"SPAN"===e.tagName&&void 0!==e.dataset.pmStart&&void 0!==e.dataset.pmEnd);if(a)return tA(a,t);let l=o.find(e=>e.classList.contains("layout-empty-run"));if(l){let e=l.closest(".layout-paragraph");if(e&&e.dataset.pmStart)return Number(e.dataset.pmStart)}let s=o.find(e=>e.classList.contains("layout-paragraph")&&void 0!==e.dataset.pmStart);if(s&&s.dataset.pmStart){let e=nA(s,t,n);return null!==e?e:Number(s.dataset.pmStart)}let c=o.find(e=>e.classList.contains("layout-table-cell"));return c?nA(c,t,n):rA(e,i,t,n)}function tA(e,t,n){let r=Number(e.dataset.pmStart),o=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let n=e.getBoundingClientRect(),i=(n.left+n.right)/2;return t<i?r:o}let i=e.firstChild;if(!i||i.nodeType!==Node.TEXT_NODE)return r;let a=i,l=a.length;if(0===l)return r;let s=e.ownerDocument;if(!s)return r;let c=0,d=l;for(;c<d;){let e=Math.floor((c+d)/2),n=s.createRange();n.setStart(a,e),n.setEnd(a,e);let r=n.getBoundingClientRect().left;t<r?d=e:c=e+1}if(c>0&&c<=l){let e=s.createRange();e.setStart(a,c-1),e.setEnd(a,c-1);let n=e.getBoundingClientRect();e.setStart(a,Math.min(c,l)),e.setEnd(a,Math.min(c,l));let o=e.getBoundingClientRect(),i=Math.abs(t-n.left),d=Math.abs(t-o.left);if(i<d)return r+(c-1)}return r+Math.min(c,o-r)}function nA(e,t,n){let r=e.querySelector(".layout-empty-run");if(r){let e=r.closest(".layout-paragraph");if(e&&e.dataset.pmStart)return Number(e.dataset.pmStart)}let o=e.querySelectorAll(".layout-line"),i=null,a=1/0;for(let u of Array.from(o)){let e=u,t=e.getBoundingClientRect(),r=(t.top+t.bottom)/2,o=Math.abs(n-r);o<a&&(a=o,i=e)}if(!i){let t=e.querySelector(".layout-paragraph[data-pm-start]");return t?.dataset.pmStart?Number(t.dataset.pmStart):e.dataset.pmStart?Number(e.dataset.pmStart):null}let l=i.querySelectorAll("span[data-pm-start][data-pm-end]");if(0===l.length){let e=i.closest(".layout-paragraph");return e?.dataset.pmStart?Number(e.dataset.pmStart):null}let s=null,c=1/0;for(let u of Array.from(l)){let e=u,n=e.getBoundingClientRect();if(t>=n.left&&t<=n.right)return tA(e,t);let r=t<n.left?n.left-t:t-n.right;r<c&&(c=r,s=e)}if(!s)return null;let d=s.getBoundingClientRect();return t<d.left?Number(s.dataset.pmStart):Number(s.dataset.pmEnd)}function rA(e,t,n,r,o){if(0===t.querySelectorAll("span[data-pm-start][data-pm-end]").length){let e=t.querySelectorAll(".layout-paragraph");if(e.length>0){let t=e[0];return Number(t.dataset.pmStart)||0}return null}let i=t.querySelectorAll(".layout-line"),a=null,l=1/0;for(let p of Array.from(i)){let e=p,t=e.getBoundingClientRect(),n=(t.top+t.bottom)/2,o=Math.abs(r-n);o<l&&(l=o,a=e)}if(!a)return null;let s=a.querySelectorAll("span[data-pm-start][data-pm-end]");if(0===s.length){let e=a.closest(".layout-paragraph");return e?.dataset.pmStart?Number(e.dataset.pmStart):null}let c=null,d=1/0;for(let p of Array.from(s)){let e=p,t=e.getBoundingClientRect();if(n>=t.left&&n<=t.right)return tA(e,n);let r=n<t.left?t.left-n:n-t.right;r<d&&(d=r,c=e)}if(!c)return null;let u=c.getBoundingClientRect();return n<u.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)}function oA(e,t,n,r){let o=[],i=QR(e);for(let a of Array.from(i)){let e=a,i=Number(e.dataset.pmStart);if(Number(e.dataset.pmEnd)<=t||i>=n)continue;let l=e.firstChild;if(!l||l.nodeType!==Node.TEXT_NODE)continue;let s=l,c=e.ownerDocument;if(!c)continue;let d=Math.max(0,t-i),u=Math.min(s.length,n-i);if(d>=u)continue;let p=c.createRange();p.setStart(s,d),p.setEnd(s,u);let h=p.getClientRects(),f=e.closest(".layout-page"),m=f?Number(f.dataset.pageNumber||1)-1:0;for(let t of Array.from(h))o.push({x:t.left-r.left,y:t.top-r.top,width:t.width,height:t.height,pageIndex:m})}return o}function iA(e,t,n){let r=QR(e);for(let i of Array.from(r)){let e=i,r=Number(e.dataset.pmStart),o=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){if(t>=r&&t<o){let t=e.getBoundingClientRect(),r=e.closest(".layout-page"),o=r?Number(r.dataset.pageNumber||1)-1:0,i=e.closest(".layout-line"),a=i?i.offsetHeight:16;return{x:t.left-n.left,y:t.top-n.top,height:a,pageIndex:o}}}else if(t>=r&&t<=o){let o=e.firstChild;if(!o||o.nodeType!==Node.TEXT_NODE){let t=e.getBoundingClientRect(),r=e.closest(".layout-page"),o=r?Number(r.dataset.pageNumber||1)-1:0,i=e.closest(".layout-line"),a=i?i.offsetHeight:16;return{x:t.left-n.left,y:t.top-n.top,height:a,pageIndex:o}}let i=o,a=Math.min(t-r,i.length),l=e.ownerDocument;if(!l)continue;let s=l.createRange();s.setStart(i,a),s.setEnd(i,a);let c=s.getBoundingClientRect(),d=e.closest(".layout-page"),u=d?Number(d.dataset.pageNumber||1)-1:0,p=e.closest(".layout-line"),h=p?p.offsetHeight:16;return{x:c.left-n.left,y:c.top-n.top,height:h,pageIndex:u}}}let o=e.querySelectorAll(".layout-paragraph");for(let i of Array.from(o)){let e=i,r=Number(e.dataset.pmStart),o=Number(e.dataset.pmEnd);if(t>=r&&t<=o){let t=e.querySelector(".layout-empty-run")||e,r=t.getBoundingClientRect(),o=e.closest(".layout-page"),i=o?Number(o.dataset.pageNumber||1)-1:0,a=(t.closest(".layout-line")||t).offsetHeight||16;return{x:r.left-n.left,y:r.top-n.top,height:a,pageIndex:i}}}return null}var aA={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},lA=[`.${aA.pageFloatingImage}`,`.${aA.cellFloatingImage}`,`.${aA.blockImage}`,`.${aA.runImage}`].join(", ");function sA(e){if(!(e instanceof HTMLElement))return null;if("IMG"===e.tagName&&e.classList.contains(aA.runImage))return e;let t=e.closest(lA);return t&&t.dataset.pmStart?t:null}function cA(e,t=1){if(!e.classList.contains(aA.runImage))return;let n=e.closest(`.${aA.pageContent}`),r=e.closest(`.${aA.paragraph}`);if(!n||!r)return;let o=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),l=t>0?t:1;return{horizontalEmu:Math.round(Js((o.left-i.left)/l)),verticalEmu:Math.round(Js((o.top-a.top)/l))}}function dA(e,t){return"inline"===e?"inline":"behind"===e?"behind":"inFront"===e?"inFront":"square"===e||"tight"===e||"through"===e?"right"===t?"squareRight":"squareLeft":null}var uA=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function pA(e,t){return!0}function hA(e){switch(e){case"inline":return"inline";case"square":case"tight":case"through":return"squareLeft";case"topAndBottom":return"topAndBottom";case"behind":return"behind";case"inFront":return"inFront";case"wrapRight":return"squareLeft";case"wrapLeft":return"squareRight";default:return}}var fA=kk.getCommands();fA.alignLeft(),fA.alignCenter(),fA.alignRight(),fA.alignJustify();fA.singleSpacing(),fA.oneAndHalfSpacing(),fA.doubleSpacing();function mA(e){return fA.setIndentLeft(e)}function gA(e){return fA.setIndentRight(e)}function vA(e,t){return fA.setIndentFirstLine(e,t)}fA.toggleBulletList(),fA.toggleNumberedList(),fA.increaseListLevel(),fA.decreaseListLevel(),fA.removeList();function yA(e,t){return fA.applyStyle(e,t)}fA.clearStyle();fA.removeSectionBreak();function bA(e){return fA.removeTabStop(e)}fA.setRtl(),fA.setLtr(),fA.generateTOC();var wA=(e,t)=>{let{schema:n}=e,r=n.nodes.pageBreak,o=n.nodes.paragraph;if(!r||!o)return!1;if(t){let n,{$from:i}=e.selection,a=e.tr,l=r.create(),s=l.nodeSize;if(i.parent.isTextblock)if(i.parentOffset>0&&i.parentOffset<i.parent.content.size){a.split(i.pos);let e=a.mapping.map(i.pos);a.insert(e,E.from([l,o.create()])),n=e+s+1}else if(i.parentOffset===i.parent.content.size){let e=i.after();a.insert(e,E.from([l,o.create()])),n=e+s+1}else{let e=i.before();a.insert(e,l),n=e+s+1}else{let e=i.pos;a.insert(e,E.from([l,o.create()])),n=e+s+1}a.setSelection(ln.create(a.doc,n)),t(a.scrollIntoView())}return!0},kA={FFFF00:"yellow","00FF00":"green","00FFFF":"cyan",FF00FF:"magenta","0000FF":"blue",FF0000:"red","00008B":"darkBlue","008080":"darkCyan","008000":"darkGreen",800080:"darkMagenta","8B0000":"darkRed",808e3:"darkYellow",808080:"darkGray",C0C0C0:"lightGray","000000":"black",FFFFFF:"white"};function xA(e){let t=e.replace(/^#/,"").toUpperCase();return kA[t]||null}kk.getCommands();kk.getCommands();function SA(e,t,n){return(r,o)=>{let i=r.schema.marks.insertion,a=r.schema.marks.deletion;if(!i&&!a)return!1;let l="accept"===n?i:a,s="accept"===n?a:i;if(o){let n=r.tr,i=[];r.doc.nodesBetween(e,t,(r,o)=>{if(!r.isText)return;let a=o+r.nodeSize,c=Math.max(e,o),d=Math.min(t,a);s&&r.marks.some(e=>e.type===s)&&i.push({from:c,to:d}),l&&r.marks.some(e=>e.type===l)&&n.removeMark(c,d,l)});for(let e of i.reverse())n.delete(e.from,e.to);n.steps.length>0&&o(n)}return!0}}function CA(e,t){return SA(e,t,"accept")}function TA(e,t){return SA(e,t,"reject")}var EA={entries:[],commentToRevision:new Map};function _A(e){if(!e)return EA;let{doc:t,schema:n}=e,r=n.marks.insertion,o=n.marks.deletion,i=n.marks.comment;if(!r&&!o)return EA;let a=[],l=new Map;t.descendants((e,t)=>{if(!e.isText)return;let n=null;for(let i of e.marks)(i.type===r||i.type===o)&&(a.push({type:i.type===r?"insertion":"deletion",text:e.text||"",author:i.attrs.author||"",date:i.attrs.date,from:t,to:t+e.nodeSize,revisionId:i.attrs.revisionId}),n=i);if(i&&n){let t=e.marks.find(e=>e.type===i);if(t){let e=t.attrs.commentId,r=n.attrs.revisionId;l.has(e)||l.set(e,r)}}});let s=[];for(let d of a){let e=s[s.length-1];e&&e.revisionId===d.revisionId&&e.type===d.type&&e.to===d.from?(e.text+=d.text,e.to=d.to):s.push({...d})}let c=[];for(let d=0;d<s.length;d++){let e=s[d],t=s[d+1];"deletion"===e.type&&t&&"insertion"===t.type&&e.author===t.author&&e.date===t.date&&e.to===t.from?(c.push({type:"replacement",text:t.text,deletedText:e.text,author:e.author,date:e.date,from:e.from,to:t.to,revisionId:e.revisionId,insertionRevisionId:t.revisionId}),d++):c.push(e)}return{entries:c,commentToRevision:l}}var MA=30,NA=200,IA=24,RA=10,AA=10,BA=24;function DA(e){let{mouseX:t,mouseY:n,pagesContainer:r,target:o,hfEditMode:i,edgeProximity:a=MA}=e,l=`.${xI.table}`,s=`.${xI.row}`,c=`.${xI.cell}`,d=`.${gR.header}`,u=`.${gR.footer}`,p=e=>{let t=!!e.closest(d),n=!!e.closest(u);return t||n?t?"header"===i:"footer"===i:!i},h=o.closest(l);if(h&&!p(h)&&(h=null),!h){let e=r.querySelectorAll(l);for(let r of Array.from(e)){if(!p(r))continue;let e=r.getBoundingClientRect(),o=t>=e.left-a&&t<e.left,i=n>=e.top-a&&n<e.top,l=t>=e.left-a&&t<=e.right,s=n>=e.top-a&&n<=e.bottom;if(o&&s||i&&l){h=r;break}}}if(!h)return null;let f=h.getBoundingClientRect(),m=t<f.left+a&&t>=f.left-a,g=n<f.top+a&&n>=f.top-a;if(!m&&!g)return null;let v=h.querySelectorAll(`:scope > ${s}`);if(0===v.length)return null;let y=e=>e&&Number(e.dataset.pmStart)||0;if(m)for(let b=0;b<v.length;b++){let e=v[b].getBoundingClientRect();if(n>=e.top&&n<=e.bottom){let t=v[b].querySelector(c),n=y(t);if(!n)break;return{type:"row",clientX:f.left-IA,clientY:e.top+e.height/2-RA,cellPmPos:n}}}if(g){let e=v[0].querySelectorAll(`:scope > ${c}`);for(let n=0;n<e.length;n++){let r=e[n].getBoundingClientRect();if(t>=r.left&&t<=r.right){let t=y(e[n]);if(!t)break;return{type:"column",clientX:r.left+r.width/2-AA,clientY:f.top-BA,cellPmPos:t}}}}return null}var FA="https://github.com/eigenpal/docx-editor/issues/new";function PA(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??(typeof window<"u"?window.location.href:"")}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join("\n"),o=new URLSearchParams({title:"[Bug] ",body:r});return`${FA}?${o.toString()}`}function OA(e){typeof window>"u"||window.open(PA(e),"_blank","noopener,noreferrer")}var LA,zA,VA,$A,jA,HA,WA,qA,ZA=class{constructor(){Am(this,HA),Am(this,LA,0),Am(this,zA,0),Am(this,VA,!1),Am(this,$A,null),Am(this,jA,new Set)}setStateSeq(e){Bm(this,LA,e)}incrementStateSeq(){return++Fm(this,LA)._}getStateSeq(){return Rm(this,LA)}getRenderSeq(){return Rm(this,zA)}onLayoutStart(){Bm(this,VA,!0)}onLayoutComplete(e){Bm(this,zA,e),Bm(this,VA,!1),Dm(this,HA,WA).call(this)}isSafeToRender(){return!Rm(this,VA)&&Rm(this,zA)>=Rm(this,LA)}requestRender(){this.isSafeToRender()?Dm(this,HA,qA).call(this):Bm(this,$A,()=>Dm(this,HA,qA).call(this))}onRender(e){return Rm(this,jA).add(e),()=>{Rm(this,jA).delete(e)}}reset(){Bm(this,LA,0),Bm(this,zA,0),Bm(this,VA,!1),Bm(this,$A,null)}getDebugInfo(){return{stateSeq:Rm(this,LA),renderSeq:Rm(this,zA),layoutUpdating:Rm(this,VA),hasPendingRender:null!==Rm(this,$A),isSafe:this.isSafeToRender()}}};function UA(e,t){if(!t.trim())return null;let n=null;return e.descendants((e,r)=>!n&&(!e.isTextblock||e.attrs?.paraId!==t||(n={from:r,to:r+e.nodeSize},!1))),n}function KA(e){let t=[];return e.descendants(e=>!e.isText||!e.text||!e.marks.some(e=>"insertion"===e.type.name)&&(t.push(e.text),!0)),t.join("")}function GA(e,t,n){if(t>=n)return"";let r=[];return e.nodesBetween(t,n,(e,o)=>{if(!e.isText||!e.text||e.marks.some(e=>"insertion"===e.type.name))return;let i=Math.max(t,o),a=Math.min(n,o+e.text.length);i<a&&r.push(e.text.slice(i-o,a-o))}),r.join("")}function XA(e,t,n,r){if(!r)return null;let o="",i=[];e.nodesBetween(t,n,(e,t)=>{!e.isText||!e.text||e.marks.some(e=>"insertion"===e.type.name)||(i.push({pos:t,len:e.text.length}),o+=e.text)});let a=o.indexOf(r);if(-1===a||-1!==o.indexOf(r,a+1))return null;let l=0,s=t,c=t;for(let d of i){let e=l+d.len;if(l<=a&&a<e&&(s=d.pos+(a-l)),l<=a+r.length&&a+r.length<=e){c=d.pos+(a+r.length-l);break}l=e}return{from:s,to:c}}function YA(e,t,n){if(!e||!t)return[];let r=n?.caseSensitive??!1,o=n?.limit??20,i=r?t:t.toLowerCase(),a=[];return e.state.doc.descendants(e=>{if(a.length>=o)return!1;if(!e.isTextblock)return!0;let n=e.attrs?.paraId;if(!n)return!1;let l=KA(e),s=r?l:l.toLowerCase(),c=s.indexOf(i);return-1===c||-1!==s.indexOf(i,c+1)||a.push({paraId:n,match:l.slice(c,c+t.length),before:l.slice(Math.max(0,c-40),c),after:l.slice(c+t.length,c+t.length+40)}),!1}),a}function JA(e){if(!e)return null;let{selection:t,doc:n}=e.state,r=t.$from,o=r.depth;for(;o>0&&!r.node(o).isTextblock;)o--;let i=o>0?r.node(o):null;if(!i)return null;let a=i.attrs?.paraId??null,l=r.start(o),s=l+i.content.size,c=GA(n,l,t.from),d=GA(n,t.from,t.to),u=GA(n,t.to,s);return{paraId:a,selectedText:d,paragraphText:c+d+u,before:c,after:u}}function QA(e,t,n){if(!t||!e)return null;let r=t.pages[n-1];if(!r)return null;let o=new Set,i=[];for(let a of r.fragments){if("paragraph"!==a.kind)continue;let t=a.pmStart;if(null==t)continue;let n=e.state.doc.nodeAt(t);if(!n||!n.isTextblock)continue;let r=n.attrs?.paraId;!r||o.has(r)||(o.add(r),i.push({paraId:r,text:KA(n),styleId:n.attrs?.styleId??void 0}))}return{pageNumber:n,text:i.map(e=>`[${e.paraId}] ${e.text}`).join("\n"),paragraphs:i}}LA=new WeakMap,zA=new WeakMap,VA=new WeakMap,$A=new WeakMap,jA=new WeakMap,HA=new WeakSet,WA=function(){if(Rm(this,$A)&&this.isSafeToRender()){let e=Rm(this,$A);Bm(this,$A,null),e()}},qA=function(){for(let e of Rm(this,jA))try{e()}catch(Jp){console.error("LayoutSelectionGate: render callback error",Jp)}};var eB=(0,n.defineComponent)({__name:"DecorationLayer",props:{getView:{type:Function},getPagesContainer:{type:Function},zoom:{},transactionVersion:{},syncCoordinator:{}},setup(e){let t=e,r=(0,n.ref)(null),o=(0,n.ref)(0),i=null,a=null;function l(){null!==i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null;let e=t.getView(),n=t.getPagesContainer(),o=r.value;!e||!n||!o||t.syncCoordinator.isSafeToRender()&&s(e,n,o,t.zoom)})}function s(e,t,n,r){let o=c(e.state);if(0===o.length)return void(n.firstChild&&n.replaceChildren());let i=yk(t,r),a=i.getContainerOffset(),l=document.createDocumentFragment();for(let{decoration:s,from:c,to:p}of o){if(c===p){let t=d(s,e);if(!t)continue;let n=i.getCoordinatesForPosition(c);if(!n)continue;let r=document.createElement("div");r.style.cssText=`position:absolute;left:${n.x+a.x}px;top:${n.y+a.y}px;height:${n.height}px;`,r.appendChild(t),l.appendChild(r);continue}let t=u(s);if(!t)continue;let n=i.getRectsForRange(c,p);for(let e of n){let n=document.createElement("div");for(let[e,o]of Object.entries(t))"nodeName"!==e&&n.setAttribute(e,o);let r=`position:absolute;left:${e.x+a.x}px;top:${e.y+a.y}px;width:${e.width}px;height:${e.height}px;`;n.style.cssText=r+(t.style??""),l.appendChild(n)}}n.replaceChildren(l)}function c(e){let t=[];for(let n of e.plugins){let r=n.props.decorations;if(!r)continue;let o=r.call(n,e);o&&o.forEachSet(e=>{e.find().forEach(e=>{e.spec?.noOverlay||t.push({decoration:e,from:e.from,to:e.to})})})}return t}function d(e,t){let n=e.type;if(!n)return null;let r=n.toDOM;return"function"==typeof r?r(t,()=>e.from):r instanceof HTMLElement?r.cloneNode(!0):null}function u(e){return e.type?.attrs??null}return(0,n.onMounted)(()=>{a=t.syncCoordinator.onRender(()=>{o.value++}),l()}),(0,n.onBeforeUnmount)(()=>{null!==i&&(cancelAnimationFrame(i),i=null),a?.()}),(0,n.watch)(()=>[t.zoom,t.transactionVersion,o.value],()=>l()),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"overlayRef",ref:r,class:"paged-editor__decoration-overlay","aria-hidden":"true"},null,512))}}),tB=["data-handle","onMousedown"],nB=["title"],rB={key:0,class:"image-overlay__dim"},oB={key:1,class:"image-overlay__dim image-overlay__dim--rotate"},iB=4,aB=15,lB=Us((0,n.defineComponent)({__name:"ImageSelectionOverlay",props:{imageInfo:{},zoom:{},view:{}},emits:["deselect","interact-start","interact-end","context-menu"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(null),l=(0,n.ref)(!1),s=(0,n.ref)(!1),c=(0,n.ref)(!1),d=(0,n.ref)(0),u=(0,n.ref)(0),p=(0,n.ref)(0),h=(0,n.ref)(null),f="se",m=0,g=0,v=0,y=0,b=null,w=null,k=null,x=null;function S(e,t){if(!e)return null;try{let n=e.state.doc.nodeAt(t);return n&&"image"===n.type.name?n:null}catch{return null}}function C(){let e=o.imageInfo;if(!e)return null;if(e.element.isConnected)return e.element;let t=a.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");if(!t)return null;for(let n of t.querySelectorAll(`[data-pm-start="${e.pmPos}"]`)){let e=sA(n);if(e)return e}return null}function T(){let e=C();if(!e||!a.value)return void(h.value=null);let t=a.value.offsetParent;if(!t)return void(h.value=null);let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=o.zoom;h.value={left:(r.left-n.left)/i,top:(r.top-n.top)/i,width:r.width/i,height:r.height/i}}(0,n.watch)(()=>o.imageInfo,async()=>{await(0,n.nextTick)(),T()},{immediate:!0}),(0,n.watch)(()=>o.imageInfo,(e,t,n)=>{if(!o.imageInfo)return;let r=()=>{w&&cancelAnimationFrame(w),w=requestAnimationFrame(T)},i=a.value?.closest(".docx-editor-vue__pages-viewport")?.parentElement;i?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r,{passive:!0}),n(()=>{i?.removeEventListener("scroll",r),window.removeEventListener("resize",r),w&&cancelAnimationFrame(w)})},{immediate:!0});let E=(0,n.computed)(()=>l.value?d.value:h.value?.width||0),_=(0,n.computed)(()=>l.value?u.value:h.value?.height||0),M=(0,n.computed)(()=>{let e=h.value;if(!e)return{position:"absolute",top:"0px",left:"0px",visibility:"hidden",pointerEvents:"none"};let t=l.value?d.value:e.width,n=l.value?u.value:e.height;return{position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${t}px`,height:`${n}px`,zIndex:bk.imageOverlay,pointerEvents:"auto"}}),N=(0,n.computed)(()=>{let e=E.value,t=_.value,n=e/2-5+"px",r=t/2-5+"px",o=e-5+"px",i=t-5+"px",a="-5px";return[{pos:"nw",style:{left:a,top:a,cursor:"nwse-resize"}},{pos:"n",style:{left:n,top:a,cursor:"ns-resize"}},{pos:"ne",style:{left:o,top:a,cursor:"nesw-resize"}},{pos:"e",style:{left:o,top:r,cursor:"ew-resize"}},{pos:"se",style:{left:o,top:i,cursor:"nwse-resize"}},{pos:"s",style:{left:n,top:i,cursor:"ns-resize"}},{pos:"sw",style:{left:a,top:i,cursor:"nesw-resize"}},{pos:"w",style:{left:a,top:r,cursor:"ew-resize"}}]}),I=e=>2===e.length;function R(e,t,n,r,o,i){let a=e.includes("w")?-1:+!!e.includes("e"),l=e.includes("n")?-1:+!!e.includes("s"),s=r+t*a,c=o+n*l;if(I(e)&&i){let e=Math.max(s/r,c/o);s=r*e,c=o*e}return{width:0===a?r:Math.max(20,Math.min(2e3,s)),height:0===l?o:Math.max(20,Math.min(2e3,c))}}function A(e,t){!o.imageInfo||!h.value||(f=t,m=e.clientX,g=e.clientY,v=h.value.width,y=h.value.height,b={...h.value},d.value=Math.round(v),u.value=Math.round(y),l.value=!0,i("interact-start"),document.addEventListener("mousemove",B),document.addEventListener("mouseup",D))}function B(e){let t=o.zoom,n=(e.clientX-m)/t,r=(e.clientY-g)/t,i=!e.shiftKey,a=R(f,n,r,v,y,i);d.value=Math.round(a.width),u.value=Math.round(a.height);let l=b;l&&(h.value={left:f.includes("w")?l.left+(l.width-a.width):l.left,top:f.includes("n")?l.top+(l.height-a.height):l.top,width:l.width,height:l.height})}function D(){document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",D),l.value=!1,b=null,i("interact-end");let e=o.view,t=o.imageInfo;if(!e||!t)return void T();let r=S(e,t.pmPos);if(r)try{e.dispatch(e.state.tr.setNodeMarkup(t.pmPos,void 0,{...r.attrs,width:d.value,height:u.value}))}catch{}(0,n.nextTick)(()=>T())}let F=0,P=0,O=0,L=0,z=null,V=null;function $(e){if(!e)return 0;let t=e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/);return t?parseFloat(t[1]):0}function j(e,t){let n=/scaleX\(-1\)/.test(e||""),r=/scaleY\(-1\)/.test(e||""),o=[],i=(t%360+360)%360;return 0!==i&&o.push(`rotate(${i}deg)`),n&&o.push("scaleX(-1)"),r&&o.push("scaleY(-1)"),o.length>0?o.join(" "):null}function H(e,t){return 180*Math.atan2(e-F,-(t-P))/Math.PI}function W(e){if(!o.imageInfo)return;let t=o.imageInfo.element.getBoundingClientRect();F=t.left+t.width/2,P=t.top+t.height/2;let n=S(o.view,o.imageInfo.pmPos);z=n&&n.attrs.transform||null,L=$(z),V=o.imageInfo.element.querySelector("img"),O=H(e.clientX,e.clientY),p.value=L,c.value=!0,i("interact-start"),document.addEventListener("mousemove",q),document.addEventListener("mouseup",Z)}function q(e){let t=H(e.clientX,e.clientY)-O,n=L+t;e.shiftKey||(n=Math.round(n/aB)*aB),p.value=(n%360+360)%360,V&&(V.style.transform=j(z,p.value)||"")}function Z(){document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Z),c.value=!1,i("interact-end");let e=o.view,t=o.imageInfo;try{let n=e&&t?S(e,t.pmPos):null;e&&t&&n&&e.dispatch(e.state.tr.setNodeMarkup(t.pmPos,void 0,{...n.attrs,transform:j(n.attrs.transform,p.value)}))}catch{}finally{V&&(V.style.transform=""),V=null,z=null}(0,n.nextTick)(()=>T())}let U=null;function K(e){if(!o.imageInfo||!h.value)return;let t=e.clientX,n=e.clientY,r=h.value,a=!1,l=e=>{let l=e.clientX-t,c=e.clientY-n;if(a||!(Math.sqrt(l*l+c*c)<iB)){if(!a){a=!0,s.value=!0,i("interact-start"),U=document.createElement("div"),U.style.cssText="position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";let e=o.zoom;U.style.width=r.width*e+"px",U.style.height=r.height*e+"px",document.body.appendChild(U)}if(U){let t=o.zoom;U.style.left=e.clientX-r.width*t/2+"px",U.style.top=e.clientY-r.height*t/2+"px"}}},c=e=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c),k=null,x=null,U&&=(U.remove(),null),s.value=!1,a&&(i("interact-end"),G(e.clientX,e.clientY))};k=l,x=c,document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)}function G(e,t){let r=o.view,i=o.imageInfo;if(!r||!i)return;let l=S(r,i.pmPos);if(!l)return;let s=l.attrs.wrapType,c="float"===l.attrs.displayMode||!!s&&["square","tight","through"].includes(s);try{if(c){let n=a.value?.closest(".docx-editor-vue__pages-viewport")?.querySelectorAll(".layout-page");if(!n||0===n.length)return;let s=null;for(let e of n){let n=e.getBoundingClientRect();if(t>=n.top&&t<=n.bottom){s=e.querySelector(".layout-page-content");break}}if(s||=n[n.length-1].querySelector(".layout-page-content"),!s)return;let c=s.getBoundingClientRect(),d=o.zoom,u=(e-c.left)/d,p=(t-c.top)/d,h={horizontal:{posOffset:Js(u),relativeTo:"margin"},vertical:{posOffset:Js(p),relativeTo:"margin"}},f=r.state.tr.setNodeMarkup(i.pmPos,void 0,{...l.attrs,position:h});r.dispatch(f),X(i.pmPos)}else{let n=a.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");if(!n)return;let o=eA(n,e,t,1);if(null==o||o<0||o===i.pmPos||o===i.pmPos+1)return;let s=r.state.tr,c=l.nodeSize;if(o<=i.pmPos)s=s.delete(i.pmPos,i.pmPos+c),s=s.insert(o,l),r.dispatch(s),X(o);else{s=s.delete(i.pmPos,i.pmPos+c);let e=Math.min(o-c,s.doc.content.size);s=s.insert(e,l),r.dispatch(s),X(Math.min(e,r.state.doc.content.size-1))}}}catch{}(0,n.nextTick)(()=>T())}function X(e){let t=o.view;if(t)try{let n=cn.create(t.state.doc,e);t.dispatch(t.state.tr.setSelection(n))}catch{}}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",D),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Z),k&&document.removeEventListener("mousemove",k),x&&document.removeEventListener("mouseup",x),U&&=(U.remove(),null),w&&cancelAnimationFrame(w)}),(t,o)=>e.imageInfo?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,ref_key:"overlayRootRef",ref:a,class:"image-overlay",style:(0,n.normalizeStyle)(M.value),onMousedown:o[3]||=(0,n.withModifiers)(()=>{},["stop"])},[o[4]||=(0,n.createElementVNode)("div",{class:"image-overlay__border"},null,-1),(0,n.createElementVNode)("div",{class:"image-overlay__body",style:(0,n.normalizeStyle)({cursor:s.value?"grabbing":"grab"}),onMousedown:o[0]||=(0,n.withModifiers)(e=>K(e),["prevent","stop"]),onContextmenu:o[1]||=(0,n.withModifiers)(e=>t.$emit("context-menu",e),["prevent","stop"])},null,36),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(N.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:e.pos,class:"image-overlay__handle",style:(0,n.normalizeStyle)(e.style),"data-handle":e.pos,onMousedown:(0,n.withModifiers)(t=>A(t,e.pos),["prevent","stop"])},null,44,tB))),128)),o[5]||=(0,n.createElementVNode)("div",{class:"image-overlay__rotate-line"},null,-1),(0,n.createElementVNode)("div",{class:"image-overlay__rotate-handle",style:(0,n.normalizeStyle)({left:E.value/2-7+"px"}),title:(0,n.unref)(r)("imageOverlay.rotate"),onMousedown:o[2]||=(0,n.withModifiers)(e=>W(e),["prevent","stop"])},null,44,nB),l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",rB,(0,n.toDisplayString)(Math.round(d.value))+" × "+(0,n.toDisplayString)(Math.round(u.value)),1)):(0,n.createCommentVNode)("",!0),c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",oB,(0,n.toDisplayString)(Math.round(p.value))+"° ",1)):(0,n.createCommentVNode)("",!0)],36)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-a6f20ec2"]]),sB={class:"doc-outline__header"},cB={class:"doc-outline__body"},dB={key:0,class:"doc-outline__empty"},uB=["onMousedown"],pB=Us((0,n.defineComponent)({__name:"DocumentOutline",props:{isOpen:{type:Boolean},headings:{}},emits:["close","navigate"],setup(e){return(t,r)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("nav",{key:0,class:"doc-outline",role:"navigation","aria-label":"Document outline",onMousedown:r[1]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",sB,[(0,n.createElementVNode)("button",{class:"doc-outline__back",title:"Close outline","aria-label":"Close outline",onClick:r[0]||=e=>t.$emit("close")},[(0,n.createVNode)(cc,{name:"arrow_back",size:20})]),r[2]||=(0,n.createElementVNode)("span",{class:"doc-outline__title"},"Document Outline",-1)]),(0,n.createElementVNode)("div",cB,[0===e.headings.length?((0,n.openBlock)(),(0,n.createElementBlock)("div",dB," No headings found ")):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.headings,(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:r,class:"doc-outline__item",style:(0,n.normalizeStyle)({paddingLeft:12+16*(e.level-1)+"px"}),onMousedown:(0,n.withModifiers)(n=>t.$emit("navigate",e.pmPos),["prevent"])},(0,n.toDisplayString)(e.text||"(untitled)"),45,uB))),128))])],32)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-cb2cdc39"]]),hB=Us((0,n.defineComponent)({__name:"PageIndicator",props:{currentPage:{},totalPages:{},visible:{type:Boolean}},setup(e){let{t:t}=xc();return(r,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"docx-editor-vue__page-indicator",style:(0,n.normalizeStyle)({opacity:+!!e.visible}),"aria-live":"polite",role:"status"},(0,n.toDisplayString)((0,n.unref)(t)("viewer.pageIndicator",{current:e.currentPage,total:e.totalPages})),5))}}),[["__scopeId","data-v-d117bf6e"]]),fB={class:"hf-editor__toolbar"},mB={class:"hf-editor__label"},gB={class:"hf-editor__actions"},vB=Us((0,n.defineComponent)({__name:"InlineHeaderFooterEditor",props:{isOpen:{type:Boolean},position:{},headerFooter:{},styles:{},theme:{},targetRect:{}},emits:["save","close","remove"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(null),a=null,l=(0,n.ref)({});function s(){let e=r.targetRect;e&&(l.value={position:"absolute",top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,minHeight:`${Math.max(e.height,60)}px`,zIndex:"100"})}function c(){let e=i.value;if(!e||a)return;let t=kk,n=gx(r.headerFooter?.content??[],{styles:r.styles??void 0,theme:r.theme??null});a=new qa(e,{state:Sn.create({doc:n,schema:t.getSchema(),plugins:t.getPlugins()??[]}),editable:()=>!0}),a.focus()}function d(){a&&=(a.destroy(),null)}function u(){a&&(o("save",i_(a.state.doc)),o("close"))}return(0,n.watch)(()=>r.isOpen,async e=>{e?(s(),await(0,n.nextTick)(),c()):d()}),(0,n.watch)(()=>r.targetRect,()=>{r.isOpen&&s()},{deep:!0}),(0,n.onBeforeUnmount)(()=>{d()}),(t,r)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"hf-editor",style:(0,n.normalizeStyle)(l.value),onMousedown:r[2]||=(0,n.withModifiers)(()=>{},["stop"]),onContextmenu:r[3]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createElementVNode)("div",fB,[(0,n.createElementVNode)("span",mB,(0,n.toDisplayString)("header"===e.position?"Header":"Footer"),1),(0,n.createElementVNode)("div",gB,[(0,n.createElementVNode)("button",{class:"hf-editor__btn",title:"Remove",onMousedown:r[0]||=(0,n.withModifiers)(e=>t.$emit("remove"),["prevent"])}," Remove ",32),(0,n.createElementVNode)("button",{class:"hf-editor__btn hf-editor__btn--primary",title:"Save",onMousedown:(0,n.withModifiers)(u,["prevent"])}," Save ",32),(0,n.createElementVNode)("button",{class:"hf-editor__btn",title:"Cancel",onMousedown:r[1]||=(0,n.withModifiers)(e=>t.$emit("close"),["prevent"])}," Cancel ",32)])]),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:i,class:"hf-editor__content"},null,512)],36)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-343434c4"]]),yB={key:0,class:"docx-editor-vue__title-bar"},bB={class:"docx-editor-vue__title-bar-left"},wB={class:"docx-editor-vue__title-bar-center"},kB={class:"docx-editor-vue__title-bar-right"},xB=(0,n.defineComponent)({__name:"DocxEditorMenuBar",props:{showMenuBar:{type:Boolean},documentName:{},documentNameEditable:{type:Boolean,default:!0},renderLogo:{},renderTitleBarRight:{}},emits:["rename","menu-action","insert-table"],setup(e,{emit:t}){let r=t;return(t,o)=>e.showMenuBar?((0,n.openBlock)(),(0,n.createElementBlock)("div",yB,[(0,n.createElementVNode)("div",bB,[e.renderLogo?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.renderLogo),{key:0})):(0,n.createCommentVNode)("",!0),(0,n.renderSlot)(t.$slots,"title-bar-left")]),(0,n.createElementVNode)("div",wB,[(0,n.createVNode)(nk,{"model-value":e.documentName,editable:e.documentNameEditable,"onUpdate:modelValue":o[0]||=e=>r("rename",e)},null,8,["model-value","editable"]),(0,n.createVNode)(gk,{onAction:o[1]||=e=>r("menu-action",e),onInsertTable:o[2]||=(e,t)=>r("insert-table",e,t)})]),(0,n.createElementVNode)("div",kB,[(0,n.renderSlot)(t.$slots,"title-bar-right"),e.renderTitleBarRight?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.renderTitleBarRight),{key:0})):(0,n.createCommentVNode)("",!0)])])):(0,n.createCommentVNode)("",!0)}}),SB=(0,n.defineComponent)({__name:"DocxEditorDialogs",props:{view:{},bookmarks:{},selectedImagePmPos:{},sectionProperties:{},showFindReplace:{type:Boolean},showInsertImage:{type:Boolean},showHyperlink:{type:Boolean},showInsertSymbol:{type:Boolean},showImageProperties:{type:Boolean},showPageSetup:{type:Boolean},showKeyboardShortcuts:{type:Boolean}},emits:["update:showFindReplace","update:showInsertImage","update:showHyperlink","update:showInsertSymbol","update:showImageProperties","update:showPageSetup","update:showKeyboardShortcuts","insert-image","insert-symbol","hyperlink-submit","hyperlink-remove","page-setup-apply"],setup(e,{emit:t}){let r=t;return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(Lc,{"is-open":e.showFindReplace,view:e.view,onClose:o[0]||=e=>r("update:showFindReplace",!1)},null,8,["is-open","view"]),(0,n.createVNode)(td,{"is-open":e.showInsertImage,onClose:o[1]||=e=>r("update:showInsertImage",!1),onInsert:o[2]||=e=>r("insert-image",e)},null,8,["is-open"]),(0,n.createVNode)(Md,{"is-open":e.showHyperlink,view:e.view,bookmarks:e.bookmarks,onClose:o[3]||=e=>r("update:showHyperlink",!1),onSubmit:o[4]||=e=>r("hyperlink-submit",e),onRemove:o[5]||=e=>r("hyperlink-remove")},null,8,["is-open","view","bookmarks"]),(0,n.createVNode)(Ud,{"is-open":e.showInsertSymbol,onClose:o[6]||=e=>r("update:showInsertSymbol",!1),onInsert:o[7]||=e=>r("insert-symbol",e)},null,8,["is-open"]),(0,n.createVNode)(Su,{"is-open":e.showImageProperties,view:e.view,"pm-pos":e.selectedImagePmPos,onClose:o[8]||=e=>r("update:showImageProperties",!1)},null,8,["is-open","view","pm-pos"]),(0,n.createVNode)(Yu,{"is-open":e.showPageSetup,"section-properties":e.sectionProperties,onClose:o[9]||=e=>r("update:showPageSetup",!1),onApply:o[10]||=e=>r("page-setup-apply",e)},null,8,["is-open","section-properties"]),(0,n.createVNode)(mp,{"is-open":e.showKeyboardShortcuts,onClose:o[11]||=e=>r("update:showKeyboardShortcuts",!1)},null,8,["is-open"])],64))}}),CB=["disabled","onMousedown"],TB={class:"ctx-menu__label"},EB={key:0,class:"ctx-menu__shortcut"},_B=220,MB=32,NB=10,IB=Us((0,n.defineComponent)({__name:"TextContextMenu",props:{isOpen:{type:Boolean},position:{},hasSelection:{type:Boolean},isEditable:{type:Boolean},inTable:{type:Boolean},onImage:{type:Boolean},canMergeCells:{type:Boolean},canSplitCell:{type:Boolean}},emits:["close","action"],setup(e,{emit:t}){let r=e,o=t,i=(0,n.ref)(null),a=(0,n.computed)(()=>{let e=[{id:"cut",label:"Cut",action:"cut",shortcut:"Ctrl+X",disabled:!r.hasSelection||!r.isEditable},{id:"copy",label:"Copy",action:"copy",shortcut:"Ctrl+C",disabled:!r.hasSelection},{id:"paste",label:"Paste",action:"paste",shortcut:"Ctrl+V",disabled:!r.isEditable},{id:"pasteAsPlainText",label:"Paste as Plain Text",action:"pasteAsPlainText",shortcut:"Ctrl+Shift+V",disabled:!r.isEditable},{id:"div1",label:"",action:"",divider:!0},{id:"delete",label:"Delete",action:"delete",shortcut:"Del",disabled:!r.hasSelection||!r.isEditable},{id:"selectAll",label:"Select All",action:"selectAll",shortcut:"Ctrl+A"}];return r.onImage&&r.isEditable&&e.push({id:"div-img",label:"",action:"",divider:!0},{id:"replaceImage",label:"Replace image…",action:"replaceImage"},{id:"imageProperties",label:"Image properties…",action:"imageProperties"},{id:"deleteImage",label:"Delete image",action:"deleteImage",shortcut:"Del"}),r.inTable&&r.isEditable&&e.push({id:"div2",label:"",action:"",divider:!0},{id:"addRowAbove",label:"Insert row above",action:"addRowAbove"},{id:"addRowBelow",label:"Insert row below",action:"addRowBelow"},{id:"deleteRow",label:"Delete row",action:"deleteRow"},{id:"div3",label:"",action:"",divider:!0},{id:"addColLeft",label:"Insert column left",action:"addColumnLeft"},{id:"addColRight",label:"Insert column right",action:"addColumnRight"},{id:"deleteCol",label:"Delete column",action:"deleteColumn"},{id:"div4",label:"",action:"",divider:!0},{id:"mergeCells",label:"Merge cells",action:"mergeCells",disabled:!r.canMergeCells},{id:"splitCell",label:"Split cell",action:"splitCell",disabled:!r.canSplitCell}),e}),l=(0,n.computed)(()=>{let e=r.position.x,t=r.position.y,n=a.value.filter(e=>!e.divider).length,o=a.value.filter(e=>e.divider).length,i=n*MB+9*o;return typeof window<"u"&&(e+_B+NB>window.innerWidth&&(e=window.innerWidth-_B-NB),t+i+NB>window.innerHeight&&(t=window.innerHeight-i-NB)),{position:"fixed",left:`${e}px`,top:`${t}px`,zIndex:400}});function s(e){e&&(o("action",e),o("close"))}function c(e){"Escape"===e.key&&o("close")}return(0,n.watch)(()=>r.isOpen,e=>{e&&(0,n.nextTick)(()=>i.value?.focus())}),(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(n.Teleport,{to:"body"},[e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"ctx-menu-backdrop",onMousedown:r[0]||=e=>t.$emit("close"),onContextmenu:r[1]||=(0,n.withModifiers)(e=>t.$emit("close"),["prevent"])},null,32)):(0,n.createCommentVNode)("",!0),e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,ref_key:"menuRef",ref:i,class:"ctx-menu",style:(0,n.normalizeStyle)(l.value),onContextmenu:r[2]||=(0,n.withModifiers)(()=>{},["prevent"]),onKeydown:c},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(a.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.id||t,class:(0,n.normalizeClass)(["ctx-menu__item",{"ctx-menu__item--disabled":e.disabled,"ctx-menu__item--divider":e.divider}]),disabled:e.disabled,onMousedown:(0,n.withModifiers)(t=>s(e.action),["prevent"])},[(0,n.createElementVNode)("span",TB,(0,n.toDisplayString)(e.label),1),e.shortcut?((0,n.openBlock)(),(0,n.createElementBlock)("span",EB,(0,n.toDisplayString)(e.shortcut),1)):(0,n.createCommentVNode)("",!0)],42,CB))),128))],36)):(0,n.createCommentVNode)("",!0)]))}}),[["__scopeId","data-v-741c4f71"]]),RB=["aria-label"],AB={class:"image-ctx-menu__icon"},BB={class:"image-ctx-menu__label"},DB={key:1,class:"image-ctx-menu__divider",role:"separator"},FB=["data-wrap-type","data-current","data-disabled","disabled","title","onClick"],PB={class:"image-ctx-menu__icon"},OB={class:"image-ctx-menu__label"},LB=["aria-label"],zB=["disabled","onClick"],VB={class:"image-ctx-menu__label"},$B={key:0,class:"image-ctx-menu__shortcut"},jB={key:0,class:"image-ctx-menu__divider",role:"separator"},HB=18,WB=260,qB=10,ZB=Us((0,n.defineComponent)({__name:"ImageContextMenu",props:{state:{},textActions:{},canOpenProperties:{type:Boolean,default:!1}},emits:["close","select","text-action","open-properties"],setup(e,{emit:t}){let r=e,o=t;function i(){o("open-properties"),o("close")}let{t:a}=xc(),l=(0,n.ref)(null),s=uA,c=(0,n.computed)(()=>r.state?dA(r.state.currentWrapType,r.state.currentCssFloat??null):null),d={inline:"wrap_text",squareLeft:"format_image_left",squareRight:"format_image_right",behind:"flip_to_back",inFront:"flip_to_front"};function u(e){return d[e]}let p=(0,n.computed)(()=>{if(!r.state)return{};let e=36*uA.length+16,t=r.state.position.x,n=r.state.position.y;return typeof window<"u"&&(t+WB>window.innerWidth&&(t=window.innerWidth-WB-qB),n+e>window.innerHeight&&(n=window.innerHeight-e-qB),t<qB&&(t=qB),n<qB&&(n=qB)),{position:"fixed",left:`${t}px`,top:`${n}px`,minWidth:`${WB}px`,zIndex:400}});function h(e){return!!r.state&&pA(e,r.state.currentWrapType)}function f(e){h(e)&&(o("select",e.choice),o("close"))}function m(e){e.disabled||(o("text-action",e.action),o("close"))}function g(e){e.preventDefault(),o("close")}function v(e){"Escape"===e.key&&(e.preventDefault(),o("close"))}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(n.Teleport,{to:"body"},[e.state&&e.state.open?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"image-ctx-menu-backdrop",onMousedown:g,onContextmenu:r[0]||=(0,n.withModifiers)(e=>t.$emit("close"),["prevent"])},null,32)):(0,n.createCommentVNode)("",!0),e.state&&e.state.open?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,ref_key:"menuRef",ref:l,class:"image-ctx-menu",role:"menu","aria-label":(0,n.unref)(a)("imageWrap.menu.ariaLabel"),"data-testid":"image-context-menu",style:(0,n.normalizeStyle)(p.value),onContextmenu:r[4]||=(0,n.withModifiers)(()=>{},["prevent"]),onKeydown:v},[e.canOpenProperties?((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:0,type:"button",role:"menuitem",class:"image-ctx-menu__item","data-action":"open-properties",onMousedown:r[1]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:i},[(0,n.createElementVNode)("span",AB,[(0,n.createVNode)(cc,{name:"settings",size:HB})]),(0,n.createElementVNode)("span",BB,(0,n.toDisplayString)((0,n.unref)(a)("imageWrap.menu.imageProperties")),1)],32)):(0,n.createCommentVNode)("",!0),e.canOpenProperties?((0,n.openBlock)(),(0,n.createElementBlock)("div",DB)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.choice,type:"button",role:"menuitem",class:(0,n.normalizeClass)(["image-ctx-menu__item",{"image-ctx-menu__item--current":e.choice===c.value}]),"data-wrap-type":e.choice,"data-current":e.choice===c.value?"true":"false","data-disabled":h(e)?"false":"true",disabled:!h(e),title:(0,n.unref)(a)(`imageWrap.menuDesc.${e.i18nDescKey}`),onMousedown:r[2]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:t=>f(e)},[(0,n.createElementVNode)("span",PB,[(0,n.createVNode)(cc,{name:u(e.iconHint),size:HB},null,8,["name"])]),(0,n.createElementVNode)("span",OB,(0,n.toDisplayString)((0,n.unref)(a)(`imageWrap.menu.${e.i18nLabelKey}`)),1),e.choice===c.value?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,class:"image-ctx-menu__current-dot","aria-label":(0,n.unref)(a)("imageWrap.menu.ariaLabel")},"●",8,LB)):(0,n.createCommentVNode)("",!0)],42,FB))),128)),e.textActions&&e.textActions.length>0?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[r[5]||=(0,n.createElementVNode)("div",{class:"image-ctx-menu__divider",role:"separator"},null,-1),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.textActions,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:`${e.action}-${t}`},[(0,n.createElementVNode)("button",{type:"button",role:"menuitem",class:"image-ctx-menu__item image-ctx-menu__item--text",disabled:e.disabled,onMousedown:r[3]||=(0,n.withModifiers)(()=>{},["prevent"]),onClick:t=>m(e)},[(0,n.createElementVNode)("span",VB,(0,n.toDisplayString)(e.label),1),e.shortcut?((0,n.openBlock)(),(0,n.createElementBlock)("span",$B,(0,n.toDisplayString)(e.shortcut),1)):(0,n.createCommentVNode)("",!0)],40,zB),e.dividerAfter?((0,n.openBlock)(),(0,n.createElementBlock)("div",jB)):(0,n.createCommentVNode)("",!0)],64))),128))],64)):(0,n.createCommentVNode)("",!0)],44,RB)):(0,n.createCommentVNode)("",!0)]))}}),[["__scopeId","data-v-5c21ca8c"]]),UB=(0,n.defineComponent)({__name:"DocxEditorOverlays",props:{readOnly:{type:Boolean},contextMenu:{},imageContextMenu:{},imageContextMenuTextActions:{},canOpenImageProperties:{type:Boolean}},emits:["context-menu-action","close-context-menu","image-wrap-select","close-image-context-menu","open-image-properties"],setup(e,{emit:t}){let r=t;return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(IB,{"is-open":e.contextMenu.isOpen,position:e.contextMenu.position,"has-selection":e.contextMenu.hasSelection,"is-editable":!e.readOnly,"in-table":e.contextMenu.inTable,"on-image":e.contextMenu.onImage,"can-merge-cells":e.contextMenu.canMergeCells,"can-split-cell":e.contextMenu.canSplitCell,onAction:o[0]||=e=>r("context-menu-action",e),onClose:o[1]||=e=>r("close-context-menu")},null,8,["is-open","position","has-selection","is-editable","in-table","on-image","can-merge-cells","can-split-cell"]),(0,n.createVNode)(ZB,{state:e.imageContextMenu,"text-actions":e.imageContextMenuTextActions,"can-open-properties":e.canOpenImageProperties,onClose:o[2]||=e=>r("close-image-context-menu"),onSelect:o[3]||=e=>r("image-wrap-select",e),onTextAction:o[4]||=e=>r("context-menu-action",e),onOpenProperties:o[5]||=e=>r("open-image-properties")},null,8,["state","text-actions","can-open-properties"])],64))}}),KB=["href","title"],GB=["title"],XB=["title"],YB=["title"],JB={class:"docx-hyperlink-popup__edit-row"},QB=["placeholder","onKeydown"],eD={class:"docx-hyperlink-popup__edit-row"},tD=["onKeydown"],nD=["disabled"],rD=Us((0,n.defineComponent)({__name:"HyperlinkPopup",props:{data:{},readOnly:{type:Boolean}},emits:["navigate","copy","edit","remove","close"],setup(e,{emit:t}){let{t:r}=xc(),o=e,i=t,a=(0,n.ref)(!1),l=(0,n.ref)(""),s=(0,n.ref)(""),c=(0,n.ref)(null),d=(0,n.computed)(()=>({left:(o.data?.position.left??0)+"px",top:(o.data?.position.top??0)+"px"}));(0,n.watch)(()=>o.data?.href,()=>{a.value=!1});let u=null,p=null;function h(){p&&=(clearTimeout(p),null),u&&=(document.removeEventListener("mousedown",u),null)}function f(){o.data&&(l.value=o.data.displayText,s.value=o.data.href,a.value=!0)}function m(){s.value.trim()&&(i("edit",l.value,s.value),a.value=!1)}function g(){o.data&&(i("copy",o.data.href),typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(o.data.href).catch(()=>{}))}return(0,n.watch)(()=>o.data,e=>{h(),e&&(u=e=>{let t=c.value;t&&!t.contains(e.target)&&i("close")},p=setTimeout(()=>{u&&document.addEventListener("mousedown",u)},0))},{immediate:!0}),(0,n.onBeforeUnmount)(h),(t,o)=>e.data?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,ref_key:"popupRef",ref:c,class:(0,n.normalizeClass)(["docx-hyperlink-popup",{"docx-hyperlink-popup--edit":a.value}]),style:(0,n.normalizeStyle)(d.value),onMousedown:o[6]||=(0,n.withModifiers)(()=>{},["stop"])},[a.value?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("div",JB,[(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"docx-hyperlink-popup__input",placeholder:(0,n.unref)(r)("hyperlinkPopup.displayTextPlaceholder"),"onUpdate:modelValue":o[2]||=e=>l.value=e,onKeydown:[(0,n.withKeys)((0,n.withModifiers)(m,["prevent"]),["enter"]),o[3]||=(0,n.withKeys)(e=>t.$emit("close"),["esc"])]},null,40,QB),[[n.vModelText,l.value]])]),(0,n.createElementVNode)("div",eD,[(0,n.withDirectives)((0,n.createElementVNode)("input",{class:"docx-hyperlink-popup__input",placeholder:"https://...","onUpdate:modelValue":o[4]||=e=>s.value=e,onKeydown:[(0,n.withKeys)((0,n.withModifiers)(m,["prevent"]),["enter"]),o[5]||=(0,n.withKeys)(e=>t.$emit("close"),["esc"])]},null,40,tD),[[n.vModelText,s.value]]),(0,n.createElementVNode)("button",{class:"docx-hyperlink-popup__apply",disabled:!s.value.trim(),onClick:(0,n.withModifiers)(m,["prevent"])},(0,n.toDisplayString)((0,n.unref)(r)("common.apply")),9,nD)])],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[o[10]||=(0,n.createStaticVNode)('<span class="docx-hyperlink-popup__icon" aria-hidden data-v-9d23bb12><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-9d23bb12><circle cx="12" cy="12" r="10" data-v-9d23bb12></circle><path d="M2 12h20" data-v-9d23bb12></path><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" data-v-9d23bb12></path></svg></span>',1),(0,n.createElementVNode)("a",{class:"docx-hyperlink-popup__url",href:e.data.href,title:e.data.href,onClick:o[0]||=(0,n.withModifiers)(n=>t.$emit("navigate",e.data.href),["prevent"])},(0,n.toDisplayString)(e.data.href),9,KB),o[11]||=(0,n.createElementVNode)("span",{class:"docx-hyperlink-popup__sep"},null,-1),(0,n.createElementVNode)("button",{class:"docx-hyperlink-popup__btn",title:(0,n.unref)(r)("hyperlinkPopup.copyLink"),onClick:(0,n.withModifiers)(g,["prevent"])},[...o[7]||=[(0,n.createElementVNode)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,n.createElementVNode)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,n.createElementVNode)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)]],8,GB),e.readOnly?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:0,class:"docx-hyperlink-popup__btn",title:(0,n.unref)(r)("hyperlinkPopup.editLink"),onClick:(0,n.withModifiers)(f,["prevent"])},[...o[8]||=[(0,n.createElementVNode)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,n.createElementVNode)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,n.createElementVNode)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})],-1)]],8,XB)),e.readOnly?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:1,class:"docx-hyperlink-popup__btn",title:(0,n.unref)(r)("hyperlinkPopup.removeLink"),onClick:o[1]||=(0,n.withModifiers)(e=>t.$emit("remove"),["prevent"])},[...o[9]||=[(0,n.createStaticVNode)('<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-9d23bb12><path d="M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" data-v-9d23bb12></path><path d="M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" data-v-9d23bb12></path><line x1="8" y1="2" x2="8" y2="5" data-v-9d23bb12></line><line x1="2" y1="8" x2="5" y2="8" data-v-9d23bb12></line><line x1="16" y1="19" x2="16" y2="22" data-v-9d23bb12></line><line x1="19" y1="16" x2="22" y2="16" data-v-9d23bb12></line></svg>',1)]],8,YB))],64))],38)):(0,n.createCommentVNode)("",!0)}}),[["__scopeId","data-v-9d23bb12"]]);function oD(e){let t=(0,n.ref)(null);async function r(){await e.nextTick(),e.extractCommentsAndChanges(),e.emit("ready")}async function o(t){try{let n=await ZR(t);if(!n)return;await e.loadBuffer(n.buffer),e.emit("update:document",e.getDocument()),e.emit("rename",n.name),await r()}catch(t){e.emit("error",t instanceof Error?t:Error("Failed to open document"))}}function i(t){e.onDocumentNameChange?.(t),e.emit("rename",t)}async function a(){let t=await e.saveBlob();if(!t)return;let n=(e.documentName()??"").trim()||"document",r=URL.createObjectURL(t),o=window.document.createElement("a");o.href=r,o.download=`${n.replace(/\.docx$/i,"")}.docx`,o.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}async function l(t){await e.loadBuffer(t),e.emit("update:document",e.getDocument()),await r()}function s(t){e.loadParsedDocument(t),e.emit("update:document",t),r()}async function c(){let t=await e.saveBlob();return t?t.arrayBuffer():null}return{docxInputRef:t,handleDocxFileChange:o,handleDocumentNameChange:i,downloadCurrentDocument:a,emitReadyAfterSidebarStateRefresh:r,loadDocumentBuffer:l,loadDocument:s,save:c}}function iD(e){let t=(0,n.ref)(null);function r(t){let n=e.editorView.value;if(!n)return;let r=e.getCommands(),{empty:o}=n.state.selection,i=t.bookmark?`#${t.bookmark}`:t.url;if(i){if(o&&t.displayText){let e=r.insertHyperlink;e&&e(t.displayText,i,t.tooltip||void 0)(n.state,e=>n.dispatch(e),n)}else{let e=r.setHyperlink;e&&e(i,t.tooltip||void 0)(n.state,e=>n.dispatch(e),n)}n.focus()}}function o(){let t=e.editorView.value;if(!t)return;let n=e.getCommands().removeHyperlink;n&&n()(t.state,e=>t.dispatch(e),t),t.focus()}function i(e){window.open(e,"_blank","noopener,noreferrer"),t.value=null}function a(n,r){let o=e.editorView.value;if(!o)return;let i=lg(o.state);if(!i)return void(t.value=null);let a=o.state.schema.marks.hyperlink,{$from:l}=o.state.selection,s=a.create({href:r,tooltip:i.mark.attrs.tooltip}),c=l.marks().filter(e=>e.type!==a),d=o.state.schema.text(n,[...c,s]),u=o.state.tr.replaceWith(i.start,i.end,d);o.dispatch(u.scrollIntoView()),t.value=null,o.focus()}function l(){let n=e.editorView.value;if(!n)return;let r=lg(n.state,t.value?.href);if(!r)return void(t.value=null);let o=n.state.schema.marks.hyperlink,i=n.state.tr.removeMark(r.start,r.end,o);n.dispatch(i.scrollIntoView()),t.value=null,n.focus()}return{hyperlinkPopupData:t,handleHyperlinkSubmit:r,handleHyperlinkRemove:o,handleHyperlinkPopupNavigate:i,handleHyperlinkPopupEdit:a,handleHyperlinkPopupRemove:l}}function aD(e){function t(){let t=e.editorView.value;t&&(ag(t.state,t.dispatch,t),t.focus())}function n(t){let n=e.editorView.value;if(!n)return;let r=e.getDocument()?.package?.styles;if(r){let e=$k(r).resolveParagraphStyle(t);yA(t,{paragraphFormatting:e.paragraphFormatting,runFormatting:e.runFormatting})(n.state,e=>n.dispatch(e))}else yA(t)(n.state,e=>n.dispatch(e));n.focus()}function r(){let t=e.editorView.value;t&&(wA(t.state,e=>t.dispatch(e),t),t.focus())}function o(t){let n=e.editorView.value;if(!n)return;let{from:r}=n.state.selection,o=n.state.tr.insertText(t,r);n.dispatch(o.scrollIntoView()),n.focus()}function i(t){let n=e.editorView.value;if(!n)return!1;let r=UA(n.state.doc,t.paraId);if(!r)return!1;let o=r.from+1,i=r.to-1;if(t.search){let e=XA(n.state.doc,r.from,r.to,t.search);if(!e)return!1;o=e.from,i=e.to}if(o>=i)return!0;let{schema:a}=n.state,l=t.marks,s=n.state.tr;if(void 0!==l.bold&&a.marks.bold&&(s=l.bold?s.addMark(o,i,a.marks.bold.create()):s.removeMark(o,i,a.marks.bold)),void 0!==l.italic&&a.marks.italic&&(s=l.italic?s.addMark(o,i,a.marks.italic.create()):s.removeMark(o,i,a.marks.italic)),void 0!==l.underline&&a.marks.underline)if(l.underline){let e="object"==typeof l.underline?l.underline.style:void 0;s=s.addMark(o,i,a.marks.underline.create({style:e??"single"}))}else s=s.removeMark(o,i,a.marks.underline);return void 0!==l.strike&&a.marks.strike&&(s=l.strike?s.addMark(o,i,a.marks.strike.create()):s.removeMark(o,i,a.marks.strike)),void 0!==l.color&&a.marks.textColor&&(s=l.color&&(l.color.rgb||l.color.themeColor)?s.addMark(o,i,a.marks.textColor.create({rgb:l.color.rgb??null,themeColor:l.color.themeColor??null})):s.removeMark(o,i,a.marks.textColor)),void 0!==l.highlight&&a.marks.highlight&&(s=l.highlight?s.addMark(o,i,a.marks.highlight.create({color:xA(l.highlight)||l.highlight})):s.removeMark(o,i,a.marks.highlight)),void 0!==l.fontSize&&a.marks.fontSize&&(s=l.fontSize>0?s.addMark(o,i,a.marks.fontSize.create({size:nc(l.fontSize)})):s.removeMark(o,i,a.marks.fontSize)),void 0!==l.fontFamily&&a.marks.fontFamily&&(s=l.fontFamily&&(l.fontFamily.ascii||l.fontFamily.hAnsi)?s.addMark(o,i,a.marks.fontFamily.create({ascii:l.fontFamily.ascii??null,hAnsi:l.fontFamily.hAnsi??l.fontFamily.ascii??null})):s.removeMark(o,i,a.marks.fontFamily)),n.dispatch(s),!0}function a(t){let n=e.editorView.value;if(!n)return!1;let r=UA(n.state.doc,t.paraId);if(!r)return!1;let o=e.getDocument(),i=o?.package?.styles?$k(o.package.styles):null;if(i&&!i.hasParagraphStyle(t.styleId))return!1;let a=n.state.doc.resolve(r.from+1),l=n.state.doc.resolve(r.to-1),s=n.state.apply(n.state.tr.setSelection(ln.between(a,l))),c=i?(()=>{let e=i.resolveParagraphStyle(t.styleId);return yA(t.styleId,{paragraphFormatting:e.paragraphFormatting,runFormatting:e.runFormatting})})():yA(t.styleId),d=!1;return c(s,e=>{d=!0,e.setSelection(n.state.selection.map(e.doc,e.mapping)),n.dispatch(e)}),d}return{handleClearFormatting:t,handleApplyStyle:n,handleInsertPageBreak:r,handleInsertSymbol:o,applyFormatting:i,setParagraphStyle:a}}function lD(e){function t(t){let n=e.getDocument();if(!n?.package?.document)return;let r=n.package.document.finalSectionProperties??{};n.package.document.finalSectionProperties={...r,...t},e.stateTick.value++,e.reLayout(),e.emit("change",n)}function n(n,r){e.readOnly.value||t({[n]:r})}function r(e){n("marginLeft",e)}function o(e){n("marginRight",e)}function i(e){n("marginTop",e)}function a(e){n("marginBottom",e)}function l(t){let n=e.editorView.value;n&&mA(t)(n.state,n.dispatch)}function s(t){let n=e.editorView.value;n&&gA(t)(n.state,n.dispatch)}function c(t){let n=e.editorView.value;n&&(t<0?vA(-t,!0)(n.state,n.dispatch):vA(t,!1)(n.state,n.dispatch))}function d(t){let n=e.editorView.value;n&&bA(t)(n.state,n.dispatch)}return{handlePageSetupApply:t,handleLeftMarginChange:r,handleRightMarginChange:o,handleTopMarginChange:i,handleBottomMarginChange:a,handleIndentLeftChange:l,handleIndentRightChange:s,handleFirstLineIndentChange:c,handleTabStopRemove:d}}function sD(e){function t(){if(!e.showOutline.value){let t=e.editorView.value;t&&(e.outlineHeadings.value=Mh(t.state.doc))}e.showOutline.value=!e.showOutline.value}function n(t){let n=e.editorView.value;if(!n)return;let r=n.state.doc.resolve(Math.min(t+1,n.state.doc.content.size)),o=ln.near(r);n.dispatch(n.state.tr.setSelection(o).scrollIntoView()),n.focus()}function r(){e.showSidebar.value||e.extractCommentsAndChanges(),e.showSidebar.value=!e.showSidebar.value}function o(t){let n=t.target;n&&(n.closest(".paged-editor__pages")||n.closest(".unified-sidebar")||n.closest(".docx-comment-margin-markers")||(e.activeSidebarItem.value=null))}return{handleToggleOutline:t,handleOutlineNavigate:n,handleToggleSidebar:r,handleEditorScrollMouseDown:o}}function cD(e){function t(t){if("F1"===t.key)return t.preventDefault(),void(e.showKeyboardShortcuts.value=!0);e.handleZoomKeyDown(t),(t.ctrlKey||t.metaKey)&&(e.disableFindReplaceShortcuts?.()&&("f"===t.key||"h"===t.key)||("f"===t.key||"h"===t.key?(t.preventDefault(),e.showFindReplace.value=!0):"k"===t.key?(t.preventDefault(),e.showHyperlink.value=!0):"/"===t.key&&(t.preventDefault(),e.showKeyboardShortcuts.value=!e.showKeyboardShortcuts.value)))}return(0,n.onMounted)(()=>window.addEventListener("keydown",t)),(0,n.onBeforeUnmount)(()=>window.removeEventListener("keydown",t)),{handleKeyDown:t}}function dD(e,t,n,r){return{id:e.reduce((e,t)=>Math.max(e,t.id),0)+1,author:n,date:(new Date).toISOString(),content:[{type:"paragraph",properties:{},content:[{type:"run",properties:{},content:[{type:"text",text:t}]}]}],...null==r?{}:{parentId:r}}}function uD(e){function t(t,n,r){return dD(e.getDocument()?.package?.document?.comments??[],t,n,r)}function n(n){let r=e.getDocument(),o=e.editorView.value;if(!r?.package?.document||!o)return null;r.package.document.comments||(r.package.document.comments=[]);let i=o.state.schema.marks.comment;if(!i)return null;let a=UA(o.state.doc,n.paraId);if(!a)return null;let l=a.from+1,s=a.to-1;if(n.search){let e=XA(o.state.doc,a.from,a.to,n.search);if(!e)return null;l=e.from,s=e.to}if(l>=s)return null;let c=t(n.text,n.author);return r.package.document.comments.push(c),e.comments.value=[...r.package.document.comments],o.dispatch(o.state.tr.addMark(l,s,i.create({commentId:c.id}))),e.showSidebar.value=!0,e.emit("change",r),e.contentChangeSubscribers.forEach(e=>e(r)),c.id}function r(n,r,o){let i=e.getDocument();if(!i?.package?.document?.comments||!i.package.document.comments.some(e=>e.id===n))return null;let a=t(r,o,n);return i.package.document.comments.push(a),e.comments.value=[...i.package.document.comments],e.emit("change",i),e.contentChangeSubscribers.forEach(e=>e(i)),a.id}function o(t){let n=e.getDocument();if(!n?.package?.document?.comments)return;let r=n.package.document.comments.find(e=>e.id===t);r&&(r.done=!0,e.comments.value=[...n.package.document.comments],e.emit("change",n),e.contentChangeSubscribers.forEach(e=>e(n)))}function i(t){let n=e.editorView.value;if(!n)return!1;let{schema:r}=n.state;if(!r.marks.deletion||!r.marks.insertion)return!1;let o=UA(n.state.doc,t.paraId);if(!o)return!1;let i,a,l=""===t.search,s=""===t.replaceWith;if(l&&s)return!1;if(l)i=o.to-1,a=o.to-1;else{let e=XA(n.state.doc,o.from,o.to,t.search);if(!e)return!1;i=e.from,a=e.to}let c=!1;if(i<a&&n.state.doc.nodesBetween(i,a,e=>{for(let t of e.marks)if(t.type===r.marks.insertion||t.type===r.marks.deletion)return c=!0,!1;return!0}),c)return!1;let d=Math.max(0,...e.trackedChanges.value.map(e=>e.revisionId))+1,u=(new Date).toISOString(),p=r.marks.deletion.create({revisionId:d,author:t.author,date:u}),h=r.marks.insertion.create({revisionId:d,author:t.author,date:u}),f=n.state.tr;return l||(f=f.addMark(i,a,p)),s||(f=f.insert(a,r.text(t.replaceWith,[h]))),n.dispatch(f),e.extractCommentsAndChanges(),e.showSidebar.value=!0,!0}function a(e,t){r(e,t,"User")}function l(t){let n=e.getDocument();if(!n?.package?.document?.comments)return;let r=n.package.document.comments.find(e=>e.id===t);r&&(r.done=!1),e.comments.value=[...n.package.document.comments],e.emit("change",n)}function s(t){let n=e.getDocument();n?.package?.document?.comments&&(n.package.document.comments=n.package.document.comments.filter(e=>e.id!==t&&e.parentId!==t),e.comments.value=[...n.package.document.comments],e.emit("change",n))}function c(t,n){let r=e.editorView.value;r&&(CA(t,n)(r.state,r.dispatch),e.extractCommentsAndChanges(),r.focus())}function d(t,n){let r=e.editorView.value;r&&(TA(t,n)(r.state,r.dispatch),e.extractCommentsAndChanges(),r.focus())}function u(n,r){let o=e.getDocument(),i=e.editorView.value;if(!o?.package?.document||!i)return;o.package.document.comments||(o.package.document.comments=[]);let a=i.state.schema.marks.comment;if(!a)return;let l=null,s=i.state.schema.marks.insertion,c=i.state.schema.marks.deletion;if(i.state.doc.descendants((e,t)=>{if(null!==l)return!1;for(let r of e.marks)if((r.type===s||r.type===c)&&r.attrs.revisionId===n)return l=t,!1;return!0}),null===l)return;let d=t(r,"User");o.package.document.comments.push(d),e.comments.value=[...o.package.document.comments];let u=l,p=Math.min(u+1,i.state.doc.content.size);i.dispatch(i.state.tr.addMark(u,p,a.create({commentId:d.id}))),e.emit("change",o)}return{addComment:n,replyToComment:r,resolveComment:o,proposeChange:i,handleCommentReply:a,handleCommentUnresolve:l,handleCommentDelete:s,handleAcceptChange:c,handleRejectChange:d,handleTrackedChangeReply:u}}function pD(e,t){let n=QR(e);for(let r of n){let e=Number(r.dataset.pmStart),n=Number(r.dataset.pmEnd);if(!isNaN(e)&&!isNaN(n)&&t>=e&&t<=n)return r}return null}function hD(e,t,n){if(!e||!t)return;let r=null;for(let a of QR(e)){let e=Number(a.dataset.pmStart),t=Number(a.dataset.pmEnd);if(Number.isFinite(e)&&Number.isFinite(t)&&n>=e&&n<=t){r=a;break}}if(r||=e.querySelector(`[data-pm-start="${n}"]`),!r)return;let o=t.getBoundingClientRect(),i=r.getBoundingClientRect();t.scrollTo({top:i.top-o.top+t.scrollTop-48,behavior:"smooth"})}function fD(e,t,n,r){if(!e||!t)return null;let o=eA(e,n,r,1);return null===o||o<0?null:Math.min(o,t.state.doc.content.size)}function mD(e,t,n){if(!e)return;let r=pD(e,t);if(!r)return;let o=r.textContent||"",i=Number(r.dataset.pmStart)||0,[a,l]=YR(o,t-i),s=i+a,c=i+l;s<c&&n(s,c)}function gD(e,t,n){if(!e)return;let r=pD(e,t);if(!r)return;let o=r.closest(".layout-paragraph");if(!o)return;let i=Number(o.dataset.pmStart),a=Number(o.dataset.pmEnd);!isNaN(i)&&!isNaN(a)&&i<a&&n(i,a)}function vD(e){let t=(0,n.ref)(null),r=(0,n.ref)(null),o=(0,n.ref)(null),i=(0,n.ref)(!1);function a(){let t=e.getDocument(),n=e.editorView.value;!t||!n||(e.comments.value=[...t.package?.document?.comments??[]],e.trackedChanges.value=_A(n.state).entries,!i.value&&(e.comments.value.length>0||e.trackedChanges.value.length>0)&&(e.showSidebar.value=!0,i.value=!0))}function l(){e.stateTick.value;let n=e.editorView.value;if(!n||e.isAddingComment.value||e.readOnly.value)return void(t.value=null);let{from:r,to:o}=n.state.selection;if(r===o)return void(t.value=null);let i=e.pagesRef.value,a=e.pagesViewportRef.value;if(!i||!a)return void(t.value=null);let l=a.getBoundingClientRect(),s=pD(i,r);if(!s)return void(t.value=null);let c=s.getBoundingClientRect().top-l.top+a.scrollTop,d=i.querySelector(".layout-page");t.value=d?{top:c,left:d.getBoundingClientRect().right-l.left+8}:null}function s(){e.stateTick.value;let t=e.editorView.value;if(!t)return;let n=t.state.selection.$from,r=[...t.state.storedMarks??[],...n.nodeAfter?.marks??[],...n.nodeBefore?.marks??[],...n.marks()],o=null;for(let i of r){if("comment"===i.type.name&&null!=i.attrs.commentId){let t=i.attrs.commentId;if(-1===t||e.resolvedCommentIds.value.has(t))continue;o=`comment-${t}`;break}if(("insertion"===i.type.name||"deletion"===i.type.name)&&null!=i.attrs.revisionId){let t=String(i.attrs.revisionId),n=e.trackedChanges.value.findIndex(e=>String(e.revisionId)===t||String(e.insertionRevisionId??"")===t);if(n>=0){o=`tc-${e.trackedChanges.value[n].revisionId}-${n}`;break}}}o&&(e.showSidebar.value=!0),e.activeSidebarItem.value=o}function c(){let n=e.editorView.value;if(!n)return;let{from:i,to:a}=n.state.selection;if(i===a)return;r.value={from:i,to:a},o.value=t.value?.top??null;let l=n.state.schema.marks.comment;if(l){let e=n.state.tr.addMark(i,a,l.create({commentId:-1}));n.dispatch(e)}e.showSidebar.value=!0,e.isAddingComment.value=!0,t.value=null}function d(t){let n=e.getDocument(),i=e.editorView.value;if(!n?.package)return;n.package.document.comments||(n.package.document.comments=[]);let a=dD(n.package.document.comments,t,"User");n.package.document.comments.push(a),e.comments.value=[...n.package.document.comments];let l=r.value;if(i&&l&&l.from!==l.to){let e=i.state.schema.marks.comment;if(e){let t=i.state.tr.removeMark(l.from,l.to,e);t=t.addMark(l.from,l.to,e.create({commentId:a.id})),i.dispatch(t)}}r.value=null,o.value=null,e.isAddingComment.value=!1,e.emit("change",n)}function u(){let t=e.editorView.value,n=r.value;if(t&&n&&n.from!==n.to){let e=t.state.schema.marks.comment;e&&t.dispatch(t.state.tr.removeMark(n.from,n.to,e))}r.value=null,o.value=null,e.isAddingComment.value=!1}function p(t){e.showSidebar.value=!0}(0,n.watch)([e.stateTick,e.isAddingComment,e.zoom],()=>l()),(0,n.watch)(e.stateTick,()=>s());let h=null;return(0,n.onMounted)(()=>{h=new ResizeObserver(()=>l()),e.pagesRef.value&&h.observe(e.pagesRef.value),window.addEventListener("resize",l)}),(0,n.onBeforeUnmount)(()=>{h?.disconnect(),window.removeEventListener("resize",l)}),{floatingCommentBtn:t,pendingCommentRange:r,addCommentYPosition:o,sidebarAutoOpenedRef:i,extractCommentsAndChanges:a,handleAddComment:d,handleCancelAddComment:u,handleStartAddComment:c,handleMarkerClick:p,recomputeFloatingCommentBtn:l,recomputeActiveSidebarItem:s}}function yD(e){let t=(0,n.shallowRef)(null),r=(0,n.ref)(!1),o=(0,n.computed)(()=>{e.stateTick.value;let n=e.editorView.value,r=t.value;if(!n||!r)return null;let o=n.state.doc.nodeAt(r.pmPos);return o&&"image"===o.type.name?{wrapType:o.attrs.wrapType??"inline",displayMode:o.attrs.displayMode??"inline",cssFloat:o.attrs.cssFloat??null}:null});function i(t){let n=e.editorView.value;if(!n)return;let r=n.state.schema.nodes.image;if(!r)return;let o=r.create({src:t.src,alt:t.alt,width:t.width,height:t.height}),{from:i}=n.state.selection,a=n.state.tr.insert(i,o);n.dispatch(a.scrollIntoView()),n.focus()}function a(n){let r=e.editorView.value,o=t.value;if(!r||!o)return;let i=hA(n);if(!i)return;let a=r.state.doc.nodeAt(o.pmPos),l=e.getCommands(),s="inline"===a?.attrs.wrapType&&"inline"!==i?{initialPositionEmu:cA(o.element,e.zoom.value)}:void 0,c=l.setImageWrapType?.(o.pmPos,i,s);c&&(c(r.state,e=>r.dispatch(e),r),r.focus())}function l(n){let r=e.editorView.value,o=t.value;if(!r||!o)return;let i=r.state.doc.nodeAt(o.pmPos);if(!i||"image"!==i.type.name)return;let a=i.attrs.transform||"",l=a.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),s=l?parseFloat(l[1]):0,c=/scaleX\(-1\)/.test(a),d=/scaleY\(-1\)/.test(a);"rotateCW"===n?s=(s+90)%360:"rotateCCW"===n?s=(s-90+360)%360:"flipH"===n?c=!c:"flipV"===n&&(d=!d);let u=[];0!==s&&u.push(`rotate(${s}deg)`),c&&u.push("scaleX(-1)"),d&&u.push("scaleY(-1)");let p=u.length>0?u.join(" "):null,h=r.state.tr.setNodeMarkup(o.pmPos,void 0,{...i.attrs,transform:p});r.dispatch(h.scrollIntoView()),r.focus()}return{selectedImage:t,imageInteracting:r,imageToolbarContext:o,handleInsertImage:i,handleToolbarImageWrap:a,handleImageTransform:l}}function bD(e,t){return e.getBlob(t)}function wD(e,t){let n=e.state.doc.nodeAt(t);if(!n||"image"!==n.type.name)return;let r=`<img src="${n.attrs.src}" data-pm-image="true" data-width="${n.attrs.width??""}" data-height="${n.attrs.height??""}" data-wrap-type="${n.attrs.wrapType??""}" data-display-mode="${n.attrs.displayMode??""}" data-rid="${n.attrs.rId??""}" />`,o=new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob(["[image]"],{type:"text/plain"})});navigator.clipboard.write([o]).catch(()=>{let e=document.createElement("textarea");e.value=r,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)})}function kD(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function xD(e){return new Promise(t=>{let n=new Image;n.onload=()=>t({width:n.naturalWidth,height:n.naturalHeight}),n.onerror=()=>t({width:200,height:200}),n.src=e})}async function SD(e){try{let t=await navigator.clipboard.read();for(let n of t){let t=n.types.find(e=>e.startsWith("image/"));if(t){let r=await kD(await bD(n,t)),o=await xD(r),i=o.width,a=o.height;i>612&&(a=Math.round(612/i*a),i=612);let l=e.state.schema.nodes.image.create({src:r,width:i,height:a,rId:`rId_img_${Date.now()}`,wrapType:"inline",displayMode:"inline"});return void e.dispatch(e.state.tr.replaceSelectionWith(l))}if(n.types.includes("text/html")){let t=await(await bD(n,"text/html")).text(),r=t.match(/<img[^>]+src="([^"]+)"[^>]*>/i);if(r&&r[1]){let n=r[1],o=t.match(/data-width="(\d+)"/),i=t.match(/data-height="(\d+)"/),a=o?Number(o[1]):200,l=i?Number(i[1]):200,s=e.state.schema.nodes.image.create({src:n,width:a||200,height:l||200,rId:`rId_img_${Date.now()}`,wrapType:"inline",displayMode:"inline"});return void e.dispatch(e.state.tr.replaceSelectionWith(s))}}if(n.types.includes("text/plain")){let t=await(await bD(n,"text/plain")).text();if(t&&"[image]"!==t){let{from:n}=e.state.selection;e.dispatch(e.state.tr.insertText(t,n))}return}}}catch{let t=await(navigator.clipboard?.readText());if(t){let{from:n}=e.state.selection;e.dispatch(e.state.tr.insertText(t,n))}}}function CD(e,t){let n=e.state.doc.nodeAt(t);if(!n||"image"!==n.type.name)return;let r=document.createElement("input");r.type="file",r.accept="image/*",r.onchange=async()=>{let o=r.files?.[0];if(!o)return;let i=await kD(o),a=await xD(i),l=n.attrs.width||a.width,s=n.attrs.height||a.height,c=Math.min(l/a.width,s/a.height),d=Math.round(a.width*c),u=Math.round(a.height*c);try{let r=e.state.tr.setNodeMarkup(t,void 0,{...n.attrs,src:i,width:d,height:u,rId:`rId_img_${Date.now()}`});e.dispatch(r)}catch{}},r.click()}function TD(e){let{t:t}=xc(),r=(0,n.ref)({isOpen:!1,position:{x:0,y:0},hasSelection:!1,inTable:!1,onImage:!1,canMergeCells:!1,canSplitCell:!1}),o=(0,n.ref)(null),i=(0,n.computed)(()=>[{action:"cut",label:t("contextMenu.cut"),shortcut:t("contextMenu.cutShortcut")},{action:"copy",label:t("contextMenu.copy"),shortcut:t("contextMenu.copyShortcut")},{action:"paste",label:t("contextMenu.paste"),shortcut:t("contextMenu.pasteShortcut"),dividerAfter:!0},{action:"delete",label:t("contextMenu.delete"),shortcut:t("contextMenu.deleteShortcut")}]);function a(t){let n=e.editorView.value;if(!n)return;let i=t.target,a=sA(i);if(a){let i=Number(a.dataset.pmStart);if(!isNaN(i)){try{let e=cn.create(n.state.doc,i);n.dispatch(n.state.tr.setSelection(e))}catch{}e.selectedImage.value={element:a,pmPos:i,width:a.offsetWidth,height:a.offsetHeight},e.clearOverlay();let l=n.state.doc.nodeAt(i);if(l&&"image"===l.type.name){let n=l.attrs.wrapType??"inline",s=l.attrs.cssFloat;return o.value={open:!0,position:{x:t.clientX,y:t.clientY},pmPos:i,currentWrapType:n,currentCssFloat:s??null,inlinePositionEmu:"inline"===n?cA(a,e.zoom.value):void 0},void(r.value.isOpen=!1)}}}{let{from:r,to:o}=n.state.selection,i=e.resolvePos(t.clientX,t.clientY);if(null!==i&&(i<r||i>o))try{e.setPmSelection(i)}catch{}}let l=Rf(n.state),{empty:s}=n.state.selection;o.value&&=null,r.value={isOpen:!0,position:{x:t.clientX,y:t.clientY},hasSelection:!s,inTable:l.isInTable,onImage:!!a,canMergeCells:!!l.hasMultiCellSelection,canSplitCell:!!l.canSplitCell}}function l(t){let n=e.editorView.value,i=e.selectedImage.value;if(!n||!i)return;let a=n.state.doc.nodeAt(i.pmPos);if(!a||"image"!==a.type.name)return;let l=a.attrs.wrapType??"inline",s=a.attrs.cssFloat;o.value={open:!0,position:{x:t.clientX,y:t.clientY},pmPos:i.pmPos,currentWrapType:l,currentCssFloat:s??null,inlinePositionEmu:"inline"===l?cA(i.element,e.zoom.value):void 0},r.value.isOpen=!1}function s(t){let n=e.editorView.value,r=o.value;if(!n||!r)return;let i=e.getCommands(),a=r.inlinePositionEmu&&"inline"!==t?{initialPositionEmu:r.inlinePositionEmu}:void 0,l=i.setImageWrapType?.(r.pmPos,t,a);l&&(l(n.state,e=>n.dispatch(e),n),n.focus())}function c(t){let n=e.editorView.value;if(!n)return;let r=e.getCommands();switch(t){case"cut":if(e.selectedImage.value){wD(n,e.selectedImage.value.pmPos);let t=e.selectedImage.value.pmPos,r=n.state.doc.nodeAt(t);r&&(n.dispatch(n.state.tr.delete(t,t+r.nodeSize)),e.selectedImage.value=null)}else document.execCommand("cut");break;case"copy":e.selectedImage.value?wD(n,e.selectedImage.value.pmPos):document.execCommand("copy");break;case"paste":SD(n);break;case"pasteAsPlainText":navigator.clipboard.readText().then(e=>{e&&n.dispatch(n.state.tr.insertText(e).scrollIntoView())}).catch(()=>{});break;case"delete":{let{from:e,to:t}=n.state.selection;e!==t&&n.dispatch(n.state.tr.delete(e,t));break}case"selectAll":{let e=ln.create(n.state.doc,0,n.state.doc.content.size);n.dispatch(n.state.tr.setSelection(e));break}case"imageProperties":e.selectedImage.value&&(e.showImageProperties.value=!0);break;case"replaceImage":e.selectedImage.value&&CD(n,e.selectedImage.value.pmPos);break;case"deleteImage":if(e.selectedImage.value){let t=e.selectedImage.value.pmPos,r=n.state.doc.nodeAt(t);r&&(n.dispatch(n.state.tr.delete(t,t+r.nodeSize)),e.selectedImage.value=null)}break;case"addRowAbove":case"addRowBelow":case"deleteRow":case"addColumnLeft":case"addColumnRight":case"deleteColumn":case"mergeCells":case"splitCell":{let e=r[t];e&&e()(n.state,e=>n.dispatch(e),n);break}}n.focus()}return{contextMenu:r,imageContextMenu:o,imageContextMenuTextActions:i,handleContextMenu:a,handleSelectedImageContextMenu:l,handleImageWrapSelect:s,handleContextMenuAction:c}}var ED=500;function _D(e){let t=(0,n.ref)(null),r=null;function o(){null!==r&&(clearTimeout(r),r=null)}let i=(0,n.ref)(null),a=0,l=null,s=0,c=!1,d=null,u=(0,n.ref)({currentPage:1,totalPages:1,visible:!1}),p=null;function h(t,n){return fD(e.pagesRef.value,e.editorView.value,t,n)}function f(t,n){let r=e.editorView.value;if(!r)return;let o=r.state.doc.resolve(t),i=void 0===n?o:r.state.doc.resolve(n),a=ln.between(o,i);r.dispatch(r.state.tr.setSelection(a))}function m(t){hD(e.pagesRef.value,e.pagesViewportRef.value,t)}function g(t){mD(e.pagesRef.value,t,f)}function v(t){gD(e.pagesRef.value,t,f)}function y(t){let n=e.editorView.value;if(!n)return;let r=null;if(n.state.doc.descendants((e,n)=>null===r&&(!e.attrs?.bookmarks?.some(e=>e.name===t)||(r=n,!1))),null!==r){m(r);try{f(Math.min(r+1,n.state.doc.content.size))}catch{f(r)}}}function b(n){if(e.readOnly.value||c)return;let a=e.pagesRef.value;if(!a)return;let l=e.pagesViewportRef.value;if(!l)return;let s=DA({mouseX:n.clientX,mouseY:n.clientY,pagesContainer:a,target:n.target,hfEditMode:i.value?.position??null});if(!s)return void(null===r&&(r=setTimeout(()=>{t.value=null,r=null},NA)));let d=l.getBoundingClientRect();t.value={type:s.type,x:s.clientX-d.left,y:s.clientY-d.top,cellPmPos:s.cellPmPos},o()}function w(n){n.preventDefault(),n.stopPropagation();let r=t.value,o=e.editorView.value;if(!r||!o)return;let i=o.state.tr.setSelection(ln.create(o.state.doc,r.cellPmPos+1));o.dispatch(i);let a=e.getCommands(),l="row"===r.type?a.addRowBelow?.():a.addColumnRight?.();l&&(l(o.state,e=>o.dispatch(e),o),t.value=null,o.focus())}function k(t){let n=t.target?.closest("a[href]");if(!n)return;t.preventDefault();let r=n.getAttribute("href")||"";if(!r)return;if(r.startsWith("#")){let e=r.slice(1);return void(e&&y(e))}let o=e.editorView.value;if(o&&o.state.selection.from!==o.state.selection.to)return;let i=e.pagesViewportRef.value;if(!i)return;let a=i.getBoundingClientRect(),l=n.getBoundingClientRect();e.hyperlinkPopupData.value={href:r,displayText:n.textContent||"",tooltip:n.getAttribute("title")||void 0,position:{top:l.bottom-a.top+i.scrollTop+4,left:l.left-a.left+i.scrollLeft}}}function x(t){let n=t.target,r=n.closest(".layout-page-header"),o=n.closest(".layout-page-footer"),a=r??o;if(!a)return;let l=r?"header":"footer",s=e.getDocument();if(!s?.package)return;let c=s.package.document?.sections?.[0]?.properties??s.package.document?.finalSectionProperties??null,d="header"===l?c?.headerReferences:c?.footerReferences,u="header"===l?s.package.headers:s.package.footers;if(!d||!u)return;let p=(d.find(e=>"default"===e.type)??d.find(e=>"first"===e.type))?.rId??null,h=p?u.get(p)??null:null,f=e.pagesViewportRef.value;if(!f)return;let m=a.getBoundingClientRect(),g=f.getBoundingClientRect(),v=e.zoom.value||1;i.value={position:l,rId:p,headerFooter:h,targetRect:{top:(m.top-g.top+f.scrollTop)/v,left:(m.left-g.left+f.scrollLeft)/v,width:m.width/v,height:m.height/v}}}function S(t){let n=e.getDocument(),r=i.value;if(!n?.package||!r)return;let o="header"===r.position?n.package.headers:n.package.footers;if(!o||!r.rId)return;let a=o.get(r.rId);a&&(a.content=t),e.reLayout(),e.emit("change",n)}function C(){let t=e.getDocument(),n=i.value;if(!t?.package||!n||!n.rId)return;let r=("header"===n.position?t.package.headers:t.package.footers)?.get(n.rId);r&&(r.content=[]),i.value=null,e.reLayout(),e.emit("change",t)}function T(t){if(0!==t.button||e.imageInteracting.value)return;let n=e.editorView.value;if(!n||!e.readOnly.value&&e.tableResize.tryStartResize(t,n))return;let r=t.target,o=sA(r);if(o){t.preventDefault(),t.stopPropagation();let r=Number(o.dataset.pmStart);if(!isNaN(r)){try{let e=cn.create(n.state.doc,r);n.dispatch(n.state.tr.setSelection(e))}catch{}e.selectedImage.value={element:o,pmPos:r,width:o.offsetWidth,height:o.offsetHeight},e.clearOverlay()}return void n.focus()}e.selectedImage.value=null,t.preventDefault();let i=h(t.clientX,t.clientY);if(null===i)return void n.focus();let u=Date.now();if(u-a<ED&&l===i?s++:s=1,a=u,l=i,2===s)g(i);else if(s>=3)v(i),s=0;else{if(t.shiftKey){let{from:e}=n.state.selection;f(e,i)}else f(i);d=i,c=!0}n.focus()}function E(e){if(!c||null===d)return;let t=h(e.clientX,e.clientY);null!==t&&t!==d&&f(d,t)}function _(){c=!1}function M(){let t=e.pagesViewportRef.value,n=e.layout.value;if(!t||!n||0===n.pages.length)return;let r=t.scrollTop,o=n.pages.length,i=r+t.clientHeight/2,a=24,l=1;for(let e=0;e<n.pages.length;e++){let t=n.pages[e].size.h,r=a+t;if(i<r){l=e+1;break}a=r+24,l=e+2}l=Math.min(l,o),u.value={currentPage:l,totalPages:o,visible:!0},p&&clearTimeout(p),p=setTimeout(()=>{u.value={...u.value,visible:!1}},600)}return(0,n.onMounted)(()=>{window.addEventListener("mousemove",E),window.addEventListener("mouseup",_),e.pagesViewportRef.value?.addEventListener("scroll",M,{passive:!0})}),(0,n.onBeforeUnmount)(()=>{o(),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",_),e.pagesViewportRef.value?.removeEventListener("scroll",M),p&&clearTimeout(p)}),{tableInsertButton:t,hfEdit:i,scrollPageInfo:u,resolvePos:h,setPmSelection:f,scrollVisiblePositionIntoView:m,navigateToBookmark:y,handlePagesMouseDown:T,handlePagesMouseMove:b,handlePagesClick:k,handlePagesDoubleClick:x,handleTableInsertClick:w,clearTableInsertTimer:o,handleHfSave:S,handleHfRemove:C}}function MD(e){let t=null,r=null;function o(){let n=e.pagesRef.value;n&&(n.querySelectorAll(".vue-sel-rect, .vue-caret").forEach(e=>e.remove()),null!==t&&(clearInterval(t),t=null),r=null)}function i(){let n=e.pagesRef.value,i=e.editorView.value;if(!n||!i)return;o();let a=i.state.selection;if(a instanceof cn&&"image"===a.node.type.name){let t=null;for(let e of n.querySelectorAll(`[data-pm-start="${a.from}"]`)){let n=sA(e);if(n){t=n;break}}if(t){let n=e.selectedImage.value;return void((!n||n.element!==t||n.pmPos!==a.from||n.width!==t.offsetWidth||n.height!==t.offsetHeight)&&(e.selectedImage.value={element:t,pmPos:a.from,width:t.offsetWidth,height:t.offsetHeight}))}}if(e.selectedImage.value)return;let{from:l,to:s,empty:c}=i.state.selection,d=n.scrollTop,u=n.scrollLeft;if(c){let e=iA(n,l,n.getBoundingClientRect());if(e){let o=document.createElement("div");o.className="vue-caret",o.style.cssText=`\n position: absolute;\n left: ${e.x+u}px;\n top: ${e.y+d}px;\n width: 2px;\n height: ${e.height}px;\n background: #000;\n pointer-events: none;\n z-index: ${bk.selectionOverlay};\n `,n.appendChild(o),r=o;let i=!0;t=setInterval(()=>{i=!i,r&&(r.style.opacity=i?"1":"0")},530)}return}let p=oA(n,l,s,n.getBoundingClientRect());for(let e of p){let t=document.createElement("div");t.className="vue-sel-rect",t.style.cssText=`\n position: absolute;\n left: ${e.x+u}px;\n top: ${e.y+d}px;\n width: ${e.width}px;\n height: ${e.height}px;\n background: rgba(66, 133, 244, 0.3);\n pointer-events: none;\n z-index: ${bk.selectionOverlay};\n `,n.appendChild(t)}}return(0,n.onBeforeUnmount)(()=>{o()}),{clearOverlay:o,updateSelectionOverlay:i}}function ND(e){function t(t){let n=e.editorView.value;if(!n)return;let r=e.getCommands()[t];r&&(r()(n.state,e=>n.dispatch(e),n),n.focus())}function n(t,n){let r=e.editorView.value;if(!r)return;let o=e.getCommands().insertTable;o&&(o(t,n)(r.state,e=>r.dispatch(e),r),r.focus())}function r(n){switch(n){case"open":e.docxInputRef.value?.click(),e.emit("menu-action","open");break;case"save":e.emit("menu-action","save"),e.downloadCurrentDocument();break;case"pageSetup":e.showPageSetup.value=!0;break;case"clearFormatting":e.handleClearFormatting();break;case"insertImage":e.showInsertImage.value=!0;break;case"insertLink":e.showHyperlink.value=!0;break;case"insertSymbol":e.showInsertSymbol.value=!0;break;case"insertPageBreak":e.handleInsertPageBreak();break;case"insertTOC":t("generateTOC");break;case"outline":e.handleToggleOutline();break;case"sidebar":e.handleToggleSidebar();break;case"shortcuts":e.showKeyboardShortcuts.value=!0;break;case"reportIssue":OA();break;case"dirLTR":t("setLtr");break;case"dirRTL":t("setRtl");break}}return{handleMenuAction:r,handleMenuTableInsert:n,execSimpleCommand:t}}function ID(e){async function t(t){e.sidebarAutoOpenedRef.value=!1,await e.loadDocumentBuffer(t)}function r(t){e.sidebarAutoOpenedRef.value=!1,e.loadDocument(t)}(0,n.watch)(e.documentBuffer,e=>{e&&t(e)}),(0,n.watch)(e.document,e=>{e&&r(e)}),(0,n.onMounted)(async()=>{await(0,n.nextTick)();let o=e.documentBuffer(),i=e.document();o?await t(o):i&&r(i)})}function RD(e){function t(){e.onPrint?.(),window.print()}function n(){t()}function r(){return e.zoom.value}function o(t){if(!Number.isInteger(t)||t<1)return;let n=e.pagesViewportRef.value,r=e.pagesRef.value?.querySelector(`[data-page-number="${t}"]`);if(!n||!r)return;let o=n.getBoundingClientRect(),i=r.getBoundingClientRect();n.scrollTo({top:i.top-o.top+n.scrollTop-24,behavior:"smooth"})}function i(t){Number.isFinite(t)&&e.scrollVisiblePositionIntoView(t)}function a(){return e.editorView.value?{getDocument:e.getDocument,getView:()=>e.editorView.value,getState:()=>e.editorView.value?.state??null}:null}function l(){return e.layout.value?.pages.length??0}function s(){let t=e.layout.value,n=e.editorView.value;if(!t||!n)return 0;let r=aN(t,n.state.selection.from);return null==r?0:r+1}function c(t){let n=e.editorView.value;if(!n)return!1;let r=UA(n.state.doc,t);return!!r&&(e.scrollVisiblePositionIntoView(r.from+1),!0)}function d(t,n){return YA(e.editorView.value,t,n)}function u(){return JA(e.editorView.value)}function p(){return e.comments.value}function h(t){return QA(e.editorView.value,e.layout.value,t)}function f(t){return e.contentChangeSubscribers.add(t),()=>e.contentChangeSubscribers.delete(t)}function m(t){return e.selectionChangeSubscribers.add(t),()=>e.selectionChangeSubscribers.delete(t)}return{exposed:{getAgent:()=>null,save:e.save,setZoom:e.setZoom,getZoom:r,focus:e.focus,scrollToPage:o,scrollToPosition:i,openPrintPreview:n,print:t,loadDocument:e.loadDocument,loadDocumentBuffer:e.loadDocumentBuffer,destroy:e.destroy,getDocument:e.getDocument,getEditorRef:a,addComment:e.addComment,replyToComment:e.replyToComment,resolveComment:e.resolveComment,proposeChange:e.proposeChange,scrollToParaId:c,findInDocument:d,getSelectionInfo:u,getComments:p,applyFormatting:e.applyFormatting,setParagraphStyle:e.setParagraphStyle,getPageContent:h,getTotalPages:l,getCurrentPage:s,onContentChange:f,onSelectionChange:m}}}var AD={class:"docx-editor-vue__toolbar-shell"},BD={key:0,class:"docx-editor-vue__error"},DD={key:1,class:"docx-editor-vue__loading"},FD={class:"docx-editor-vue__editor-area"},PD={key:0,class:"docx-editor-vue__vertical-ruler"},OD=["title"],LD=["title","aria-label"],zD=(0,n.defineComponent)({__name:"DocxEditor",props:{documentBuffer:{default:null},document:{default:null},showToolbar:{type:Boolean,default:!0},showMenuBar:{type:Boolean,default:!0},showRuler:{type:Boolean,default:!0},documentName:{default:""},readOnly:{type:Boolean,default:!1},mode:{default:"editing"},onModeChange:{},i18n:{default:void 0},theme:{default:null},externalPlugins:{default:()=>[]},showZoomControl:{type:Boolean,default:!0},initialZoom:{default:1},toolbarExtra:{type:Function,default:void 0},className:{default:""},style:{type:[Boolean,null,String,Object,Array],default:void 0},showOutline:{type:Boolean,default:!1},showOutlineButton:{type:Boolean,default:!0},fontFamilies:{default:void 0},onPrint:{type:Function,default:void 0},disableFindReplaceShortcuts:{type:Boolean,default:!1},renderLogo:{type:Function,default:void 0},onDocumentNameChange:{type:Function,default:void 0},documentNameEditable:{type:Boolean,default:!0},renderTitleBarRight:{type:Function,default:void 0}},emits:["change","update:document","error","ready","rename","menu-action","mode-change"],setup(e,{expose:t,emit:r}){let o=e,i=r,a=(0,n.ref)(o.mode),l=(0,n.computed)(()=>o.readOnly||"viewing"===a.value);wc((0,n.computed)(()=>o.i18n));let{t:s}=kc((0,n.computed)(()=>o.i18n)),c=(0,n.ref)(null),d=(0,n.ref)(null),u=(0,n.ref)(null),p=(0,n.ref)(0),h=new Set,f=new Set,m=new ZA,g=(0,n.ref)(!1),v=(0,n.ref)(!1),y=(0,n.ref)(!1),b=(0,n.ref)(!1),w=(0,n.ref)(!1),k=(0,n.ref)(!1),x=(0,n.ref)(o.showOutline),S=(0,n.ref)(!1),C=(0,n.ref)(!1),T=(0,n.ref)(!1),E=(0,n.ref)(null),_=(0,n.shallowRef)([]),M=(0,n.shallowRef)([]),N=(0,n.shallowRef)([]),{zoom:I,zoomPercent:R,isMinZoom:A,isMaxZoom:B,setZoom:D,zoomIn:F,zoomOut:P,handleWheel:O,handleKeyDown:L,installShortcuts:z,ZOOM_PRESETS:V}=DR(o.initialZoom);z();let{editorView:$,isReady:j,parseError:H,layout:W,loadBuffer:q,loadDocument:Z,save:U,focus:K,destroy:G,getDocument:X,getCommands:Y,reLayout:J}=NR({hiddenContainer:c,pagesContainer:d,readOnly:l,externalPlugins:o.externalPlugins,syncCoordinator:m,onChange:e=>{i("change",e),i("update:document",e),h.forEach(t=>t(e))},onError:e=>i("error",e),onSelectionUpdate:()=>{p.value++,zt();let e=JA($.value);f.forEach(t=>t(e))}}),Q=(0,n.computed)(()=>{p.value;let e=X();if(!e?.package?.document)return null;let t=e.package.document;return t.finalSectionProperties??t.sections?.[0]?.properties??null}),ee=(0,n.computed)(()=>(p.value,X()?.package?.theme??o.theme??null)),te=(0,n.computed)(()=>{let e=[];return C.value&&e.push(`translateX(-${Jv}px)`),1!==I.value&&e.push(`scale(${I.value})`),{transform:e.length>0?e.join(" "):void 0,transformOrigin:"top center",transition:"transform 0.2s ease"}}),ne=(0,n.computed)(()=>({paddingLeft:"20px",paddingRight:20+(C.value?2*Jv:0)+"px",transition:"padding 0.2s ease"})),re=(0,n.computed)(()=>{let e=Q.value;return Gs(e?.pageWidth??12240)*I.value}),oe=(0,n.computed)(()=>{let e=new Set;for(let t of _.value)null==t.parentId&&t.done&&e.add(t.id);return e}),ie=(0,n.computed)(()=>{p.value;let e=$.value;if(!e)return[];let t=new Set,n=[];return e.state.doc.descendants(e=>{let r=e.attrs?.bookmarks;if(!r)return!0;for(let o of r){let e=o.name;!e||e.startsWith("_")||t.has(e)||(t.add(e),n.push({name:e,label:e}))}return!0}),n.sort((e,t)=>e.name.localeCompare(t.name))}),{floatingCommentBtn:ae,pendingCommentRange:le,addCommentYPosition:se,sidebarAutoOpenedRef:ce,extractCommentsAndChanges:de,handleAddComment:ue,handleCancelAddComment:pe,handleStartAddComment:he,handleMarkerClick:fe}=vD({editorView:$,getDocument:X,comments:_,trackedChanges:M,resolvedCommentIds:oe,activeSidebarItem:E,showSidebar:C,isAddingComment:T,readOnly:l,zoom:I,stateTick:p,pagesRef:d,pagesViewportRef:u,emit:i}),{docxInputRef:me,handleDocxFileChange:ge,handleDocumentNameChange:ve,downloadCurrentDocument:ye,emitReadyAfterSidebarStateRefresh:be,loadDocumentBuffer:we,loadDocument:ke,save:xe}=oD({loadBuffer:q,loadParsedDocument:Z,getDocument:X,saveBlob:U,extractCommentsAndChanges:de,emit:i,documentName:()=>o.documentName,onDocumentNameChange:o.onDocumentNameChange,nextTick:n.nextTick}),{hyperlinkPopupData:Se,handleHyperlinkSubmit:Ce,handleHyperlinkRemove:Te,handleHyperlinkPopupNavigate:Ee,handleHyperlinkPopupEdit:_e,handleHyperlinkPopupRemove:Me}=iD({editorView:$,getCommands:Y}),{handleClearFormatting:Ne,handleApplyStyle:Ie,handleInsertPageBreak:Re,handleInsertSymbol:Ae,applyFormatting:Be,setParagraphStyle:De}=aD({editorView:$,getDocument:X}),{handlePageSetupApply:Fe,handleLeftMarginChange:Pe,handleRightMarginChange:Oe,handleTopMarginChange:Le,handleBottomMarginChange:ze,handleIndentLeftChange:Ve,handleIndentRightChange:$e,handleFirstLineIndentChange:je,handleTabStopRemove:He}=lD({editorView:$,getDocument:X,readOnly:l,stateTick:p,reLayout:J,emit:i}),{handleToggleOutline:We,handleOutlineNavigate:qe,handleToggleSidebar:Ze,handleEditorScrollMouseDown:Ue}=sD({editorView:$,showOutline:x,showSidebar:C,outlineHeadings:N,activeSidebarItem:E,extractCommentsAndChanges:de});cD({showKeyboardShortcuts:S,showFindReplace:g,showHyperlink:y,handleZoomKeyDown:L,disableFindReplaceShortcuts:()=>o.disableFindReplaceShortcuts});let{addComment:Ke,replyToComment:Ge,resolveComment:Xe,proposeChange:Ye,handleCommentReply:Je,handleCommentUnresolve:Qe,handleCommentDelete:et,handleAcceptChange:tt,handleRejectChange:nt,handleTrackedChangeReply:rt}=uD({editorView:$,getDocument:X,comments:_,trackedChanges:M,showSidebar:C,isAddingComment:T,pendingCommentRange:le,contentChangeSubscribers:h,extractCommentsAndChanges:de,emit:i}),{selectedImage:ot,imageInteracting:it,imageToolbarContext:at,handleInsertImage:lt,handleToolbarImageWrap:st,handleImageTransform:ct}=yD({editorView:$,zoom:I,stateTick:p,getCommands:Y}),dt=zR(),ut=null,{tableInsertButton:pt,hfEdit:ht,scrollPageInfo:ft,resolvePos:mt,setPmSelection:gt,scrollVisiblePositionIntoView:vt,handlePagesMouseDown:yt,handlePagesMouseMove:bt,handlePagesClick:wt,handlePagesDoubleClick:kt,handleTableInsertClick:xt,clearTableInsertTimer:St,handleHfSave:Ct,handleHfRemove:Tt}=_D({editorView:$,pagesRef:d,pagesViewportRef:u,selectedImage:ot,imageInteracting:it,hyperlinkPopupData:Se,readOnly:l,zoom:I,layout:W,tableResize:dt,getCommands:Y,getDocument:X,reLayout:J,emit:i,clearOverlay:Lt}),{contextMenu:Et,imageContextMenu:_t,imageContextMenuTextActions:Mt,handleContextMenu:Nt,handleSelectedImageContextMenu:It,handleImageWrapSelect:Rt,handleContextMenuAction:At}=TD({editorView:$,selectedImage:ot,zoom:I,showImageProperties:w,getCommands:Y,clearOverlay:Lt,setPmSelection:gt,resolvePos:mt}),{handleMenuAction:Bt,handleMenuTableInsert:Dt}=ND({editorView:$,getCommands:Y,docxInputRef:me,showPageSetup:k,showInsertImage:v,showHyperlink:y,showInsertSymbol:b,showKeyboardShortcuts:S,handleClearFormatting:Ne,handleInsertPageBreak:Re,handleToggleOutline:We,handleToggleSidebar:Ze,downloadCurrentDocument:ye,emit:i});ID({documentBuffer:()=>o.documentBuffer,document:()=>o.document,loadDocumentBuffer:we,loadDocument:ke,sidebarAutoOpenedRef:ce});let Ft=()=>$.value,Pt=()=>d.value;function Ot(e){a.value!==e&&(a.value=e,i("mode-change",e))}function Lt(){Vt.clearOverlay()}function zt(){Vt.updateSelectionOverlay()}(0,n.watch)(()=>o.mode,e=>{e&&e!==a.value&&(a.value=e)}),(0,n.watch)(()=>o.showOutline,e=>{x.value=!!e}),(0,n.onMounted)(()=>{ut=dt.install()}),(0,n.onBeforeUnmount)(()=>{ut?.()});let Vt=MD({editorView:$,pagesRef:d,selectedImage:ot});(0,n.onBeforeUnmount)(()=>{Lt()});let{exposed:$t}=RD({editorView:$,layout:W,pagesRef:d,pagesViewportRef:u,zoom:I,comments:_,focus:K,destroy:G,getDocument:X,setZoom:D,save:xe,loadDocument:ke,loadDocumentBuffer:we,addComment:Ke,replyToComment:Ge,resolveComment:Xe,proposeChange:Ye,applyFormatting:Be,setParagraphStyle:De,scrollVisiblePositionIntoView:vt,contentChangeSubscribers:h,selectionChangeSubscribers:f,onPrint:o.onPrint});return t($t),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["docx-editor-vue ep-root paged-editor",e.className,{"paged-editor--readonly":l.value,"paged-editor--hf-editing":null!==(0,n.unref)(ht),"paged-editor--editing-header":"header"===(0,n.unref)(ht)?.position,"paged-editor--editing-footer":"footer"===(0,n.unref)(ht)?.position}]),style:(0,n.normalizeStyle)(e.style)},[(0,n.createElementVNode)("div",AD,[(0,n.createVNode)(xB,{"show-menu-bar":e.showMenuBar,"document-name":e.documentName,"document-name-editable":e.documentNameEditable,"render-logo":e.renderLogo,"render-title-bar-right":e.renderTitleBarRight,onRename:(0,n.unref)(ve),onMenuAction:(0,n.unref)(Bt),onInsertTable:(0,n.unref)(Dt)},{"title-bar-left":(0,n.withCtx)(()=>[(0,n.renderSlot)(t.$slots,"title-bar-left")]),"title-bar-right":(0,n.withCtx)(()=>[(0,n.renderSlot)(t.$slots,"title-bar-right")]),_:3},8,["show-menu-bar","document-name","document-name-editable","render-logo","render-title-bar-right","onRename","onMenuAction","onInsertTable"]),e.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(Jy,{key:0,view:(0,n.unref)($),"get-commands":(0,n.unref)(Y),"state-tick":p.value,"zoom-percent":(0,n.unref)(R),"is-min-zoom":(0,n.unref)(A),"is-max-zoom":(0,n.unref)(B),"zoom-presets":(0,n.unref)(V),"show-zoom-control":e.showZoomControl,"editor-mode":a.value,"comments-sidebar-open":C.value,"image-context":(0,n.unref)(at),theme:ee.value,"font-families":e.fontFamilies,onInsertLink:r[0]||=e=>y.value=!0,onApplyStyle:(0,n.unref)(Ie),onZoomIn:(0,n.unref)(F),onZoomOut:(0,n.unref)(P),onZoomSet:(0,n.unref)(D),onToggleSidebar:(0,n.unref)(Ze),onModeChange:Ot,onImageWrapType:(0,n.unref)(st),onImageProperties:r[1]||=e=>w.value=!0,onImageTransform:(0,n.unref)(ct)},(0,n.createSlots)({"table-context":(0,n.withCtx)(()=>[(0,n.createVNode)(Hb,{view:(0,n.unref)($),"get-commands":(0,n.unref)(Y),"state-tick":p.value,theme:ee.value},null,8,["view","get-commands","state-tick","theme"])]),_:2},[e.toolbarExtra?{name:"toolbar-extra",fn:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.toolbarExtra)))]),key:"0"}:{name:"toolbar-extra",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(t.$slots,"toolbar-extra")]),key:"1"}]),1032,["view","get-commands","state-tick","zoom-percent","is-min-zoom","is-max-zoom","zoom-presets","show-zoom-control","editor-mode","comments-sidebar-open","image-context","theme","font-families","onApplyStyle","onZoomIn","onZoomOut","onZoomSet","onToggleSidebar","onImageWrapType","onImageTransform"])):(0,n.createCommentVNode)("",!0)]),(0,n.createVNode)(SB,{"show-find-replace":g.value,"onUpdate:showFindReplace":r[2]||=e=>g.value=e,"show-insert-image":v.value,"onUpdate:showInsertImage":r[3]||=e=>v.value=e,"show-hyperlink":y.value,"onUpdate:showHyperlink":r[4]||=e=>y.value=e,"show-insert-symbol":b.value,"onUpdate:showInsertSymbol":r[5]||=e=>b.value=e,"show-image-properties":w.value,"onUpdate:showImageProperties":r[6]||=e=>w.value=e,"show-page-setup":k.value,"onUpdate:showPageSetup":r[7]||=e=>k.value=e,"show-keyboard-shortcuts":S.value,"onUpdate:showKeyboardShortcuts":r[8]||=e=>S.value=e,view:(0,n.unref)($),bookmarks:ie.value,"selected-image-pm-pos":(0,n.unref)(ot)?.pmPos??null,"section-properties":Q.value,onInsertImage:(0,n.unref)(lt),onInsertSymbol:(0,n.unref)(Ae),onHyperlinkSubmit:(0,n.unref)(Ce),onHyperlinkRemove:(0,n.unref)(Te),onPageSetupApply:(0,n.unref)(Fe)},null,8,["show-find-replace","show-insert-image","show-hyperlink","show-insert-symbol","show-image-properties","show-page-setup","show-keyboard-shortcuts","view","bookmarks","selected-image-pm-pos","section-properties","onInsertImage","onInsertSymbol","onHyperlinkSubmit","onHyperlinkRemove","onPageSetupApply"]),(0,n.unref)(H)?((0,n.openBlock)(),(0,n.createElementBlock)("div",BD,(0,n.toDisplayString)((0,n.unref)(H)),1)):(0,n.createCommentVNode)("",!0),(0,n.unref)(j)||(0,n.unref)(H)?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",DD,"Loading...")),(0,n.createElementVNode)("div",{ref_key:"hiddenPmRef",ref:c,class:"docx-editor-vue__hidden-pm paged-editor__hidden-pm"},null,512),(0,n.createElementVNode)("div",{class:"docx-editor-vue__editor-scroll",onMousedown:r[31]||=(...e)=>(0,n.unref)(Ue)&&(0,n.unref)(Ue)(...e)},[e.showRuler&&Q.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"docx-editor-vue__ruler-row",style:(0,n.normalizeStyle)(ne.value)},[(0,n.createVNode)(qw,{"section-props":Q.value,zoom:(0,n.unref)(I),editable:!l.value,onLeftMarginChange:(0,n.unref)(Pe),onRightMarginChange:(0,n.unref)(Oe),onIndentLeftChange:(0,n.unref)(Ve),onIndentRightChange:(0,n.unref)($e),onFirstLineIndentChange:(0,n.unref)(je),onTabStopRemove:(0,n.unref)(He)},null,8,["section-props","zoom","editable","onLeftMarginChange","onRightMarginChange","onIndentLeftChange","onIndentRightChange","onFirstLineIndentChange","onTabStopRemove"])],4)):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",FD,[(0,n.createElementVNode)("div",{ref_key:"pagesViewportRef",ref:u,class:"docx-editor-vue__pages-viewport",onMousedown:r[22]||=(...e)=>(0,n.unref)(yt)&&(0,n.unref)(yt)(...e),onMousemove:r[23]||=(...e)=>(0,n.unref)(bt)&&(0,n.unref)(bt)(...e),onClick:r[24]||=(...e)=>(0,n.unref)(wt)&&(0,n.unref)(wt)(...e),onDblclick:r[25]||=(...e)=>(0,n.unref)(kt)&&(0,n.unref)(kt)(...e),onContextmenu:r[26]||=(0,n.withModifiers)((...e)=>(0,n.unref)(Nt)&&(0,n.unref)(Nt)(...e),["prevent"]),onWheel:r[27]||=(...e)=>(0,n.unref)(O)&&(0,n.unref)(O)(...e)},[e.showRuler&&Q.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",PD,[(0,n.createVNode)(Jw,{"section-props":Q.value,zoom:(0,n.unref)(I),editable:!l.value,onTopMarginChange:(0,n.unref)(Le),onBottomMarginChange:(0,n.unref)(ze)},null,8,["section-props","zoom","editable","onTopMarginChange","onBottomMarginChange"])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"pagesRef",ref:d,class:"docx-editor-vue__pages paged-editor__pages",style:(0,n.normalizeStyle)(te.value)},null,4),(0,n.createVNode)(vB,{"is-open":null!==(0,n.unref)(ht),position:(0,n.unref)(ht)?.position??"header","header-footer":(0,n.unref)(ht)?.headerFooter??null,styles:(0,n.unref)(X)()?.package?.styles??null,theme:(0,n.unref)(X)()?.package?.theme??null,"target-rect":(0,n.unref)(ht)?.targetRect??null,onSave:(0,n.unref)(Ct),onClose:r[9]||=e=>ht.value=null,onRemove:(0,n.unref)(Tt)},null,8,["is-open","position","header-footer","styles","theme","target-rect","onSave","onRemove"]),(0,n.createVNode)(lB,{"image-info":(0,n.unref)(ot),zoom:(0,n.unref)(I),view:(0,n.unref)($),onOpenProperties:r[10]||=e=>w.value=!0,onDeselect:r[11]||=e=>ot.value=null,onInteractStart:r[12]||=e=>it.value=!0,onInteractEnd:r[13]||=e=>it.value=!1,onContextMenu:(0,n.unref)(It)},null,8,["image-info","zoom","view","onContextMenu"]),(0,n.createVNode)(eB,{"get-view":Ft,"get-pages-container":Pt,zoom:(0,n.unref)(I),"transaction-version":p.value,"sync-coordinator":(0,n.unref)(m)},null,8,["zoom","transaction-version","sync-coordinator"]),!(0,n.unref)(ae)||T.value||l.value?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:1,type:"button",class:"docx-editor-vue__floating-comment",style:(0,n.normalizeStyle)({top:(0,n.unref)(ae).top+"px",left:(0,n.unref)(ae).left+"px"}),title:(0,n.unref)(s)("comments.addComment"),onMousedown:r[14]||=(0,n.withModifiers)((...e)=>(0,n.unref)(he)&&(0,n.unref)(he)(...e),["prevent","stop"])},[(0,n.createVNode)(cc,{name:"add_comment",size:16})],44,OD)),(0,n.unref)(pt)&&!l.value?((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:2,type:"button",class:"docx-editor-vue__table-insert-btn",style:(0,n.normalizeStyle)({left:(0,n.unref)(pt).x+"px",top:(0,n.unref)(pt).y+"px"}),title:"row"===(0,n.unref)(pt).type?"Insert row below":"Insert column to the right","aria-label":"row"===(0,n.unref)(pt).type?"Insert row below":"Insert column to the right",onMousedown:r[15]||=(...e)=>(0,n.unref)(xt)&&(0,n.unref)(xt)(...e),onMouseenter:r[16]||=(...e)=>(0,n.unref)(St)&&(0,n.unref)(St)(...e),onMouseleave:r[17]||=e=>pt.value=null},[...r[36]||=[(0,n.createElementVNode)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[(0,n.createElementVNode)("path",{d:"M6 1v10M1 6h10",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)]],44,LD)):(0,n.createCommentVNode)("",!0),(0,n.createVNode)(Aw,{comments:_.value,"pages-container":d.value,zoom:(0,n.unref)(I),"page-width-px":re.value,"sidebar-open":C.value,"resolved-comment-ids":oe.value,onMarkerClick:(0,n.unref)(fe)},null,8,["comments","pages-container","zoom","page-width-px","sidebar-open","resolved-comment-ids","onMarkerClick"]),(0,n.createVNode)(Iw,{"is-open":C.value,comments:_.value,"tracked-changes":M.value,"is-adding-comment":T.value,"add-comment-y-position":(0,n.unref)(se),"show-resolved":!0,"pages-container":d.value,"page-width-px":re.value,zoom:(0,n.unref)(I),"active-item-id":E.value,onClose:r[18]||=e=>C.value=!1,onAddComment:(0,n.unref)(ue),onCancelAddComment:(0,n.unref)(pe),onCommentReply:(0,n.unref)(Je),onCommentResolve:(0,n.unref)(Xe),onCommentUnresolve:(0,n.unref)(Qe),onCommentDelete:(0,n.unref)(et),onAcceptChange:(0,n.unref)(tt),onRejectChange:(0,n.unref)(nt),onTrackedChangeReply:(0,n.unref)(rt),"onUpdate:activeItemId":r[19]||=e=>E.value=e},null,8,["is-open","comments","tracked-changes","is-adding-comment","add-comment-y-position","pages-container","page-width-px","zoom","active-item-id","onAddComment","onCancelAddComment","onCommentReply","onCommentResolve","onCommentUnresolve","onCommentDelete","onAcceptChange","onRejectChange","onTrackedChangeReply"]),(0,n.createVNode)(rD,{data:(0,n.unref)(Se),"read-only":l.value,onNavigate:(0,n.unref)(Ee),onCopy:r[20]||=e=>Se.value=null,onEdit:(0,n.unref)(_e),onRemove:(0,n.unref)(Me),onClose:r[21]||=e=>Se.value=null},null,8,["data","read-only","onNavigate","onEdit","onRemove"])],544),!x.value&&e.showOutlineButton?((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:0,type:"button",class:"docx-editor-vue__outline-toggle",title:"Show document outline",onClick:r[28]||=(...e)=>(0,n.unref)(We)&&(0,n.unref)(We)(...e),onMousedown:r[29]||=(0,n.withModifiers)(()=>{},["stop"])},[(0,n.createVNode)(cc,{name:"format_list_bulleted",size:20})],32)):(0,n.createCommentVNode)("",!0),(0,n.unref)(ft).totalPages>1?((0,n.openBlock)(),(0,n.createBlock)(hB,{key:1,"current-page":(0,n.unref)(ft).currentPage,"total-pages":(0,n.unref)(ft).totalPages,visible:(0,n.unref)(ft).visible},null,8,["current-page","total-pages","visible"])):(0,n.createCommentVNode)("",!0),(0,n.createVNode)(pB,{"is-open":x.value,headings:N.value,onClose:r[30]||=e=>x.value=!1,onNavigate:(0,n.unref)(qe)},null,8,["is-open","headings","onNavigate"])])],32),(0,n.createElementVNode)("input",{ref_key:"docxInputRef",ref:me,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:r[32]||=(...e)=>(0,n.unref)(ge)&&(0,n.unref)(ge)(...e)},null,544),(0,n.createVNode)(UB,{"read-only":l.value,"context-menu":(0,n.unref)(Et),"image-context-menu":(0,n.unref)(_t),"image-context-menu-text-actions":(0,n.unref)(Mt),"can-open-image-properties":!!(0,n.unref)(ot),onContextMenuAction:(0,n.unref)(At),onCloseContextMenu:r[33]||=e=>(0,n.unref)(Et).isOpen=!1,onImageWrapSelect:(0,n.unref)(Rt),onCloseImageContextMenu:r[34]||=e=>_t.value=null,onOpenImageProperties:r[35]||=e=>w.value=!0},null,8,["read-only","context-menu","image-context-menu","image-context-menu-text-actions","can-open-image-properties","onContextMenuAction","onImageWrapSelect"])],6))}});async function VD(e,t,r={}){let o=e instanceof ArrayBuffer?e:await VT(e),i=null,a=null,l=!1,s={save:async()=>{let e=await(i?.save()??Promise.resolve(null));return e?new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}):null},getDocument:()=>i?.getDocument()??null,focus:()=>{i?.focus()},setZoom:e=>{i?.setZoom(e)},scrollToParaId:e=>i?.scrollToParaId(e)??!1,scrollToPosition:e=>{i?.scrollToPosition(e)},destroy:()=>{i?.destroy(),a?.unmount(),a=null}};return new Promise((e,c)=>{a=(0,n.createApp)({setup(){return()=>(0,n.h)(zD,{...r,documentBuffer:o,showToolbar:r.showToolbar??!0,readOnly:r.readOnly??!1,ref:e=>{i=e??null},onReady:()=>{r.onReady?.(),l||(l=!0,e(s))},onError:e=>{r.onError?.(e),l||(l=!0,c(e))},onChange:r.onChange,onRename:r.onRename,onMenuAction:r.onMenuAction,onModeChange:r.onModeChange})}}),a.mount(t)})}var $D={_lang:"zh-CN",common:{cancel:"取消",insert:"插入",apply:"应用",close:"关闭",delete:"删除",update:"更新",save:"保存",retry:"重试",send:"发送",edit:"编辑",comment:"批注",reply:"回复",accept:"接受",reject:"拒绝",dismiss:"忽略",change:"更改",px:"px",closeDialog:"关闭对话框",clear:"清除"},toolbar:{ariaLabel:"格式工具栏",file:"文件",format:"格式",insert:"插入",open:"打开",openShortcut:"Ctrl+O",save:"保存",saveShortcut:"Ctrl+S",print:"打印",printShortcut:"Ctrl+P",pageSetup:"页面设置",leftToRight:"文本从左到右",rightToLeft:"文本从右到左",image:"图片",table:"表格",pageBreak:"分页符",tableOfContents:"目录",symbol:"符号",help:"帮助",reportIssue:"反馈问题"},formattingBar:{groups:{history:"历史记录",zoom:"缩放",styles:"样式",font:"字体",textFormatting:"文本格式",script:"上下标",alignment:"对齐",listFormatting:"列表格式",image:"图片",table:"表格"},undo:"撤销",undoShortcut:"撤销(Ctrl+Z)",redo:"恢复",redoShortcut:"恢复(Ctrl+Y)",bold:"加粗",boldShortcut:"加粗(Ctrl+B)",italic:"倾斜",italicShortcut:"倾斜(Ctrl+I)",underline:"下划线",underlineShortcut:"下划线(Ctrl+U)",strikethrough:"删除线",fontColor:"字体颜色",highlightColor:"文本突出显示颜色",insertLink:"插入链接",insertLinkShortcut:"插入链接(Ctrl+K)",superscript:"上标",superscriptShortcut:"上标(Ctrl+Shift+=)",subscript:"下标",subscriptShortcut:"下标(Ctrl+=)",imageProperties:"图片属性",imagePropertiesShortcut:"图片属性(替代文本、边框)...",clearFormatting:"清除格式"},alignment:{alignLeft:"左对齐",alignLeftShortcut:"Ctrl+L",center:"居中",centerShortcut:"Ctrl+E",alignRight:"右对齐",alignRightShortcut:"Ctrl+R",justify:"两端对齐",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"列表格式",typeAriaLabel:"列表类型",indentationAriaLabel:"列表缩进",bulletList:"项目符号",numberedList:"编号",decreaseIndent:"减少缩进",increaseIndent:"增加缩进"},lineSpacing:{single:"单倍行距",double:"双倍行距",lineSpacingTitle:"行距: {label}",paragraphSpacing:"段间距"},styles:{selectAriaLabel:"选择段落样式",normalText:"正文",title:"标题",subtitle:"副标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3"},font:{selectAriaLabel:"选择字体",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace"},fontSize:{decrease:"减小字号",increase:"增大字号",label:"字号",listLabel:"字号列表"},zoom:{ariaLabel:"缩放: {label}"},colorPicker:{ariaLabel:"{type} 颜色选择器",highlightColors:"突出显示颜色",customColor:"自定义颜色",noColor:"无颜色",automatic:"自动",themeColors:"主题颜色",standardColors:"标准颜色",colors:{black:"黑色",darkRed:"深红",red:"红色",orange:"橙色",yellow:"黄色",darkYellow:"深黄",green:"绿色",darkGreen:"深绿",teal:"蓝绿",darkTeal:"深蓝绿",blue:"蓝色",darkBlue:"深蓝",purple:"紫色",darkPurple:"深紫",brown:"棕色",grey50:"灰色 50%",grey25:"灰色 25%",grey10:"灰色 10%",white:"白色",lightRed:"浅红",lightOrange:"浅橙",lightYellow:"浅黄",lightGreen:"浅绿",lightBlue:"浅蓝",lightPurple:"浅紫",pink:"粉红",rose:"玫瑰红",gold:"金色",aqua:"水绿色",lavender:"薰衣草色",silver:"银色",darkOrange:"深橙",darkGray:"深灰",gray:"灰色",cyan:"青色",magenta:"品红",paleGreen:"淡绿",lightCyan:"浅青",skyBlue:"天蓝",lightBlue2:"浅蓝 2",lightMagenta:"浅品红",brightGreen:"亮绿",violet:"紫罗兰色"}},dialogs:{findReplace:{titleFind:"查找",titleFindReplace:"查找和替换",findLabel:"查找内容:",findPlaceholder:"输入要查找的文本...",findAriaLabel:"查找文本",findPrevious:"查找上一处",findPreviousTitle:"查找上一处(Shift+Enter)",findNext:"查找下一处",findNextTitle:"查找下一处(Enter)",matchCount:"{current}/{total} 个匹配项",noResults:"未找到结果",replaceLabel:"替换为:",replacePlaceholder:"输入要替换的文本...",replaceAriaLabel:"替换文本",replaceButton:"替换",replaceCurrentTitle:"替换当前匹配项",replaceAllButton:"全部替换",replaceAllTitle:"替换所有匹配项",matchCase:"区分大小写",wholeWords:"全字匹配",toggleReplace:"+ 替换",matchesFound:"{total} 个匹配项"},hyperlink:{titleEdit:"编辑超链接",titleInsert:"插入超链接",tabWebAddress:"网址",tabBookmark:"书签",urlLabel:"URL",urlPlaceholder:"https://example.com",urlHint:"输入网址、电子邮箱(mailto:)或电话(tel:)",bookmarkLabel:"书签",bookmarkPlaceholder:"选择一个书签...",displayTextLabel:"显示文本",displayTextPlaceholder:"输入要显示的文本(可选)",displayTextHint:"留空则使用所选文本",tooltipLabel:"屏幕提示(可选)",tooltipPlaceholder:"悬停时显示的文本",removeLink:"删除链接",invalidUrl:"请输入有效的 URL",urlRequired:"URL 不能为空"},insertTable:{title:"插入表格",hoverToSelect:"悬停以选择表格尺寸",tableSize:"{cols} x {rows} 表格",orSpecifySize:"或指定尺寸",rowsLabel:"行数:",columnsLabel:"列数:",insertButton:"插入表格",sizeSelector:"表格尺寸选择器",autofit:"根据内容自动调整",columnWidthLabel:"列宽",fixedWidth:"固定列宽",tableStyleLabel:"表格样式",validationHint:"行数: {minRows}-{maxRows}, 列数: {minCols}-{maxCols}"},splitCell:{title:"拆分单元格",description:"设置要将所选单元格拆分成的行数和列数。",rowsLabel:"行数:",columnsLabel:"列数:",currentMinimum:"基于当前跨度的最小拆分:{rows} 行 x {cols} 列",minValue:"至少拆分为 {rows} 行 {cols} 列。",notOneByOne:"请至少拆分成两个单元格。"},insertImage:{title:"插入图片",uploadAriaLabel:"点击或拖拽上传图片",uploadText:"点击选择或拖拽上传图片",uploadSubtext:"支持 PNG、JPG、GIF,最大 10MB",dimensions:"尺寸",widthLabel:"宽度:",heightLabel:"高度:",aspectRatioLocked:"锁定宽高比",aspectRatioUnlocked:"未锁定宽高比",altTextLabel:"替代文本(可选)",altTextPlaceholder:"描述图片内容以供无障碍访问",insertButton:"插入图片",invalidFile:"请选择有效的图片文件",fileTooLarge:"图片文件过大(最大 10MB)",readFailed:"无法读取图片文件",loadFailed:"无法加载图片",preview:"预览"},insertSymbol:{title:"插入符号",searchPlaceholder:"搜索符号(字符或 Unicode)...",noResults:'未找到与 "{query}" 匹配的符号',decimal:"十进制:{value}",categories:{common:"常用符号",arrows:"箭头",math:"数学符号",greek:"希腊字母",shapes:"形状",punctuation:"标点符号",currency:"货币符号",music:"音乐符号",emoji:"Emoji"},noResultsEmpty:"未找到符号",recent:"最近使用:"},imageProperties:{title:"图片属性",altText:"替代文本",altTextPlaceholder:"描述图片内容以供无障碍访问...",border:"边框",width:"宽度",style:"样式",color:"颜色",preview:"预览",borderStyles:{solid:"实线",dashed:"虚线",dotted:"点线",double:"双实线",groove:"凹槽",ridge:"凸脊",inset:"嵌入",outset:"突出"},dimensions:"尺寸",heightLabel:"高度:",lockAspectRatio:"锁定纵横比",textWrapping:"文字环绕",widthLabel:"宽度:",wrapOptions:{behind:"衬于文字下方",inFront:"浮于文字上方",inline:"嵌入型",topAndBottom:"上下型环绕",wrapLeft:"文字环绕, 浮于右侧",wrapRight:"文字环绕, 浮于左侧"}},imagePosition:{title:"图片位置",horizontal:"水平",vertical:"垂直",position:"位置",alignment:"对齐方式",offset:"偏移",offsetPx:"偏移(px)",align:"对齐",relativeTo:"相对于",alignOptions:{left:"左对齐",center:"居中",right:"右对齐",top:"顶端对齐",bottom:"底端对齐"},relativeOptions:{page:"页面",column:"列",margin:"页边距",character:"字符",paragraph:"段落",line:"行"}},pageSetup:{title:"页面设置",pageSize:"纸张大小",sizeLabel:"大小",custom:"自定义",orientation:"方向",portrait:"纵向",landscape:"横向",margins:"页边距",top:"上",bottom:"下",left:"左",right:"右",pageSizes:{letter:'信纸 (8.5" × 11")',a4:'A4 (8.27" × 11.69")',legal:'法律专用纸 (8.5" × 14")',a3:'A3 (11.69" × 16.54")',a5:'A5 (5.83" × 8.27")',b5:'B5 (6.93" × 9.84")',executive:'Executive (7.25" × 10.5")'}},tableProperties:{title:"表格属性",widthType:"宽度类型",widthLabel:"宽度",alignmentLabel:"对齐方式",widthTypes:{auto:"自动",fixed:"固定(twips)",percentage:"百分比"},units:{fiftiethsPercent:"(五十分之一 %)",twips:"tw"},alignOptions:{left:"左对齐",center:"居中",right:"右对齐"}},pasteSpecial:{title:"选择性粘贴",keepFormatting:"保留源格式",keepFormattingDescription:"粘贴时保留源格式",keepFormattingShortcut:"Ctrl+V",plainText:"粘贴为纯文本",plainTextDescription:"粘贴为纯文本,不保留任何格式",plainTextShortcut:"Ctrl+Shift+V",readingClipboard:"正在读取剪贴板...",preview:"预览:",noContent:"无可粘贴内容",clipboardError:"无法读取剪贴板,请使用 Ctrl+V 粘贴。"},footnoteProperties:{title:"脚注和尾注属性",footnotes:"脚注",endnotes:"尾注",position:"位置",numberFormat:"编号格式",startAt:"起始编号",numbering:"编号方式",footnotePositions:{bottomOfPage:"页面底端",belowText:"文本下方"},endnotePositions:{endOfDocument:"文档末尾",endOfSection:"节末尾"},numberingOptions:{continuous:"连续",restartSection:"每节重新编号",restartPage:"每页重新编号"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, †, ‡, ..."}},keyboardShortcuts:{ariaLabel:"键盘快捷方式",searchPlaceholder:"搜索快捷方式...",categories:{editing:"编辑",formatting:"格式",navigation:"导航",clipboard:"剪贴板",selection:"选择",view:"视图",file:"文件",other:"其他"},shortcuts:{save:"保存",saveDescription:"保存文档",print:"打印",printDescription:"打印文档",undo:"撤销",undoDescription:"撤销上一次操作",redo:"恢复",redoDescription:"恢复上一次操作",delete:"删除",deleteDescription:"删除所选内容",find:"查找",findDescription:"查找内容",findReplace:"查找和替换",findReplaceDescription:"查找并替换内容",cut:"剪切",cutDescription:"剪切所选内容",copy:"复制",copyDescription:"复制所选内容",paste:"粘贴",pasteDescription:"粘贴剪贴板内容",pastePlainText:"粘贴为纯文本",pastePlainTextDescription:"粘贴为纯文本,不保留任何格式",bold:"加粗",boldDescription:"将所选文本加粗",italic:"斜体",italicDescription:"将所选文本设置为斜体",underline:"下划线",underlineDescription:"为所选文本添加下划线",strikethrough:"删除线",strikethroughDescription:"为所选文本添加删除线",subscript:"下标",subscriptDescription:"将所选文本设置为下标",superscript:"上标",superscriptDescription:"将所选文本设置为上标",alignLeft:"左对齐",alignLeftDescription:"将所选文本左对齐",alignCenter:"居中",alignCenterDescription:"将所选文本居中",alignRight:"右对齐",alignRightDescription:"将所选文本右对齐",justify:"两端对齐",justifyDescription:"将所选文本两端对齐",increaseIndent:"增加缩进",increaseIndentDescription:"将所选文本增加缩进",decreaseIndent:"减少缩进",decreaseIndentDescription:"将所选文本减少缩进",selectAll:"全选",selectAllDescription:"选中所有内容",selectWord:"选择单词",selectWordDescription:"选择当前单词",selectParagraph:"选择段落",selectParagraphDescription:"选择当前段落",extendSelectionByWord:"按单词扩展选区",extendSelectionByWordDescription:"将选区扩展到下一个/上一个单词",extendSelectionToLineEdge:"扩展到行首/行尾",extendSelectionToLineEdgeDescription:"将选区扩展到行首或行尾",moveByWord:"按单词移动",moveByWordDescription:"将光标移动到下一个/上一个单词",moveToLineStart:"移动到行首",moveToLineStartDescription:"将光标移动到当前行的开始位置",moveToLineEnd:"移动到行尾",moveToLineEndDescription:"将光标移动到当前行的结束位置",moveToDocumentStart:"移动到文档开始",moveToDocumentStartDescription:"将光标移动到文档的开始位置",moveToDocumentEnd:"移动到文档结束",moveToDocumentEndDescription:"将光标移动到文档的结束位置",pageUp:"向上翻页",pageUpDescription:"将页面向上滚动",pageDown:"向下翻页",pageDownDescription:"将页面向下滚动",zoomIn:"放大",zoomInDescription:"将文档放大",zoomOut:"缩小",zoomOutDescription:"将文档缩小",resetZoom:"重置缩放",resetZoomDescription:"重置缩放至 100%",keyboardShortcuts:"键盘快捷方式",keyboardShortcutsDescription:"显示键盘快捷方式",insertLink:"插入链接",insertLinkDescription:"插入或编辑超链接"},noResults:'未找到与 "{query}" 匹配的快捷方式',pressEscToClose:"按 {key} 关闭",or:"或"}},comments:{resolved:"已解决",resolve:"解决",reopen:"重新打开",moreOptions:"更多选项",unknown:"未知",addComment:"添加批注",replyPlaceholder:"回复或使用 @ 提及他人...",replyCount:"{count, plural, one {# 条回复} other {# 条回复}}"},trackedChanges:{unknown:"未知",replaced:"替换",with:"为",added:"添加",deleted:"删除"},contextMenu:{ariaLabel:"AI 操作菜单",textMenuAriaLabel:"文本编辑菜单",customPromptPlaceholder:"输入自定义提示...",cut:"剪切",cutShortcut:"Ctrl+X",copy:"复制",copyShortcut:"Ctrl+C",paste:"粘贴",pasteShortcut:"Ctrl+V",pastePlainText:"粘贴为纯文本",pastePlainTextShortcut:"Ctrl+Shift+V",delete:"删除",deleteShortcut:"Del",selectAll:"全选",selectAllShortcut:"Ctrl+A",selected:"已选择",aiActions:{askAi:"询问 AI",rewrite:"重写",expand:"扩写",summarize:"总结",translate:"翻译",explain:"解释",fixGrammar:"修正语法",makeFormal:"正式化",makeCasual:"口语化",custom:"自定义"}},documentOutline:{ariaLabel:"文档大纲",closeAriaLabel:"关闭大纲",closeTitle:"关闭大纲",title:"大纲",noHeadings:"未找到标题。请在文档中添加标题以在此处显示。"},sidebar:{ariaLabel:"批注侧边栏"},titleBar:{untitled:"未命名",documentNameAriaLabel:"文档名称",menuBarAriaLabel:"菜单栏"},errors:{loadingDocument:"正在加载文档...",noDocumentLoaded:"未加载文档",failedToLoad:"文档加载失败",unableToParse:"无法解析文档",somethingWentWrong:"发生错误",errorDescription:"渲染此组件时发生错误。请重试,如果问题仍然存在,请联系支持人员。",errorLabel:"错误:",componentStack:"组件堆栈:",tryAgain:"请重试",showDetails:"显示详情",hideDetails:"隐藏详情",unsavedChanges:"您有未保存的更改,是否确定离开?"},table:{insertRowAbove:"在上方插入行",insertRowBelow:"在下方插入行",insertColumnLeft:"在左侧插入列",insertColumnRight:"在右侧插入列",deleteRow:"删除行",deleteColumn:"删除列",deleteTable:"删除表格",mergeCells:"合并单元格",splitCell:"拆分单元格",editingTools:"表格编辑工具",label:"表格",cellFillColor:"单元格填充颜色",borderColor:"边框颜色",borderWidth:"边框宽度",unknownAction:"未知操作",borders:{all:"所有框线",outside:"外侧框线",inside:"内侧框线",none:"无框线",remove:"移除框线",top:"上框线",bottom:"下框线",left:"左框线",right:"右框线",styleAriaLabel:"边框样式",tooltip:"边框"},moreOptions:"更多表格选项",styles:{title:"表格样式",label:"样式",normalTable:"普通表格",tableGrid:"表格网格",gridTableLight:"浅色网格表",plainTable1:"纯文本表格 1",plainTable2:"纯文本表格 2",plainTable3:"纯文本表格 3",plainTable4:"纯文本表格 4",gridTable1Light:"浅色网格表 1",gridTable4Accent1:"网格表 4 强调色 1",gridTable5Dark:"深色网格表 5",listTable3Accent2:"列表表格 3 强调色 2",listTable4Accent3:"列表表格 4 强调色 3",gridTable4Accent5:"网格表 4 强调色 5",gridTable4Accent6:"网格表 4 强调色 6"}},tableAdvanced:{verticalAlignment:"垂直对齐",top:"顶端对齐",middle:"居中对齐",bottom:"底端对齐",cellMargins:"单元格边距",textDirection:"文本方向",textDirections:{horizontal:"水平 (从左到右)",verticalRL:"垂直 (从上到下,从右到左)",verticalLR:"垂直 (从下到上,从左到右)"},toggleNoWrap:"切换文本换行",rowHeight:"行高",heightRules:{auto:"自动调整",atLeast:"最小值",exact:"固定值"},rule:"规则",height:"高度",toggleHeaderRow:"切换标题行",distributeColumns:"平均分布各列",autoFit:"根据内容自动调整",tableProperties:"表格属性...",tableAlignment:"表格对齐方式",alignTableLeft:"表格左对齐",alignTableCenter:"表格居中对齐",alignTableRight:"表格右对齐",tableOptionsMenu:"表格选项菜单",tableOptions:"表格选项"},imageTransform:{tooltip:"变换",rotateClockwise:"向右旋转",rotateCounterClockwise:"向左旋转",flipHorizontal:"水平翻转",flipVertical:"垂直翻转"},imageWrap:{inline:"嵌入型",floatLeft:"浮于左侧(文字环绕右侧)",floatRight:"浮于右侧(文字环绕左侧)",topAndBottom:"上下型环绕",behindText:"衬于文字下方",inFrontOfText:"浮于文字上方",tooltipPrefix:"环绕方式:{label}",menu:{ariaLabel:"图像布局选项",behindText:"衬于文字下方",inFrontOfText:"浮于文字上方",inLineWithText:"嵌入型",squareLeft:"四周型靠左",squareRight:"四周型靠右",imageProperties:"图片属性…"},menuDesc:{behindText:"图像绘制在正文下方",inFrontOfText:"图像绘制在正文上方",inLineWithText:"图像作为字形在行中流动",squareLeft:"图像靠左,文字环绕右侧",squareRight:"图像靠右,文字环绕左侧"}},responsePreview:{loading:"正在{action}...",result:"{action}结果",closeEsc:"关闭(Esc)",editPrompt:"在接受前编辑结果:",changes:"更改:",original:"原文:",new:"新内容:",cancelEdit:"取消编辑"},commentMarkers:{resolvedComment:"已解决的批注",comment:"批注"},editor:{toggleCommentsSidebar:"切换批注侧边栏",showDocumentOutline:"显示文档大纲",editing:"编辑",editingDescription:"直接编辑文档",suggesting:"修订",suggestingDescription:"编辑内容将显示为修订建议",viewing:"查看",viewingDescription:"只读,不可编辑",failedToParse:"解析文档失败",linkRemoved:"链接已删除",linkCopied:"链接已复制到剪贴板",failedToSave:"保存文档失败"},hyperlinkPopup:{displayTextPlaceholder:"显示文本",urlPlaceholder:"https://example.com",copyLink:"复制链接",editLink:"编辑链接",removeLink:"删除链接"},headerFooter:{header:"页眉",footer:"页脚",options:"选项",insertPageNumber:"插入当前页码",insertTotalPages:"插入总页数",remove:"删除 {label}",closeEditing:"关闭 {label} 编辑"},image:{placeholder:"图片占位符",placeholderText:"[图片]",editableAriaLabel:"可编辑图片"},ruler:{horizontal:"水平标尺",vertical:"垂直标尺",firstLineIndent:"首行缩进",leftIndent:"左缩进",rightIndent:"右缩进",topMargin:"上边距",bottomMargin:"下边距"},print:{label:"打印",allPages:"全部(共 {totalPages} 页)",singlePage:"第 {start} 页",pageRange:"第 {start}-{end} 页"},unsaved:{unsaved:"未保存",saved:"已保存",unsavedTitle:"文档有未保存的更改",savedTitle:"所有更改已保存",unsavedAriaLabel:"有未保存的更改",savedAriaLabel:"所有更改已保存"},loading:{label:"正在加载"},agentPanel:{defaultTitle:"助手",toggle:"打开助手",close:"关闭面板",resizeHandle:"调整助手面板大小",thinking:"助手正在思考",composerPlaceholder:"向助手提问…",send:"发送",timeline:{working:"处理中… {count, plural, one {# 步} other {# 步}}",summary:"{count, plural, one {# 步} other {# 步}}",earlier:"+ {count, plural, one {# 个历史步骤} other {# 个历史步骤}}"}},viewer:{pageIndicator:"第 {current} 页,共 {total} 页"},imageOverlay:{deleteImage:"删除图片",imageProperties:"图片属性",rotate:"旋转"}},jD=$D,HD=jD;const WD={class:"template-editor"},qD={key:0,class:"template-editor-status"},ZD={key:1,class:"template-editor-status is-error"},UD={name:"FDocxTemplateEditor"};function KD(e,{expose:t,emit:r}){const o=e,i="application/vnd.openxmlformats-officedocument.wordprocessingml.document",l="运营报告.docx",s=[".docx-editor-vue__toolbar-shell",".doc-outline",".docx-editor-vue__outline-toggle",".ctx-menu",".image-ctx-menu"],c={File:"文件",Format:"格式",Insert:"插入",Help:"帮助",Editing:"编辑",Viewing:"查看",Suggesting:"建议","Normal text":"正文",Normal:"正文",Title:"标题",Subtitle:"副标题","Heading 1":"标题 1","Heading 2":"标题 2","Heading 3":"标题 3","Document Outline":"文档目录","No headings found":"未找到标题","(untitled)":"(未命名)",Header:"页眉",Footer:"页脚",Remove:"移除",Save:"保存",Cancel:"取消",Print:"打印",Cut:"剪切",Copy:"复制",Paste:"粘贴","Paste as Plain Text":"粘贴为纯文本",Delete:"删除","Select All":"全选","Insert row above":"在上方插入行","Insert row below":"在下方插入行","Delete row":"删除行","Insert column left":"在左侧插入列","Insert column right":"在右侧插入列","Delete column":"删除列","Merge cells":"合并单元格","Split cell":"拆分单元格","Replace image...":"替换图片...","Replace image…":"替换图片...","Image properties...":"图片属性...","Image properties…":"图片属性...","Delete image":"删除图片"},u={"Document outline":"文档目录","Close outline":"关闭目录","Show document outline":"显示文档目录","Font family":"字体","Paragraph style":"段落样式","Line spacing":"行距","Decrease font size":"减小字号","Increase font size":"增大字号","Bullet list":"项目符号","Numbered list":"编号","Decrease indent":"减少缩进","Increase indent":"增加缩进","Insert table":"插入表格","Insert row above":"在上方插入行","Insert row below":"在下方插入行","Insert column left":"在左侧插入列","Insert column right":"在右侧插入列","Merge cells":"合并单元格","Split cells":"拆分单元格",Print:"打印",Remove:"移除",Save:"保存",Cancel:"取消"},p=["pointerdown","mousedown","click"],h=new Set(["f","g","h","l","o","p","r","s","w"]),f="loopStart",m="loopEnd",g="field",v=(0,n.ref)(null),y=(0,n.ref)(!1),b=(0,n.ref)("");let w=0,k=null,x=null,S=null,C=0,T="";function E(e){return String(e||"").replace(/\s+/g,"").replace(/\u200b/g,"").trim()}function _(){return o.templateUrl||`/${encodeURIComponent(o.templateFileName||l)}`}function M(){return o.exportFileName||o.templateFileName||l}function N(e){return{name:e,fields:[],loops:[]}}function I(e,t){t&&!e.includes(t)&&e.push(t)}function R(e,t,n){const r=String(t||"").split(".").map(e=>e.trim()).filter(Boolean);if(!r.length)return;let o=e;r.forEach((e,t)=>{const i=t===r.length-1;i?void 0===o[e]&&(o[e]=n):(o[e]&&"object"===typeof o[e]&&!Array.isArray(o[e])||(o[e]={}),o=o[e])})}function A(e){const t={};return e.fields.forEach(e=>{R(t,e,"")}),e.loops.forEach(e=>{t[e.name]=[A(e)]}),t}function B(e,t){const n={};return e.forEach(e=>{R(n,e,"")}),t.forEach(e=>{n[e.name]=[A(e)]}),n}function D(e){const t=String(e||"").trim();return t?t.startsWith("#")||t.startsWith("^")?{type:f,value:t.slice(1).trim(),raw:t}:t.startsWith("/")?{type:m,value:t.slice(1).trim(),raw:t}:{type:g,value:t,raw:t}:null}function F(e=""){const t=[],n=/\{([^{}]+)\}/g;let r=n.exec(e);while(r){const o=D(r[1]);o&&t.push(o),r=n.exec(e)}return t}function P(e){const t=[],n=[],r=[];return e.forEach(e=>{if(e.type===f){const t=N(e.value),o=r[r.length-1];return o?o.loops.push(t):n.push(t),void r.push(t)}if(e.type===m){const t=r.map(e=>e.name).lastIndexOf(e.value);return void(t>=0&&r.splice(t))}const o=r[r.length-1];I(o?o.fields:t,e.value)}),{tags:e.map(e=>e.raw),fields:t,loops:n,renderData:B(t,n)}}function O(e){try{const t=new(d())(e),n=new(a())(t,{paragraphLoop:!0,linebreaks:!0}),r=F(n.getFullText()),o=P(r);return{...o,summary:{tagCount:o.tags.length,fieldCount:o.fields.length,loopCount:o.loops.length}}}catch(t){return console.warn("Template variable extraction failed:",t),{tags:[],fields:[],loops:[],renderData:{},summary:{tagCount:0,fieldCount:0,loopCount:0},error:t?.message||String(t)}}}async function L(){const e=await fetch(_());if(!e.ok)throw new Error(`模板加载失败: ${e.status}`);return e.arrayBuffer()}function z(e){return e?u[e]?u[e]:e.replace(/^Zoom:/,"缩放:").replace(/^Alignment:/,"对齐:").replace(/Align left/g,"左对齐").replace(/Center/g,"居中").replace(/Align right/g,"右对齐").replace(/Justify/g,"两端对齐").replace(/Insert link/g,"插入链接").replace(/Clear formatting/g,"清除格式").replace(/(\d+) more items/g,"还有 $1 项"):e}function V(e){if(1!==e.childNodes.length||e.firstChild.nodeType!==Node.TEXT_NODE)return;const t=e.textContent.trim(),n=c[t];n&&(e.textContent=e.textContent.replace(t,n))}function $(e){V(e),["title","aria-label","placeholder"].forEach(t=>{const n=e.getAttribute(t),r=z(n);r&&r!==n&&e.setAttribute(t,r)})}function j(){const e=v.value;e&&s.forEach(t=>{e.querySelectorAll(t).forEach(e=>{$(e),e.querySelectorAll("*").forEach($)})}),[".ctx-menu",".image-ctx-menu"].forEach(e=>{document.body.querySelectorAll(e).forEach(e=>{$(e),e.querySelectorAll("*").forEach($)})})}function H(){C||(C=requestAnimationFrame(()=>{C=0,j()}))}function W(){v.value&&(q(),j(),x=new MutationObserver(H),x.observe(v.value,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["title","aria-label","placeholder"]}),S=new MutationObserver(H),S.observe(document.body,{subtree:!0,childList:!0,characterData:!0}))}function q(){x?.disconnect(),x=null,S?.disconnect(),S=null,C&&(cancelAnimationFrame(C),C=0)}function Z(e){const t=v.value?.querySelector(".docx-editor-vue__pages");if(!t||!Number.isFinite(e))return null;const n=Array.from(t.querySelectorAll("[data-pm-start][data-pm-end]"));let r=null,o=Number.POSITIVE_INFINITY;for(const i of n){const t=Number(i.dataset.pmStart),n=Number(i.dataset.pmEnd);if(!Number.isFinite(t)||!Number.isFinite(n))continue;if(e>=t&&e<=n)return i.closest(".layout-paragraph")||i;const a=Math.abs(t-e);a<o&&(o=a,r=i)}return r?.closest(".layout-paragraph")||r}function U(e){const t=v.value?.querySelector(".docx-editor-vue__pages");if(!t)return null;const n=E(e.textContent);if(!n)return null;const r=Array.from(t.querySelectorAll(".layout-paragraph, [data-pm-start][data-pm-end]")).filter(e=>E(e.textContent)).sort((e,t)=>{const n=Number(e.dataset.pmStart||e.querySelector("[data-pm-start]")?.dataset.pmStart||0),r=Number(t.dataset.pmStart||t.querySelector("[data-pm-start]")?.dataset.pmStart||0);return n-r}),o=r.find(e=>E(e.textContent)===n);if(o)return o.closest(".layout-paragraph")||o;const i=r.find(e=>E(e.textContent).includes(n));return i?i.closest(".layout-paragraph")||i:null}function K(e){const t=v.value?.querySelector(".docx-editor-vue__pages-viewport");if(!t||!e)return!1;const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return t.scrollTo({top:Math.max(r.top-n.top+t.scrollTop-48,0),behavior:"smooth"}),!0}function G(e){return K(Z(e))}function X(e){const t=e.target?.nodeType===Node.ELEMENT_NODE?e.target:e.target?.parentElement,n=t?.closest?.(".doc-outline__item");if(!n||!v.value?.contains(n))return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation?.();const r=U(n);if(!K(r)){const e=Number(r?.dataset.pmStart);Number.isFinite(e)&&(k?.scrollToPosition?.(e+1),G(e))}k?.focus?.()}function Y(e){const t=e.key?.toLowerCase(),n=e.ctrlKey||e.metaKey,r=n&&h.has(t),o="f5"===t||e.altKey&&["arrowleft","arrowright"].includes(t);if(r||o){if(e.preventDefault(),n&&"s"===t)return e.stopPropagation(),e.stopImmediatePropagation?.(),void re();("f5"===t||n&&["l","o","r","w"].includes(t)||o)&&(e.stopPropagation(),e.stopImmediatePropagation?.())}}function J(){p.forEach(e=>{v.value?.addEventListener(e,X,!0)}),window.addEventListener("keydown",Y,!0)}function Q(){p.forEach(e=>{v.value?.removeEventListener(e,X,!0)}),window.removeEventListener("keydown",Y,!0)}function ee(){q(),Q(),k?.destroy?.(),k=null,v.value&&(v.value.innerHTML="")}async function te(){const e=++w;y.value=!0,b.value="";try{const t=await L();if(await(0,n.nextTick)(),!v.value||e!==w)return;ee(),k=await VD(t,v.value,{mode:"editing",showToolbar:!0,showMenuBar:!0,showRuler:!0,i18n:HD,documentName:M()}),J(),W()}catch(t){if(e!==w)return;console.error("Template editor render failed:",t),b.value="模板加载失败,请检查模板文件或模板接口。",r("template-load-error",t)}finally{e===w&&(y.value=!1)}}async function ne(){if(!k?.save)throw new Error("模板编辑器尚未加载完成");const e=await k.save();if(!e)throw new Error("模板保存失败,编辑器未返回文件内容");const t=e instanceof Blob?await e.arrayBuffer():e,n=e instanceof Blob?e:new Blob([t],{type:i}),r=O(t);return{success:!0,arrayBuffer:t,blob:n,fileName:M(),variables:r,variableMapping:r,renderData:r.renderData}}async function re(){try{const e=await ne();return r("template-save",e),e}catch(e){return console.error("Template save failed:",e),{success:!1,error:e}}}async function oe(){try{const e=await ne();T&&URL.revokeObjectURL(T),T=URL.createObjectURL(e.blob);const t=document.createElement("a");return t.href=T,t.download=e.fileName.endsWith(".docx")?e.fileName:`${e.fileName}.docx`,document.body.appendChild(t),t.click(),document.body.removeChild(t),e}catch(e){return console.error("Template export failed:",e),{success:!1,error:e}}}return(0,n.onMounted)(()=>{te()}),(0,n.watch)(()=>[o.templateUrl,o.templateFileName],()=>{te()}),(0,n.onBeforeUnmount)(()=>{w+=1,T&&(URL.revokeObjectURL(T),T=""),ee()}),t({saveTemplate:re,exportTemplate:oe,reloadTemplate:te}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",WD,[y.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",qD,"正在加载模板...")):b.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",ZD,(0,n.toDisplayString)(b.value),1)):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref:(e,t)=>{t["editorHostRef"]=e,v.value=e},class:"template-editor-host"},null,512)]))}var GD=Object.assign(UD,{props:{templateUrl:{type:String,default:""},templateFileName:{type:String,default:"运营报告.docx"},exportFileName:{type:String,default:""}},emits:["template-save","template-load-error"],setup:KD}),XD=x(8868);const YD=(0,XD.A)(GD,[["__scopeId","data-v-756b17e6"]]);var JD=YD,QD=x(5733);const eF=e=>((0,n.pushScopeId)("data-v-706f3b30"),e=e(),(0,n.popScopeId)(),e),tF={key:0,class:"document-outline"},nF=eF(()=>(0,n.createElementVNode)("div",{class:"outline-title"},"文档目录",-1)),rF=["onClick"],oF={class:"outline-text"},iF={key:0,class:"status-box"},aF={key:1,class:"status-box is-error"},lF={class:"edit-dialog"},sF={class:"edit-dialog-tip"},cF={key:0,class:"edit-dialog-path"},dF={class:"editor-toolbar"},uF=["onClick"],pF={class:"toolbar-svg heading-svg",viewBox:"0 0 28 28","aria-hidden":"true"},hF=eF(()=>(0,n.createElementVNode)("text",{x:"5",y:"19",class:"svg-heading-main"},"H",-1)),fF={x:"18",y:"24",class:"svg-heading-level"},mF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M6 7h16M6 12h16M6 17h13M6 22h10",class:"svg-stroke round"})],-1)),gF=[mF],vF=eF(()=>(0,n.createElementVNode)("div",{class:"toolbar-divider"},null,-1)),yF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("text",{x:"8",y:"20",class:"svg-bold"},"B")],-1)),bF=[yF],wF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"5",y:"5",width:"18",height:"18",rx:"2",class:"svg-stroke"}),(0,n.createElementVNode)("path",{d:"M5 11.5h18M5 17.5h18M11.5 5v18M17.5 5v18",class:"svg-stroke thin"}),(0,n.createElementVNode)("rect",{x:"6.5",y:"6.5",width:"15",height:"4",class:"svg-soft-fill"})],-1)),kF=[wF],xF={class:"table-picker"},SF=eF(()=>(0,n.createElementVNode)("div",{class:"table-picker-title"},"插入表格",-1)),CF={class:"table-picker-grid"},TF=["onMouseenter","onClick"],EF={class:"table-picker-tip"},_F=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M6 7h16M6 12h11M6 17h16M6 22h9",class:"svg-stroke round"})],-1)),MF=[_F],NF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M6 7h16M9 12h10M6 17h16M10 22h8",class:"svg-stroke round"})],-1)),IF=[NF],RF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M6 7h16M11 12h11M6 17h16M13 22h9",class:"svg-stroke round"})],-1)),AF=[RF],BF=eF(()=>(0,n.createElementVNode)("div",{class:"toolbar-divider"},null,-1)),DF={class:"toolbar-tip-wrap"},FF=["disabled"],PF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"5",y:"4",width:"18",height:"16",rx:"1.5",class:"svg-stroke muted"}),(0,n.createElementVNode)("path",{d:"M5 9.5h18M5 14.5h18M11 4v16M17 4v16",class:"svg-stroke thin muted"}),(0,n.createElementVNode)("path",{d:"M14 23v4M12 25h4",class:"svg-stroke accent round"})],-1)),OF=[PF],LF={class:"toolbar-tip-wrap"},zF=["disabled"],VF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"5",y:"4",width:"18",height:"16",rx:"1.5",class:"svg-stroke muted"}),(0,n.createElementVNode)("path",{d:"M5 9.5h18M5 14.5h18M11 4v16M17 4v16",class:"svg-stroke thin muted"}),(0,n.createElementVNode)("path",{d:"M11.5 25h5",class:"svg-stroke danger round"})],-1)),$F=[VF],jF={class:"toolbar-tip-wrap"},HF=["disabled"],WF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"4",y:"5",width:"16",height:"18",rx:"1.5",class:"svg-stroke muted"}),(0,n.createElementVNode)("path",{d:"M4 11h16M4 17h16M9.5 5v18M15 5v18",class:"svg-stroke thin muted"}),(0,n.createElementVNode)("path",{d:"M24 12v4M22 14h4",class:"svg-stroke accent round"})],-1)),qF=[WF],ZF={class:"toolbar-tip-wrap"},UF=["disabled"],KF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"4",y:"5",width:"16",height:"18",rx:"1.5",class:"svg-stroke muted"}),(0,n.createElementVNode)("path",{d:"M4 11h16M4 17h16M9.5 5v18M15 5v18",class:"svg-stroke thin muted"}),(0,n.createElementVNode)("path",{d:"M22 14h5",class:"svg-stroke danger round"})],-1)),GF=[KF],XF={class:"toolbar-tip-wrap"},YF=["disabled"],JF=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("rect",{x:"6",y:"6",width:"16",height:"16",rx:"2",class:"svg-stroke muted"}),(0,n.createElementVNode)("path",{d:"M11 11l6 6M17 11l-6 6",class:"svg-stroke danger round"})],-1)),QF=[JF],eP=eF(()=>(0,n.createElementVNode)("div",{class:"toolbar-divider"},null,-1)),tP={class:"toolbar-svg color-svg",viewBox:"0 0 28 28","aria-hidden":"true"},nP=eF(()=>(0,n.createElementVNode)("path",{d:"M8 19l6-14 6 14M10.5 14.5h7",class:"svg-stroke round"},null,-1)),rP=["value"],oP={class:"toolbar-svg color-svg",viewBox:"0 0 28 28","aria-hidden":"true"},iP=eF(()=>(0,n.createElementVNode)("path",{d:"M8 16.5l7.5-7.5 3.5 3.5-7.5 7.5H8v-3.5z",class:"svg-stroke round"},null,-1)),aP=eF(()=>(0,n.createElementVNode)("path",{d:"M17 7l4 4",class:"svg-stroke thin round"},null,-1)),lP=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M8 16.5l7.5-7.5 3.5 3.5-7.5 7.5H8v-3.5z",class:"svg-stroke muted round"}),(0,n.createElementVNode)("path",{d:"M17 7l4 4",class:"svg-stroke thin muted round"}),(0,n.createElementVNode)("path",{d:"M7 23h14",class:"svg-stroke danger round"}),(0,n.createElementVNode)("path",{d:"M21 6L6 21",class:"svg-stroke danger round"})],-1)),sP=[lP],cP=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M8 5h12v6H8zM10 11v4h8v-4M13 15h2v7",class:"svg-stroke round"})],-1)),dP=[cP],uP=eF(()=>(0,n.createElementVNode)("svg",{class:"toolbar-svg",viewBox:"0 0 28 28","aria-hidden":"true"},[(0,n.createElementVNode)("path",{d:"M7 20l5-12h4l5 12M9 16h10",class:"svg-stroke round"}),(0,n.createElementVNode)("path",{d:"M21 6L6 21",class:"svg-stroke danger round"})],-1)),pP=[uP],hP=["value"],fP=eF(()=>(0,n.createElementVNode)("div",{class:"toolbar-divider"},null,-1)),mP={class:"toolbar-tip-wrap"},gP=["disabled"],vP={class:"toolbar-tip-wrap"},yP=["disabled"],bP=eF(()=>(0,n.createElementVNode)("div",{class:"table-context-divider"},null,-1)),wP=eF(()=>(0,n.createElementVNode)("div",{class:"table-context-divider"},null,-1)),kP=eF(()=>(0,n.createElementVNode)("div",{class:"table-context-divider"},null,-1)),xP={class:"dialog-footer"},SP=(0,n.createTextVNode)("取消"),CP=(0,n.createTextVNode)("保存当前内容"),TP={name:"DocxEditor"};function EP(e,{expose:t,emit:i}){const l=e;(0,n.useCssVars)(e=>({e243b5c8:F,"8f531268":O,"4b257812":P}));const c="运营报告.docx",f="application/vnd.openxmlformats-officedocument.wordprocessingml.document",g="#2b3345",y="#e8f3ff",w="[EDITOR_START]",k="[EDITOR_END]",x="【",S="】",C=["cpuWaterLevelChart","memoryWaterLevelChart","diskWaterLevelChart"],T=720,E=360,_=554,M=277,N={top:88,left:48,right:36,bottom:42},I=8306,R=5e3,A="方正仿宋_GB2312",B="28",D="22",F="'方正仿宋_GB2312', '仿宋_GB2312', FangSong, STFangsong, SimSun, '宋体', serif",P="14pt",O="11pt",L=8,z=10,V="__DOCX_RICH_TEXT_FIELD__",$="请输入内容...",j="请输入内容,支持 Ctrl/Command + A/C/Z/Y 等常用快捷键...",H=2,W=6,q=(0,n.ref)(null),Z=(0,n.ref)(null),U=(0,n.ref)(null),K=(0,n.ref)(!1),G=(0,n.ref)(""),X=(0,n.ref)(!1),Y=(0,n.ref)(null),J=(0,n.ref)(null),Q=(0,n.ref)(null),ee=(0,n.ref)(g),te=(0,n.ref)(y),ne=(0,n.ref)(null),re=(0,n.ref)(null),oe=(0,n.ref)(!1),ie=(0,n.ref)({rows:3,cols:3}),ae=(0,n.ref)(!1),le=(0,n.ref)({x:0,y:0}),se=(0,n.ref)([]),ce=(0,n.ref)(""),de=(0,n.ref)([]),ue=(0,n.ref)([]),pe=(0,n.ref)({}),he=(0,n.reactive)({}),fe=(0,n.reactive)({}),me=(0,n.ref)({}),ge=(0,n.ref)([]),ve=(0,n.ref)({headingStyleIds:{},bodyStyleId:"",editableHeadingCounters:{}}),ye=[{label:"H1",level:1},{label:"H2",level:2},{label:"H3",level:3}],be=Array.from({length:L*z},(e,t)=>({key:t,row:Math.floor(t/z)+1,col:t%z+1}));let we=0,ke=[],xe=0;const Se=(0,n.ref)(Pe(l.renderData)),Ce=3,Te=1;function Ee(e){const t=e.isActive("heading")?e.getAttributes("heading"):e.getAttributes("paragraph");return Number(t.textIndentLevel||0)}function _e(e,t){if(!e||e.isActive("table"))return!1;const n=e.isActive("heading")?"heading":"paragraph",r=Math.min(W,Math.max(0,Ee(e)+t));return e.chain().focus().updateAttributes(n,{textIndentLevel:r}).run()}const Me=h.Extension.create({name:"editorIndent",addGlobalAttributes(){return[{types:["paragraph","heading"],attributes:{textIndentLevel:{default:0,parseHTML:e=>{const t=e.style?.textIndent||"",n=t.match(/^([\d.]+)em$/);return n?Math.min(W,Math.max(0,Math.round(Number(n[1])/H))):0},renderHTML:e=>{const t=Number(e.textIndentLevel||0);return t?{style:`text-indent: ${t*H}em;`}:{}}}}}]},addKeyboardShortcuts(){return{Tab:()=>_e(this.editor,1),"Shift-Tab":()=>_e(this.editor,-1),"Mod-y":()=>this.editor.commands.redo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-z":()=>this.editor.commands.undo()}}}),Ne=(0,QD.useEditor)({content:"<p></p>",extensions:[Zs().configure({bulletList:!1,orderedList:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Fs.Table.configure({resizable:!0}),$s(),zs(),Os(),Ws.TextStyle,m().configure({types:["textStyle"]}),v().configure({multicolor:!0}),Hs().configure({types:["heading","paragraph"]}),Me,b().configure({placeholder:j,showOnlyWhenEditable:!0,includeChildren:!0})],onSelectionUpdate({editor:e}){ee.value=e.getAttributes("textStyle").color||g,te.value=e.getAttributes("highlight").color||y},onUpdate({editor:e}){i("content-change",{html:e.getHTML(),json:e.getJSON()}),i("update:editorHtml",e.getHTML()),i("update:editorJson",e.getJSON())}}),Ie=(0,n.computed)(()=>Ne.value?.isActive("bold")),Re=(0,n.computed)(()=>Ne.value?.isActive("table")),Ae=(0,n.computed)(()=>Ne.value?.isActive("paragraph")),Be=(0,n.computed)(()=>Ne.value?.can().chain().focus().undo().run()),De=(0,n.computed)(()=>Ne.value?.can().chain().focus().redo().run());function Fe(e){return JSON.parse(JSON.stringify(e||{}))}function Pe(e){const t=Fe(e);return t.__editableRichTextMap||(t.__editableRichTextMap={}),t}function Oe(){return C.reduce((e,t)=>(e[t]=lt(Se.value,`overallData.${t}`)||Se.value[t]||{},e),{})}function Le(){return C.reduce((e,t)=>(e[`{%${t}}`]=!0,e[t]=!0,e),{})}function ze(e){const t=String(e||"").trim();return t?/\.docx$/i.test(t)?t:`${t}.docx`:""}function Ve(e=new Date){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function $e(e){const t=String(e||"").trim();if(!t)return"";const n=t.split(/[?#]/)[0],r=n.split("/").filter(Boolean).pop()||"";try{return decodeURIComponent(r)}catch(o){return r}}function je(){const e=$e(l.templateUrl),t=l.templateFileName&&l.templateFileName!==c?l.templateFileName:e||l.templateFileName||c,n=String(t).replace(/\.docx$/i,"").replace(/模板|模版/g,"").replace(/[\\/:*?"<>|]/g,"").replace(/^[_\-\s]+|[_\-\s]+$/g,"").trim();return n||"运营报告"}function He(e){const t=e||l.exportFileName;return ze(t||`${je()}_${Ve()}`)}function We(){qe(),se.value=[],ce.value="",Object.keys(fe).forEach(e=>{delete fe[e]}),q.value&&(q.value.innerHTML="")}function qe(){ke.forEach(e=>e()),ke=[]}function Ze(e){return Array.isArray(e)?e.map(e=>e&&"object"===typeof e?Ue(e):e??""):e&&"object"===typeof e?Ue(e):e??""}function Ue(e={}){return Object.keys(e).reduce((t,n)=>(t[n]=Ze(e[n]),t),{})}function Ke(e={}){const t=Ue(e),n=t.overallData||{},r=t.operationsData||{},o=t.maintenanceData||{},i=t.workThisWeek||{},a=t.workNextWeek||{};return{...t,...n,...r,...o,...i,...a,intranet_resource_list:n.intranet_resource_list||[]}}function Ge(e){return`${V}${e}__`}function Xe(e){return Boolean(e?.html||e?.json||e?.blocks?.length)}function Ye(e){return Se.value.__editableRichTextMap?.[e]||null}function Je(e={}){const{useRichTextTokens:t=!0,useRichTextPlainText:n=!0}=e,r=Fe(Se.value),o=r.__editableRichTextMap||{};return de.value.forEach(e=>{""===lt(r,e)&&at(r,e,"")}),Object.keys(o).forEach(e=>{const i=o[e];if(i?.path){const o=t&&Xe(i),a=n&&i.plainText||"";at(r,i.path,o?Ge(e):a)}}),{...Ke(r),...Oe()}}function Qe(e){return[...e.matchAll(/<w:t[^>]*>([\s\S]*?)<\/w:t>/g)].map(e=>rt(e[1]))}function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tt(){return new RegExp(`(?:${et(x)}\\s*)?${et(w)}\\s*(\\{([^#/{][^}]*)\\})[\\s\\S]*?${et(k)}(?:\\s*${et(S)})?`,"g")}function nt(){return new RegExp(`(?:${et(x)}\\s*)?${et(w)}\\s*([\\s\\S]*?)\\s*${et(k)}(?:\\s*${et(S)})?`,"g")}function rt(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")}function ot(e){const t=Qe(e).join(""),n=tt();return[...t.matchAll(nt())].map(e=>{const t=e[0]||"",r=n.exec(t);return n.lastIndex=0,{markerText:t,fieldKey:r?.[2]||"",isValid:Boolean(r?.[2])}})}function it(e,t="",n={}){return e&&"object"===typeof e?(Object.keys(e).forEach(r=>{if(r.startsWith("__"))return;const o=e[r],i=t?`${t}.${r}`:r;Array.isArray(o)||(o&&"object"===typeof o?it(o,i,n):n[r]||(n[r]=i))}),n):n}function at(e,t,n){if(!t)return;const r=t.split(".");let o=e;for(let i=0;i<r.length-1;i+=1){const e=r[i];o[e]&&"object"===typeof o[e]||(o[e]={}),o=o[e]}o[r[r.length-1]]=n}function lt(e,t){return t?t.split(".").reduce((e,t)=>null==e?"":e[t],e):""}function st(e){const t=document.createElement("div");function n(e){if(!e)return"";if(e.nodeType===Ce)return e.textContent||"";if(e.nodeType!==Te)return"";const t=e.tagName?.toLowerCase?.()||"";if("br"===t)return"\n";const r=Array.from(e.childNodes).map(e=>n(e)).join("");return["p","div","h1","h2","h3","li"].includes(t)||"tr"===t?`${r}\n`:"td"===t||"th"===t?`${r}\t`:r}return t.innerHTML=e,Array.from(t.childNodes).map(e=>n(e)).join("").replace(/\t+$/gm,"").replace(/\n{3,}/g,"\n\n").trim()}function ct(e=""){if(!e)return!1;const t=document.createElement("div");return t.innerHTML=e,!!t.querySelector("table, img, svg, canvas")||Boolean((t.textContent||"").replace(/\u00a0/g," ").trim())}function dt(e,t=""){const n=Ye(e);return void 0!==n?.html?ct(n.html):void 0!==n?.plainText?Boolean(String(n.plainText||"").trim()):fe[e]?ct(fe[e]):Boolean(String(t||"").trim())}function ut(e,t=""){const n=Ye(e);return n?.html?ht(n.html):fe[e]?ht(fe[e]):`<p>${Et(String(t||""))}</p>`}function pt(e,t=""){const n=Ye(e);return n?.html?ht(n.html):fe[e]?ht(fe[e]):`<p>${Et(String(t||""))}</p>`}function ht(e=""){if(!e)return"";const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll(".tableWrapper").forEach(e=>{e.style.width="100%",e.style.maxWidth="100%"}),t.querySelectorAll("table").forEach(e=>{e.removeAttribute("width"),e.style.width="100%",e.style.minWidth="100%",e.style.maxWidth="100%",e.style.tableLayout="fixed"}),t.querySelectorAll("col").forEach(e=>{e.removeAttribute("width"),e.style.width=""}),t.querySelectorAll("td, th").forEach(e=>{e.style.textAlign=e.style.textAlign||"center",e.style.verticalAlign="middle"}),t.innerHTML}function ft(e,t=""){if(!e)return[{type:"text",text:String(t||"")}];const n=document.createElement("div");n.innerHTML=e;const r=[];function o(e){if(!e)return;if(e.nodeType===Ce){const t=e.textContent||"";return void(t&&r.push({type:"text",text:t}))}if(e.nodeType!==Te)return;const t=e.tagName?.toLowerCase?.()||"";"br"!==t?(Array.from(e.childNodes).forEach(e=>o(e)),["p","div","h1","h2","h3","li"].includes(t)&&r.push({type:"break"})):r.push({type:"break"})}Array.from(n.childNodes).forEach(e=>o(e));while(r.length&&"break"===r[r.length-1].type)r.pop();return r.length?r:[{type:"text",text:String(t||"")}]}function mt(e){if(!e)return null;const t=e.nodeType===Te?e:e.parentElement;return t?.closest?.("p")||null}function gt(e=""){return e.replace(/(\s|\u00a0|\u200b|\u200c|\u200d|\ufeff)/g,"")}function vt(e,t,n,r){const o=document.createRange();return o.setStart(e,t),o.setEnd(n,r),o.toString()}function yt(e,t,n,r){const o=document.createRange();return o.setStart(e,t),o.setEnd(n,r),o.cloneContents()}function bt(e=""){return!e||["\n","\r","\f"].includes(e)}function wt(e="",t=0,n=0){return bt(e[t-1])&&bt(e[n])}function kt(e){if(!e||e.nodeType!==Te)return!1;const t=e.tagName?.toLowerCase?.()||"";if("br"===t)return!0;const n=e.getAttribute("style")||"";return/(?:page-)?break-(?:before|after)\s*:\s*(?:page|always)/i.test(n)}function xt(e){const t=[];function n(e){e&&(e.nodeType!==Ce?e.nodeType===Te&&(kt(e)?t.push("\n"):Array.from(e.childNodes).forEach(e=>n(e))):t.push(e.textContent||""))}return Array.from(e.childNodes).forEach(e=>n(e)),t.join("")}function St(e,t){const n=xt(e);if(!gt(n))return!0;const r=n.split(/[\n\r\f]/);return"before"===t?!gt(r[r.length-1]||""):!gt(r[0]||"")}function Ct(e,t,n="",r="",o=0,i=0){const{node:a,offset:l}=e,{node:s,offset:c}=t,d=mt(a),u=mt(s);if(!d||!u)return wt(r,o,i);if(d!==u)return!0;const p=vt(d,0,a,l),h=d.childNodes.length,f=vt(s,c,d,h),m=yt(d,0,a,l),g=yt(s,c,d,h),v=gt(n),y=gt(d.textContent||""),b=!gt(p)&&!gt(f),w=St(m,"before")&&St(g,"after");return b||w||y===v}function Tt(e,t){if(!t)return;const n=window.getComputedStyle(t),r=["textAlign","marginTop","marginBottom","paddingTop","paddingBottom","textIndent","lineHeight"];r.forEach(t=>{e.style[t]=n[t]})}function Et(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function _t(e=""){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Mt(e=""){const t=String(e||"").trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.slice(1).toUpperCase();const n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);return n?[n[1],n[2],n[3]].map(e=>Number(e).toString(16).padStart(2,"0")).join("").toUpperCase():""}function Nt(e=""){return e.replace(/<w:b\b[^>]*\/>/g,"").replace(/<w:b\b[\s\S]*?<\/w:b>/g,"").replace(/<w:color\b[^>]*\/>/g,"").replace(/<w:color\b[\s\S]*?<\/w:color>/g,"").replace(/<w:highlight\b[^>]*\/>/g,"").replace(/<w:highlight\b[\s\S]*?<\/w:highlight>/g,"").replace(/<w:shd\b[^>]*\/>/g,"").replace(/<w:shd\b[\s\S]*?<\/w:shd>/g,"")}function It(e=""){return e.replace(/<w:rFonts\b[^>]*\/>/g,"").replace(/<w:rFonts\b[\s\S]*?<\/w:rFonts>/g,"")}function Rt(e=""){return e.replace(/<w:sz\b[^>]*\/>/g,"").replace(/<w:sz\b[\s\S]*?<\/w:sz>/g,"").replace(/<w:szCs\b[^>]*\/>/g,"").replace(/<w:szCs\b[\s\S]*?<\/w:szCs>/g,"")}function At(e=A){const t=_t(e);return`<w:rFonts w:hint="eastAsia" w:ascii="${t}" w:hAnsi="${t}" w:eastAsia="${t}" w:cs="${t}"/>`}function Bt(e=D){return`<w:sz w:val="${e}"/><w:szCs w:val="${e}"/>`}function Dt(e="",t=!1){const n=Rt(It(e)),r=t?B:D;return`${n}${At()}${Bt(r)}`}function Ft(e="",t={}){const n=[Nt(e)],r=Mt(t.color),o=Mt(t.backgroundColor);t.bold&&n.push("<w:b/>"),r&&n.push(`<w:color w:val="${r}"/>`),o&&n.push(`<w:shd w:val="clear" w:color="auto" w:fill="${o}"/>`);const i=n.join("");return i?`<w:rPr>${i}</w:rPr>`:""}function Pt(e="",t={},n=""){const r=String(e).split("\n"),o=Ft(n,t),i=[];return r.forEach((e,t)=>{t>0&&i.push("<w:r><w:br/></w:r>"),e&&i.push(`<w:r>${o}<w:t xml:space="preserve">${_t(e)}</w:t></w:r>`)}),i.join("")}function Ot(e=""){return`<w:r>${Ft(e,{})}<w:t xml:space="preserve"></w:t></w:r>`}function Lt(e=""){return e.replace(/<w:jc\b[^>]*\/>/g,"").replace(/<w:jc\b[\s\S]*?<\/w:jc>/g,"")}function zt(e=""){return e.replace(/<w:ind\b[^>]*\/>/g,"").replace(/<w:ind\b[\s\S]*?<\/w:ind>/g,"")}function Vt(e=""){return e.replace(/<w:pStyle\b[^>]*\/>/g,"").replace(/<w:pStyle\b[\s\S]*?<\/w:pStyle>/g,"")}function $t(e=""){const t={left:"left",center:"center",right:"right"};return t[e]||"left"}function jt(e="",t="left",n=0,r=""){const o=Vt(zt(Lt(e))),i=Math.max(0,Number(n||0)),a=i?`<w:ind w:firstLine="${Math.round(420*i)}"/>`:"",l=r?`<w:pStyle w:val="${_t(r)}"/>`:"";return`<w:pPr>${l}${o}<w:jc w:val="${$t(t)}"/>${a}</w:pPr>`}function Ht(e=""){return[...e.matchAll(/<w:t\b[^>]*>([\s\S]*?)<\/w:t>/g)].map(e=>rt(e[1])).join("")}function Wt(e=""){return e.match(/<w:pPr>([\s\S]*?)<\/w:pPr>/)?.[1]||""}function qt(e=""){return e.match(/<w:rPr>([\s\S]*?)<\/w:rPr>/)?.[1]||""}function Zt(e="",t="left",n="",r=0,o=""){return`<w:p>${jt(n,t,r,o)}${e||'<w:r><w:t xml:space="preserve"></w:t></w:r>'}</w:p>`}function Ut(e={}){return Math.max(1,...(e.rows||[]).map(e=>(e.cells||[]).reduce((e,t)=>e+Number(t.colSpan||1),0)))}function Kt(e={}){const t=Ut(e),n=[];return(e.rows||[]).map(e=>{const r=[];let o=0;function i(){const e=n[o];return!!e?.remaining&&(r.push({vMerge:"continue",colSpan:e.colSpan||1,blocks:[]}),e.remaining-=1,o+=e.colSpan||1,!0)}const a=e.cells||[];a.forEach(e=>{while(i());const t=Number(e.colSpan||1),a=Number(e.rowSpan||1);r.push({...e,colSpan:t,rowSpan:a,vMerge:a>1?"restart":""}),a>1&&(n[o]={remaining:a-1,colSpan:t}),o+=t});while(o<t)i()||(r.push({colSpan:1,blocks:[]}),o+=1);return{cells:r}})}function Gt(e={},t=0,n="",r=""){const o=Dt(r,e.header),i=(e.blocks||[]).filter(e=>"paragraph"===e.type||"heading"===e.type),a=i.length?i.map(t=>{const r=(t.runs||[]).map(t=>Pt(t.text||"",e.header?{...t.marks||{},bold:!0}:t.marks||{},o)).join("");return Zt(r,t.align||"center",n)}).join(""):Zt(Ot(o),"center",n),l=Number(e.colSpan||1)>1?`<w:gridSpan w:val="${Number(e.colSpan||1)}"/>`:"",s=e.header?'<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF"/>':"",c=e.vMerge?`<w:vMerge${"restart"===e.vMerge?' w:val="restart"':""}/>`:"";return`<w:tc><w:tcPr><w:tcW w:w="${t*Number(e.colSpan||1)}" w:type="pct"/>${l}${c}${s}<w:vAlign w:val="center"/><w:tcMar><w:top w:w="80" w:type="dxa"/><w:left w:w="80" w:type="dxa"/><w:bottom w:w="80" w:type="dxa"/><w:right w:w="80" w:type="dxa"/></w:tcMar></w:tcPr>${a}</w:tc>`}function Xt(e={},t="",n=""){const r=Ut(e),o=Math.max(1,Math.floor(I/r)),i=Math.max(1,Math.floor(R/r)),a=Array.from({length:r},()=>`<w:gridCol w:w="${o}"/>`).join(""),l=Kt(e).map(e=>{const r=(e.cells||[]).map(e=>Gt(e,i,t,n)).join("");return`<w:tr>${r}</w:tr>`}).join("");return`<w:tbl><w:tblPr><w:tblW w:w="${R}" w:type="pct"/><w:jc w:val="center"/><w:tblLayout w:type="fixed"/><w:tblBorders><w:top w:val="single" w:sz="8" w:space="0" w:color="000000"/><w:left w:val="single" w:sz="8" w:space="0" w:color="000000"/><w:bottom w:val="single" w:sz="8" w:space="0" w:color="000000"/><w:right w:val="single" w:sz="8" w:space="0" w:color="000000"/><w:insideH w:val="single" w:sz="8" w:space="0" w:color="000000"/><w:insideV w:val="single" w:sz="8" w:space="0" w:color="000000"/></w:tblBorders></w:tblPr><w:tblGrid>${a}</w:tblGrid>${l}</w:tbl>`}function Yt(e=[]){return e.reduce((e,t)=>("bold"===t.type&&(e.bold=!0),"textStyle"===t.type&&t.attrs?.color&&(e.color=t.attrs.color),"highlight"===t.type&&t.attrs?.color&&(e.backgroundColor=t.attrs.color),e),{})}function Jt(e){return en(e)}function Qt(e){if(!e||e.nodeType!==Te)return 0;const t=e.style?.textIndent||"",n=t.match(/^([\d.]+)em$/);return n?Math.min(W,Math.max(0,Math.round(Number(n[1])/H))):0}function en(e,t="left"){if(!e||e.nodeType!==Te)return t;const n=e.style?.textAlign||"";if(["left","center","right"].includes(n))return n;const r=e.getAttribute?.("align")||"";return["left","center","right"].includes(r)?r:t}function tn(e,t={}){if(!e||e.nodeType!==Te)return t;const n=e.tagName?.toLowerCase?.()||"",r={...t};"strong"!==n&&"b"!==n||(r.bold=!0);const o=e.style?.color?Mt(e.style.color):"",i=e.style?.backgroundColor?Mt(e.style.backgroundColor):"";return o&&(r.color=`#${o}`),i&&(r.backgroundColor=`#${i}`),r}function nn(e,t={}){if(!e)return[];if(e.nodeType===Ce)return e.textContent?[{text:e.textContent,marks:t}]:[];if(e.nodeType!==Te)return[];const n=e.tagName?.toLowerCase?.()||"",r=tn(e,t);return"br"===n?[{text:"\n",marks:r}]:Array.from(e.childNodes).flatMap(e=>nn(e,r))}function rn(e=[]){return e.reduce((e,t)=>{if(!t?.text)return e;const n=e[e.length-1],r=JSON.stringify(t.marks||{}),o=JSON.stringify(n?.marks||{});return n&&r===o?(n.text+=t.text,e):(e.push({text:t.text,marks:t.marks||{}}),e)},[])}function on(e=""){if(!e)return[];const t=document.createElement("div");function n(e){const t=e.tagName?.toLowerCase?.()||"";return"table"===t?{type:"table",rows:Array.from(e.rows||[]).map(e=>({cells:Array.from(e.cells||[]).map(e=>{const t=Array.from(e.childNodes).flatMap(t=>{if(t.nodeType===Ce){const n=t.textContent?.trim?.()||"";return n?[{type:"paragraph",align:en(e,"center"),textIndentLevel:0,runs:[{text:n,marks:{}}]}]:[]}if(t.nodeType!==Te)return[];const r=t.tagName?.toLowerCase?.()||"";if(["p","div","h1","h2","h3"].includes(r)){const r=n(t);return!r||t.style?.textAlign||t.getAttribute?.("align")||(r.align=en(e,"center")),r?[r]:[]}return[]});return{header:"th"===e.tagName?.toLowerCase?.(),colSpan:Number(e.colSpan||1),rowSpan:Number(e.rowSpan||1),blocks:t.length?t:[{type:"paragraph",align:en(e,"center"),textIndentLevel:0,runs:[]}]}})}))}:["p","div","h1","h2","h3"].includes(t)?{type:t.startsWith("h")?"heading":"paragraph",level:t.startsWith("h")?Number(t.slice(1)):null,align:Jt(e),textIndentLevel:Qt(e),runs:rn(nn(e))}:null}t.innerHTML=e;const r=Array.from(t.childNodes).flatMap(e=>{if(e.nodeType===Ce){const t=e.textContent?.trim?.()||"";return t?[{type:"paragraph",align:"left",textIndentLevel:0,runs:[{text:t,marks:{}}]}]:[]}if(e.nodeType!==Te)return[];const t=e.tagName?.toLowerCase?.()||"";if(!["p","div","h1","h2","h3","table"].includes(t))return[];const r=n(e);return r?[r]:[]});return r.filter(e=>"table"===e.type?e.rows?.length:e.runs?.some(e=>e.text))}function an(e=[]){return e.reduce((e,t)=>t?"text"===t.type?(e.push({text:t.text||"",marks:Yt(t.marks)}),e):(Array.isArray(t.content)&&e.push(...an(t.content)),e):e,[])}function ln(e){return e?"paragraph"===e.type||"heading"===e.type?{type:e.type,level:e.attrs?.level||null,align:e.attrs?.textAlign||"left",textIndentLevel:Number(e.attrs?.textIndentLevel||0),runs:an(e.content||[])}:{type:e.type,runs:an(e.content||[])}:null}function sn(e,t,n,r,o){const i=ht(n),a=on(i),l=(r?.content||[]).map(e=>ln(e)).filter(Boolean);return{version:"1.0",fieldKey:e,path:t,docxRenderText:o,plainText:o,html:i,json:r,blocks:a.length?a:l,updatedAt:(new Date).toISOString()}}function cn(e={}){return e?Array.isArray(e.blocks)&&e.blocks.length?e.blocks:(e.json?.content||[]).map(e=>ln(e)).filter(Boolean):[]}function dn(e={},t=""){const n=e||{},r=cn(e).filter(e=>"table"!==e.type);return!r.length&&n.plainText?Pt(n.plainText,{},t):r.map((e,n)=>{const r=(e.runs||[]).map(e=>Pt(e.text||"",e.marks||{},t)).join("");return`${n>0?"<w:r><w:br/></w:r>":""}${r}`}).join("")}function un(e,t){if(1===e){const e=["一","二","三","四","五","六","七","八","九","十"];return`${e[t[0]-1]||t[0]}、`}if(2===e){const e=["一","二","三","四","五","六","七","八","九","十"];return`(${e[t[1]-1]||t[1]})`}return`(${t[2]})`}function pn(e=""){return String(e||"").replace(/^([一二三四五六七八九十]+、|([一二三四五六七八九十\d]+)|\(\d+\)|\d+[.、])\s*/,"")}function hn(e,t){if("heading"!==e.type||!e.level||e.__numberApplied)return e;const n=Math.min(3,Math.max(1,Number(e.level||1)));t[n-1]+=1;for(let a=n;a<t.length;a+=1)t[a]=0;const r=e.runs||[],o=r.find(e=>e.text),i=un(n,t);return o?o.text=`${i}${pn(o.text)}`:r.unshift({text:i,marks:{}}),e.runs=r,e.__numberApplied=!0,e}function fn(e,t={}){return"heading"===e.type?t.headingStyleIds?.[e.level]||"":t.bodyStyleId||""}function mn(e={},t="",n="",r="",o="",i={}){const a=e||{},l=cn(e),s=l.length?l:[{type:"paragraph",align:"left",textIndentLevel:0,runs:[{text:a.plainText||"",marks:{}}]}],c=Fe(s),d=[...i.headingCounters||[0,0,0]];if(r&&("paragraph"===c[0]?.type||"heading"===c[0]?.type?c[0].runs=[{text:r,marks:{}},...c[0].runs||[]]:c.unshift({type:"paragraph",align:"left",textIndentLevel:0,runs:[{text:r,marks:{}}]})),o){const e=c[c.length-1];"paragraph"===e?.type||"heading"===e?.type?e.runs=[...e.runs||[],{text:o,marks:{}}]:c.push({type:"paragraph",align:"left",textIndentLevel:0,runs:[{text:o,marks:{}}]})}return c.map(e=>{const r=hn(e,d);if("table"===r.type)return Xt(r,t,n);const o=(r.runs||[]).map(e=>Pt(e.text||"",e.marks||{},n)).join("");return Zt(o,r.align||"left",t,r.textIndentLevel||0,fn(r,i))}).join("")}function gn(e={}){return cn(e).some(e=>"table"===e.type)}function vn(e={}){if(!e?.html)return"";const t=document.createElement("div");t.innerHTML=e.html;const n=t.querySelector("table");return n?.outerHTML||""}function yn(e="",t="",n={},r={}){const o=et(t),i=new RegExp(`<w:p\\b(?:(?!<w:p\\b)[\\s\\S])*?${o}(?:(?!<w:p\\b)[\\s\\S])*?<\\/w:p>\\s*<w:tbl\\b[\\s\\S]*?<\\/w:tbl>`,"g");return e.replace(i,e=>{const t=Wt(e),o=qt(e);return mn(n,t,o,"","",r)})}function bn(e,t={}){const n=t.wordStyleContext||{};return{headingStyleIds:n.headingStyleIds||{},bodyStyleId:n.bodyStyleId||"",headingCounters:n.editableHeadingCounters?.[e]||[0,0,0]}}function wn(e="",t={},n={}){return Object.keys(t).reduce((e,r)=>{const o=t[r],i=bn(r,n);if(!Xe(o))return e;const a=Ge(r);if(!e.includes(a))return e;if(gn(o)){if(e=yn(e,a,o,i),!e.includes(a))return e;e=e.replace(/<w:tbl\b[\s\S]*?<\/w:tbl>/g,e=>e.includes(a)?mn(o,Wt(e),qt(e),"","",i):e)}if(!e.includes(a))return e;const l=e.replace(/<w:p\b[^>]*>[\s\S]*?<\/w:p>/g,e=>{if(!e.includes(a))return e;const t=Ht(e);if(!t.includes(a))return e;const[n,r]=t.split(a),l=cn(o),s=!gt(n)&&!gt(r),c=l.some(e=>["center","right"].includes(e.align));return!s&&!c&&l.length<=1?e:mn(o,Wt(e),qt(e),n,r,i)});return l.includes(a)?l.replace(/<w:r\b[\s\S]*?<\/w:r>/g,e=>{if(!e.includes(a))return e;const t=e.match(/<w:rPr>([\s\S]*?)<\/w:rPr>/)?.[1]||"",n=[...e.matchAll(/<w:t\b[^>]*>([\s\S]*?)<\/w:t>/g)],r=n.map(e=>rt(e[1])).join("");if(!r.includes(a))return e;const[i,l]=r.split(a),s=Pt(i,{},t),c=dn(o,t),d=Pt(l,{},t);return`${s}${c}${d}`}):l},e)}function kn(e,t={},n={}){const r=e.file("word/document.xml");if(!r)return;const o=r.asText(),i=wn(o,t,n);i!==o&&e.file("word/document.xml",i)}function xn(){const e=Se.value.__editableRichTextMap||{};return{renderData:Fe(Se.value),richTextFields:Fe(e),editableFields:de.value.map(t=>({fieldKey:t,path:pe.value[t]||"",hasRichText:Boolean(e[t])}))}}function Sn(e,t=""){const n=Se.value.__editableRichTextMap||{},r=n[e];return ft(r?.html,t)}function Cn(){if(!q.value)return;const e=Bn(q.value);e.forEach(e=>{const t=e.textContent||"";if(!t)return;const n=t.replaceAll(`${x}${w}`,"").replaceAll(`${k}${S}`,"").replaceAll(`${x} ${w}`,"").replaceAll(`${k} ${S}`,"").replaceAll(w,"").replaceAll(k,"").replaceAll(x,"").replaceAll(S,"");n!==t&&(e.textContent=n)})}function Tn(e={}){const t=e.xAxisData||e.xAxis||e.categories||[],n=e.yAxisData||e.yAxis||e.values||[],r=Number(e.upperLimit??e.reasonableUpperLimit??e.maxReasonableValue??80),o=Number(e.lowerLimit??e.reasonableLowerLimit??e.minReasonableValue??30),i=e.regionList||e.regions||e.areas||[];return{title:e.title||"",xAxisData:t,yAxisData:n,upperLimit:r,lowerLimit:o,regionList:i}}function En(e={},t=""){const n=Tn(e,t),r=n.xAxisData.length||1,o=T-N.left-N.right,i=E-N.bottom,a=[];let l=0;return n.regionList.forEach((e,t)=>{const s=Number(e.count||e.length||0);if(!s)return;const c=l/r,d=(l+s)/r,u=(c+d)/2,p=N.left+o*u,h=N.left+o*d;a.push({type:"group",left:p-32,top:18,children:[{type:"rect",shape:{x:0,y:0,width:64,height:18},style:{fill:"#efefef",stroke:"#999",lineWidth:1}},{type:"text",style:{x:32,y:9,text:e.name||`区域${t+1}`,fill:"#333",fontSize:12,fontFamily:"Microsoft YaHei",textAlign:"center",textVerticalAlign:"middle"}}]}),t<n.regionList.length-1&&a.push({type:"line",shape:{x1:h,y1:38,x2:h,y2:i},style:{stroke:"#777",lineWidth:1}}),l+=s}),{animation:!1,backgroundColor:"#fff",title:{text:n.title,left:"center",top:0,textStyle:{color:"#333",fontSize:14,fontWeight:400}},legend:{top:58,right:18,itemWidth:18,itemHeight:2,textStyle:{color:"#666",fontSize:11},data:["合理区间上限","合理区间下限"]},grid:{...N},tooltip:{trigger:"axis"},xAxis:{type:"category",data:n.xAxisData,axisTick:{show:!1},axisLine:{lineStyle:{color:"#888"}},axisLabel:{interval:0,rotate:90,color:"#333",fontSize:11}},yAxis:{type:"value",min:0,max:100,axisLine:{show:!0},splitLine:{lineStyle:{color:"#e8e8e8"}}},series:[{name:"水位值",type:"bar",barWidth:26,data:n.yAxisData.map(e=>{const t=Number(e);let r="#86c5e3";return t>=n.upperLimit?r="#ff2a23":t>=.85*n.upperLimit&&(r="#ffef1f"),{value:t,itemStyle:{color:r}}}),label:{show:!0,position:"top",color:"#333",fontSize:11,formatter:({value:e})=>Number(e).toFixed(2)},markLine:{silent:!0,symbol:"none",lineStyle:{width:1},data:[{name:"合理区间上限",yAxis:n.upperLimit,lineStyle:{color:"#ff6b6b",type:"dashed"}},{name:"合理区间下限",yAxis:n.lowerLimit,lineStyle:{color:"#77c48b",type:"dashed"}}]}}],graphic:a}}async function _n(e={},t=""){const n=document.createElement("div");n.style.cssText=`position:fixed;left:-10000px;top:-10000px;width:${T}px;height:${E}px;background:#fff;`,document.body.appendChild(n);try{const r=p.init(n,null,{renderer:"canvas",width:T,height:E});r.setOption(En(e,t));const o=r.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#fff"});r.dispose();const i=await fetch(o);return i.arrayBuffer()}finally{n.remove()}}async function Mn(){const e=l.templateUrl||`/${encodeURIComponent(l.templateFileName||c)}`,t=await fetch(e);if(!t.ok)throw new Error(`模板加载失败: ${t.status}`);return t.arrayBuffer()}function Nn(e=""){return e.replaceAll(w,"").replaceAll(k,"")}function In(e,t={}){const{stripEditorMarkers:n=!1}=t,r=new(d())(e),o=r.file("word/document.xml")?.asText?.()||"";let i=C.reduce((e,t)=>e.replaceAll(`{${t}}`,`{%${t}}`),o);return n&&(i=Nn(i)),i!==o&&r.file("word/document.xml",i),{zip:r,documentXml:i}}async function Rn(e={}){const{stripEditorMarkers:t=!0,applyRichText:n=!0}=e,r=await Mn(),{zip:o,documentXml:i}=In(r,{stripEditorMarkers:!1}),{zip:l}=In(r,{stripEditorMarkers:t}),c=Zn(o,i),d=new(s())({centered:!0,fileType:"docx",getImage(e,t){return Le()[t]?_n(e,t):e},getSize(e,t,n){return Le()[n]?[_,M]:[120,120]}}),u=new(a())(l,{modules:[d],paragraphLoop:!0,linebreaks:!0}),p=Je({useRichTextTokens:n,useRichTextPlainText:n});return"function"===typeof u.resolveData?await u.resolveData(p):"function"===typeof u.setData&&u.setData(p),u.render(),n&&kn(u.getZip(),Se.value.__editableRichTextMap||{},{wordStyleContext:c}),u.getZip().generate({type:"blob",mimeType:f})}function An(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Bn(e){const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];while(t.nextNode()){const e=t.currentNode;n.push(e)}return n}function Dn(e,t,n="end"){let r=0;for(const i of e){const e=(i.textContent||"").length,o=r+e,a="start"===n?t<o:t<=o;if(a)return{node:i,offset:Math.max(0,t-r)};r=o}const o=e[e.length-1];return{node:o,offset:(o?.textContent||"").length}}function Fn(e,t){const n=()=>cr(t);e.addEventListener("click",n),ke.push(()=>{e.removeEventListener("click",n)})}function Pn(e,t=""){const n=document.createElement("span");n.className="editable-field-anchor",n.dataset.fieldKey=e;const r=dt(e,t);if(!r)return n.classList.add("is-placeholder"),n.textContent=$,Fn(n,e),n;const o=Sn(e,t);return o.forEach(e=>{"break"!==e.type?n.appendChild(document.createTextNode(e.text||"")):n.appendChild(document.createElement("br"))}),Fn(n,e),n}function On(e,t="",n=null){const r=document.createElement("div");r.className="editable-field-block",r.dataset.fieldKey=e;const o=dt(e,t);return o?r.innerHTML=pt(e,t):(r.classList.add("is-placeholder"),r.textContent=$),r.querySelector("table")&&r.classList.add("is-table-field"),Tt(r,n),Fn(r,e),r}function Ln(e){e&&Bn(e).forEach(e=>{const t=e.textContent||"",n=t.replaceAll(`${x}${w}`,"").replaceAll(`${k}${S}`,"").replaceAll(`${x} ${w}`,"").replaceAll(`${k} ${S}`,"").replaceAll(w,"").replaceAll(k,"").replaceAll(x,"").replaceAll(S,"");n!==t&&(e.textContent=n)})}function zn(e){if(!e)return"";const t=e.cloneNode(!0);return Ln(t),t.outerHTML||""}function Vn(e,t){const n=e?.nodeType===Te?e:e?.parentElement,r=t?.nodeType===Te?t:t?.parentElement,o=n?.closest?.("table")||null,i=r?.closest?.("table")||null;return o&&o===i?o:null}function $n(e,t){if(!e.node||!t.node)return"";const n=document.createRange();n.setStart(e.node,e.offset),n.setEnd(t.node,t.offset);const r=n.cloneContents(),o=r.querySelector?.("table");return o?zn(o):""}function jn(e,t,n){const r=mt(e),o=mt(t);if(!r||!o)return!1;if(r===o)return r.replaceWith(n),!0;const i=document.createRange();return i.setStartBefore(r),i.setEndAfter(o),i.deleteContents(),i.insertNode(n),!0}function Hn(e=""){return`docx_${String(e||"").replace(/[ .]+/g,"-").replace(/[&]+/g,"and").toLowerCase()}`}function Wn(e){const t=e.file("word/styles.xml")?.asText?.()||"",n={};for(const r of t.matchAll(/<w:style\b[\s\S]*?<\/w:style>/g)){const e=r[0],t=e.match(/w:type="([^"]+)"/)?.[1]||"";if("paragraph"!==t)continue;const o=e.match(/w:styleId="([^"]+)"/)?.[1]||"",i=e.match(/<w:outlineLvl w:val="([^"]+)"/)?.[1];if(!o||void 0===i)continue;const a=Number(i)+1;a>=1&&a<=3&&(n[Hn(o)]=a)}return n}function qn(e){const t=e.file("word/styles.xml")?.asText?.()||"",n={};for(const r of t.matchAll(/<w:style\b[\s\S]*?<\/w:style>/g)){const e=r[0],t=e.match(/w:type="([^"]+)"/)?.[1]||"";if("paragraph"!==t)continue;const o=e.match(/w:styleId="([^"]+)"/)?.[1]||"",i=e.match(/<w:outlineLvl w:val="([^"]+)"/)?.[1];if(!o||void 0===i)continue;const a=Number(i)+1;a>=1&&a<=3&&(n[o]=a)}return n}function Zn(e,t=""){const n=e.file("word/styles.xml")?.asText?.()||"",r={};let o="";for(const s of n.matchAll(/<w:style\b[\s\S]*?<\/w:style>/g)){const e=s[0],t=e.match(/w:type="([^"]+)"/)?.[1]||"";if("paragraph"!==t)continue;const n=e.match(/w:styleId="([^"]+)"/)?.[1]||"",i=e.match(/<w:name w:val="([^"]+)"/)?.[1]||"",a=e.match(/<w:outlineLvl w:val="([^"]+)"/)?.[1];if(n&&void 0!==a){const e=Number(a)+1;e>=1&&e<=3&&(r[e]=n)}!o&&/^normal$/i.test(i)&&(o=n)}const i=qn(e),a={},l=[0,0,0];for(const s of t.matchAll(/<w:p\b[\s\S]*?<\/w:p>/g)){const e=s[0],t=e.match(/<w:pStyle w:val="([^"]+)"/)?.[1]||"",n=i[t],r=Kn(e);if(r.includes(w)){const t=ot(e);t.forEach(e=>{e.isValid&&e.fieldKey&&!a[e.fieldKey]&&(a[e.fieldKey]=[...l])})}if(n>=1&&n<=3){l[n-1]+=1;for(let e=n;e<l.length;e+=1)l[e]=0}}return{headingStyleIds:r,bodyStyleId:o,editableHeadingCounters:a}}function Un(e=""){return String(e||"").replace(/\s+/g,"")}function Kn(e=""){return[...e.matchAll(/<w:t[^>]*>([\s\S]*?)<\/w:t>/g)].map(e=>rt(e[1])).join("").trim().replace(/\s+/g," ")}function Gn(e,t=""){const n=qn(e),r=[];for(const o of t.matchAll(/<w:p\b[\s\S]*?<\/w:p>/g)){const e=o[0],t=e.match(/<w:pStyle w:val="([^"]+)"/)?.[1]||"",i=n[t];if(!i)continue;const a=Kn(e);!a||a.includes(w)||a.includes(k)||r.push({level:i,text:a,normalizedText:Un(a)})}return r}function Xn(e){if(!e)return 0;for(const n of Array.from(e.classList||[])){const e=me.value[n];if(e>=1&&e<=3)return e}const t=e.tagName?.toLowerCase?.()||"";return/^h[1-3]$/.test(t)?Number(t.slice(1)):0}function Yn(e){const t=window.getComputedStyle(e),n=e.getBoundingClientRect();return"none"!==t.display&&"hidden"!==t.visibility&&n.width>0&&n.height>0}function Jn(e){return Un(e?.textContent||"")}function Qn(e,t,n=0){const r=e.normalizedText;if(!r)return{element:null,index:n};const o=t.findIndex((e,t)=>t>=n&&Jn(e)===r);if(o>=0)return{element:t[o],index:o};const i=t.map((e,t)=>({element:e,index:t,text:Jn(e)})).filter(e=>e.index>=n&&e.text.includes(r)&&e.text.length<=r.length+12).sort((e,t)=>e.text.length-t.text.length||e.index-t.index);if(i.length)return{element:i[0].element,index:i[0].index};const a=t.map((e,t)=>({element:e,index:t,text:Jn(e)})).filter(e=>e.index>=n&&e.text.includes(r)).sort((e,t)=>e.text.length-t.text.length||e.index-t.index);return a.length?{element:a[0].element,index:a[0].index}:{element:null,index:n}}function er(){const e=q.value?.querySelector(".docx")||q.value;if(!e)return[];const t=Array.from(e.querySelectorAll("h1, h2, h3, p, div, span")).filter(t=>{if(t===e||t.closest("table")||!Yn(t))return!1;const n=Jn(t);return n.length>0&&n.length<=120});return t.filter(e=>{const n=Jn(e),r=Array.from(e.children||[]).some(e=>t.includes(e)&&Jn(e)===n);return!r})}function tr(){if(!q.value)return void(se.value=[]);const e=er(),t=new Set,n=[],r=ge.value||[];if(r.length){let o=0;return r.forEach(r=>{const i=`${r.level}-${r.normalizedText}`;if(t.has(i))return;const{element:a,index:l}=Qn(r,e,o);a&&(o=l+1),t.add(i);const s=`docx-outline-${n.length+1}`;a&&(a.dataset.outlineId=s),n.push({id:s,level:r.level,text:r.text,element:a})}),se.value=n,ce.value=n[0]?.id||"",void ar()}e.forEach(e=>{const r=(e.textContent||"").trim().replace(/\s+/g," ");if(!r||r.length>80||r.includes(w)||r.includes(k))return;const o=Xn(e);if(!o)return;const i=`${o}-${r}`;if(t.has(i))return;t.add(i);const a=`docx-outline-${n.length+1}`;e.dataset.outlineId=a,n.push({id:a,level:o,text:r,element:e})}),se.value=n,ce.value=n[0]?.id||"",ar()}function nr(){return Z.value||q.value?.parentElement||null}function rr(e){if(!e||!q.value)return null;if(e.element?.isConnected)return e.element;const t=q.value.querySelector(`[data-outline-id="${e.id}"]`);if(t)return e.element=t,t;const n=er(),r=Qn({normalizedText:Un(e.text)},n,0).element;return r&&(r.dataset.outlineId=e.id,e.element=r),r}function or(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function ir(e){const t=nr(),n=rr(e);n&&t&&(ce.value=e.id,t.scrollTo({top:Math.max(or(n,t)-24,0),behavior:"smooth"}))}function ar(){const e=nr();if(!e||!se.value.length)return;const t=e.getBoundingClientRect(),n=t.top+96;let r=null,o=null;se.value.forEach(e=>{const t=rr(e);if(!t)return;const i=t.getBoundingClientRect();i.top<=n?r=e:o||(o=e)});const i=r?.id||o?.id||se.value[0]?.id||"";i&&ce.value!==i&&(ce.value=i)}function lr(){xe&&cancelAnimationFrame(xe),xe=requestAnimationFrame(()=>{xe=0,ar()})}function sr(){if("edit"!==l.renderType||!q.value||!ue.value.length)return;qe();const e=Bn(q.value),t=e.map(e=>e.textContent||"").join(""),n=[...t.matchAll(nt())].map((e,t)=>({match:e,descriptor:ue.value[t]})).filter(e=>e.descriptor?.isValid&&e.descriptor?.fieldKey),r=new WeakSet;for(let o=n.length-1;o>=0;o-=1){const{match:i,descriptor:a}=n[o],l=i[0]||"",s=a.fieldKey;if(!s)continue;const c=i.index||0,d=c+l.length,u=(i[1]||"").trim(),p=Dn(e,c,"start"),h=Dn(e,d,"end");if(!p.node||!h.node)continue;if(!p.node.isConnected||!h.node.isConnected)continue;const f=Ye(s),m=gn(f)?vn(f):"";if(m){fe[s]=m;const e=document.createRange();e.setStart(p.node,p.offset),e.setEnd(h.node,h.offset),e.deleteContents(),e.insertNode(On(s,u,mt(p.node)));continue}const g=$n(p,h);if(g){fe[s]=g;const e=document.createRange();e.setStart(p.node,p.offset),e.setEnd(h.node,h.offset),e.deleteContents(),e.insertNode(On(s,u,mt(p.node)));continue}const v=Vn(p.node,h.node);if(v&&!r.has(v)){fe[s]=zn(v),v.replaceWith(On(s,u,mt(p.node))),r.add(v);continue}const y=document.createRange(),b=Ct(p,h,l,t,c,d);if(b){const e=mt(p.node);jn(p.node,h.node,On(s,u,e));continue}y.setStart(p.node,p.offset),y.setEnd(h.node,h.offset),y.deleteContents(),y.insertNode(Pn(s,u))}}function cr(e){const t=pe.value[e]||"",n=lt(Se.value,t)??"";Y.value={key:e,path:t},Ne.value?.commands.setContent(ut(e,n),!1),X.value=!0}function dr(){if(!Y.value||!Ne.value)return;const e=Y.value.key,t=ht(Ne.value.getHTML()),n=Ne.value.getJSON(),r=st(t),o=Y.value.path;Se.value.__editableRichTextMap[e]=sn(e,o,t,n,r),at(Se.value,o,r),he[e]=t,i("render-data-change",Fe(Se.value)),i("save-payload-change",xn()),X.value=!1,fr()}function ur(){Y.value=null}function pr(e){i("template-save",e)}function hr(e){i("template-load-error",e)}async function fr(){const e=++we;K.value=!0,G.value="";try{const t=await Mn(),{zip:r,documentXml:o}=In(t,{stripEditorMarkers:"edit"!==l.renderType});me.value=Wn(r),ge.value=Gn(r,o),ve.value=Zn(r,o),ue.value=ot(o),de.value=ue.value.filter(e=>e.isValid).map(e=>e.fieldKey),pe.value=it(Se.value),de.value.forEach(e=>{pe.value[e]||(pe.value[e]=e)});const i=await Rn({stripEditorMarkers:"edit"!==l.renderType,applyRichText:"edit"!==l.renderType});if(await(0,n.nextTick)(),!q.value||e!==we)return;We(),await u.renderAsync(i,q.value,q.value,{className:"docx-preview",inWrapper:!0,breakPages:!0,ignoreWidth:!1,ignoreHeight:!1,ignoreLastRenderedPageBreak:!1,renderHeaders:!0,renderFooters:!0,useBase64URL:!0}),await(0,n.nextTick)(),"edit"===l.renderType?sr():Cn(),tr()}catch(t){if(e!==we)return;console.error("Docx preview render failed:",t),G.value="文档预览生成失败,请检查模板变量或模板文件。",r.ElMessage.error(G.value)}finally{e===we&&(K.value=!1)}}async function mr(e={}){const t=He("string"===typeof e?e:e?.fileName);try{const e=await Rn({stripEditorMarkers:!0});return An(e,t),{success:!0,fileName:t}}catch(n){return console.error("Docx export failed:",n),r.ElMessage.error("导出失败,请检查模板变量或模板文件。"),{success:!1,error:n}}}function gr(e){return!!Ne.value?.isActive("heading",{level:e})}function vr(e){return!!Ne.value?.isActive({textAlign:e})}function yr(e){Ne.value?.chain().focus().toggleHeading({level:e}).run()}function br(){Ne.value?.chain().focus().setParagraph().updateAttributes("paragraph",{textIndentLevel:0}).setTextAlign("left").run()}function wr(){Ne.value?.chain().focus().toggleBold().run()}function kr(){if(!Ne.value)return null;const e=ye.find(e=>Ne.value.isActive("heading",{level:e.level}))?.level||0;return{headingLevel:e,bold:Boolean(Ne.value.isActive("bold")),textColor:Ne.value.getAttributes("textStyle").color||"",backgroundColor:Ne.value.getAttributes("highlight").color||"",align:["center","right"].find(e=>Ne.value.isActive({textAlign:e}))||"left",textIndentLevel:Ee(Ne.value)}}function xr(e){if(!Ne.value||!e)return;let t=Ne.value.chain().focus().unsetAllMarks();t=e.headingLevel?t.setHeading({level:e.headingLevel}):t.setParagraph(),t=t.setTextAlign(e.align||"left").updateAttributes(e.headingLevel?"heading":"paragraph",{textIndentLevel:Number(e.textIndentLevel||0)}),e.bold&&(t=t.toggleBold()),e.textColor&&(t=t.setColor(e.textColor)),e.backgroundColor&&(t=t.setHighlight({color:e.backgroundColor})),t.run()}function Sr(){if(!re.value)return re.value=kr(),void r.ElMessage.success("已复制当前格式,请选中目标内容后再次点击格式刷应用。");xr(re.value),re.value=null}function Cr(){Ne.value&&Ne.value.chain().focus().unsetAllMarks().setParagraph().setTextAlign("left").updateAttributes("paragraph",{textIndentLevel:0}).run()}function Tr(e,t){ie.value={rows:e,cols:t}}function Er(e,t){Ne.value?.chain().focus().insertTable({rows:e,cols:t,withHeaderRow:!0}).run(),oe.value=!1}function _r(){Ne.value?.chain().focus().addRowAfter().run()}function Mr(){Ne.value?.chain().focus().deleteRow().run()}function Nr(){Ne.value?.chain().focus().addColumnAfter().run()}function Ir(){Ne.value?.chain().focus().deleteColumn().run()}function Rr(){Ne.value?.chain().focus().deleteTable().run()}function Ar(){ae.value=!1}function Br(e){return e instanceof Al}function Dr(e){const t=Ne.value?.state.selection;return Br(t)&&e.classList.contains("selectedCell")}function Fr(e){const t=Ne.value?.view,n=t?.posAtCoords({left:e.clientX,top:e.clientY});n?.pos?Ne.value.chain().focus().setTextSelection(n.pos).run():Ne.value?.commands.focus()}function Pr(e){if(2!==e.button)return;const t=e.target?.closest?.("td, th");t&&Dr(t)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation?.())}function Or(e){const t=e.target?.closest?.("td, th");if(!t||!Ne.value)return void Ar();e.preventDefault(),Dr(t)||Fr(e);const n=e.currentTarget.closest(".edit-dialog")?.getBoundingClientRect()||e.currentTarget.getBoundingClientRect();le.value={x:e.clientX-n.left,y:e.clientY-n.top},ae.value=!0}function Lr(e){return"mergeCells"===e?"请先拖选两个或多个连续单元格,再执行合并。":"splitCell"===e?"当前单元格没有可拆分的合并行或合并列。":""}function zr(e){const t=Ne.value;if(!t)return;const n={mergeCells:()=>t.chain().focus().mergeCells().run(),splitCell:()=>t.chain().focus().splitCell().run(),addRowBefore:()=>t.chain().focus().addRowBefore().run(),addRowAfter:()=>t.chain().focus().addRowAfter().run(),deleteRow:()=>t.chain().focus().deleteRow().run(),addColumnBefore:()=>t.chain().focus().addColumnBefore().run(),addColumnAfter:()=>t.chain().focus().addColumnAfter().run(),deleteColumn:()=>t.chain().focus().deleteColumn().run(),toggleHeaderRow:()=>t.chain().focus().toggleHeaderRow().run(),toggleHeaderColumn:()=>t.chain().focus().toggleHeaderColumn().run(),deleteTable:()=>t.chain().focus().deleteTable().run()},o=t.can()?.[e]?.();if(!1===o){const t=Lr(e);return t&&r.ElMessage.warning(t),void Ar()}const i=n[e]?.();if(!1===i){const t=Lr(e);t&&r.ElMessage.warning(t)}Ar()}function Vr(e){Ne.value?.chain().focus().setTextAlign(e).run()}function $r(){const e=Ne.value?.state.selection;e&&(ne.value={from:e.from,to:e.to})}function jr(){const e=Ne.value?.chain().focus();return e?ne.value?e.setTextSelection(ne.value):e:null}function Hr(){$r(),J.value?.click()}function Wr(){$r(),Q.value?.click()}function qr(e){const t=e.target.value||g;ee.value=t,jr()?.setColor(t).run(),ne.value=null}function Zr(e){const t=e.target.value||y;te.value=t,jr()?.setHighlight({color:t}).run(),ne.value=null}function Ur(){$r(),jr()?.unsetHighlight().run(),te.value=y,ne.value=null}function Kr(){Ne.value?.chain().focus().undo().run()}function Gr(){Ne.value?.chain().focus().redo().run()}return(0,n.watch)(()=>l.renderData,e=>{Se.value=Pe(e),"templateEdit"!==l.renderType&&fr()},{deep:!0,immediate:!0}),(0,n.watch)(()=>l.renderType,e=>{"templateEdit"!==e?fr():We()}),t({exportDocx:mr,saveTemplate:()=>U.value?.saveTemplate?.(),exportTemplate:()=>U.value?.exportTemplate?.(),reloadTemplate:()=>U.value?.reloadTemplate?.(),getRenderData:()=>Fe(Se.value),getSavePayload:()=>xn(),getEditorHtml:()=>Ne.value?.getHTML()||"",getEditorJson:()=>Ne.value?.getJSON()||null}),(0,n.onBeforeUnmount)(()=>{we+=1,xe&&(cancelAnimationFrame(xe),xe=0),We(),Ne.value?.destroy()}),(t,r)=>{const i=(0,n.resolveComponent)("el-tooltip"),a=(0,n.resolveComponent)("el-popover"),l=(0,n.resolveComponent)("el-button"),s=(0,n.resolveComponent)("el-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["view-page",{"has-outline":"templateEdit"!==e.renderType&&se.value.length}])},["templateEdit"===e.renderType?((0,n.openBlock)(),(0,n.createBlock)(JD,{key:0,ref:(e,t)=>{t["templateEditorRef"]=e,U.value=e},class:"template-editor-panel","template-url":e.templateUrl,"template-file-name":e.templateFileName,"export-file-name":e.exportFileName,onTemplateSave:pr,onTemplateLoadError:hr},null,8,["template-url","template-file-name","export-file-name"])):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[se.value.length?((0,n.openBlock)(),(0,n.createElementBlock)("aside",tF,[nF,((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(se.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.id,type:"button",class:(0,n.normalizeClass)(["outline-item",[`level-${e.level}`,{"is-active":ce.value===e.id}]]),onClick:t=>ir(e)},[(0,n.createElementVNode)("span",oF,(0,n.toDisplayString)(e.text),1)],10,rF))),128))])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref:(e,t)=>{t["docxScrollRef"]=e,Z.value=e},class:(0,n.normalizeClass)("view"===e.renderType?"view-box":"edit-box"),onScroll:lr},[K.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",iF,"正在生成文档预览...")):G.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",aF,(0,n.toDisplayString)(G.value),1)):(0,n.createCommentVNode)("",!0),(0,n.withDirectives)((0,n.createElementVNode)("div",{ref:(e,t)=>{t["previewRef"]=e,q.value=e},class:"docx-preview-container"},null,512),[[n.vShow,!K.value&&!G.value]])],34),(0,n.createVNode)(s,{modelValue:X.value,"onUpdate:modelValue":r[36]||(r[36]=e=>X.value=e),title:"编辑变量内容",width:"70%",class:"editDialog-dialog","destroy-on-close":"",onClosed:ur},{footer:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",xP,[(0,n.createVNode)(l,{onClick:r[35]||(r[35]=e=>X.value=!1)},{default:(0,n.withCtx)(()=>[SP]),_:1}),(0,n.createVNode)(l,{type:"primary",onClick:dr},{default:(0,n.withCtx)(()=>[CP]),_:1})])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",lF,[(0,n.createElementVNode)("div",sF,[(0,n.createTextVNode)(" 当前变量:"+(0,n.toDisplayString)(Y.value?.key||"--")+" ",1),Y.value?.path?((0,n.openBlock)(),(0,n.createElementBlock)("span",cF,(0,n.toDisplayString)(Y.value.path),1)):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",dF,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(ye,e=>(0,n.createVNode)(i,{key:e.level,content:`标题 ${e.level}`,placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":gr(e.level)}]),onMousedown:r[0]||(r[0]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:t=>yr(e.level)},[((0,n.openBlock)(),(0,n.createElementBlock)("svg",pF,[hF,(0,n.createElementVNode)("text",fF,(0,n.toDisplayString)(e.level),1)]))],42,uF)]),_:2},1032,["content"])),64)),(0,n.createVNode)(i,{content:"正文",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":(0,n.unref)(Ae)}]),onMousedown:r[1]||(r[1]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:br},gF,34)]),_:1}),vF,(0,n.createVNode)(i,{content:"加粗",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":(0,n.unref)(Ie)}]),onMousedown:r[2]||(r[2]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:wr},bF,34)]),_:1}),(0,n.createVNode)(a,{visible:oe.value,"onUpdate:visible":r[4]||(r[4]=e=>oe.value=e),placement:"bottom-start",trigger:"click",width:340,"popper-class":"table-picker-popper"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn table-trigger-btn",{"is-active":(0,n.unref)(Re)}]),title:"插入表格",onMousedown:r[3]||(r[3]=(0,n.withModifiers)(()=>{},["prevent"]))},kF,34)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",xF,[SF,(0,n.createElementVNode)("div",CF,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(be),e=>((0,n.openBlock)(),(0,n.createElementBlock)("button",{key:e.key,type:"button",class:(0,n.normalizeClass)(["table-picker-cell",{"is-active":e.row<=ie.value.rows&&e.col<=ie.value.cols}]),onMouseenter:t=>Tr(e.row,e.col),onClick:t=>Er(e.row,e.col)},null,42,TF))),128))]),(0,n.createElementVNode)("div",EF,(0,n.toDisplayString)(ie.value.rows)+" x "+(0,n.toDisplayString)(ie.value.cols),1)])]),_:1},8,["visible"]),(0,n.createVNode)(i,{content:"左对齐",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":vr("left")}]),onMousedown:r[5]||(r[5]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:r[6]||(r[6]=e=>Vr("left"))},MF,34)]),_:1}),(0,n.createVNode)(i,{content:"居中对齐",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":vr("center")}]),onMousedown:r[7]||(r[7]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:r[8]||(r[8]=e=>Vr("center"))},IF,34)]),_:1}),(0,n.createVNode)(i,{content:"右对齐",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":vr("right")}]),onMousedown:r[9]||(r[9]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:r[10]||(r[10]=e=>Vr("right"))},AF,34)]),_:1}),BF,(0,n.createVNode)(i,{content:"下方插入行",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",DF,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn table-op-btn",disabled:!(0,n.unref)(Re),onMousedown:r[11]||(r[11]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:_r},OF,40,FF)])]),_:1}),(0,n.createVNode)(i,{content:"删除当前行",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",LF,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn table-op-btn",disabled:!(0,n.unref)(Re),onMousedown:r[12]||(r[12]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Mr},$F,40,zF)])]),_:1}),(0,n.createVNode)(i,{content:"右侧插入列",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",jF,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn table-op-btn",disabled:!(0,n.unref)(Re),onMousedown:r[13]||(r[13]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Nr},qF,40,HF)])]),_:1}),(0,n.createVNode)(i,{content:"删除当前列",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",ZF,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn table-op-btn",disabled:!(0,n.unref)(Re),onMousedown:r[14]||(r[14]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Ir},GF,40,UF)])]),_:1}),(0,n.createVNode)(i,{content:"删除表格",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",XF,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn table-op-btn",disabled:!(0,n.unref)(Re),onMousedown:r[15]||(r[15]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Rr},QF,40,YF)])]),_:1}),eP,(0,n.createVNode)(i,{content:"字体颜色",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn color-btn",onMousedown:r[16]||(r[16]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Hr},[((0,n.openBlock)(),(0,n.createElementBlock)("svg",tP,[nP,(0,n.createElementVNode)("path",{d:"M6 23h16",class:"svg-stroke color-preview-stroke round",style:(0,n.normalizeStyle)({color:ee.value})},null,4)]))],32)]),_:1}),(0,n.createElementVNode)("input",{ref:(e,t)=>{t["textColorInputRef"]=e,J.value=e},class:"hidden-color-input",type:"color",value:ee.value,onInput:qr},null,40,rP),(0,n.createVNode)(i,{content:"背景色",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn color-btn",onMousedown:r[17]||(r[17]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Wr},[((0,n.openBlock)(),(0,n.createElementBlock)("svg",oP,[iP,aP,(0,n.createElementVNode)("rect",{x:"6",y:"22",width:"16",height:"3",rx:"1.5",class:"svg-color-fill",style:(0,n.normalizeStyle)({color:te.value})},null,4)]))],32)]),_:1}),(0,n.createVNode)(i,{content:"清除背景色",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn clear-highlight-btn",onMousedown:r[18]||(r[18]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Ur},sP,32)]),_:1}),(0,n.createVNode)(i,{content:"格式刷",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:(0,n.normalizeClass)(["toolbar-btn",{"is-active":Boolean(re.value)}]),onMousedown:r[19]||(r[19]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Sr},dP,34)]),_:1}),(0,n.createVNode)(i,{content:"清除格式",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn",onMousedown:r[20]||(r[20]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Cr},pP,32)]),_:1}),(0,n.createElementVNode)("input",{ref:(e,t)=>{t["highlightColorInputRef"]=e,Q.value=e},class:"hidden-color-input",type:"color",value:te.value,onInput:Zr},null,40,hP),fP,(0,n.createVNode)(i,{content:"撤销",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",mP,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn",disabled:!(0,n.unref)(Be),onMousedown:r[21]||(r[21]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Kr},[(0,n.createVNode)((0,n.unref)(o.RefreshLeft))],40,gP)])]),_:1}),(0,n.createVNode)(i,{content:"恢复",placement:"top"},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",vP,[(0,n.createElementVNode)("button",{type:"button",class:"toolbar-btn",disabled:!(0,n.unref)(De),onMousedown:r[22]||(r[22]=(0,n.withModifiers)(()=>{},["prevent"])),onClick:Gr},[(0,n.createVNode)((0,n.unref)(o.RefreshRight))],40,yP)])]),_:1})]),(0,n.createElementVNode)("div",{class:"editor-content-shell",onClick:Ar,onMousedownCapture:Pr,onContextmenu:Or},[(0,n.unref)(Ne)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(QD.EditorContent),{key:0,editor:(0,n.unref)(Ne),class:"editor-content"},null,8,["editor"])):(0,n.createCommentVNode)("",!0)],32),ae.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"table-context-menu",style:(0,n.normalizeStyle)({left:`${le.value.x}px`,top:`${le.value.y}px`}),onMousedown:r[34]||(r[34]=(0,n.withModifiers)(()=>{},["prevent"]))},[(0,n.createElementVNode)("button",{type:"button",onClick:r[23]||(r[23]=e=>zr("mergeCells"))},"合并单元格"),(0,n.createElementVNode)("button",{type:"button",onClick:r[24]||(r[24]=e=>zr("splitCell"))},"拆分单元格"),bP,(0,n.createElementVNode)("button",{type:"button",onClick:r[25]||(r[25]=e=>zr("addRowBefore"))},"上方插入行"),(0,n.createElementVNode)("button",{type:"button",onClick:r[26]||(r[26]=e=>zr("addRowAfter"))},"下方插入行"),(0,n.createElementVNode)("button",{type:"button",onClick:r[27]||(r[27]=e=>zr("deleteRow"))},"删除当前行"),wP,(0,n.createElementVNode)("button",{type:"button",onClick:r[28]||(r[28]=e=>zr("addColumnBefore"))},"左侧插入列"),(0,n.createElementVNode)("button",{type:"button",onClick:r[29]||(r[29]=e=>zr("addColumnAfter"))},"右侧插入列"),(0,n.createElementVNode)("button",{type:"button",onClick:r[30]||(r[30]=e=>zr("deleteColumn"))},"删除当前列"),kP,(0,n.createElementVNode)("button",{type:"button",onClick:r[31]||(r[31]=e=>zr("toggleHeaderRow"))},"切换表头行"),(0,n.createElementVNode)("button",{type:"button",onClick:r[32]||(r[32]=e=>zr("toggleHeaderColumn"))},"切换表头列"),(0,n.createElementVNode)("button",{type:"button",class:"is-danger",onClick:r[33]||(r[33]=e=>zr("deleteTable"))},"删除表格")],36)):(0,n.createCommentVNode)("",!0)])]),_:1},8,["modelValue"])],64))],2)}}var _P=Object.assign(TP,{props:{renderData:{type:Object,default:()=>({})},renderType:{type:String,default:"view"},templateUrl:{type:String,default:""},templateFileName:{type:String,default:"运营报告.docx"},exportFileName:{type:String,default:""}},emits:["content-change","render-data-change","save-payload-change","template-save","template-load-error","update:editorHtml","update:editorJson"],setup:EP});const MP=(0,XD.A)(_P,[["__scopeId","data-v-706f3b30"]]);var NP=MP;NP.install=e=>{e.component(NP.name||"FDocxEditor",NP)};var IP=NP,RP=IP}(),S}()});
|