Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
firepot
/
wp-content
/
plugins
/
gutenberg
/
build
/
core-data
:
index.min.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
(()=>{var e={2167:e=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t){var n=e._map,r=e._arrayTreeMap,i=e._objectTreeMap;if(n.has(t))return n.get(t);for(var s=Object.keys(t).sort(),o=Array.isArray(t)?r:i,a=0;a<s.length;a++){var c=s[a];if(void 0===(o=o.get(c)))return;var l=t[c];if(void 0===(o=o.get(l)))return}var u=o.get("_ekm_value");return u?(n.delete(u[0]),u[0]=t,o.set("_ekm_value",u),n.set(t,u),u):void 0}var i=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.clear(),t instanceof e){var n=[];t.forEach((function(e,t){n.push([t,e])})),t=n}if(null!=t)for(var r=0;r<t.length;r++)this.set(t[r][0],t[r][1])}var i,s;return i=e,s=[{key:"set",value:function(n,r){if(null===n||"object"!==t(n))return this._map.set(n,r),this;for(var i=Object.keys(n).sort(),s=[n,r],o=Array.isArray(n)?this._arrayTreeMap:this._objectTreeMap,a=0;a<i.length;a++){var c=i[a];o.has(c)||o.set(c,new e),o=o.get(c);var l=n[c];o.has(l)||o.set(l,new e),o=o.get(l)}var u=o.get("_ekm_value");return u&&this._map.delete(u[0]),o.set("_ekm_value",s),this._map.set(n,s),this}},{key:"get",value:function(e){if(null===e||"object"!==t(e))return this._map.get(e);var n=r(this,e);return n?n[1]:void 0}},{key:"has",value:function(e){return null===e||"object"!==t(e)?this._map.has(e):void 0!==r(this,e)}},{key:"delete",value:function(e){return!!this.has(e)&&(this.set(e,void 0),!0)}},{key:"forEach",value:function(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this;this._map.forEach((function(i,s){null!==s&&"object"===t(s)&&(i=i[1]),e.call(r,i,s,n)}))}},{key:"clear",value:function(){this._map=new Map,this._arrayTreeMap=new Map,this._objectTreeMap=new Map}},{key:"size",get:function(){return this._map.size}}],s&&n(i.prototype,s),e}();e.exports=i},5619:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!=i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},2248:(e,t,n)=>{var r,i,s;e.exports=(r=Math.floor,i=Math.abs,s=Math.pow,function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){return i(t[o][1][e]||e)}),l,l.exports,e,t,n,r)}return n[o].exports}for(var s=void 0,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";function r(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function i(e){return o[63&e>>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function s(e,t,n){for(var r,s=[],o=t;o<n;o+=3)r=(16711680&e[o]<<16)+(65280&e[o+1]<<8)+(255&e[o+2]),s.push(i(r));return s.join("")}n.byteLength=function(e){var t=r(e),n=t[0],i=t[1];return 3*(n+i)/4-i},n.toByteArray=function(e){var t,n,i=r(e),s=i[0],o=i[1],l=new c(function(e,t,n){return 3*(t+n)/4-n}(0,s,o)),u=0,d=0<o?s-4:s;for(n=0;n<d;n+=4)t=a[e.charCodeAt(n)]<<18|a[e.charCodeAt(n+1)]<<12|a[e.charCodeAt(n+2)]<<6|a[e.charCodeAt(n+3)],l[u++]=255&t>>16,l[u++]=255&t>>8,l[u++]=255&t;return 2===o&&(t=a[e.charCodeAt(n)]<<2|a[e.charCodeAt(n+1)]>>4,l[u++]=255&t),1===o&&(t=a[e.charCodeAt(n)]<<10|a[e.charCodeAt(n+1)]<<4|a[e.charCodeAt(n+2)]>>2,l[u++]=255&t>>8,l[u++]=255&t),l},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],a=16383,c=0,l=n-r;c<l;c+=a)i.push(s(e,c,c+a>l?l:c+a));return 1===r?(t=e[n-1],i.push(o[t>>2]+o[63&t<<4]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(o[t>>10]+o[63&t>>4]+o[63&t<<2]+"=")),i.join("")};for(var o=[],a=[],c="undefined"==typeof Uint8Array?Array:Uint8Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)o[u]=l[u],a[l.charCodeAt(u)]=u;a[45]=62,a[95]=63},{}],2:[function(){},{}],3:[function(e,t,n){(function(){(function(){"use strict";var t=String.fromCharCode,r=Math.min;function i(e){if(2147483647<e)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|h(e,t),r=i(n),s=r.write(e,t);return s!==n&&(r=r.slice(0,s)),r}(e,t);if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer))return function(e,t,n){if(0>t||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n)).__proto__=o.prototype,r}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var s=function(e){if(o.isBuffer(e)){var t=0|d(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0===e.length?"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0:"number"!=typeof e.length||F(e.length)?i(0):u(e)}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(0>e)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),i(0>e?0:0|d(e))}function u(e){for(var t=0>e.length?0:0|d(e.length),n=i(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=2<arguments.length&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return P(e).length;default:if(i)return r?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:-2147483648>n&&(n=-2147483648),F(n=+n)&&(n=i?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(0>n){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var o,a=1,c=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=(r+"").toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(2>e.length||2>t.length)return-1;a=2,c/=2,l/=2,n/=2}if(i){var u=-1;for(o=n;o<c;o++)if(s(e,o)!==s(t,-1===u?0:o-u))-1!==u&&(o-=o-u),u=-1;else if(-1===u&&(u=o),o-u+1===l)return u*a}else for(n+l>c&&(n=c-l),o=n;0<=o;o--){for(var d=!0,h=0;h<l;h++)if(s(e,o+h)!==s(t,h)){d=!1;break}if(d)return o}return-1}function m(e,t,n,r){n=+n||0;var i=e.length-n;r?(r=+r)>i&&(r=i):r=i;var s=t.length;r>s/2&&(r=s/2);for(var o,a=0;a<r;++a){if(F(o=parseInt(t.substr(2*a,2),16)))return a;e[n+a]=o}return a}function b(e,t,n,r){return j(U(t,e.length-n),e,n,r)}function _(e,t,n,r){return j(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function w(e,t,n,r){return _(e,t,n,r)}function v(e,t,n,r){return j(P(t),e,n,r)}function E(e,t,n,r){return j(function(e,t){for(var n,r,i,s=[],o=0;o<e.length&&!(0>(t-=2));++o)r=(n=e.charCodeAt(o))>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?V.fromByteArray(e):V.fromByteArray(e.slice(t,n))}function S(e,t,n){n=r(e.length,n);for(var i=[],s=t;s<n;){var o,a,c,l,u=e[s],d=null,h=239<u?4:223<u?3:191<u?2:1;s+h<=n&&(1===h?128>u&&(d=u):2===h?128==(192&(o=e[s+1]))&&127<(l=(31&u)<<6|63&o)&&(d=l):3===h?(o=e[s+1],a=e[s+2],128==(192&o)&&128==(192&a)&&2047<(l=(15&u)<<12|(63&o)<<6|63&a)&&(55296>l||57343<l)&&(d=l)):4===h&&(o=e[s+1],a=e[s+2],c=e[s+3],128==(192&o)&&128==(192&a)&&128==(192&c)&&65535<(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&c)&&1114112>l&&(d=l))),null===d?(d=65533,h=1):65535<d&&(d-=65536,i.push(55296|1023&d>>>10),d=56320|1023&d),i.push(d),s+=h}return C(i)}function C(e){var n=e.length;if(n<=4096)return t.apply(String,e);for(var r="",i=0;i<n;)r+=t.apply(String,e.slice(i,i+=4096));return r}function k(e,n,i){var s="";i=r(e.length,i);for(var o=n;o<i;++o)s+=t(127&e[o]);return s}function T(e,n,i){var s="";i=r(e.length,i);for(var o=n;o<i;++o)s+=t(e[o]);return s}function A(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=M(e[s]);return i}function I(e,n,r){for(var i=e.slice(n,r),s="",o=0;o<i.length;o+=2)s+=t(i[o]+256*i[o+1]);return s}function O(e,t,n){if(0!=e%1||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function L(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function x(e,t,n,r,i){return t=+t,n>>>=0,i||L(e,0,n,4),q.write(e,t,n,r,23,4),n+4}function N(e,t,n,r,i){return t=+t,n>>>=0,i||L(e,0,n,8),q.write(e,t,n,r,52,8),n+8}function M(e){return 16>e?"0"+e.toString(16):e.toString(16)}function U(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o<r;++o){if(55295<(n=e.charCodeAt(o))&&57344>n){if(!i){if(56319<n){-1<(t-=3)&&s.push(239,191,189);continue}if(o+1===r){-1<(t-=3)&&s.push(239,191,189);continue}i=n;continue}if(56320>n){-1<(t-=3)&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&-1<(t-=3)&&s.push(239,191,189);if(i=null,128>n){if(0>(t-=1))break;s.push(n)}else if(2048>n){if(0>(t-=2))break;s.push(192|n>>6,128|63&n)}else if(65536>n){if(0>(t-=3))break;s.push(224|n>>12,128|63&n>>6,128|63&n)}else{if(!(1114112>n))throw new Error("Invalid code point");if(0>(t-=4))break;s.push(240|n>>18,128|63&n>>12,128|63&n>>6,128|63&n)}}return s}function P(e){return V.toByteArray(function(e){if(2>(e=(e=e.split("=")[0]).trim().replace(W,"")).length)return"";for(;0!=e.length%4;)e+="=";return e}(e))}function j(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function B(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var V=e("base64-js"),q=e("ieee754");n.Buffer=o,n.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},n.INSPECT_MAX_BYTES=50,n.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){return o.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){return o.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),o.poolSize=8192,o.from=function(e,t,n){return a(e,t,n)},o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,o.alloc=function(e,t,n){return function(e,t,n){return c(e),0>=e||void 0===t?i(e):"string"==typeof n?i(e).fill(t,n):i(e).fill(t)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(B(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),B(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,i=t.length,s=0,a=r(n,i);s<a;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0},o.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=o.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(B(s,Uint8Array)&&(s=o.from(s)),!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(0!=e%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(0!=e%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(0!=e%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},o.prototype.compare=function(e,t,n,i,s){if(B(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),0>t||n>e.length||0>i||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(s>>>=0)-(i>>>=0),c=(n>>>=0)-(t>>>=0),l=r(a,c),u=this.slice(i,s),d=e.slice(t,n),h=0;h<l;++h)if(u[h]!==d[h]){a=u[h],c=d[h];break}return a<c?-1:c<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),0<e.length&&(0>n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return v(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var n=this.length;0>(e=~~e)?0>(e+=n)&&(e=0):e>n&&(e=n),0>(t=void 0===t?n:~~t)?0>(t+=n)&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=o.prototype,r},o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e+--t],i=1;0<t&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=s(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=t,i=1,o=this[e+--r];0<r&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=s(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),q.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),q.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),q.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),q.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||D(this,e,t,n,s(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=255&e/i;return t+n},o.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||D(this,e,t,n,s(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=255&e/o;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=s(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=0,a=1,c=0;for(this[t]=255&e;++o<n&&(a*=256);)0>e&&0===c&&0!==this[t+o-1]&&(c=1),this[t+o]=255&(e/a|0)-c;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=s(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=n-1,a=1,c=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)0>e&&0===c&&0!==this[t+o+1]&&(c=1),this[t+o]=255&(e/a|0)-c;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return N(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return N(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var s=i-1;0<=s;--s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var i=e.charCodeAt(0);("utf8"===r&&128>i||"latin1"===r)&&(e=i)}}else"number"==typeof e&&(e&=255);if(0>t||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var a=o.isBuffer(e)?e:o.from(e,r),c=a.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=a[s%c]}return this};var W=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(e,t,n){(function(r){(function(){n.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"===e||(r++,"%c"===e&&(i=r))})),e.splice(i,0,n)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e},n.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":5,_process:12}],5:[function(e,t){t.exports=function(t){function n(e){function t(...e){if(!t.enabled)return;const r=t,s=+new Date,o=s-(i||s);r.diff=o,r.prev=i,r.curr=s,i=s,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,i)=>{if("%%"===t)return"%";a++;const s=n.formatters[i];if("function"==typeof s){const n=e[a];t=s.call(r,n),e.splice(a,1),a--}return t})),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}let i,s=null;return t.namespace=e,t.useColors=n.useColors(),t.color=n.selectColor(e),t.extend=r,t.destroy=n.destroy,Object.defineProperty(t,"enabled",{enumerable:!0,configurable:!1,get:()=>null===s?n.enabled(e):s,set:e=>{s=e}}),"function"==typeof n.init&&n.init(t),t}function r(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){const e=[...n.names.map(s),...n.skips.map(s).map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=e("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{n[e]=t[e]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[i(t)%n.colors.length]},n.enable(n.load()),n}},{ms:11}],6:[function(e,t){"use strict";function n(e,t){for(const n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}t.exports=function(e,t,r){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof t&&(r=t,t=""),t&&(r.code=t);try{return n(e,r)}catch(t){r.message=e.message,r.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),n(new i,r)}}},{}],7:[function(e,t){"use strict";function n(){n.init.call(this)}function r(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function i(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function s(e,t,n,s){var o,a,c;if(r(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),c=a[t]),void 0===c)c=a[t]=n,++e._eventsCount;else if("function"==typeof c?c=a[t]=s?[n,c]:[c,n]:s?c.unshift(n):c.push(n),0<(o=i(e))&&c.length>o&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=c.length,function(e){console&&console.warn&&console.warn(e)}(l)}return e}function o(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.bind(r);return i.listener=n,r.wrapFn=i,i}function c(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):u(i,i.length)}function l(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function u(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function d(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}var h,f="object"==typeof Reflect?Reflect:null,p=f&&"function"==typeof f.apply?f.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};h=f&&"function"==typeof f.ownKeys?f.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var g=Number.isNaN||function(e){return e!=e};t.exports=n,t.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}d(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&d(e,"error",t,n)}(e,i,{once:!0})}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var y=10;Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return y},set:function(e){if("number"!=typeof e||0>e||g(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");y=e}}),n.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||0>e||g(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return i(this)},n.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(0<t.length&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)p(a,this,t);else{var c=a.length,l=u(a,c);for(n=0;n<c;++n)p(l[n],this,t)}return!0},n.prototype.addListener=function(e,t){return s(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return s(this,e,t,!0)},n.prototype.once=function(e,t){return r(t),this.on(e,a(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return r(t),this.prependListener(e,a(this,e,t)),this},n.prototype.removeListener=function(e,t){var n,i,s,o,a;if(r(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,o=n.length-1;0<=o;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,s=o;break}if(0>s)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;0<=r;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return c(this,e,!0)},n.prototype.rawListeners=function(e){return c(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l.call(e,t)},n.prototype.listenerCount=l,n.prototype.eventNames=function(){return 0<this._eventsCount?h(this._events):[]}},{}],8:[function(e,t){t.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},{}],9:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,c=8*i-r-1,l=(1<<c)-1,u=l>>1,d=-7,h=n?i-1:0,f=n?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-d)-1,p>>=-d,d+=c;0<d;o=256*o+e[t+h],h+=f,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;0<d;a=256*a+e[t+h],h+=f,d-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=s(2,r),o-=u}return(p?-1:1)*a*s(2,o-r)},n.write=function(e,t,n,o,a,c){var l,u,d,h=Math.LN2,f=Math.log,p=8*c-a-1,g=(1<<p)-1,y=g>>1,m=23===a?s(2,-24)-s(2,-77):0,b=o?0:c-1,_=o?1:-1,w=0>t||0===t&&0>1/t?1:0;for(t=i(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,l=g):(l=r(f(t)/h),1>t*(d=s(2,-l))&&(l--,d*=2),2<=(t+=1<=l+y?m/d:m*s(2,1-y))*d&&(l++,d/=2),l+y>=g?(u=0,l=g):1<=l+y?(u=(t*d-1)*s(2,a),l+=y):(u=t*s(2,y-1)*s(2,a),l=0));8<=a;e[n+b]=255&u,b+=_,u/=256,a-=8);for(l=l<<a|u,p+=a;0<p;e[n+b]=255&l,b+=_,l/=256,p-=8);e[n+b-_]|=128*w}},{}],10:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],11:[function(e,t){var n=Math.round;function r(e){var t=i(e);return 864e5<=t?n(e/864e5)+"d":36e5<=t?n(e/36e5)+"h":6e4<=t?n(e/6e4)+"m":1e3<=t?n(e/1e3)+"s":e+"ms"}function s(e){var t=i(e);return 864e5<=t?o(e,t,864e5,"day"):36e5<=t?o(e,t,36e5,"hour"):6e4<=t?o(e,t,6e4,"minute"):1e3<=t?o(e,t,1e3,"second"):e+" ms"}function o(e,t,r,i){return n(e/r)+" "+i+(t>=1.5*r?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"==n&&0<e.length)return function(e){if(!(100<(e+="").length)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();return"years"===r||"year"===r||"yrs"===r||"yr"===r||"y"===r?315576e5*n:"weeks"===r||"week"===r||"w"===r?6048e5*n:"days"===r||"day"===r||"d"===r?864e5*n:"hours"===r||"hour"===r||"hrs"===r||"hr"===r||"h"===r?36e5*n:"minutes"===r||"minute"===r||"mins"===r||"min"===r||"m"===r?6e4*n:"seconds"===r||"second"===r||"secs"===r||"sec"===r||"s"===r?1e3*n:"milliseconds"===r||"millisecond"===r||"msecs"===r||"msec"===r||"ms"===r?n:void 0}}}(e);if("number"===n&&isFinite(e))return t.long?s(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],12:[function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(){p&&h&&(p=!1,h.length?f=h.concat(f):g=-1,f.length&&o())}function o(){if(!p){var e=i(s);p=!0;for(var t=f.length;t;){for(h=f,f=[];++g<t;)h&&h[g].run();g=-1,t=f.length}h=null,p=!1,function(e){if(u===clearTimeout)return clearTimeout(e);if((u===r||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}(e)}}function a(e,t){this.fun=e,this.array=t}function c(){}var l,u,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{u="function"==typeof clearTimeout?clearTimeout:r}catch(e){u=r}}();var h,f=[],p=!1,g=-1;d.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new a(e,t)),1!==f.length||p||i(o)},a.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(){return[]},d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],13:[function(e,t){(function(e){(function(){let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"==typeof window?e:window):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this)}).call(this,void 0===n.g?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:n.g)},{}],14:[function(e,t){(function(n,r){(function(){"use strict";var i=e("safe-buffer").Buffer,s=r.crypto||r.msCrypto;t.exports=s&&s.getRandomValues?function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(e);if(0<e)if(65536<e)for(var o=0;o<e;o+=65536)s.getRandomValues(r.slice(o,o+65536));else s.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}:function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this)}).call(this,e("_process"),void 0===n.g?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:n.g)},{_process:12,"safe-buffer":30}],15:[function(e,t){"use strict";function n(e,t,n){function r(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var s=function(e){function t(t,n,i){return e.call(this,r(t,n,i))||this}return function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(t,e),t}(n);s.prototype.name=n.name,s.prototype.code=e,i[e]=s}function r(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return e+""})),2<n?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(e+"")}var i={};n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){var i,s;if("string"==typeof t&&function(e,t,n){return e.substr(!n||0>n?0:+n,t.length)===t}(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(r(t,"type"));else{var o=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(o," ").concat(i," ").concat(r(t,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},{}],16:[function(e,t){(function(n){(function(){"use strict";function r(e){return this instanceof r?(a.call(this,e),c.call(this,e),this.allowHalfOpen=!0,void(e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",i))))):new r(e)}function i(){this._writableState.ended||n.nextTick(s,this)}function s(e){e.end()}var o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var a=e("./_stream_readable"),c=e("./_stream_writable");e("inherits")(r,a);for(var l,u=o(c.prototype),d=0;d<u.length;d++)l=u[d],r.prototype[l]||(r.prototype[l]=c.prototype[l]);Object.defineProperty(r.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(r.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(r.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0===this._readableState||void 0===this._writableState||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(e,t){"use strict";function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform");e("inherits")(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":19,inherits:10}],18:[function(e,t){(function(n,r){(function(){"use strict";function i(t,n,r){E=E||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof E),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=N(this,t,"readableHighWaterMark",r),this.buffer=new L,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(!I&&(I=e("string_decoder/").StringDecoder),this.decoder=new I(t.encoding),this.encoding=t.encoding)}function s(t){if(E=E||e("./_stream_duplex"),!(this instanceof s))return new s(t);var n=this instanceof E;this._readableState=new i(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),C.call(this)}function o(e,t,n,r,i){R("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(R("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?u(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,d(e)))}}(e,o);else if(i||(s=c(o,t)),s)F(e,s);else if(o.objectMode||t&&0<t.length)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===k.prototype||(t=function(e){return k.from(e)}(t)),r)o.endEmitted?F(e,new B):a(e,o,t,!0);else if(o.ended)F(e,new P);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?a(e,o,t,!1):h(e,o)):a(e,o,t,!1)}else r||(o.reading=!1,h(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function a(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&u(e)),h(e,t)}function c(e,t){var n;return function(e){return k.isBuffer(e)||e instanceof T}(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new U("chunk",["string","Buffer","Uint8Array"],t)),n}function l(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e==e?(e>t.highWaterMark&&(t.highWaterMark=function(e){return 1073741824<=e?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function u(e){var t=e._readableState;R("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(R("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(d,e))}function d(e){var t=e._readableState;R("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,m(e)}function h(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(f,e,t))}function f(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(R("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function p(e){var t=e._readableState;t.readableListening=0<e.listenerCount("readable"),t.resumeScheduled&&!t.paused?t.flowing=!0:0<e.listenerCount("data")&&e.resume()}function g(e){R("readable nexttick read 0"),e.read(0)}function y(e,t){R("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),m(e),t.flowing&&!t.reading&&e.read(0)}function m(e){var t=e._readableState;for(R("flow",t.flowing);t.flowing&&null!==e.read(););}function b(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function _(e){var t=e._readableState;R("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(w,t,e))}function w(e,t){if(R("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function v(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}var E;t.exports=s,s.ReadableState=i,e("events").EventEmitter;var R,S=function(e,t){return e.listeners(t).length},C=e("./internal/streams/stream"),k=e("buffer").Buffer,T=r.Uint8Array||function(){},A=e("util");R=A&&A.debuglog?A.debuglog("stream"):function(){};var I,O,D,L=e("./internal/streams/buffer_list"),x=e("./internal/streams/destroy"),N=e("./internal/streams/state").getHighWaterMark,M=e("../errors").codes,U=M.ERR_INVALID_ARG_TYPE,P=M.ERR_STREAM_PUSH_AFTER_EOF,j=M.ERR_METHOD_NOT_IMPLEMENTED,B=M.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(s,C);var F=x.errorOrDestroy,V=["error","close","destroy","pause","resume"];Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),s.prototype.destroy=x.destroy,s.prototype._undestroy=x.undestroy,s.prototype._destroy=function(e,t){t(e)},s.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=k.from(e,t),t=""),n=!0),o(this,e,t,!1,n)},s.prototype.unshift=function(e){return o(this,e,null,!0,!1)},s.prototype.isPaused=function(){return!1===this._readableState.flowing},s.prototype.setEncoding=function(t){I||(I=e("string_decoder/").StringDecoder);var n=new I(t);this._readableState.decoder=n,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=n.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this},s.prototype.read=function(e){R("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0===t.highWaterMark?0<t.length:t.length>=t.highWaterMark)||t.ended))return R("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?_(this):u(this),null;if(0===(e=l(e,t))&&t.ended)return 0===t.length&&_(this),null;var r,i=t.needReadable;return R("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&R("length less than watermark",i=!0),t.ended||t.reading?R("reading or ended",i=!1):i&&(R("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=l(n,t))),null===(r=0<e?b(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(!t.ended&&(t.needReadable=!0),n!==e&&t.ended&&_(this)),null!==r&&this.emit("data",r),r},s.prototype._read=function(){F(this,new j("_read()"))},s.prototype.pipe=function(e,t){function r(e,t){R("onunpipe"),e===d&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,s())}function i(){R("onend"),e.end()}function s(){R("cleanup"),e.removeListener("close",c),e.removeListener("finish",l),e.removeListener("drain",p),e.removeListener("error",a),e.removeListener("unpipe",r),d.removeListener("end",i),d.removeListener("end",u),d.removeListener("data",o),g=!0,h.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&p()}function o(t){R("ondata");var n=e.write(t);R("dest.write",n),!1===n&&((1===h.pipesCount&&h.pipes===e||1<h.pipesCount&&-1!==v(h.pipes,e))&&!g&&(R("false write response, pause",h.awaitDrain),h.awaitDrain++),d.pause())}function a(t){R("onerror",t),u(),e.removeListener("error",a),0===S(e,"error")&&F(e,t)}function c(){e.removeListener("finish",l),u()}function l(){R("onfinish"),e.removeListener("close",c),u()}function u(){R("unpipe"),d.unpipe(e)}var d=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,R("pipe count=%d opts=%j",h.pipesCount,t);var f=t&&!1===t.end||e===n.stdout||e===n.stderr?u:i;h.endEmitted?n.nextTick(f):d.once("end",f),e.on("unpipe",r);var p=function(e){return function(){var t=e._readableState;R("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&S(e,"data")&&(t.flowing=!0,m(e))}}(d);e.on("drain",p);var g=!1;return d.on("data",o),function(e,t,n){"function"==typeof e.prependListener?e.prependListener(t,n):e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",a),e.once("close",c),e.once("finish",l),e.emit("pipe",d),h.flowing||(R("pipe resume"),d.resume()),e},s.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=v(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},s.prototype.on=function(e,t){var r=C.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=0<this.listenerCount("readable"),!1!==i.flowing&&this.resume()):"readable"==e&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,R("on readable",i.length,i.reading),i.length?u(this):!i.reading&&n.nextTick(g,this)),r},s.prototype.addListener=s.prototype.on,s.prototype.removeListener=function(e,t){var r=C.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(p,this),r},s.prototype.removeAllListeners=function(e){var t=C.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.nextTick(p,this),t},s.prototype.resume=function(){var e=this._readableState;return e.flowing||(R("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(y,e,t))}(this,e)),e.paused=!1,this},s.prototype.pause=function(){return R("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(R("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},s.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(R("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){R("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||!(n.objectMode||i&&i.length)||t.push(i)||(r=!0,e.pause())})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<V.length;s++)e.on(V[s],this.emit.bind(this,V[s]));return this._read=function(t){R("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(s.prototype[Symbol.asyncIterator]=function(){return void 0===O&&(O=e("./internal/streams/async_iterator")),O(this)}),Object.defineProperty(s.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(s.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(s.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),s._fromList=b,Object.defineProperty(s.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(s.from=function(t,n){return void 0===D&&(D=e("./internal/streams/from")),D(s,t,n)})}).call(this)}).call(this,e("_process"),void 0===n.g?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:n.g)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(e,t){"use strict";function n(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new c);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function r(e){return this instanceof r?(d.call(this,e),this._transformState={afterTransform:n.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),void this.on("prefinish",i)):new r(e)}function i(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?s(this,null,null):this._flush((function(t,n){s(e,t,n)}))}function s(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new u;if(e._transformState.transforming)throw new l;return e.push(null)}t.exports=r;var o=e("../errors").codes,a=o.ERR_METHOD_NOT_IMPLEMENTED,c=o.ERR_MULTIPLE_CALLBACK,l=o.ERR_TRANSFORM_ALREADY_TRANSFORMING,u=o.ERR_TRANSFORM_WITH_LENGTH_0,d=e("./_stream_duplex");e("inherits")(r,d),r.prototype.push=function(e,t){return this._transformState.needTransform=!1,d.prototype.push.call(this,e,t)},r.prototype._transform=function(e,t,n){n(new a("_transform()"))},r.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},r.prototype._destroy=function(e,t){d.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(e,t){(function(n,r){(function(){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}function s(){}function o(t,n,r){w=w||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof w),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=T(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){h(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function a(t){var n=this instanceof(w=w||e("./_stream_duplex"));return n||v.call(a,this)?(this._writableState=new o(t,this,n),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),void R.call(this)):new a(t)}function c(e,t){var r=new M;P(e,r),n.nextTick(t,r)}function l(e,t,r,i){var s;return null===r?s=new N:"string"!=typeof r&&!t.objectMode&&(s=new I("chunk",["string","Buffer"],r)),!s||(P(e,s),n.nextTick(i,s),!1)}function u(e,t,n,r,i,s){if(!n){var o=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=S.from(t,n)),t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else d(e,t,!1,a,r,i,s);return c}function d(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new x("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function h(e,t){var r=e._writableState,i=r.sync,s=r.writecb;if("function"!=typeof s)throw new D;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,s){--t.pendingcb,r?(n.nextTick(s,i),n.nextTick(b,e,t),e._writableState.errorEmitted=!0,P(e,i)):(s(i),e._writableState.errorEmitted=!0,P(e,i),b(e,t))}(e,r,i,t,s);else{var o=g(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||p(e,r),i?n.nextTick(f,e,r,o,s):f(e,r,o,s)}}function f(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),b(e,t)}function p(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,s=Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,d(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,h=n.callback;if(d(e,t,!1,t.objectMode?1:l.length,l,u,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function g(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function y(e,t){e._final((function(n){t.pendingcb--,n&&P(e,n),t.prefinished=!0,e.emit("prefinish"),b(e,t)}))}function m(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(y,e,t)))}function b(e,t){var n=g(t);if(n&&(m(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function _(e,t,r){t.ending=!0,b(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}var w;t.exports=a,a.WritableState=o;var v,E={deprecate:e("util-deprecate")},R=e("./internal/streams/stream"),S=e("buffer").Buffer,C=r.Uint8Array||function(){},k=e("./internal/streams/destroy"),T=e("./internal/streams/state").getHighWaterMark,A=e("../errors").codes,I=A.ERR_INVALID_ARG_TYPE,O=A.ERR_METHOD_NOT_IMPLEMENTED,D=A.ERR_MULTIPLE_CALLBACK,L=A.ERR_STREAM_CANNOT_PIPE,x=A.ERR_STREAM_DESTROYED,N=A.ERR_STREAM_NULL_VALUES,M=A.ERR_STREAM_WRITE_AFTER_END,U=A.ERR_UNKNOWN_ENCODING,P=k.errorOrDestroy;e("inherits")(a,R),o.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(o.prototype,"buffer",{get:E.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(v=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(e){return!!v.call(this,e)||!(this!==a)&&e&&e._writableState instanceof o}})):v=function(e){return e instanceof this},a.prototype.pipe=function(){P(this,new L)},a.prototype.write=function(e,t,n){var r=this._writableState,i=!1,o=!r.objectMode&&function(e){return S.isBuffer(e)||e instanceof C}(e);return o&&!S.isBuffer(e)&&(e=function(e){return S.from(e)}(e)),"function"==typeof t&&(n=t,t=null),o?t="buffer":!t&&(t=r.defaultEncoding),"function"!=typeof n&&(n=s),r.ending?c(this,n):(o||l(this,r,e,n))&&(r.pendingcb++,i=u(this,r,o,e,t,n)),i},a.prototype.cork=function(){this._writableState.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&p(this,e))},a.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())))throw new U(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),a.prototype._write=function(e,t,n){n(new O("_write()"))},a.prototype._writev=null,a.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||_(this,r,n),this},Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),a.prototype.destroy=k.destroy,a.prototype._undestroy=k.undestroy,a.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),void 0===n.g?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:n.g)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(e,t){(function(n){(function(){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return{value:e,done:t}}function s(e){var t=e[l];if(null!==t){var n=e[g].read();null!==n&&(e[f]=null,e[l]=null,e[u]=null,t(i(n,!1)))}}function o(e){n.nextTick(s,e)}var a,c=e("./end-of-stream"),l=Symbol("lastResolve"),u=Symbol("lastReject"),d=Symbol("error"),h=Symbol("ended"),f=Symbol("lastPromise"),p=Symbol("handlePromise"),g=Symbol("stream"),y=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((a={get stream(){return this[g]},next:function(){var e=this,t=this[d];if(null!==t)return Promise.reject(t);if(this[h])return Promise.resolve(i(void 0,!0));if(this[g].destroyed)return new Promise((function(t,r){n.nextTick((function(){e[d]?r(e[d]):t(i(void 0,!0))}))}));var r,s=this[f];if(s)r=new Promise(function(e,t){return function(n,r){e.then((function(){return t[h]?void n(i(void 0,!0)):void t[p](n,r)}),r)}}(s,this));else{var o=this[g].read();if(null!==o)return Promise.resolve(i(o,!1));r=new Promise(this[p])}return this[f]=r,r}},r(a,Symbol.asyncIterator,(function(){return this})),r(a,"return",(function(){var e=this;return new Promise((function(t,n){e[g].destroy(null,(function(e){return e?void n(e):void t(i(void 0,!0))}))}))})),a),y);t.exports=function(e){var t,n=Object.create(m,(r(t={},g,{value:e,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,u,{value:null,writable:!0}),r(t,d,{value:null,writable:!0}),r(t,h,{value:e._readableState.endEmitted,writable:!0}),r(t,p,{value:function(e,t){var r=n[g].read();r?(n[f]=null,n[l]=null,n[u]=null,e(i(r,!1))):(n[l]=e,n[u]=t)},writable:!0}),t));return n[f]=null,c(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[u];return null!==t&&(n[f]=null,n[l]=null,n[u]=null,t(e)),void(n[d]=e)}var r=n[l];null!==r&&(n[f]=null,n[l]=null,n[u]=null,r(i(void 0,!0))),n[h]=!0})),e.on("readable",o.bind(null,n)),n}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":24,_process:12}],22:[function(e,t){"use strict";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function s(e,t,n){o.prototype.copy.call(e,t,n)}var o=e("buffer").Buffer,a=e("util").inspect,c=a&&a.custom||"inspect";t.exports=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.head=null,this.tail=null,this.length=0}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(e,[{key:"push",value:function(e){var t={data:e,next:null};0<this.length?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return this.head=1===this.length?this.tail=null:this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t=o.allocUnsafe(e>>>0),n=this.head,r=0;n;)s(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(r+=s===i.length?i:i.slice(0,e),0==(e-=s)){s===i.length?(++n,this.head=t.next?t.next:this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,this.head=n.next?n.next:this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:c,value:function(e,t){return a(this,function(e){for(var t,i=1;i<arguments.length;i++)t=null==arguments[i]?{}:arguments[i],i%2?n(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}));return e}({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:3,util:2}],23:[function(e,t){(function(e){(function(){"use strict";function n(e,t){i(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}t.exports={destroy:function(t,s){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(s?s(t):t&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!s&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(r,o):(o._writableState.errorEmitted=!0,e.nextTick(n,o,t)):e.nextTick(n,o,t):s?(e.nextTick(r,o),s(t)):e.nextTick(r,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this)}).call(this,e("_process"))},{_process:12}],24:[function(e,t){"use strict";function n(){}var r=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;t.exports=function e(t,i,s){if("function"==typeof i)return e(t,null,i);i||(i={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(s||n);var o=i.readable||!1!==i.readable&&t.readable,a=i.writable||!1!==i.writable&&t.writable,c=function(){t.writable||u()},l=t._writableState&&t._writableState.finished,u=function(){a=!1,l=!0,o||s.call(t)},d=t._readableState&&t._readableState.endEmitted,h=function(){o=!1,d=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!d?(t._readableState&&t._readableState.ended||(e=new r),s.call(t,e)):a&&!l?(t._writableState&&t._writableState.ended||(e=new r),s.call(t,e)):void 0},g=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",p),t.req?g():t.on("request",g)):a&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",h),t.on("finish",u),!1!==i.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",u),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",u),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",u),t.removeListener("end",h),t.removeListener("error",f),t.removeListener("close",p)}}},{"../../../errors":15}],25:[function(e,t){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(e,t){"use strict";function n(e){if(e)throw e}function r(t,n,r,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var s=!1;t.on("close",(function(){s=!0})),void 0===a&&(a=e("./end-of-stream")),a(t,{readable:n,writable:r},(function(e){return e?i(e):(s=!0,void i())}));var o=!1;return function(e){if(!s)return o?void 0:(o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new u("pipe")))}}function i(e){e()}function s(e,t){return e.pipe(t)}function o(e){return e.length&&"function"==typeof e[e.length-1]?e.pop():n}var a,c=e("../../../errors").codes,l=c.ERR_MISSING_ARGS,u=c.ERR_STREAM_DESTROYED;t.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=o(t);if(Array.isArray(t[0])&&(t=t[0]),2>t.length)throw new l("streams");var c,u=t.map((function(e,n){var s=n<t.length-1;return r(e,s,0<n,(function(e){c||(c=e),e&&u.forEach(i),s||(u.forEach(i),a(c))}))}));return t.reduce(s)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(e,t){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,i,s){var o=function(e,t,n){return null==e.highWaterMark?t?e[n]:null:e.highWaterMark}(t,s,i);if(null!=o){if(!isFinite(o)||r(o)!==o||0>o)throw new n(s?i:"highWaterMark",o);return r(o)}return e.objectMode?16:16384}}},{"../../../errors":15}],28:[function(e,t){t.exports=e("events").EventEmitter},{events:7}],29:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return o(e,t,n)}var s=e("buffer"),o=s.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?t.exports=s:(r(s,n),n.Buffer=i),i.prototype=Object.create(o.prototype),r(o,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s.SlowBuffer(e)}},{buffer:3}],31:[function(e,t,n){"use strict";function r(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(h.isEncoding===f||!f(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=o,this.end=a,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=l,t=3;break;default:return this.write=u,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=h.allocUnsafe(t)}function i(e){return 127>=e?0:6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1<e.lastNeed&&1<t.length){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(2<e.lastNeed&&2<t.length&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0===n?this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length)):n}function o(e,t){if(0==(e.length-t)%2){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(55296<=r&&56319>=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0==n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}var h=e("safe-buffer").Buffer,f=h.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};n.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var s=i(t[r]);return 0<=s?(0<s&&(e.lastNeed=s-1),s):--r<n||-2===s?0:0<=(s=i(t[r]))?(0<s&&(e.lastNeed=s-2),s):--r<n||-2===s?0:0<=(s=i(t[r]))?(0<s&&(2===s?s=0:e.lastNeed=s-3),s):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},r.prototype.fillLast=function(e){return this.lastNeed<=e.length?(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),void(this.lastNeed-=e.length))}},{"safe-buffer":30}],32:[function(e,t){(function(e){(function(){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===(n+"").toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,void 0===n.g?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:n.g)},{}],"/":[function(e,t){function n(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}const r=e("debug")("simple-peer"),i=e("get-browser-rtc"),s=e("randombytes"),o=e("readable-stream"),a=e("queue-microtask"),c=e("err-code"),{Buffer:l}=e("buffer"),u=65536;class d extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||d.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},d.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void this.destroy(c(e,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{!t.address||t.address.endsWith(".local")?function(e){console.warn(e)}("Ignoring unsupported ICE candidate."):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}addStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach((t=>{this.addTrack(t,e)}))}}addTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(e)||new Map;let r=n.get(t);if(r)throw r.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(e,t),n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation()}replaceTrack(e,t,n){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const r=this._senderMap.get(e),i=r?r.get(n):null;if(!i)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,r),null==i.replaceTrack?this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):i.replaceTrack(t)}removeTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(e),r=n?n.get(t):null;if(!r)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(r):this.destroy(c(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach((t=>{this.removeTrack(t,e)}))}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a((()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1})))}negotiate(){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((()=>{this._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(e){this._destroy(e,(()=>{}))}_destroy(e,t){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),a((()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()})))}_setupData(e){if(!e.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=u),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{const t=e.error instanceof Error?e.error:new Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.destroy(c(t,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_read(){}_write(e,t,n){if(this.destroyed)return n(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_onFinish(){if(!this.destroyed){const e=()=>{setTimeout((()=>this.destroy()),1e3)};this._connected?e():this.once("connect",e)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))}),this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=n(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})}};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))}))}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach((e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=n(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),("connected"===e||"completed"===e)&&(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((n=>{const r=[];n.forEach((e=>{r.push(t(e))})),e(null,r)}),(t=>e(t))):0<this._pc.getStats.length?this._pc.getStats((n=>{if(this.destroyed)return;const r=[];n.result().forEach((e=>{const n={};e.names().forEach((t=>{n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,r.push(t(n))})),e(null,r)}),(t=>e(t))):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats(((t,n)=>{if(this.destroyed)return;t&&(n=[]);const r={},i={},s={};let o=!1;n.forEach((e=>{("remotecandidate"===e.type||"remote-candidate"===e.type)&&(r[e.id]=e),("localcandidate"===e.type||"local-candidate"===e.type)&&(i[e.id]=e),("candidatepair"===e.type||"candidate-pair"===e.type)&&(s[e.id]=e)}));const a=e=>{o=!0;let t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=+t.port):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=+t.portNumber):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=+t[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[e.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=+n.port):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=+n.portNumber):"string"==typeof e.googRemoteAddress&&(n=e.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=+n[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)})),o||Object.keys(s).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)}))};e()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>u)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=l.from(t)),this.push(t)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach((t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some((e=>e.id===t.id))||(this._remoteStreams.push(t),a((()=>{this._debug("on stream"),this.emit("stream",t)})))}))}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],r.apply(null,e)}}d.WEBRTC_SUPPORT=!!i(),d.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},d.channelConfig={},t.exports=d},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/"))}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{EntityProvider:()=>Fc,__experimentalFetchLinkSuggestions:()=>Qa,__experimentalFetchUrlData:()=>ec,__experimentalUseEntityRecord:()=>zc,__experimentalUseEntityRecords:()=>Jc,__experimentalUseResourcePermissions:()=>Zc,fetchBlockPatterns:()=>tc,store:()=>yl,useEntityBlockEditor:()=>ul,useEntityId:()=>tl,useEntityProp:()=>dl,useEntityRecord:()=>$c,useEntityRecords:()=>Kc,useResourcePermissions:()=>Xc});var e={};n.r(e),n.d(e,{__experimentalBatch:()=>ao,__experimentalReceiveCurrentGlobalStylesId:()=>Ks,__experimentalReceiveThemeBaseGlobalStyles:()=>Js,__experimentalReceiveThemeGlobalStyleVariations:()=>Qs,__experimentalSaveSpecifiedEntityEdits:()=>lo,__unstableCreateUndoLevel:()=>so,addEntities:()=>$s,deleteEntityRecord:()=>to,editEntityRecord:()=>no,receiveAutosaves:()=>fo,receiveCurrentTheme:()=>Ys,receiveCurrentUser:()=>Hs,receiveDefaultTemplateId:()=>go,receiveEmbedPreview:()=>eo,receiveEntityRecords:()=>zs,receiveNavigationFallbackId:()=>po,receiveRevisions:()=>yo,receiveThemeGlobalStyleRevisions:()=>Zs,receiveThemeSupports:()=>Xs,receiveUploadPermissions:()=>uo,receiveUserPermission:()=>ho,receiveUserQuery:()=>Gs,redo:()=>io,saveEditedEntityRecord:()=>co,saveEntityRecord:()=>oo,undo:()=>ro});var t={};n.r(t),n.d(t,{__experimentalGetCurrentGlobalStylesId:()=>Sa,__experimentalGetCurrentThemeBaseGlobalStyles:()=>Ma,__experimentalGetCurrentThemeGlobalStylesVariations:()=>Ua,__experimentalGetDirtyEntityRecords:()=>ca,__experimentalGetEntitiesBeingSaved:()=>la,__experimentalGetEntityRecordNoResolver:()=>na,__experimentalGetTemplateForLink:()=>Na,canUser:()=>Aa,canUserEditEntityRecord:()=>Ia,getAuthors:()=>Yo,getAutosave:()=>Da,getAutosaves:()=>Oa,getBlockPatternCategories:()=>ja,getBlockPatterns:()=>Pa,getCurrentTheme:()=>Ra,getCurrentThemeGlobalStylesRevisions:()=>Fa,getCurrentUser:()=>Ko,getDefaultTemplateId:()=>Va,getEditedEntityRecord:()=>fa,getEmbedPreview:()=>ka,getEntitiesByKind:()=>Qo,getEntitiesConfig:()=>Xo,getEntity:()=>Zo,getEntityConfig:()=>ea,getEntityRecord:()=>ta,getEntityRecordEdits:()=>ua,getEntityRecordNonTransientEdits:()=>da,getEntityRecords:()=>sa,getEntityRecordsTotalItems:()=>oa,getEntityRecordsTotalPages:()=>aa,getLastEntityDeleteError:()=>ba,getLastEntitySaveError:()=>ma,getRawEntityRecord:()=>ra,getRedoEdit:()=>wa,getReferenceByDistinctEdits:()=>xa,getRevision:()=>Wa,getRevisions:()=>qa,getThemeSupports:()=>Ca,getUndoEdit:()=>_a,getUserPatternCategories:()=>Ba,getUserQueryResults:()=>Jo,hasEditsForEntityRecord:()=>ha,hasEntityRecords:()=>ia,hasFetchedAutosaves:()=>La,hasRedo:()=>Ea,hasUndo:()=>va,isAutosavingEntityRecord:()=>pa,isDeletingEntityRecord:()=>ya,isPreviewEmbedFallback:()=>Ta,isRequestingEmbedPreview:()=>zo,isSavingEntityRecord:()=>ga});var i={};n.r(i),n.d(i,{getBlockPatternsForPostType:()=>$a,getNavigationFallbackId:()=>Ha,getUndoManager:()=>Ga});var s={};n.r(s),n.d(s,{__experimentalGetCurrentGlobalStylesId:()=>yc,__experimentalGetCurrentThemeBaseGlobalStyles:()=>mc,__experimentalGetCurrentThemeGlobalStylesVariations:()=>bc,__experimentalGetTemplateForLink:()=>gc,canUser:()=>dc,canUserEditEntityRecord:()=>hc,getAuthors:()=>nc,getAutosave:()=>pc,getAutosaves:()=>fc,getBlockPatternCategories:()=>vc,getBlockPatterns:()=>wc,getCurrentTheme:()=>cc,getCurrentThemeGlobalStylesRevisions:()=>_c,getCurrentUser:()=>rc,getDefaultTemplateId:()=>Sc,getEditedEntityRecord:()=>oc,getEmbedPreview:()=>uc,getEntityRecord:()=>ic,getEntityRecords:()=>ac,getNavigationFallbackId:()=>Rc,getRawEntityRecord:()=>sc,getRevision:()=>kc,getRevisions:()=>Cc,getThemeSupports:()=>lc,getUserPatternCategories:()=>Ec});const o=window.wp.data;var a=n(5619),c=n.n(a);const l=window.wp.compose,u=window.wp.isShallowEqual;var d=n.n(u);function h(e,t){const n={...e};return Object.entries(t).forEach((([e,t])=>{n[e]?n[e]={...n[e],to:t.to}:n[e]=t})),n}const f=(e,t)=>{const n=e?.findIndex((({id:e})=>"string"==typeof e?e===t.id:d()(e,t.id))),r=[...e];return-1!==n?r[n]={id:t.id,changes:h(r[n].changes,t.changes)}:r.push(t),r};const p=e=>t=>(n,r)=>void 0===n||e(r)?t(n,r):n,g=e=>t=>(n,r)=>t(n,e(r)),y=e=>t=>(n={},r)=>{const i=r[e];if(void 0===i)return n;const s=t(n[i],r);return s===n[i]?n:{...n,[i]:s}};var m=function(){return m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},m.apply(this,arguments)};function b(e){return e.toLowerCase()}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var _=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],w=/[^A-Z0-9]+/gi;function v(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?_:n,i=t.stripRegexp,s=void 0===i?w:i,o=t.transform,a=void 0===o?b:o,c=t.delimiter,l=void 0===c?" ":c,u=E(E(e,r,"$1\0$2"),s,"\0"),d=0,h=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(h-1);)h--;return u.slice(d,h).split("\0").map(a).join(l)}function E(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function R(e){return function(e){return e.charAt(0).toUpperCase()+e.substr(1)}(e.toLowerCase())}function S(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>="0"&&n<="9"?"_"+n+r:""+n.toUpperCase()+r}function C(e,t){return void 0===t&&(t={}),v(e,m({delimiter:"",transform:S},t))}const k=window.wp.apiFetch;var T=n.n(k);const A=window.wp.i18n,I=window.wp.richText;var O,D=new Uint8Array(16);function L(){if(!O&&!(O="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(D)}const x=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var N=[],M=0;M<256;++M)N.push((M+256).toString(16).substr(1));const U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(N[e[t+0]]+N[e[t+1]]+N[e[t+2]]+N[e[t+3]]+"-"+N[e[t+4]]+N[e[t+5]]+"-"+N[e[t+6]]+N[e[t+7]]+"-"+N[e[t+8]]+N[e[t+9]]+"-"+N[e[t+10]]+N[e[t+11]]+N[e[t+12]]+N[e[t+13]]+N[e[t+14]]+N[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&x.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},P=function(e,t,n){var r=(e=e||{}).random||(e.rng||L)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return U(r)},j=window.wp.url,B=window.wp.deprecated;var F=n.n(B);function V(e,t,n){if(!e||"object"!=typeof e)return e;const r=Array.isArray(t)?t:t.split(".");return r.reduce(((e,t,i)=>(void 0===e[t]&&(Number.isInteger(r[i+1])?e[t]=[]:e[t]={}),i===r.length-1&&(e[t]=n),e[t])),e),e}function q(e,t,n){if(!e||"object"!=typeof e||"string"!=typeof t&&!Array.isArray(t))return e;const r=Array.isArray(t)?t:t.split(".");let i=e;return r.forEach((e=>{i=i?.[e]})),void 0!==i?i:n}function W(e,t,n){return{type:"RECEIVE_ITEMS",items:Array.isArray(e)?e:[e],persistedEdits:t,meta:n}}let G=null;async function H(e){if(null===G){const e=await T()({path:"/batch/v1",method:"OPTIONS"});G=e.endpoints[0].args.requests.maxItems}const t=[];for(const n of function(e,t){const n=[...e],r=[];for(;n.length;)r.push(n.splice(0,t));return r}(e,G)){const e=await T()({path:"/batch/v1",method:"POST",data:{validation:"require-all-validate",requests:n.map((e=>({path:e.path,body:e.data,method:e.method,headers:e.headers})))}});let r;r=e.failed?e.responses.map((e=>({error:e?.body}))):e.responses.map((e=>{const t={};return e.status>=200&&e.status<300?t.output=e.body:t.error=e.body,t})),t.push(...r)}return t}function $(e=H){let t=0,n=[];const r=new z;return{add(e){const i=++t;r.add(i);const s=e=>new Promise(((t,s)=>{n.push({input:e,resolve:t,reject:s}),r.delete(i)}));return"function"==typeof e?Promise.resolve(e(s)).finally((()=>{r.delete(i)})):s(e)},async run(){let t;r.size&&await new Promise((e=>{const t=r.subscribe((()=>{r.size||(t(),e(void 0))}))}));try{if(t=await e(n.map((({input:e})=>e))),t.length!==n.length)throw new Error("run: Array returned by processor must be same size as input array.")}catch(e){for(const{reject:t}of n)t(e);throw e}let i=!0;return t.forEach(((e,t)=>{const r=n[t];var s;e?.error?(r?.reject(e.error),i=!1):r?.resolve(null!==(s=e?.output)&&void 0!==s?s:e)})),n=[],i}}}class z{constructor(...e){this.set=new Set(...e),this.subscribers=new Set}get size(){return this.set.size}add(e){return this.set.add(e),this.subscribers.forEach((e=>e())),this}delete(e){const t=this.set.delete(e);return this.subscribers.forEach((e=>e())),t}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}}const Y="core",K=()=>new Map,J=e=>{const t=K();return e.forEach(((e,n)=>{t.set(n,e)})),t},Q=(e,t,n)=>{let r=e.get(t);return void 0===r&&e.set(t,r=n()),r},X=()=>new Set,Z=e=>e[e.length-1],ee=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},te=Array.from,ne=Array.isArray;class re{constructor(){this._observers=K()}on(e,t){Q(this._observers,e,X).add(t)}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);void 0!==n&&(n.delete(t),0===n.size&&this._observers.delete(e))}emit(e,t){return te((this._observers.get(e)||K()).values()).forEach((e=>e(...t)))}destroy(){this._observers=K()}}const ie=Math.floor,se=(Math.ceil,Math.abs),oe=(Math.imul,Math.round,Math.log10),ae=(Math.log2,Math.log,Math.sqrt,(e,t)=>e<t?e:t),ce=(e,t)=>e>t?e:t,le=(Number.isNaN,Math.pow,Math.sign,e=>0!==e?e<0:1/e<0),ue=String.fromCharCode,de=(String.fromCodePoint,ue(65535),/^\s*/g),he=/([A-Z])/g,fe=(e,t)=>(e=>e.replace(de,""))(e.replace(he,(e=>`${t}${(e=>e.toLowerCase())(e)}`))),pe="undefined"!=typeof TextEncoder?new TextEncoder:null,ge=pe?e=>pe.encode(e):e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r};let ye="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ye&&1===ye.decode(new Uint8Array).length&&(ye=null);let me=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},be=!0;try{"undefined"!=typeof localStorage&&(me=localStorage,be=!1)}catch(e){}const _e=me,we=Object.assign,ve=Object.keys,Ee=e=>ve(e).length,Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Se=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Se(e,t,n+1)}},Ce=()=>{},ke=e=>e,Te=(e,t)=>{if(null==e||null==t)return((e,t)=>e===t)(e,t);if(e.constructor!==t.constructor)return!1;if(e===t)return!0;switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!Te(e.get(n),t.get(n)))return!1;break;case Object:if(Ee(e)!==Ee(t))return!1;for(const n in e)if(!Re(e,n)||!Te(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Te(e[n],t[n]))return!1;break;default:return!1}return!0},Ae="undefined"!=typeof process&&process.release&&/node|io\.js/.test(process.release.name),Ie="undefined"!=typeof window&&"undefined"!=typeof document&&!Ae;let Oe;"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);const De=[],Le=e=>(()=>{if(void 0===Oe)if(Ae){Oe=K();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];"-"===r[0]?(null!==t&&Oe.set(t,""),t=r):null!==t?(Oe.set(t,r),t=null):De.push(r)}null!==t&&Oe.set(t,"")}else"object"==typeof location?(Oe=K(),(location.search||"?").slice(1).split("&").forEach((e=>{if(0!==e.length){const[t,n]=e.split("=");Oe.set(`--${fe(t,"-")}`,n),Oe.set(`-${fe(t,"-")}`,n)}}))):Oe=K();return Oe})().has(e),xe=e=>{return void 0===(t=Ae?process.env[e.toUpperCase()]:_e.getItem(e))?null:t;var t};Le("--"+"production")||xe("production");const Ne=Ae&&(Me=process.env.FORCE_COLOR,["true","1","2"].includes(Me));var Me;const Ue=!Le("no-colors")&&(!Ae||process.stdout.isTTY||Ne)&&(!Ae||Le("color")||Ne||null!==xe("COLORTERM")||(xe("TERM")||"").includes("color")),Pe=e=>new Uint8Array(e),je=(e,t,n)=>new Uint8Array(e,t,n),Be=Ie?e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=ue(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),Fe=Ie?e=>{const t=atob(e),n=Pe(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}:e=>{const t=Buffer.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},Ve=64,qe=128,We=127,Ge=Number.MAX_SAFE_INTEGER,He=(Number.MIN_SAFE_INTEGER,Number.isInteger||(e=>"number"==typeof e&&isFinite(e)&&ie(e)===e));Number.isNaN,Number.parseInt;class $e{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const ze=()=>new $e,Ye=e=>{const t=new Uint8Array((e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t})(e));let n=0;for(let r=0;r<e.bufs.length;r++){const i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(je(e.cbuf.buffer,0,e.cpos),n),t},Ke=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*n),e.cpos=0),e.cbuf[e.cpos++]=t},Je=Ke,Qe=(e,t)=>{for(;t>We;)Ke(e,qe|We&t),t=ie(t/128);Ke(e,We&t)},Xe=(e,t)=>{const n=le(t);for(n&&(t=-t),Ke(e,(t>63?qe:0)|(n?Ve:0)|63&t),t=ie(t/64);t>0;)Ke(e,(t>We?qe:0)|We&t),t=ie(t/128)},Ze=new Uint8Array(3e4),et=Ze.length/3,tt=pe&&pe.encodeInto?(e,t)=>{if(t.length<et){const n=pe.encodeInto(t,Ze).written||0;Qe(e,n);for(let t=0;t<n;t++)Ke(e,Ze[t])}else rt(e,ge(t))}:(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Qe(e,r);for(let t=0;t<r;t++)Ke(e,n.codePointAt(t))},nt=(e,t)=>{const n=e.cbuf.length,r=e.cpos,i=ae(n-r,t.length),s=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,s>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(ce(2*n,s)),e.cbuf.set(t.subarray(i)),e.cpos=s)},rt=(e,t)=>{Qe(e,t.byteLength),nt(e,t)},it=(e,t)=>{((e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(je(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(2*ce(n,t)),e.cpos=0)})(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},st=new DataView(new ArrayBuffer(4)),ot=(e,t)=>{switch(typeof t){case"string":Ke(e,119),tt(e,t);break;case"number":He(t)&&se(t)<=2147483647?(Ke(e,125),Xe(e,t)):(n=t,st.setFloat32(0,n),st.getFloat32(0)===n?(Ke(e,124),((e,t)=>{it(e,4).setFloat32(0,t,!1)})(e,t)):(Ke(e,123),((e,t)=>{it(e,8).setFloat64(0,t,!1)})(e,t)));break;case"bigint":Ke(e,122),((e,t)=>{it(e,8).setBigInt64(0,t,!1)})(e,t);break;case"object":if(null===t)Ke(e,126);else if(ne(t)){Ke(e,117),Qe(e,t.length);for(let n=0;n<t.length;n++)ot(e,t[n])}else if(t instanceof Uint8Array)Ke(e,116),rt(e,t);else{Ke(e,118);const n=Object.keys(t);Qe(e,n.length);for(let r=0;r<n.length;r++){const i=n[r];tt(e,i),ot(e,t[i])}}break;case"boolean":Ke(e,t?120:121);break;default:Ke(e,127)}var n};class at extends $e{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Qe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const ct=e=>{e.count>0&&(Xe(e.encoder,1===e.count?e.s:-e.s),e.count>1&&Qe(e.encoder,e.count-2))};class lt{constructor(){this.encoder=new $e,this.s=0,this.count=0}write(e){this.s===e?this.count++:(ct(this),this.count=1,this.s=e)}toUint8Array(){return ct(this),Ye(this.encoder)}}const ut=e=>{if(e.count>0){const t=2*e.diff+(1===e.count?0:1);Xe(e.encoder,t),e.count>1&&Qe(e.encoder,e.count-2)}};class dt{constructor(){this.encoder=new $e,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(ut(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return ut(this),Ye(this.encoder)}}class ht{constructor(){this.sarr=[],this.s="",this.lensE=new lt}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new $e;return this.sarr.push(this.s),this.s="",tt(e,this.sarr.join("")),nt(e,this.lensE.toUint8Array()),Ye(e)}}const ft=e=>new Error(e),pt=()=>{throw ft("Method unimplemented")},gt=()=>{throw ft("Unexpected case")},yt=ft("Unexpected end of array"),mt=ft("Integer out of Range");class bt{constructor(e){this.arr=e,this.pos=0}}const _t=e=>new bt(e),wt=e=>((e,t)=>{const n=je(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n})(e,Et(e)),vt=e=>e.arr[e.pos++],Et=e=>{let t=0,n=1;const r=e.arr.length;for(;e.pos<r;){const r=e.arr[e.pos++];if(t+=(r&We)*n,n*=128,r<qe)return t;if(t>Ge)throw mt}throw yt},Rt=e=>{let t=e.arr[e.pos++],n=63&t,r=64;const i=(t&Ve)>0?-1:1;if(!(t&qe))return i*n;const s=e.arr.length;for(;e.pos<s;){if(t=e.arr[e.pos++],n+=(t&We)*r,r*=128,t<qe)return i*n;if(n>Ge)throw mt}throw yt},St=ye?e=>ye.decode(wt(e)):e=>{let t=Et(e);if(0===t)return"";{let n=String.fromCodePoint(vt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(vt(e));else for(;t>0;){const r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Ct=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},kt=[e=>{},e=>null,Rt,e=>Ct(e,4).getFloat32(0,!1),e=>Ct(e,8).getFloat64(0,!1),e=>Ct(e,8).getBigInt64(0,!1),e=>!1,e=>!0,St,e=>{const t=Et(e),n={};for(let r=0;r<t;r++)n[St(e)]=Tt(e);return n},e=>{const t=Et(e),n=[];for(let r=0;r<t;r++)n.push(Tt(e));return n},wt],Tt=e=>kt[127-vt(e)](e);class At extends bt{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return 0===this.count&&(this.s=this.reader(this),(e=this).pos!==e.arr.length?this.count=Et(this)+1:this.count=-1),this.count--,this.s;var e}}class It extends bt{constructor(e){super(e),this.s=0,this.count=0}read(){if(0===this.count){this.s=Rt(this);const e=le(this.s);this.count=1,e&&(this.s=-this.s,this.count=Et(this)+2)}return this.count--,this.s}}class Ot extends bt{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){const e=Rt(this),t=1&e;this.diff=ie(e/2),this.count=1,t&&(this.count=Et(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Dt{constructor(e){this.decoder=new It(e),this.str=St(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}crypto.subtle;const Lt=crypto.getRandomValues.bind(crypto),xt=Math.random,Nt=()=>Lt(new Uint32Array(1))[0],Mt=[1e7]+-1e3+-4e3+-8e3+-1e11,Ut=()=>Mt.replace(/[018]/g,(e=>(e^Nt()&15>>e/4).toString(16))),Pt=e=>new Promise(e),jt=(Promise.all.bind(Promise),e=>Promise.resolve(e));class Bt{constructor(e,t){this.left=e,this.right=t}}const Ft=(e,t)=>new Bt(e,t),Vt="undefined"!=typeof document?document:{},qt=("undefined"!=typeof DOMParser&&new DOMParser,Vt.ELEMENT_NODE,Vt.TEXT_NODE,Vt.CDATA_SECTION_NODE,Vt.COMMENT_NODE,Vt.DOCUMENT_NODE,Vt.DOCUMENT_TYPE_NODE,Vt.DOCUMENT_FRAGMENT_NODE,Symbol),Wt=Date.now,Gt=qt(),Ht=qt(),$t=qt(),zt=qt(),Yt=qt(),Kt=qt(),Jt=qt(),Qt=qt(),Xt=qt(),Zt=[Yt,Jt,Qt,$t];let en=0,tn=Wt();const nn={[Gt]:Ft("font-weight","bold"),[Ht]:Ft("font-weight","normal"),[$t]:Ft("color","blue"),[Yt]:Ft("color","green"),[zt]:Ft("color","grey"),[Kt]:Ft("color","red"),[Jt]:Ft("color","purple"),[Qt]:Ft("color","orange"),[Xt]:Ft("color","black")},rn=Ue?e=>{const t=[],n=[],r=K();let i=[],s=0;for(;s<e.length;s++){const i=e[s],o=nn[i];if(void 0!==o)r.set(o.left,o.right);else{if(i.constructor!==String&&i.constructor!==Number)break;{const e=((e,t)=>{const n=[];for(const[r,i]of e)n.push(t(i,r));return n})(r,((e,t)=>`${t}:${e};`)).join("");s>0||e.length>0?(t.push("%c"+i),n.push(e)):t.push(i)}}}for(s>0&&(i=n,i.unshift(t.join("")));s<e.length;s++){const t=e[s];t instanceof Symbol||i.push(t)}return i}:e=>{const t=[],n=[];let r=0;for(;r<e.length;r++){const i=e[r];i.constructor===String||i.constructor===Number?t.push(i):i.constructor===Object&&n.push(JSON.stringify(i))}return n},sn=(...e)=>{console.log(...rn(e)),on.forEach((t=>t.print(e)))},on=X(),an=e=>({[Symbol.iterator](){return this},next:e}),cn=(e,t)=>an((()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}));class ln{constructor(e,t){this.clock=e,this.len=t}}class un{constructor(){this.clients=new Map}}const dn=(e,t,n)=>t.clients.forEach(((t,r)=>{const i=e.doc.store.clients.get(r);for(let r=0;r<t.length;r++){const s=t[r];sr(e,i,s.clock,s.len,n)}})),hn=(e,t)=>{const n=e.clients.get(t.client);return void 0!==n&&null!==((e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const i=ie((n+r)/2),s=e[i],o=s.clock;if(o<=t){if(t<o+s.len)return i;n=i+1}else r=i-1}return null})(n,t.clock)},fn=e=>{e.clients.forEach((e=>{let t,n;for(e.sort(((e,t)=>e.clock-t.clock)),t=1,n=1;t<e.length;t++){const r=e[n-1],i=e[t];r.clock+r.len>=i.clock?r.len=ce(r.len,i.clock+i.len-r.clock):(n<t&&(e[n]=i),n++)}e.length=n}))},pn=(e,t,n,r)=>{Q(e.clients,t,(()=>[])).push(new ln(n,r))},gn=()=>new un,yn=(e,t)=>{Qe(e.restEncoder,t.clients.size),te(t.clients.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,n])=>{e.resetDsCurVal(),Qe(e.restEncoder,t);const r=n.length;Qe(e.restEncoder,r);for(let t=0;t<r;t++){const r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}}))},mn=e=>{const t=new un,n=Et(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();const n=Et(e.restDecoder),r=Et(e.restDecoder);if(r>0){const i=Q(t.clients,n,(()=>[]));for(let t=0;t<r;t++)i.push(new ln(e.readDsClock(),e.readDsLen()))}}return t},bn=(e,t,n)=>{const r=new un,i=Et(e.restDecoder);for(let s=0;s<i;s++){e.resetDsCurVal();const i=Et(e.restDecoder),s=Et(e.restDecoder),o=n.clients.get(i)||[],a=Xn(n,i);for(let n=0;n<s;n++){const n=e.readDsClock(),s=n+e.readDsLen();if(n<a){a<s&&pn(r,i,a,s-a);let e=er(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,Fi(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<s);)c.deleted||(s<c.id.clock+c.length&&o.splice(e,0,Fi(t,c,s-c.id.clock)),c.delete(t))}else pn(r,i,n,s-n)}}if(r.clients.size>0){const e=new In;return Qe(e.restEncoder,0),yn(e,r),e.toUint8Array()}return null},wn=Nt;class vn extends re{constructor({guid:e=Ut(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=wn(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Jn,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Pt((e=>{this.on("load",(()=>{this.isLoaded=!0,e(this)}))}));const a=()=>Pt((e=>{const t=n=>{void 0!==n&&!0!==n||(this.off("sync",t),e())};this.on("sync",t)}));this.on("sync",(e=>{!1===e&&this.isSynced&&(this.whenSynced=a()),this.isSynced=void 0===e||!0===e,this.isLoaded||this.emit("load",[])})),this.whenSynced=a()}load(){const e=this._item;null===e||this.shouldLoad||dr(e.parent.doc,(e=>{e.subdocsLoaded.add(this)}),null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(te(this.subdocs).map((e=>e.guid)))}transact(e,t=null){return dr(this,e,t)}get(e,t=Dr){const n=Q(this.share,e,(()=>{const e=new t;return e._integrate(this,null),e})),r=n.constructor;if(t!==Dr&&r!==t){if(r===Dr){const r=new t;r._map=n._map,n._map.forEach((e=>{for(;null!==e;e=e.left)e.parent=r})),r._start=n._start;for(let e=r._start;null!==e;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}throw new Error(`Type with the name ${e} has already been defined with a different constructor`)}return n}getArray(e=""){return this.get(e,Kr)}getText(e=""){return this.get(e,fi)}getMap(e=""){return this.get(e,Qr)}getXmlFragment(e=""){return this.get(e,gi)}toJSON(){const e={};return this.share.forEach(((t,n)=>{e[n]=t.toJSON()})),e}destroy(){te(this.subdocs).forEach((e=>e.destroy()));const e=this._item;if(null!==e){this._item=null;const t=e.content;t.doc=new vn({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,dr(e.parent.doc,(n=>{const r=t.doc;e.deleted||n.subdocsAdded.add(r),n.subdocsRemoved.add(this)}),null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}}class En{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Et(this.restDecoder)}readDsLen(){return Et(this.restDecoder)}}class Rn extends En{readLeftID(){return Gn(Et(this.restDecoder),Et(this.restDecoder))}readRightID(){return Gn(Et(this.restDecoder),Et(this.restDecoder))}readClient(){return Et(this.restDecoder)}readInfo(){return vt(this.restDecoder)}readString(){return St(this.restDecoder)}readParentInfo(){return 1===Et(this.restDecoder)}readTypeRef(){return Et(this.restDecoder)}readLen(){return Et(this.restDecoder)}readAny(){return Tt(this.restDecoder)}readBuf(){return(e=>{const t=Pe(e.byteLength);return t.set(e),t})(wt(this.restDecoder))}readJSON(){return JSON.parse(St(this.restDecoder))}readKey(){return St(this.restDecoder)}}class Sn{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Et(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Et(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Cn extends Sn{constructor(e){super(e),this.keys=[],Et(e),this.keyClockDecoder=new Ot(wt(e)),this.clientDecoder=new It(wt(e)),this.leftClockDecoder=new Ot(wt(e)),this.rightClockDecoder=new Ot(wt(e)),this.infoDecoder=new At(wt(e),vt),this.stringDecoder=new Dt(wt(e)),this.parentInfoDecoder=new At(wt(e),vt),this.typeRefDecoder=new It(wt(e)),this.lenDecoder=new It(wt(e))}readLeftID(){return new qn(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new qn(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Tt(this.restDecoder)}readBuf(){return wt(this.restDecoder)}readJSON(){return Tt(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const e=this.stringDecoder.read();return this.keys.push(e),e}}}class kn{constructor(){this.restEncoder=ze()}toUint8Array(){return Ye(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Qe(this.restEncoder,e)}writeDsLen(e){Qe(this.restEncoder,e)}}class Tn extends kn{writeLeftID(e){Qe(this.restEncoder,e.client),Qe(this.restEncoder,e.clock)}writeRightID(e){Qe(this.restEncoder,e.client),Qe(this.restEncoder,e.clock)}writeClient(e){Qe(this.restEncoder,e)}writeInfo(e){Je(this.restEncoder,e)}writeString(e){tt(this.restEncoder,e)}writeParentInfo(e){Qe(this.restEncoder,e?1:0)}writeTypeRef(e){Qe(this.restEncoder,e)}writeLen(e){Qe(this.restEncoder,e)}writeAny(e){ot(this.restEncoder,e)}writeBuf(e){rt(this.restEncoder,e)}writeJSON(e){tt(this.restEncoder,JSON.stringify(e))}writeKey(e){tt(this.restEncoder,e)}}class An{constructor(){this.restEncoder=ze(),this.dsCurrVal=0}toUint8Array(){return Ye(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Qe(this.restEncoder,t)}writeDsLen(e){0===e&>(),Qe(this.restEncoder,e-1),this.dsCurrVal+=e}}class In extends An{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new dt,this.clientEncoder=new lt,this.leftClockEncoder=new dt,this.rightClockEncoder=new dt,this.infoEncoder=new at(Je),this.stringEncoder=new ht,this.parentInfoEncoder=new at(Je),this.typeRefEncoder=new lt,this.lenEncoder=new lt}toUint8Array(){const e=ze();return Qe(e,0),rt(e,this.keyClockEncoder.toUint8Array()),rt(e,this.clientEncoder.toUint8Array()),rt(e,this.leftClockEncoder.toUint8Array()),rt(e,this.rightClockEncoder.toUint8Array()),rt(e,Ye(this.infoEncoder)),rt(e,this.stringEncoder.toUint8Array()),rt(e,Ye(this.parentInfoEncoder)),rt(e,this.typeRefEncoder.toUint8Array()),rt(e,this.lenEncoder.toUint8Array()),nt(e,Ye(this.restEncoder)),Ye(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){ot(this.restEncoder,e)}writeBuf(e){rt(this.restEncoder,e)}writeJSON(e){ot(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);void 0===t?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const On=(e,t,n)=>{const r=new Map;n.forEach(((e,n)=>{Xn(t,n)>e&&r.set(n,e)})),Qn(t).forEach(((e,t)=>{n.has(t)||r.set(t,0)})),Qe(e.restEncoder,r.size),te(r.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([n,r])=>{((e,t,n,r)=>{r=ce(r,t[0].id.clock);const i=er(t,r);Qe(e.restEncoder,t.length-i),e.writeClient(n),Qe(e.restEncoder,r);const s=t[i];s.write(e,r-s.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)})(e,t.clients.get(n),n,r)}))},Dn=(e,t,n,r=Cn)=>{const i=_t(t);((e,t,n,r=new Cn(e))=>{dr(t,(e=>{e.local=!1;let t=!1;const n=e.doc,i=n.store,s=((e,t)=>{const n=K(),r=Et(e.restDecoder);for(let i=0;i<r;i++){const r=Et(e.restDecoder),i=new Array(r),s=e.readClient();let o=Et(e.restDecoder);n.set(s,{i:0,refs:i});for(let n=0;n<r;n++){const r=e.readInfo();switch(31&r){case 0:{const t=e.readLen();i[n]=new vi(Gn(s,o),t),o+=t;break}case 10:{const t=Et(e.restDecoder);i[n]=new Gi(Gn(s,o),t),o+=t;break}default:{const a=!(192&r),c=new Vi(Gn(s,o),null,(r&qe)===qe?e.readLeftID():null,null,(r&Ve)===Ve?e.readRightID():null,a?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,!a||32&~r?null:e.readString(),qi(e,r));i[n]=c,o+=c.length}}}}return n})(r,n),o=((e,t,n)=>{const r=[];let i=te(n.keys()).sort(((e,t)=>e-t));if(0===i.length)return null;const s=()=>{if(0===i.length)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;){if(i.pop(),!(i.length>0))return null;e=n.get(i[i.length-1])}return e};let o=s();if(null===o&&0===r.length)return null;const a=new Jn,c=new Map,l=(e,t)=>{const n=c.get(e);(null==n||n>t)&&c.set(e,t)};let u=o.refs[o.i++];const d=new Map,h=()=>{for(const e of r){const t=e.id.client,r=n.get(t);r?(r.i--,a.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):a.clients.set(t,[e]),i=i.filter((e=>e!==t))}r.length=0};for(;;){if(u.constructor!==Gi){const i=Q(d,u.id.client,(()=>Xn(t,u.id.client)))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),h();else{const s=u.getMissing(e,t);if(null!==s){r.push(u);const e=n.get(s)||{refs:[],i:0};if(e.refs.length!==e.i){u=e.refs[e.i++];continue}l(s,Xn(t,s)),h()}else(0===i||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(null!==o&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=s(),null===o)break;u=o.refs[o.i++]}}if(a.clients.size>0){const e=new In;return On(e,a,new Map),Qe(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null})(e,i,s),a=i.pendingStructs;if(a){for(const[e,n]of a.missing)if(n<Xn(i,e)){t=!0;break}if(o){for(const[e,t]of o.missing){const n=a.missing.get(e);(null==n||n>t)&&a.missing.set(e,t)}a.update=yr([a.update,o.update])}}else i.pendingStructs=o;const c=bn(r,e,i);if(i.pendingDs){const t=new Cn(_t(i.pendingDs));Et(t.restDecoder);const n=bn(t,e,i);i.pendingDs=c&&n?yr([c,n]):c||n}else i.pendingDs=c;if(t){const t=i.pendingStructs.update;i.pendingStructs=null,Dn(e.doc,t)}}),n,!1)})(i,e,n,new r(i))},Ln=(e,t,n)=>Dn(e,t,n,Rn),xn=(e,t=new Uint8Array([0]),n=new In)=>{((e,t,n=new Map)=>{On(e,t.store,n),yn(e,(e=>{const t=gn();return e.clients.forEach(((e,n)=>{const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(n.deleted){const i=n.id.clock;let s=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[1+ ++t])s+=n.length;r.push(new ln(i,s))}}r.length>0&&t.clients.set(n,r)})),t})(t.store))})(n,e,Mn(t));const r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(mr(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===Tn)return pr(r.map(((e,t)=>0===t?e:vr(e))));if(n.constructor===In)return yr(r)}return r[0]},Nn=(e,t)=>xn(e,t,new Tn),Mn=e=>(e=>{const t=new Map,n=Et(e.restDecoder);for(let r=0;r<n;r++){const n=Et(e.restDecoder),r=Et(e.restDecoder);t.set(n,r)}return t})(new En(_t(e))),Un=(e,t)=>(Qe(e.restEncoder,t.size),te(t.entries()).sort(((e,t)=>t[0]-e[0])).forEach((([t,n])=>{Qe(e.restEncoder,t),Qe(e.restEncoder,n)})),e);class Pn{constructor(){this.l=[]}}const jn=()=>new Pn,Bn=(e,t)=>e.l.push(t),Fn=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter((e=>t!==e)),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Vn=(e,t,n)=>Se(e.l,[t,n]);class qn{constructor(e,t){this.client=e,this.clock=t}}const Wn=(e,t)=>e===t||null!==e&&null!==t&&e.client===t.client&&e.clock===t.clock,Gn=(e,t)=>new qn(e,t);class Hn{constructor(e,t){this.ds=e,this.sv=t}}const $n=(Yn=gn(),Kn=new Map,new Hn(Yn,Kn),(e,t)=>void 0===t?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!hn(t.ds,e.id)),zn=(e,t)=>{const n=Q(e.meta,zn,X),r=e.doc.store;n.has(t)||(t.sv.forEach(((t,n)=>{t<Xn(r,n)&&rr(e,Gn(n,t))})),dn(e,t.ds,(e=>{})),n.add(t))};var Yn,Kn;class Jn{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Qn=e=>{const t=new Map;return e.clients.forEach(((e,n)=>{const r=e[e.length-1];t.set(n,r.id.clock+r.length)})),t},Xn=(e,t)=>{const n=e.clients.get(t);if(void 0===n)return 0;const r=n[n.length-1];return r.id.clock+r.length},Zn=(e,t)=>{let n=e.clients.get(t.id.client);if(void 0===n)n=[],e.clients.set(t.id.client,n);else{const e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw gt()}n.push(t)},er=(e,t)=>{let n=0,r=e.length-1,i=e[r],s=i.id.clock;if(s===t)return r;let o=ie(t/(s+i.length-1)*r);for(;n<=r;){if(i=e[o],s=i.id.clock,s<=t){if(t<s+i.length)return o;n=o+1}else r=o-1;o=ie((n+r)/2)}throw gt()},tr=(e,t)=>{const n=e.clients.get(t.client);return n[er(n,t.clock)]},nr=(e,t,n)=>{const r=er(t,n),i=t[r];return i.id.clock<n&&i instanceof Vi?(t.splice(r+1,0,Fi(e,i,n-i.id.clock)),r+1):r},rr=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[nr(e,n,t.clock)]},ir=(e,t,n)=>{const r=t.clients.get(n.client),i=er(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==vi&&r.splice(i+1,0,Fi(e,s,n.clock-s.id.clock+1)),s},sr=(e,t,n,r,i)=>{if(0===r)return;const s=n+r;let o,a=nr(e,t,n);do{o=t[a++],s<o.id.clock+o.length&&nr(e,t,s),i(o)}while(a<t.length&&t[a].id.clock<s)};class or{constructor(e,t,n){this.doc=e,this.deleteSet=new un,this.beforeState=Qn(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const ar=(e,t)=>!(0===t.deleteSet.clients.size&&!((e,n)=>{for(const[n,s]of e)if(r=s,i=n,t.beforeState.get(i)!==r)return!0;var r,i;return!1})(t.afterState)||(fn(t.deleteSet),((e,t)=>{On(e,t.doc.store,t.beforeState)})(e,t),yn(e,t.deleteSet),0)),cr=(e,t,n)=>{const r=t._item;(null===r||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Q(e.changed,t,X).add(n)},lr=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0&&r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n);n=r,r=e[--i-1])n instanceof Vi&&null!==n.parentSub&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);const s=t-i;return s&&e.splice(t+1-s,s),s},ur=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{fn(s),n.afterState=Qn(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const e=[];n.changed.forEach(((t,r)=>e.push((()=>{null!==r._item&&r._item.deleted||r._callObserver(n,t)})))),e.push((()=>{n.changedParentTypes.forEach(((e,t)=>{t._dEH.l.length>0&&(null===t._item||!t._item.deleted)&&((e=e.filter((e=>null===e.target._item||!e.target._item.deleted))).forEach((e=>{e.currentTarget=t,e._path=null})),e.sort(((e,t)=>e.path.length-t.path.length)),Vn(t._dEH,e,n))}))})),e.push((()=>r.emit("afterTransaction",[n,r]))),Se(e,[]),n._needFormattingCleanup&&ui(n)}finally{r.gc&&((e,t,n)=>{for(const[r,i]of e.clients.entries()){const e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){const s=i[r],o=s.clock+s.len;for(let r=er(e,s.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){const i=e[r];if(s.clock+s.len<=i.id.clock)break;i instanceof Vi&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}})(s,i,r.gcFilter),((e,t)=>{e.clients.forEach(((e,n)=>{const r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){const n=e[t];for(let e=ae(r.length-1,1+er(r,n.clock+n.len-1)),t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+lr(r,e)}}))})(s,i),n.afterState.forEach(((e,t)=>{const r=n.beforeState.get(t)||0;if(r!==e){const e=i.clients.get(t),n=ce(er(e,r),1);for(let t=e.length-1;t>=n;)t-=1+lr(e,t)}}));for(let e=o.length-1;e>=0;e--){const{client:t,clock:n}=o[e].id,r=i.clients.get(t),s=er(r,n);s+1<r.length&&lr(r,s+1)>1||s>0&&lr(r,s)}if(n.local||n.afterState.get(r.clientID)===n.beforeState.get(r.clientID)||(sn(Qt,Gt,"[yjs] ",Ht,Kt,"Changed the client-id because another client seems to be using it."),r.clientID=wn()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const e=new Tn;ar(e,n)&&r.emit("update",[e.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const e=new In;ar(e,n)&&r.emit("updateV2",[e.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:c,subdocsRemoved:l}=n;(a.size>0||l.size>0||c.size>0)&&(a.forEach((e=>{e.clientID=r.clientID,null==e.collectionid&&(e.collectionid=r.collectionid),r.subdocs.add(e)})),l.forEach((e=>r.subdocs.delete(e))),r.emit("subdocs",[{loaded:c,added:a,removed:l},r,n]),l.forEach((e=>e.destroy()))),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):ur(e,t+1)}}},dr=(e,t,n=null,r=!0)=>{const i=e._transactionCleanups;let s=!1,o=null;null===e._transaction&&(s=!0,e._transaction=new or(e,n,r),i.push(e._transaction),1===i.length&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(s){const t=e._transaction===i[0];e._transaction=null,t&&ur(i,0)}}return o};class hr{constructor(e,t){this.gen=function*(e){const t=Et(e.restDecoder);for(let n=0;n<t;n++){const t=Et(e.restDecoder),n=e.readClient();let r=Et(e.restDecoder);for(let i=0;i<t;i++){const t=e.readInfo();if(10===t){const t=Et(e.restDecoder);yield new Gi(Gn(n,r),t),r+=t}else if(31&t){const i=!(192&t),s=new Vi(Gn(n,r),null,(t&qe)===qe?e.readLeftID():null,null,(t&Ve)===Ve?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,!i||32&~t?null:e.readString(),qi(e,t));yield s,r+=s.length}else{const t=e.readLen();yield new vi(Gn(n,r),t),r+=t}}}}(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do{this.curr=this.gen.next().value||null}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===Gi);return this.curr}}class fr{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const pr=e=>yr(e,Rn,Tn),gr=(e,t)=>{if(e.constructor===vi){const{client:n,clock:r}=e.id;return new vi(Gn(n,r+t),e.length-t)}if(e.constructor===Gi){const{client:n,clock:r}=e.id;return new Gi(Gn(n,r+t),e.length-t)}{const n=e,{client:r,clock:i}=n.id;return new Vi(Gn(r,i+t),null,Gn(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},yr=(e,t=Cn,n=In)=>{if(1===e.length)return e[0];const r=e.map((e=>new t(_t(e))));let i=r.map((e=>new hr(e,!0))),s=null;const o=new n,a=new fr(o);for(;i=i.filter((e=>null!==e.curr)),i.sort(((e,t)=>{if(e.curr.id.client===t.curr.id.client){const n=e.curr.id.clock-t.curr.id.clock;return 0===n?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===Gi?1:-1:n}return t.curr.id.client-e.curr.id.client})),0!==i.length;){const e=i[0],t=e.curr.id.client;if(null!==s){let n=e.curr,r=!1;for(;null!==n&&n.id.clock+n.length<=s.struct.id.clock+s.struct.length&&n.id.client>=s.struct.id.client;)n=e.next(),r=!0;if(null===n||n.id.client!==t||r&&n.id.clock>s.struct.id.clock+s.struct.length)continue;if(t!==s.struct.id.client)_r(a,s.struct,s.offset),s={struct:n,offset:0},e.next();else if(s.struct.id.clock+s.struct.length<n.id.clock)if(s.struct.constructor===Gi)s.struct.length=n.id.clock+n.length-s.struct.id.clock;else{_r(a,s.struct,s.offset);const e=n.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Gi(Gn(t,s.struct.id.clock+s.struct.length),e),offset:0}}else{const t=s.struct.id.clock+s.struct.length-n.id.clock;t>0&&(s.struct.constructor===Gi?s.struct.length-=t:n=gr(n,t)),s.struct.mergeWith(n)||(_r(a,s.struct,s.offset),s={struct:n,offset:0},e.next())}}else s={struct:e.curr,offset:0},e.next();for(let n=e.curr;null!==n&&n.id.client===t&&n.id.clock===s.struct.id.clock+s.struct.length&&n.constructor!==Gi;n=e.next())_r(a,s.struct,s.offset),s={struct:n,offset:0}}null!==s&&(_r(a,s.struct,s.offset),s=null),wr(a);const c=(e=>{const t=new un;for(let n=0;n<e.length;n++)e[n].clients.forEach(((r,i)=>{if(!t.clients.has(i)){const s=r.slice();for(let t=n+1;t<e.length;t++)ee(s,e[t].clients.get(i)||[]);t.clients.set(i,s)}}));return fn(t),t})(r.map((e=>mn(e))));return yn(o,c),o.toUint8Array()},mr=(e,t,n=Cn,r=In)=>{const i=Mn(t),s=new r,o=new fr(s),a=new n(_t(e)),c=new hr(a,!1);for(;c.curr;){const e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor!==Gi)if(e.id.clock+e.length>n)for(_r(o,e,ce(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)_r(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next();else c.next()}wr(o);const l=mn(a);return yn(s,l),s.toUint8Array()},br=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:Ye(e.encoder.restEncoder)}),e.encoder.restEncoder=ze(),e.written=0)},_r=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&br(e),0===e.written&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),Qe(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},wr=e=>{br(e);const t=e.encoder.restEncoder;Qe(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const r=e.clientStructs[n];Qe(t,r.written),nt(t,r.restEncoder)}},vr=e=>((e,t,n,r)=>{const i=new n(_t(e)),s=new hr(i,!1),o=new r,a=new fr(o);for(let e=s.curr;null!==e;e=s.next())_r(a,t(e),0);wr(a);const c=mn(i);return yn(o,c),o.toUint8Array()})(e,ke,Cn,Tn),Er="You must not compute changes after the event-handler fired.";class Rr{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Sr(this.currentTarget,this.target))}deletes(e){return hn(this.transaction.deleteSet,e.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw ft(Er);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach((n=>{if(null!==n){const r=t._map.get(n);let i,s;if(this.adds(r)){let e=r.left;for(;null!==e&&this.adds(e);)e=e.left;if(this.deletes(r)){if(null===e||!this.deletes(e))return;i="delete",s=Z(e.content.getContent())}else null!==e&&this.deletes(e)?(i="update",s=Z(e.content.getContent())):(i="add",s=void 0)}else{if(!this.deletes(r))return;i="delete",s=Z(r.content.getContent())}e.set(n,{action:i,oldValue:s})}})),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(null===e){if(0===this.transaction.doc._transactionCleanups.length)throw ft(Er);const t=this.target,n=X(),r=X(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null;const s=()=>{e&&i.push(e)};for(let i=t._start;null!==i;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&(null!==e&&void 0!==e.delete||(s(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?(null!==e&&void 0!==e.insert||(s(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):(null!==e&&void 0!==e.retain||(s(),e={retain:0}),e.retain+=i.length);null!==e&&void 0===e.retain&&s()}this._changes=e}return e}}const Sr=(e,t)=>{const n=[];for(;null!==t._item&&t!==e;){if(null!==t._item.parentSub)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&null!==r;)r.deleted||e++,r=r.right;n.unshift(e)}t=t._item.parent}return n};let Cr=0;class kr{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Cr++}}const Tr=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Cr++},Ar=(e,t)=>{if(null===e._start||0===t||null===e._searchMarker)return null;const n=0===e._searchMarker.length?null:e._searchMarker.reduce(((e,n)=>se(t-e.index)<se(t-n.index)?e:n));let r=e._start,i=0;for(null!==n&&(r=n.p,i=n.index,(e=>{e.timestamp=Cr++})(n));null!==r.right&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;null!==r.left&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return null!==n&&se(n.index-i)<r.parent.length/80?(Tr(n,r,i),n):((e,t,n)=>{if(e.length>=80){const r=e.reduce(((e,t)=>e.timestamp<t.timestamp?e:t));return Tr(r,t,n),r}{const r=new kr(t,n);return e.push(r),r}})(e._searchMarker,r,i)},Ir=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(null===t||!0===t.marker){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=ce(t,i.index+n))}},Or=(e,t,n)=>{const r=e,i=t.changedParentTypes;for(;Q(i,e,(()=>[])).push(n),null!==e._item;)e=e._item.parent;Vn(r._eH,n,t)};class Dr{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=jn(),this._dEH=jn(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw pt()}clone(){throw pt()}_write(e){}get _first(){let e=this._start;for(;null!==e&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Bn(this._eH,e)}observeDeep(e){Bn(this._dEH,e)}unobserve(e){Fn(this._eH,e)}unobserveDeep(e){Fn(this._dEH,e)}toJSON(){}}const Lr=(e,t,n)=>{t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const i=[];let s=e._start;for(;null!==s&&r>0;){if(s.countable&&!s.deleted){const e=s.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}s=s.right}return i},xr=e=>{const t=[];let n=e._start;for(;null!==n;){if(n.countable&&!n.deleted){const e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},Nr=(e,t)=>{let n=0,r=e._start;for(;null!==r;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},Mr=(e,t)=>{const n=[];return Nr(e,((r,i)=>{n.push(t(r,i,e))})),n},Ur=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(null===n){for(;null!==t&&t.deleted;)t=t.right;if(null===t)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},Pr=(e,t)=>{const n=Ar(e,t);let r=e._start;for(null!==n&&(r=n.p,t-=n.index);null!==r;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},jr=(e,t,n,r)=>{let i=n;const s=e.doc,o=s.clientID,a=s.store,c=null===n?t._start:n.right;let l=[];const u=()=>{l.length>0&&(i=new Vi(Gn(o,Xn(a,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ii(l)),i.integrate(e,0),l=[])};r.forEach((n=>{if(null===n)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new Vi(Gn(o,Xn(a,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ei(new Uint8Array(n))),i.integrate(e,0);break;case vn:i=new Vi(Gn(o,Xn(a,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ci(n)),i.integrate(e,0);break;default:if(!(n instanceof Dr))throw new Error("Unexpected content type in insert operation");i=new Vi(Gn(o,Xn(a,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Bi(n)),i.integrate(e,0)}}})),u()},Br=ft("Length exceeded!"),Fr=(e,t,n,r)=>{if(n>t._length)throw Br;if(0===n)return t._searchMarker&&Ir(t._searchMarker,n,r.length),jr(e,t,null,r);const i=n,s=Ar(t,n);let o=t._start;for(null!==s&&(o=s.p,0==(n-=s.index)&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));null!==o;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&rr(e,Gn(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Ir(t._searchMarker,i,r.length),jr(e,t,o,r)},Vr=(e,t,n,r)=>{if(0===r)return;const i=n,s=r,o=Ar(t,n);let a=t._start;for(null!==o&&(a=o.p,n-=o.index);null!==a&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&rr(e,Gn(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&null!==a;)a.deleted||(r<a.length&&rr(e,Gn(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw Br;t._searchMarker&&Ir(t._searchMarker,i,-s+r)},qr=(e,t,n)=>{const r=t._map.get(n);void 0!==r&&r.delete(e)},Wr=(e,t,n,r)=>{const i=t._map.get(n)||null,s=e.doc,o=s.clientID;let a;if(null==r)a=new Ii([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new Ii([r]);break;case Uint8Array:a=new Ei(r);break;case vn:a=new Ci(r);break;default:if(!(r instanceof Dr))throw new Error("Unexpected content type");a=new Bi(r)}new Vi(Gn(o,Xn(s.store,o)),i,i&&i.lastId,null,null,t,n,a).integrate(e,0)},Gr=(e,t)=>{const n=e._map.get(t);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},Hr=e=>{const t={};return e._map.forEach(((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])})),t},$r=(e,t)=>{const n=e._map.get(t);return void 0!==n&&!n.deleted},zr=e=>{return t=e.entries(),n=e=>!e[1].deleted,an((()=>{let e;do{e=t.next()}while(!e.done&&!n(e.value));return e}));var t,n};class Yr extends Rr{constructor(e,t){super(e,t),this._transaction=t}}class Kr extends Dr{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Kr;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Kr}clone(){const e=new Kr;return e.insert(0,this.toArray().map((e=>e instanceof Dr?e.clone():e))),e}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),Or(this,e,new Yr(this,e))}insert(e,t){null!==this.doc?dr(this.doc,(n=>{Fr(n,this,e,t)})):this._prelimContent.splice(e,0,...t)}push(e){null!==this.doc?dr(this.doc,(t=>{((e,t,n)=>{let r=(t._searchMarker||[]).reduce(((e,t)=>t.index>e.index?t:e),{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;jr(e,t,r,n)})(t,this,e)})):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){null!==this.doc?dr(this.doc,(n=>{Vr(n,this,e,t)})):this._prelimContent.splice(e,t)}get(e){return Pr(this,e)}toArray(){return xr(this)}slice(e=0,t=this.length){return Lr(this,e,t)}toJSON(){return this.map((e=>e instanceof Dr?e.toJSON():e))}map(e){return Mr(this,e)}forEach(e){Nr(this,e)}[Symbol.iterator](){return Ur(this)}_write(e){e.writeTypeRef(Li)}}class Jr extends Rr{constructor(e,t,n){super(e,t),this.keysChanged=n}}class Qr extends Dr{constructor(e){super(),this._prelimContent=null,this._prelimContent=void 0===e?new Map:new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach(((e,t)=>{this.set(t,e)})),this._prelimContent=null}_copy(){return new Qr}clone(){const e=new Qr;return this.forEach(((t,n)=>{e.set(n,t instanceof Dr?t.clone():t)})),e}_callObserver(e,t){Or(this,e,new Jr(this,e,t))}toJSON(){const e={};return this._map.forEach(((t,n)=>{if(!t.deleted){const r=t.content.getContent()[t.length-1];e[n]=r instanceof Dr?r.toJSON():r}})),e}get size(){return[...zr(this._map)].length}keys(){return cn(zr(this._map),(e=>e[0]))}values(){return cn(zr(this._map),(e=>e[1].content.getContent()[e[1].length-1]))}entries(){return cn(zr(this._map),(e=>[e[0],e[1].content.getContent()[e[1].length-1]]))}forEach(e){this._map.forEach(((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)}))}[Symbol.iterator](){return this.entries()}delete(e){null!==this.doc?dr(this.doc,(t=>{qr(t,this,e)})):this._prelimContent.delete(e)}set(e,t){return null!==this.doc?dr(this.doc,(n=>{Wr(n,this,e,t)})):this._prelimContent.set(e,t),t}get(e){return Gr(this,e)}has(e){return $r(this,e)}clear(){null!==this.doc?dr(this.doc,(e=>{this.forEach((function(t,n,r){qr(e,r,n)}))})):this._prelimContent.clear()}_write(e){e.writeTypeRef(xi)}}const Xr=(e,t)=>e===t||"object"==typeof e&&"object"==typeof t&&e&&t&&((e,t)=>e===t||Ee(e)===Ee(t)&&((e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0})(e,((e,n)=>(void 0!==e||Re(t,n))&&t[n]===e)))(e,t);class Zr{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){null===this.right&>(),this.right.content.constructor===Ti?this.right.deleted||ri(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const ei=(e,t,n)=>{for(;null!==t.right&&n>0;)t.right.content.constructor===Ti?t.right.deleted||ri(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&rr(e,Gn(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},ti=(e,t,n)=>{const r=new Map,i=Ar(t,n);if(i){const t=new Zr(i.p.left,i.p,i.index,r);return ei(e,t,n-i.index)}{const i=new Zr(null,t._start,0,r);return ei(e,i,n)}},ni=(e,t,n,r)=>{for(;null!==n.right&&(!0===n.right.deleted||n.right.content.constructor===Ti&&Xr(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=e.doc,s=i.clientID;r.forEach(((r,o)=>{const a=n.left,c=n.right,l=new Vi(Gn(s,Xn(i.store,s)),a,a&&a.lastId,c,c&&c.id,t,null,new Ti(o,r));l.integrate(e,0),n.right=l,n.forward()}))},ri=(e,t)=>{const{key:n,value:r}=t;null===r?e.delete(n):e.set(n,r)},ii=(e,t)=>{for(;null!==e.right&&(e.right.deleted||e.right.content.constructor===Ti&&Xr(t[e.right.content.key]||null,e.right.content.value));)e.forward()},si=(e,t,n,r)=>{const i=e.doc,s=i.clientID,o=new Map;for(const a in r){const c=r[a],l=n.currentAttributes.get(a)||null;if(!Xr(l,c)){o.set(a,l);const{left:r,right:u}=n;n.right=new Vi(Gn(s,Xn(i.store,s)),r,r&&r.lastId,u,u&&u.id,t,null,new Ti(a,c)),n.right.integrate(e,0),n.forward()}}return o},oi=(e,t,n,r,i)=>{n.currentAttributes.forEach(((e,t)=>{void 0===i[t]&&(i[t]=null)}));const s=e.doc,o=s.clientID;ii(n,i);const a=si(e,t,n,i),c=r.constructor===String?new Oi(r):r instanceof Dr?new Bi(r):new ki(r);let{left:l,right:u,index:d}=n;t._searchMarker&&Ir(t._searchMarker,n.index,c.getLength()),u=new Vi(Gn(o,Xn(s.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),ni(e,t,n,a)},ai=(e,t,n,r,i)=>{const s=e.doc,o=s.clientID;ii(n,i);const a=si(e,t,n,i);e:for(;null!==n.right&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ti));){if(!n.right.deleted)switch(n.right.content.constructor){case Ti:{const{key:t,value:s}=n.right.content,o=i[t];if(void 0!==o){if(Xr(o,s))a.delete(t);else{if(0===r)break e;a.set(t,s)}n.right.delete(e)}else n.currentAttributes.set(t,s);break}default:r<n.right.length&&rr(e,Gn(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i="";for(;r>0;r--)i+="\n";n.right=new Vi(Gn(o,Xn(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Oi(i)),n.right.integrate(e,0),n.forward()}ni(e,t,n,a)},ci=(e,t,n,r,i)=>{let s=t;const o=K();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Ti){const e=s.content;o.set(e.key,e)}s=s.right}let a=0,c=!1;for(;t!==s;){if(n===t&&(c=!0),!t.deleted){const n=t.content;switch(n.constructor){case Ti:{const{key:s,value:l}=n,u=r.get(s)||null;o.get(s)===n&&u!==l||(t.delete(e),a++,c||(i.get(s)||null)!==l||u===l||(null===u?i.delete(s):i.set(s,u))),c||t.deleted||ri(i,n);break}}}t=t.right}return a},li=e=>{let t=0;return dr(e.doc,(n=>{let r=e._start,i=e._start,s=K();const o=J(s);for(;i;)!1===i.deleted&&(i.content.constructor===Ti?ri(o,i.content):(t+=ci(n,r,i,s,o),s=J(o),r=i)),i=i.right})),t},ui=e=>{const t=new Set,n=e.doc;for(const[r,i]of e.afterState.entries()){const s=e.beforeState.get(r)||0;i!==s&&sr(e,n.store.clients.get(r),s,i,(e=>{e.deleted||e.content.constructor!==Ti||e.constructor===vi||t.add(e.parent)}))}dr(n,(n=>{dn(e,e.deleteSet,(e=>{if(e instanceof vi||!e.parent._hasFormatting||t.has(e.parent))return;const r=e.parent;e.content.constructor===Ti?t.add(r):((e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Ti){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}})(n,e)}));for(const e of t)li(e)}))},di=(e,t,n)=>{const r=n,i=J(t.currentAttributes),s=t.right;for(;n>0&&null!==t.right;){if(!1===t.right.deleted)switch(t.right.content.constructor){case Bi:case ki:case Oi:n<t.right.length&&rr(e,Gn(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e)}t.forward()}s&&ci(e,s,t.right,i,t.currentAttributes);const o=(t.left||t.right).parent;return o._searchMarker&&Ir(o._searchMarker,t.index,-r+n),t};class hi extends Rr{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach((e=>{null===e?this.childListChanged=!0:this.keysChanged.add(e)}))}get changes(){if(null===this._changes){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(null===this._delta){const e=this.target.doc,t=[];dr(e,(e=>{const n=new Map,r=new Map;let i=this.target._start,s=null;const o={};let a="",c=0,l=0;const u=()=>{if(null!==s){let e=null;switch(s){case"delete":l>0&&(e={delete:l}),l=0;break;case"insert":("object"==typeof a||a.length>0)&&(e={insert:a},n.size>0&&(e.attributes={},n.forEach(((t,n)=>{null!==t&&(e.attributes[n]=t)})))),a="";break;case"retain":c>0&&(e={retain:c},(e=>{for(const t in e)return!1;return!0})(o)||(e.attributes=we({},o))),c=0}e&&t.push(e),s=null}};for(;null!==i;){switch(i.content.constructor){case Bi:case ki:this.adds(i)?this.deletes(i)||(u(),s="insert",a=i.content.getContent()[0],u()):this.deletes(i)?("delete"!==s&&(u(),s="delete"),l+=1):i.deleted||("retain"!==s&&(u(),s="retain"),c+=1);break;case Oi:this.adds(i)?this.deletes(i)||("insert"!==s&&(u(),s="insert"),a+=i.content.str):this.deletes(i)?("delete"!==s&&(u(),s="delete"),l+=i.length):i.deleted||("retain"!==s&&(u(),s="retain"),c+=i.length);break;case Ti:{const{key:t,value:a}=i.content;if(this.adds(i)){if(!this.deletes(i)){const c=n.get(t)||null;Xr(c,a)?null!==a&&i.delete(e):("retain"===s&&u(),Xr(a,r.get(t)||null)?delete o[t]:o[t]=a)}}else if(this.deletes(i)){r.set(t,a);const e=n.get(t)||null;Xr(e,a)||("retain"===s&&u(),o[t]=e)}else if(!i.deleted){r.set(t,a);const n=o[t];void 0!==n&&(Xr(n,a)?null!==n&&i.delete(e):("retain"===s&&u(),null===a?delete o[t]:o[t]=a))}i.deleted||("insert"===s&&u(),ri(n,i.content));break}}i=i.right}for(u();t.length>0;){const e=t[t.length-1];if(void 0===e.retain||void 0!==e.attributes)break;t.pop()}})),this._delta=t}return this._delta}}class fi extends Dr{constructor(e){super(),this._pending=void 0!==e?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach((e=>e()))}catch(e){console.error(e)}this._pending=null}_copy(){return new fi}clone(){const e=new fi;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const n=new hi(this,e,t);Or(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",t=this._start;for(;null!==t;)!t.deleted&&t.countable&&t.content.constructor===Oi&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){null!==this.doc?dr(this.doc,(n=>{const r=new Zr(null,this._start,0,new Map);for(let i=0;i<e.length;i++){const s=e[i];if(void 0!==s.insert){const o=t||"string"!=typeof s.insert||i!==e.length-1||null!==r.right||"\n"!==s.insert.slice(-1)?s.insert:s.insert.slice(0,-1);("string"!=typeof o||o.length>0)&&oi(n,this,r,o,s.attributes||{})}else void 0!==s.retain?ai(n,this,r,s.retain,s.attributes||{}):void 0!==s.delete&&di(n,r,s.delete)}})):this._pending.push((()=>this.applyDelta(e)))}toDelta(e,t,n){const r=[],i=new Map,s=this.doc;let o="",a=this._start;function c(){if(o.length>0){const e={};let t=!1;i.forEach(((n,r)=>{t=!0,e[r]=n}));const n={insert:o};t&&(n.attributes=e),r.push(n),o=""}}const l=()=>{for(;null!==a;){if($n(a,e)||void 0!==t&&$n(a,t))switch(a.content.constructor){case Oi:{const r=i.get("ychange");void 0===e||$n(a,e)?void 0===t||$n(a,t)?void 0!==r&&(c(),i.delete("ychange")):void 0!==r&&r.user===a.id.client&&"added"===r.type||(c(),i.set("ychange",n?n("added",a.id):{type:"added"})):void 0!==r&&r.user===a.id.client&&"removed"===r.type||(c(),i.set("ychange",n?n("removed",a.id):{type:"removed"})),o+=a.content.str;break}case Bi:case ki:{c();const e={insert:a.content.getContent()[0]};if(i.size>0){const t={};e.attributes=t,i.forEach(((e,n)=>{t[n]=e}))}r.push(e);break}case Ti:$n(a,e)&&(c(),ri(i,a.content))}a=a.right}c()};return e||t?dr(s,(n=>{e&&zn(n,e),t&&zn(n,t),l()}),"cleanup"):l(),r}insert(e,t,n){if(t.length<=0)return;const r=this.doc;null!==r?dr(r,(r=>{const i=ti(r,this,e);n||(n={},i.currentAttributes.forEach(((e,t)=>{n[t]=e}))),oi(r,this,i,t,n)})):this._pending.push((()=>this.insert(e,t,n)))}insertEmbed(e,t,n={}){const r=this.doc;null!==r?dr(r,(r=>{const i=ti(r,this,e);oi(r,this,i,t,n)})):this._pending.push((()=>this.insertEmbed(e,t,n)))}delete(e,t){if(0===t)return;const n=this.doc;null!==n?dr(n,(n=>{di(n,ti(n,this,e),t)})):this._pending.push((()=>this.delete(e,t)))}format(e,t,n){if(0===t)return;const r=this.doc;null!==r?dr(r,(r=>{const i=ti(r,this,e);null!==i.right&&ai(r,this,i,t,n)})):this._pending.push((()=>this.format(e,t,n)))}removeAttribute(e){null!==this.doc?dr(this.doc,(t=>{qr(t,this,e)})):this._pending.push((()=>this.removeAttribute(e)))}setAttribute(e,t){null!==this.doc?dr(this.doc,(n=>{Wr(n,this,e,t)})):this._pending.push((()=>this.setAttribute(e,t)))}getAttribute(e){return Gr(this,e)}getAttributes(){return Hr(this)}_write(e){e.writeTypeRef(Ni)}}class pi{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(null!==e&&(!this._firstCall||e.deleted||!this._filter(t)))do{if(t=e.content.type,e.deleted||t.constructor!==yi&&t.constructor!==gi||null===t._start)for(;null!==e;){if(null!==e.right){e=e.right;break}e=e.parent===this._root?null:e.parent._item}else e=t._start}while(null!==e&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,null===e?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class gi extends Dr{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new gi}clone(){const e=new gi;return e.insert(0,this.toArray().map((e=>e instanceof Dr?e.clone():e))),e}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(e){return new pi(this,e)}querySelector(e){e=e.toUpperCase();const t=new pi(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),te(new pi(this,(t=>t.nodeName&&t.nodeName.toUpperCase()===e)))}_callObserver(e,t){Or(this,e,new mi(this,t,e))}toString(){return Mr(this,(e=>e.toString())).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},n){const r=e.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),Nr(this,(i=>{r.insertBefore(i.toDOM(e,t,n),null)})),r}insert(e,t){null!==this.doc?dr(this.doc,(n=>{Fr(n,this,e,t)})):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(null!==this.doc)dr(this.doc,(n=>{const r=e&&e instanceof Dr?e._item:e;jr(n,this,r,t)}));else{const n=this._prelimContent,r=null===e?0:n.findIndex((t=>t===e))+1;if(0===r&&null!==e)throw ft("Reference item not found");n.splice(r,0,...t)}}delete(e,t=1){null!==this.doc?dr(this.doc,(n=>{Vr(n,this,e,t)})):this._prelimContent.splice(e,t)}toArray(){return xr(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Pr(this,e)}slice(e=0,t=this.length){return Lr(this,e,t)}forEach(e){Nr(this,e)}_write(e){e.writeTypeRef(Ui)}}class yi extends gi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach(((e,t)=>{this.setAttribute(t,e)})),this._prelimAttrs=null}_copy(){return new yi(this.nodeName)}clone(){const e=new yi(this.nodeName);return((e,t)=>{for(const n in e)t(e[n],n)})(this.getAttributes(),((t,n)=>{"string"==typeof t&&e.setAttribute(n,t)})),e.insert(0,this.toArray().map((e=>e instanceof Dr?e.clone():e))),e}toString(){const e=this.getAttributes(),t=[],n=[];for(const t in e)n.push(t);n.sort();const r=n.length;for(let i=0;i<r;i++){const r=n[i];t.push(r+'="'+e[r]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?" "+t.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(e){null!==this.doc?dr(this.doc,(t=>{qr(t,this,e)})):this._prelimAttrs.delete(e)}setAttribute(e,t){null!==this.doc?dr(this.doc,(n=>{Wr(n,this,e,t)})):this._prelimAttrs.set(e,t)}getAttribute(e){return Gr(this,e)}hasAttribute(e){return $r(this,e)}getAttributes(){return Hr(this)}toDOM(e=document,t={},n){const r=e.createElement(this.nodeName),i=this.getAttributes();for(const e in i){const t=i[e];"string"==typeof t&&r.setAttribute(e,t)}return Nr(this,(i=>{r.appendChild(i.toDOM(e,t,n))})),void 0!==n&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Mi),e.writeKey(this.nodeName)}}class mi extends Rr{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach((e=>{null===e?this.childListChanged=!0:this.attributesChanged.add(e)}))}}class bi extends Qr{constructor(e){super(),this.hookName=e}_copy(){return new bi(this.hookName)}clone(){const e=new bi(this.hookName);return this.forEach(((t,n)=>{e.set(n,t)})),e}toDOM(e=document,t={},n){const r=t[this.hookName];let i;return i=void 0!==r?r.createDom(this):document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(Pi),e.writeKey(this.hookName)}}class _i extends fi{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new _i}clone(){const e=new _i;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,n){const r=e.createTextNode(this.toString());return void 0!==n&&n._createAssociation(r,this),r}toString(){return this.toDelta().map((e=>{const t=[];for(const n in e.attributes){const r=[];for(const t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort(((e,t)=>e.key<t.key?-1:1)),t.push({nodeName:n,attrs:r})}t.sort(((e,t)=>e.nodeName<t.nodeName?-1:1));let n="";for(let e=0;e<t.length;e++){const r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){const t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=">"}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n})).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ji)}}class wi{constructor(e,t){this.id=e,this.length=t}get deleted(){throw pt()}mergeWith(e){return!1}write(e,t,n){throw pt()}integrate(e,t){throw pt()}}class vi extends wi{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Zn(e.doc.store,this)}write(e,t){e.writeInfo(0),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Ei{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ei(this.content)}splice(e){throw pt()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class Ri{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ri(this.len)}splice(e){const t=new Ri(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){pn(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const Si=(e,t)=>new vn({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class Ci{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),null!==e.meta&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ci(Si(this.doc.guid,this.opts))}splice(e){throw pt()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class ki{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ki(this.embed)}splice(e){throw pt()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class Ti{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ti(this.key,this.value)}splice(e){throw pt()}mergeWith(e){return!1}integrate(e,t){const n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}class Ai{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ai(this.arr)}splice(e){const t=new Ai(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){const t=this.arr[r];e.writeString(void 0===t?"undefined":JSON.stringify(t))}}getRef(){return 2}}class Ii{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ii(this.arr)}splice(e){const t=new Ii(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){const t=this.arr[r];e.writeAny(t)}}getRef(){return 8}}class Oi{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Oi(this.str)}splice(e){const t=new Oi(this.str.slice(e));this.str=this.str.slice(0,e);const n=this.str.charCodeAt(e-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(0===t?this.str:this.str.slice(t))}getRef(){return 4}}const Di=[e=>new Kr,e=>new Qr,e=>new fi,e=>new yi(e.readKey()),e=>new gi,e=>new bi(e.readKey()),e=>new _i],Li=0,xi=1,Ni=2,Mi=3,Ui=4,Pi=5,ji=6;class Bi{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Bi(this.type._copy())}splice(e){throw pt()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;null!==t;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach((t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)})),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;null!==t;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach((t=>{for(;null!==t;)t.gc(e,!0),t=t.left})),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const Fi=(e,t,n)=>{const{client:r,clock:i}=t.id,s=new Vi(Gn(r,i+n),t,Gn(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&s.markDeleted(),t.keep&&(s.keep=!0),null!==t.redone&&(s.redone=Gn(t.redone.client,t.redone.clock+n)),t.right=s,null!==s.right&&(s.right.left=s),e._mergeStructs.push(s),null!==s.parentSub&&null===s.right&&s.parent._map.set(s.parentSub,s),t.length=n,s};class Vi extends wi{constructor(e,t,n,r,i,s,o,a){super(e,a.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=s,this.parentSub=o,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(e){(8&this.info)>0!==e&&(this.info^=8)}get marker(){return(8&this.info)>0}get keep(){return(1&this.info)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(2&this.info)>0}get deleted(){return(4&this.info)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Xn(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Xn(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===qn&&this.id.client!==this.parent.client&&this.parent.clock>=Xn(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=ir(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=rr(e,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===vi||this.right&&this.right.constructor===vi)&&(this.parent=null),this.parent){if(this.parent.constructor===qn){const e=tr(t,this.parent);e.constructor===vi?this.parent=null:this.parent=e.content.type}}else this.left&&this.left.constructor===Vi&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Vi&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=ir(e,e.doc.store,Gn(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let t,n=this.left;if(null!==n)t=n.right;else if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start;const r=new Set,i=new Set;for(;null!==t&&t!==this.right;){if(i.add(t),r.add(t),Wn(this.origin,t.origin)){if(t.id.client<this.id.client)n=t,r.clear();else if(Wn(this.rightOrigin,t.rightOrigin))break}else{if(null===t.origin||!i.has(tr(e.doc.store,t.origin)))break;r.has(tr(e.doc.store,t.origin))||(n=t,r.clear())}t=t.right}this.left=n}if(null!==this.left){const e=this.left.right;this.right=e,this.left.right=this}else{let e;if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(e)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Zn(e.doc.store,this),this.content.integrate(e,this),cr(e,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(e)}else new vi(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;null!==e&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;null!==e&&e.deleted;)e=e.left;return e}get lastId(){return 1===this.length?this.id:Gn(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Wn(e.origin,this.lastId)&&this.right===e&&Wn(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&null===this.redone&&null===e.redone&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach((t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))})),e.keep&&(this.keep=!0),this.right=e.right,null!==this.right&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&null===this.parentSub&&(t._length-=this.length),this.markDeleted(),pn(e.deleteSet,this.id.client,this.id.clock,this.length),cr(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw gt();this.content.gc(e),t?((e,t,n)=>{const r=e.clients.get(t.id.client);r[er(r,t.id.clock)]=n})(e,this,new vi(this.id,this.length)):this.content=new Ri(this.length)}write(e,t){const n=t>0?Gn(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,s=31&this.content.getRef()|(null===n?0:qe)|(null===r?0:Ve)|(null===i?0:32);if(e.writeInfo(s),null!==n&&e.writeLeftID(n),null!==r&&e.writeRightID(r),null===n&&null===r){const t=this.parent;if(void 0!==t._item){const n=t._item;if(null===n){const n=(e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw gt()})(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===qn?(e.writeParentInfo(!1),e.writeLeftID(t)):gt();null!==i&&e.writeString(i)}this.content.write(e,t)}}const qi=(e,t)=>Wi[31&t](e),Wi=[()=>{gt()},e=>new Ri(e.readLen()),e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++){const t=e.readString();"undefined"===t?n.push(void 0):n.push(JSON.parse(t))}return new Ai(n)},e=>new Ei(e.readBuf()),e=>new Oi(e.readString()),e=>new ki(e.readJSON()),e=>new Ti(e.readKey(),e.readJSON()),e=>new Bi(Di[e.readTypeRef()](e)),e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new Ii(n)},e=>new Ci(Si(e.readString(),e.readAny())),()=>{gt()}];class Gi extends wi{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){gt()}write(e,t){e.writeInfo(10),Qe(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const Hi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$i="__ $YJS$ __";!0===Hi[$i]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Hi[$i]=!0;const zi=(e,t)=>{const n={},r={},i={};return{register:function(e,t){n[e]=t},bootstrap:async function(s,o,a){const c=new vn;i[s]=i[s]||{},i[s][o]=c;const l=()=>{const e=n[s].fromCRDTDoc(c);a(e)};c.on("update",l);const u=await e(o,s,c);t&&await t(o,s,c);const d=n[s].fetch;d&&d(o).then((e=>{c.transact((()=>{n[s].applyChangesToDoc(c,e)}))})),r[s]=r[s]||{},r[s][o]=()=>{u(),c.off("update",l)}},update:async function(e,t,r){const s=i[e][t];if(!s)throw"Error doc "+e+" "+t+" not found";s.transact((()=>{n[e].applyChangesToDoc(s,r)}))},discard:async function(e,t){r?.[e]?.[t]&&r[e][t]()}}},Yi=e=>Pt(((t,n)=>{e.onerror=e=>n(new Error(e.target.error)),e.onsuccess=e=>t(e.target.result)})),Ki=(e,t,n="readwrite")=>{const r=e.transaction(t,n);return t.map((e=>es(r,e)))},Ji=(e,t)=>Yi(e.count(t)),Qi=(e,t)=>Yi(e.delete(t)),Xi=(e,t)=>Yi(e.add(t)),Zi=(e,t,n,r="next")=>((e,t)=>Pt(((n,r)=>{e.onerror=r,e.onsuccess=async e=>{const r=e.target.result;if(null===r||!1===await t(r))return n();r.continue()}})))(e.openKeyCursor(t,r),(e=>n(e.key))),es=(e,t)=>e.objectStore(t),ts="custom",ns="updates",rs=(e,t=()=>{},n=()=>{})=>{const[r]=Ki(e.db,[ns]);return((e,t,n)=>Yi(e.getAll(t,n)))(r,(i=e._dbref,IDBKeyRange.lowerBound(i,false))).then((i=>{e._destroyed||(t(r),dr(e.doc,(()=>{i.forEach((t=>Ln(e.doc,t)))}),e,!1),n(r))})).then((()=>((e,t=null)=>((e,t,n)=>{let r=null;return Zi(e,t,(e=>(r=e,!1)),n).then((()=>r))})(e,t,"prev"))(r).then((t=>{e._dbref=t+1})))).then((()=>Ji(r).then((t=>{e._dbsize=t})))).then((()=>r));var i};class is extends re{constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=((e,t)=>Pt(((t,n)=>{const r=indexedDB.open(e);r.onupgradeneeded=e=>((e,t)=>[["updates",{autoIncrement:!0}],["custom"]].forEach((t=>e.createObjectStore.apply(e,t))))(e.target.result),r.onerror=e=>n(ft(e.target.error)),r.onsuccess=e=>{const n=e.target.result;n.onversionchange=()=>{n.close()},"undefined"!=typeof addEventListener&&addEventListener("unload",(()=>n.close())),t(n)}})))(e),this.whenSynced=Pt((e=>this.on("synced",(()=>e(this))))),this._db.then((e=>{this.db=e,rs(this,(e=>Xi(e,Nn(t))),(()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])}))})),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(e,t)=>{if(this.db&&t!==this){const[t]=Ki(this.db,[ns]);Xi(t,e),++this._dbsize>=500&&(null!==this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout((()=>{((e,t=!0)=>{rs(e).then((n=>{(t||e._dbsize>=500)&&Xi(n,Nn(e.doc)).then((()=>{return Qi(n,(t=e._dbref,IDBKeyRange.upperBound(t,!0)));var t})).then((()=>Ji(n).then((t=>{e._dbsize=t}))))}))})(this,!1),this._storeTimeoutId=null}),this._storeTimeout))}},t.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then((e=>{e.close()}))}clearData(){return this.destroy().then((()=>{(e=>{Yi(indexedDB.deleteDatabase(e))})(this.name)}))}get(e){return this._db.then((t=>{const[n]=Ki(t,[ts],"readonly");return((e,t)=>Yi(e.get(t)))(n,e)}))}set(e,t){return this._db.then((n=>{const[r]=Ki(n,[ts]);return((e,t,n)=>Yi(e.put(t,n)))(r,t,e)}))}del(e){return this._db.then((t=>{const[n]=Ki(t,[ts]);return Qi(n,e)}))}}function ss(e,t,n){const r=new is(`${t}-${e}`,n);return new Promise((e=>{r.on("synced",(()=>{e((()=>r.destroy()))}))}))}const os=e=>{if(e.shouldConnect&&null===e.ws){const t=new WebSocket(e.url),n=e.binaryType;let r=null;n&&(t.binaryType=n),e.ws=t,e.connecting=!0,e.connected=!1,t.onmessage=t=>{e.lastMessageReceived=Wt();const n=t.data,i="string"==typeof n?JSON.parse(n):n;i&&"pong"===i.type&&(clearTimeout(r),r=setTimeout(s,15e3)),e.emit("message",[i,e])};const i=t=>{null!==e.ws&&(e.ws=null,e.connecting=!1,e.connected?(e.connected=!1,e.emit("disconnect",[{type:"disconnect",error:t},e])):e.unsuccessfulReconnects++,setTimeout(os,ae(1200*oe(e.unsuccessfulReconnects+1),2500),e)),clearTimeout(r)},s=()=>{e.ws===t&&e.send({type:"ping"})};t.onclose=()=>i(null),t.onerror=e=>i(e),t.onopen=()=>{e.lastMessageReceived=Wt(),e.connecting=!1,e.connected=!0,e.unsuccessfulReconnects=0,e.emit("connect",[{type:"connect"},e]),r=setTimeout(s,15e3)}}};class as extends re{constructor(e,{binaryType:t}={}){super(),this.url=e,this.ws=null,this.binaryType=t||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval((()=>{this.connected&&3e4<Wt()-this.lastMessageReceived&&this.ws.close()}),15e3),os(this)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,null!==this.ws&&this.ws.close()}connect(){this.shouldConnect=!0,this.connected||null!==this.ws||os(this)}}const cs=new Map,ls="undefined"==typeof BroadcastChannel?class{constructor(e){var t;this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&null!==this.onmessage&&this.onmessage({data:Fe(t.newValue||"")}),t=this._onChange,be||addEventListener("storage",t)}postMessage(e){_e.setItem(this.room,Be(new Uint8Array(e)))}close(){var e;e=this._onChange,be||removeEventListener("storage",e)}}:BroadcastChannel,us=e=>Q(cs,e,(()=>{const t=X(),n=new ls(e);return n.onmessage=e=>t.forEach((t=>t(e.data,"broadcastchannel"))),{bc:n,subs:t}}));var ds=n(2248),hs=n.n(ds);const fs=(e,t)=>{Qe(e,0);const n=(e=>((e,t=new An)=>(e instanceof Map?Un(t,e):((e,t)=>{Un(e,Qn(t.store))})(t,e),t.toUint8Array()))(e,new kn))(t);rt(e,n)},ps=(e,t,n)=>{Qe(e,1),rt(e,Nn(t,n))},gs=(e,t,n)=>{try{Ln(t,wt(e),n)}catch(e){console.error("Caught error while handling a Yjs update",e)}},ys=gs;class ms extends re{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const e=Wt();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const t=[];this.meta.forEach(((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)})),t.length>0&&bs(this,t,"timeout")}),ie(3e3)),e.on("destroy",(()=>{this.destroy()})),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,n=this.meta.get(t),r=void 0===n?0:n.clock+1,i=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:Wt()});const s=[],o=[],a=[],c=[];null===e?c.push(t):null==i?null!=e&&s.push(t):(o.push(t),Te(i,e)||a.push(t)),(s.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:s,updated:a,removed:c},"local"]),this.emit("update",[{added:s,updated:o,removed:c},"local"])}setLocalStateField(e,t){const n=this.getLocalState();null!==n&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}}const bs=(e,t,n)=>{const r=[];for(let n=0;n<t.length;n++){const i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){const t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:Wt()})}r.push(i)}}r.length>0&&(e.emit("change",[{added:[],updated:[],removed:r},n]),e.emit("update",[{added:[],updated:[],removed:r},n]))},_s=(e,t,n=e.states)=>{const r=t.length,i=ze();Qe(i,r);for(let s=0;s<r;s++){const r=t[s],o=n.get(r)||null,a=e.meta.get(r).clock;Qe(i,r),Qe(i,a),tt(i,JSON.stringify(o))}return Ye(i)},ws=(e,t)=>{if(!t)return jt(e);const n=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:n},t,e).then((e=>{const t=ze();return tt(t,"AES-GCM"),rt(t,n),rt(t,new Uint8Array(e)),Ye(t)}))},vs=(e,t)=>{if(!t)return jt(e);const n=_t(e);var r;"AES-GCM"!==St(n)&&(r=ft("Unknown encryption algorithm"),Promise.reject(r));const i=wt(n),s=wt(n);return crypto.subtle.decrypt({name:"AES-GCM",iv:i},t,s).then((e=>new Uint8Array(e)))},Es=(e,t)=>vs(e,t).then((e=>Tt(_t(new Uint8Array(e))))),Rs=((e,t)=>{const n=Zt[en],r=xe("log"),i=null!==r&&("*"===r||"true"===r||new RegExp(r,"gi").test(t));return en=(en+1)%Zt.length,t+=": ",i?(...r)=>{const i=Wt(),s=i-tn;tn=i,e(n,t,Xt,...r.map((e=>"string"==typeof e||"symbol"==typeof e?e:JSON.stringify(e))),n," +"+s+"ms")}:Ce})(sn,"y-webrtc"),Ss=new Map,Cs=new Map,ks=e=>{let t=!0;e.webrtcConns.forEach((e=>{e.synced||(t=!1)})),(!t&&e.synced||t&&!e.synced)&&(e.synced=t,e.provider.emit("synced",[{synced:t}]),Rs("synced ",Gt,e.name,Ht," with all peers"))},Ts=(e,t,n)=>{const r=_t(t),i=ze(),s=Et(r);if(void 0===e)return null;const o=e.awareness,a=e.doc;let c=!1;switch(s){case 0:{Qe(i,0);const t=((e,t,n,r)=>{const i=Et(e);switch(i){case 0:((e,t,n)=>{ps(t,n,wt(e))})(e,t,n);break;case 1:gs(e,n,r);break;case 2:ys(e,n,r);break;default:throw new Error("Unknown message type")}return i})(r,i,a,e);1!==t||e.synced||n(),0===t&&(c=!0);break}case 3:Qe(i,1),rt(i,_s(o,Array.from(o.getStates().keys()))),c=!0;break;case 1:((e,t,n)=>{const r=_t(t),i=Wt(),s=[],o=[],a=[],c=[],l=Et(r);for(let t=0;t<l;t++){const t=Et(r);let n=Et(r);const l=JSON.parse(St(r)),u=e.meta.get(t),d=e.states.get(t),h=void 0===u?0:u.clock;(h<n||h===n&&null===l&&e.states.has(t))&&(null===l?t===e.clientID&&null!=e.getLocalState()?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),void 0===u&&null!==l?s.push(t):void 0!==u&&null===l?c.push(t):null!==l&&(Te(l,d)||a.push(t),o.push(t)))}(s.length>0||a.length>0||c.length>0)&&e.emit("change",[{added:s,updated:a,removed:c},n]),(s.length>0||o.length>0||c.length>0)&&e.emit("update",[{added:s,updated:o,removed:c},n])})(o,wt(r),e);break;case 4:{const t=1===vt(r),n=St(r);if(n!==e.peerId&&(e.bcConns.has(n)&&!t||!e.bcConns.has(n)&&t)){const r=[],i=[];t?(e.bcConns.add(n),i.push(n)):(e.bcConns.delete(n),r.push(n)),e.provider.emit("peers",[{added:i,removed:r,webrtcPeers:Array.from(e.webrtcConns.keys()),bcPeers:Array.from(e.bcConns)}]),xs(e)}break}default:return console.error("Unable to compute message"),i}return c?i:null},As=(e,t)=>{Rs("send message to ",Gt,e.remotePeerId,Ht,zt," (",e.room.name,")",Xt);try{e.peer.send(Ye(t))}catch(e){}};class Is{constructor(e,t,n,r){Rs("establishing connection to ",Gt,n),this.room=r,this.remotePeerId=n,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new(hs())({initiator:t,...r.provider.peerOpts}),this.peer.on("signal",(t=>{void 0===this.glareToken&&(this.glareToken=Date.now()+Math.random()),Ms(e,r,{to:n,from:r.peerId,type:"signal",token:this.glareToken,signal:t})})),this.peer.on("connect",(()=>{Rs("connected to ",Gt,n),this.connected=!0;const e=r.provider.doc,t=r.awareness,i=ze();Qe(i,0),fs(i,e),As(this,i);const s=t.getStates();if(s.size>0){const e=ze();Qe(e,1),rt(e,_s(t,Array.from(s.keys()))),As(this,e)}})),this.peer.on("close",(()=>{this.connected=!1,this.closed=!0,r.webrtcConns.has(this.remotePeerId)&&(r.webrtcConns.delete(this.remotePeerId),r.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(r.webrtcConns.keys()),bcPeers:Array.from(r.bcConns)}])),ks(r),this.peer.destroy(),Rs("closed connection to ",Gt,n),Ls(r)})),this.peer.on("error",(e=>{Rs("Error in connection to ",Gt,n,": ",e),Ls(r)})),this.peer.on("data",(e=>{const t=((e,t)=>{const n=e.room;return Rs("received message from ",Gt,e.remotePeerId,zt," (",n.name,")",Ht,Xt),Ts(n,t,(()=>{e.synced=!0,Rs("synced ",Gt,n.name,Ht," with ",Gt,e.remotePeerId),ks(n)}))})(this,e);null!==t&&As(this,t)}))}destroy(){this.peer.destroy()}}const Os=(e,t)=>ws(t,e.key).then((t=>e.mux((()=>((e,t,n=null)=>{const r=us(e);r.bc.postMessage(t),r.subs.forEach((e=>e(t,n)))})(e.name,t))))),Ds=(e,t)=>{e.bcconnected&&Os(e,t),((e,t)=>{Rs("broadcast message in ",Gt,e.name,Ht),e.webrtcConns.forEach((e=>{try{e.peer.send(t)}catch(e){}}))})(e,t)},Ls=e=>{Ss.forEach((t=>{t.connected&&(t.send({type:"subscribe",topics:[e.name]}),e.webrtcConns.size<e.provider.maxConns&&Ms(t,e,{type:"announce",from:e.peerId}))}))},xs=e=>{if(e.provider.filterBcConns){const t=ze();Qe(t,4),Je(t,1),tt(t,e.peerId),Os(e,Ye(t))}};class Ns{constructor(e,t,n,r){this.peerId=Ut(),this.doc=e,this.awareness=t.awareness,this.provider=t,this.synced=!1,this.name=n,this.key=r,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=(()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else void 0!==n&&n()}})(),this.bcconnected=!1,this._bcSubscriber=e=>vs(new Uint8Array(e),r).then((e=>this.mux((()=>{const t=Ts(this,e,(()=>{}));t&&Os(this,Ye(t))})))),this._docUpdateHandler=(e,t)=>{const n=ze();Qe(n,0),((e,t)=>{Qe(e,2),rt(e,t)})(n,e),Ds(this,Ye(n))},this._awarenessUpdateHandler=({added:e,updated:t,removed:n},r)=>{const i=e.concat(t).concat(n),s=ze();Qe(s,1),rt(s,_s(this.awareness,i)),Ds(this,Ye(s))},this._beforeUnloadHandler=()=>{bs(this.awareness,[e.clientID],"window unload"),Cs.forEach((e=>{e.disconnect()}))},"undefined"!=typeof window?window.addEventListener("beforeunload",this._beforeUnloadHandler):"undefined"!=typeof process&&process.on("exit",this._beforeUnloadHandler)}connect(){var e,t;this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),Ls(this),e=this.name,t=this._bcSubscriber,us(e).subs.add(t),this.bcconnected=!0,xs(this);const n=ze();Qe(n,0),fs(n,this.doc),Os(this,Ye(n));const r=ze();Qe(r,0),ps(r,this.doc),Os(this,Ye(r));const i=ze();Qe(i,3),Os(this,Ye(i));const s=ze();Qe(s,1),rt(s,_s(this.awareness,[this.doc.clientID])),Os(this,Ye(s))}disconnect(){Ss.forEach((e=>{e.connected&&e.send({type:"unsubscribe",topics:[this.name]})})),bs(this.awareness,[this.doc.clientID],"disconnect");const e=ze();Qe(e,4),Je(e,0),tt(e,this.peerId),Os(this,Ye(e)),((e,t)=>{const n=us(e);n.subs.delete(t)&&0===n.subs.size&&(n.bc.close(),cs.delete(e))})(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach((e=>e.destroy()))}destroy(){this.disconnect(),"undefined"!=typeof window?window.removeEventListener("beforeunload",this._beforeUnloadHandler):"undefined"!=typeof process&&process.off("exit",this._beforeUnloadHandler)}}const Ms=(e,t,n)=>{t.key?((e,t)=>{const n=ze();return ot(n,e),ws(Ye(n),t)})(n,t.key).then((n=>{e.send({type:"publish",topic:t.name,data:Be(n)})})):e.send({type:"publish",topic:t.name,data:n})};class Us extends as{constructor(e){super(e),this.providers=new Set,this.on("connect",(()=>{Rs(`connected (${e})`);const t=Array.from(Cs.keys());this.send({type:"subscribe",topics:t}),Cs.forEach((e=>Ms(this,e,{type:"announce",from:e.peerId})))})),this.on("message",(e=>{if("publish"===e.type){const t=e.topic,n=Cs.get(t);if(null==n||"string"!=typeof t)return;const r=e=>{const t=n.webrtcConns,r=n.peerId;if(null==e||e.from===r||void 0!==e.to&&e.to!==r||n.bcConns.has(e.from))return;const i=t.has(e.from)?()=>{}:()=>n.provider.emit("peers",[{removed:[],added:[e.from],webrtcPeers:Array.from(n.webrtcConns.keys()),bcPeers:Array.from(n.bcConns)}]);switch(e.type){case"announce":t.size<n.provider.maxConns&&(Q(t,e.from,(()=>new Is(this,!0,e.from,n))),i());break;case"signal":if("offer"===e.signal.type){const n=t.get(e.from);if(n){const t=e.token,r=n.glareToken;if(r&&r>t)return void Rs("offer rejected: ",e.from);n.glareToken=void 0}}"answer"===e.signal.type&&(Rs("offer answered by: ",e.from),t.get(e.from).glareToken=void 0),e.to===r&&(Q(t,e.from,(()=>new Is(this,!1,e.from,n))).peer.signal(e.signal),i())}};n.key?"string"==typeof e.data&&Es(Fe(e.data),n.key).then(r):r(e.data)}})),this.on("disconnect",(()=>Rs(`disconnect (${e})`)))}}class Ps extends re{constructor(e,t,{signaling:n=["wss://y-webrtc-eu.fly.dev"],password:r=null,awareness:i=new ms(t),maxConns:s=20+ie(15*xt()),filterBcConns:o=!0,peerOpts:a={}}={}){super(),this.roomName=e,this.doc=t,this.filterBcConns=o,this.awareness=i,this.shouldConnect=!1,this.signalingUrls=n,this.signalingConns=[],this.maxConns=s,this.peerOpts=a,this.key=r?((e,t)=>{const n=ge(e).buffer,r=ge(t).buffer;return crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveKey"]).then((e=>crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])))})(r,e):jt(null),this.room=null,this.key.then((n=>{this.room=((e,t,n,r)=>{if(Cs.has(n))throw ft(`A Yjs Doc connected to room "${n}" already exists!`);const i=new Ns(e,t,n,r);return Cs.set(n,i),i})(t,this,e,n),this.shouldConnect?this.room.connect():this.room.disconnect()})),this.connect(),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}get connected(){return null!==this.room&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach((e=>{const t=Q(Ss,e,(()=>new Us(e)));this.signalingConns.push(t),t.providers.add(this)})),this.room&&this.room.connect()}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach((e=>{e.providers.delete(this),0===e.providers.size&&(e.destroy(),Ss.delete(e.url))})),this.room&&this.room.disconnect()}destroy(){this.doc.off("destroy",this.destroy),this.key.then((()=>{this.room.destroy(),Cs.delete(this.roomName)})),super.destroy()}}function js(e){if(e.shouldConnect&&null===e.ws){const t=Math.floor(1e5+9e5*Math.random()),n=e.url,r=new window.EventSource((0,j.addQueryArgs)(n,{subscriber_id:t,action:"gutenberg_signaling_server"}));let i=null;r.onmessage=t=>{e.lastMessageReceived=Date.now();const n=t.data;if(n){const e=JSON.parse(n);Array.isArray(e)&&e.forEach(s)}},e.ws=r,e.connecting=!0,e.connected=!1;const s=t=>{t&&"pong"===t.type&&(clearTimeout(i),i=setTimeout(a,Bs/2)),e.emit("message",[t,e])},o=t=>{null!==e.ws&&(e.ws.close(),e.ws=null,e.connecting=!1,e.connected?(e.connected=!1,e.emit("disconnect",[{type:"disconnect",error:t},e])):e.unsuccessfulReconnects++),clearTimeout(i)},a=()=>{e.ws&&e.ws.readyState===window.EventSource.OPEN&&e.send({type:"ping"})};e.ws&&(e.ws.onclose=()=>{o(null)},e.ws.send=function(e){window.fetch(n,{body:new URLSearchParams({subscriber_id:t.toString(),action:"gutenberg_signaling_server",message:e}),method:"POST"}).catch((()=>{Rs("Error sending to server with message: "+e)}))}),r.onerror=()=>{},r.onopen=()=>{e.connected||r.readyState===window.EventSource.OPEN&&(e.lastMessageReceived=Date.now(),e.connecting=!1,e.connected=!0,e.unsuccessfulReconnects=0,e.emit("connect",[{type:"connect"},e]),i=setTimeout(a,Bs/2))}}}const Bs=3e4;class Fs extends re{constructor(e){super(),this.url=e,this.ws=null,this.binaryType=null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval((()=>{this.connected&&Bs<Date.now()-this.lastMessageReceived&&this.ws&&this.ws.close()}),Bs/2),js(this),this.providers=new Set,function(e,t){e.on("connect",(()=>{Rs(`connected (${t})`);const n=Array.from(Cs.keys());e.send({type:"subscribe",topics:n}),Cs.forEach((t=>Ms(e,t,{type:"announce",from:t.peerId})))})),e.on("message",(t=>{if("publish"===t.type){const n=t.topic,r=Cs.get(n);if(null===r||"string"!=typeof n||void 0===r)return;const i=t=>{const n=r.webrtcConns,i=r.peerId;if(null===t||t.from===i||void 0!==t.to&&t.to!==i||r.bcConns.has(t.from))return;const s=n.has(t.from)?()=>{}:()=>r.provider.emit("peers",[{removed:[],added:[t.from],webrtcPeers:Array.from(r.webrtcConns.keys()),bcPeers:Array.from(r.bcConns)}]);switch(t.type){case"announce":n.size<r.provider.maxConns&&(Q(n,t.from,(()=>new Is(e,!0,t.from,r))),s());break;case"signal":if("offer"===t.signal.type){const e=n.get(t.from);if(e){const n=t.token,r=e.glareToken;if(r&&r>n)return void Rs("offer rejected: ",t.from);e.glareToken=void 0}}if("answer"===t.signal.type){Rs("offer answered by: ",t.from);const e=n.get(t.from);e&&(e.glareToken=void 0)}t.to===i&&(Q(n,t.from,(()=>new Is(e,!1,t.from,r))).peer.signal(t.signal),s())}};r.key?"string"==typeof t.data&&Es(Fe(t.data),r.key).then(i):i(t.data)}})),e.on("disconnect",(()=>Rs(`disconnect (${t})`)))}(this,e)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,null!==this.ws&&this.ws.close()}connect(){this.shouldConnect=!0,this.connected||null!==this.ws||js(this)}}class Vs extends Ps{connect(){this.shouldConnect=!0,this.signalingUrls.forEach((e=>{const t=Q(Ss,e,e.startsWith("ws://")||e.startsWith("wss://")?()=>new Us(e):()=>new Fs(e));this.signalingConns.push(t),t.providers.add(this)})),this.room&&this.room.connect()}}let qs;function Ws(){return qs||(qs=zi(ss,function({signaling:e,password:t}){return function(n,r,i){return new Vs(`${r}-${n}`,i,{signaling:e,password:t}),Promise.resolve((()=>!0))}}({signaling:[window?.wp?.ajax?.settings?.url],password:window?.__experimentalCollaborativeEditingSecret}))),qs}function Gs(e,t){return{type:"RECEIVE_USER_QUERY",users:Array.isArray(t)?t:[t],queryID:e}}function Hs(e){return{type:"RECEIVE_CURRENT_USER",currentUser:e}}function $s(e){return{type:"ADD_ENTITIES",entities:e}}function zs(e,t,n,r,i=!1,s,o){let a;return"postType"===e&&(n=(Array.isArray(n)?n:[n]).map((e=>"auto-draft"===e.status?{...e,title:""}:e))),a=r?function(e,t={},n,r){return{...W(e,n,r),query:t}}(n,r,s,o):W(n,s,o),{...a,kind:e,name:t,invalidateCache:i}}function Ys(e){return{type:"RECEIVE_CURRENT_THEME",currentTheme:e}}function Ks(e){return{type:"RECEIVE_CURRENT_GLOBAL_STYLES_ID",id:e}}function Js(e,t){return{type:"RECEIVE_THEME_GLOBAL_STYLES",stylesheet:e,globalStyles:t}}function Qs(e,t){return{type:"RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS",stylesheet:e,variations:t}}function Xs(){return F()("wp.data.dispatch( 'core' ).receiveThemeSupports",{since:"5.9"}),{type:"DO_NOTHING"}}function Zs(e,t){return F()("wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()",{since:"6.5.0",alternative:"wp.data.dispatch( 'core' ).receiveRevisions"}),{type:"RECEIVE_THEME_GLOBAL_STYLE_REVISIONS",currentId:e,revisions:t}}function eo(e,t){return{type:"RECEIVE_EMBED_PREVIEW",url:e,preview:t}}const to=(e,t,n,r,{__unstableFetch:i=T(),throwOnError:s=!1}={})=>async({dispatch:o})=>{const a=(await o(To(e,t))).find((n=>n.kind===e&&n.name===t));let c,l=!1;if(!a)return;const u=await o.__unstableAcquireStoreLock(Y,["entities","records",e,t,n],{exclusive:!0});try{o({type:"DELETE_ENTITY_RECORD_START",kind:e,name:t,recordId:n});let u=!1;try{let s=`${a.baseURL}/${n}`;r&&(s=(0,j.addQueryArgs)(s,r)),l=await i({path:s,method:"DELETE"}),await o(function(e,t,n,r=!1){return{type:"REMOVE_ITEMS",itemIds:Array.isArray(n)?n:[n],kind:e,name:t,invalidateCache:r}}(e,t,n,!0))}catch(e){u=!0,c=e}if(o({type:"DELETE_ENTITY_RECORD_FINISH",kind:e,name:t,recordId:n,error:c}),u&&s)throw c;return l}finally{o.__unstableReleaseStoreLock(u)}},no=(e,t,n,r,i={})=>({select:s,dispatch:o})=>{const a=s.getEntityConfig(e,t);if(!a)throw new Error(`The entity being edited (${e}, ${t}) does not have a loaded config.`);const{mergedEdits:l={}}=a,u=s.getRawEntityRecord(e,t,n),d=s.getEditedEntityRecord(e,t,n),h={kind:e,name:t,recordId:n,edits:Object.keys(r).reduce(((e,t)=>{const n=u[t],i=d[t],s=l[t]?{...i,...r[t]}:r[t];return e[t]=c()(n,s)?void 0:s,e}),{})};if(window.__experimentalEnableSync&&a.syncConfig){const e=a.getSyncObjectId(n);Ws().update(a.syncObjectType+"--edit",e,h.edits)}else i.undoIgnore||s.getUndoManager().addRecord([{id:{kind:e,name:t,recordId:n},changes:Object.keys(r).reduce(((e,t)=>(e[t]={from:d[t],to:r[t]},e)),{})}],i.isCached),o({type:"EDIT_ENTITY_RECORD",...h})},ro=()=>({select:e,dispatch:t})=>{const n=e.getUndoManager().undo();n&&t({type:"UNDO",record:n})},io=()=>({select:e,dispatch:t})=>{const n=e.getUndoManager().redo();n&&t({type:"REDO",record:n})},so=()=>({select:e})=>{e.getUndoManager().addRecord()},oo=(e,t,n,{isAutosave:r=!1,__unstableFetch:i=T(),throwOnError:s=!1}={})=>async({select:o,resolveSelect:a,dispatch:c})=>{const l=(await c(To(e,t))).find((n=>n.kind===e&&n.name===t));if(!l)return;const u=l.key||mo,d=n[u],h=await c.__unstableAcquireStoreLock(Y,["entities","records",e,t,d||P()],{exclusive:!0});try{for(const[r,i]of Object.entries(n))if("function"==typeof i){const s=i(o.getEditedEntityRecord(e,t,d));c.editEntityRecord(e,t,d,{[r]:s},{undoIgnore:!0}),n[r]=s}let u,h;c({type:"SAVE_ENTITY_RECORD_START",kind:e,name:t,recordId:d,isAutosave:r});let f=!1;try{const s=`${l.baseURL}${d?"/"+d:""}`,h=o.getRawEntityRecord(e,t,d);if(r){const r=o.getCurrentUser(),l=r?r.id:void 0,d=await a.getAutosave(h.type,h.id,l);let f={...h,...d,...n};if(f=Object.keys(f).reduce(((e,t)=>(["title","excerpt","content","meta"].includes(t)&&(e[t]=f[t]),e)),{status:"auto-draft"===f.status?"draft":void 0}),u=await i({path:`${s}/autosaves`,method:"POST",data:f}),h.id===u.id){let n={...h,...f,...u};n=Object.keys(n).reduce(((e,t)=>(["title","excerpt","content"].includes(t)?e[t]=n[t]:e[t]="status"===t?"auto-draft"===h.status&&"draft"===n.status?n.status:h.status:h[t],e)),{}),c.receiveEntityRecords(e,t,n,void 0,!0)}else c.receiveAutosaves(h.id,u)}else{let r=n;l.__unstablePrePersist&&(r={...r,...l.__unstablePrePersist(h,r)}),u=await i({path:s,method:d?"PUT":"POST",data:r}),c.receiveEntityRecords(e,t,u,void 0,!0,r)}}catch(e){f=!0,h=e}if(c({type:"SAVE_ENTITY_RECORD_FINISH",kind:e,name:t,recordId:d,error:h,isAutosave:r}),f&&s)throw h;return u}finally{c.__unstableReleaseStoreLock(h)}},ao=e=>async({dispatch:t})=>{const n=$(),r={saveEntityRecord:(e,r,i,s)=>n.add((n=>t.saveEntityRecord(e,r,i,{...s,__unstableFetch:n}))),saveEditedEntityRecord:(e,r,i,s)=>n.add((n=>t.saveEditedEntityRecord(e,r,i,{...s,__unstableFetch:n}))),deleteEntityRecord:(e,r,i,s,o)=>n.add((n=>t.deleteEntityRecord(e,r,i,s,{...o,__unstableFetch:n})))},i=e.map((e=>e(r))),[,...s]=await Promise.all([n.run(),...i]);return s},co=(e,t,n,r)=>async({select:i,dispatch:s})=>{if(!i.hasEditsForEntityRecord(e,t,n))return;const o=(await s(To(e,t))).find((n=>n.kind===e&&n.name===t));if(!o)return;const a=o.key||mo,c=i.getEntityRecordNonTransientEdits(e,t,n),l={[a]:n,...c};return await s.saveEntityRecord(e,t,l,r)},lo=(e,t,n,r,i)=>async({select:s,dispatch:o})=>{if(!s.hasEditsForEntityRecord(e,t,n))return;const a=s.getEntityRecordNonTransientEdits(e,t,n),c={};for(const e of r)V(c,e,q(a,e));const l=(await o(To(e,t))).find((n=>n.kind===e&&n.name===t));return n&&(c[l?.key||mo]=n),await o.saveEntityRecord(e,t,c,i)};function uo(e){return F()("wp.data.dispatch( 'core' ).receiveUploadPermissions",{since:"5.9",alternative:"receiveUserPermission"}),ho("create/media",e)}function ho(e,t){return{type:"RECEIVE_USER_PERMISSION",key:e,isAllowed:t}}function fo(e,t){return{type:"RECEIVE_AUTOSAVES",postId:e,autosaves:Array.isArray(t)?t:[t]}}function po(e){return{type:"RECEIVE_NAVIGATION_FALLBACK_ID",fallbackId:e}}function go(e,t){return{type:"RECEIVE_DEFAULT_TEMPLATE",query:e,templateId:t}}const yo=(e,t,n,r,i,s=!1,o)=>async({dispatch:a})=>{const c=(await a(To(e,t))).find((n=>n.kind===e&&n.name===t));a({type:"RECEIVE_ITEM_REVISIONS",key:c&&c?.revisionKey?c.revisionKey:mo,items:Array.isArray(r)?r:[r],recordKey:n,meta:o,query:i,kind:e,name:t,invalidateCache:s})},mo="id",bo=["title","excerpt","content"],_o=[{label:(0,A.__)("Base"),kind:"root",name:"__unstableBase",baseURL:"/",baseURLParams:{_fields:["description","gmt_offset","home","name","site_icon","site_icon_url","site_logo","timezone_string","url"].join(",")},plural:"__unstableBases",syncConfig:{fetch:async()=>T()({path:"/"}),applyChangesToDoc:(e,t)=>{const n=e.getMap("document");Object.entries(t).forEach((([e,t])=>{n.get(e)!==t&&n.set(e,t)}))},fromCRDTDoc:e=>e.getMap("document").toJSON()},syncObjectType:"root/base",getSyncObjectId:()=>"index"},{label:(0,A.__)("Post Type"),name:"postType",kind:"root",key:"slug",baseURL:"/wp/v2/types",baseURLParams:{context:"edit"},plural:"postTypes",syncConfig:{fetch:async e=>T()({path:`/wp/v2/types/${e}?context=edit`}),applyChangesToDoc:(e,t)=>{const n=e.getMap("document");Object.entries(t).forEach((([e,t])=>{n.get(e)!==t&&n.set(e,t)}))},fromCRDTDoc:e=>e.getMap("document").toJSON()},syncObjectType:"root/postType",getSyncObjectId:e=>e},{name:"media",kind:"root",baseURL:"/wp/v2/media",baseURLParams:{context:"edit"},plural:"mediaItems",label:(0,A.__)("Media"),rawAttributes:["caption","title","description"],supportsPagination:!0},{name:"taxonomy",kind:"root",key:"slug",baseURL:"/wp/v2/taxonomies",baseURLParams:{context:"edit"},plural:"taxonomies",label:(0,A.__)("Taxonomy")},{name:"sidebar",kind:"root",baseURL:"/wp/v2/sidebars",baseURLParams:{context:"edit"},plural:"sidebars",transientEdits:{blocks:!0},label:(0,A.__)("Widget areas")},{name:"widget",kind:"root",baseURL:"/wp/v2/widgets",baseURLParams:{context:"edit"},plural:"widgets",transientEdits:{blocks:!0},label:(0,A.__)("Widgets")},{name:"widgetType",kind:"root",baseURL:"/wp/v2/widget-types",baseURLParams:{context:"edit"},plural:"widgetTypes",label:(0,A.__)("Widget types")},{label:(0,A.__)("User"),name:"user",kind:"root",baseURL:"/wp/v2/users",baseURLParams:{context:"edit"},plural:"users"},{name:"comment",kind:"root",baseURL:"/wp/v2/comments",baseURLParams:{context:"edit"},plural:"comments",label:(0,A.__)("Comment")},{name:"menu",kind:"root",baseURL:"/wp/v2/menus",baseURLParams:{context:"edit"},plural:"menus",label:(0,A.__)("Menu")},{name:"menuItem",kind:"root",baseURL:"/wp/v2/menu-items",baseURLParams:{context:"edit"},plural:"menuItems",label:(0,A.__)("Menu Item"),rawAttributes:["title"]},{name:"menuLocation",kind:"root",baseURL:"/wp/v2/menu-locations",baseURLParams:{context:"edit"},plural:"menuLocations",label:(0,A.__)("Menu Location"),key:"name"},{label:(0,A.__)("Global Styles"),name:"globalStyles",kind:"root",baseURL:"/wp/v2/global-styles",baseURLParams:{context:"edit"},plural:"globalStylesVariations",getTitle:e=>e?.title?.rendered||e?.title,getRevisionsUrl:(e,t)=>`/wp/v2/global-styles/${e}/revisions${t?"/"+t:""}`,supportsPagination:!0},{label:(0,A.__)("Themes"),name:"theme",kind:"root",baseURL:"/wp/v2/themes",baseURLParams:{context:"edit"},plural:"themes",key:"stylesheet"},{label:(0,A.__)("Plugins"),name:"plugin",kind:"root",baseURL:"/wp/v2/plugins",baseURLParams:{context:"edit"},plural:"plugins",key:"plugin"},{label:(0,A.__)("Status"),name:"status",kind:"root",baseURL:"/wp/v2/statuses",baseURLParams:{context:"edit"},plural:"statuses",key:"slug"}],wo=[{kind:"postType",loadEntities:async function(){const e=await T()({path:"/wp/v2/types?context=view"});return Object.entries(null!=e?e:{}).map((([e,t])=>{var n;const r=["wp_template","wp_template_part"].includes(e),i=null!==(n=t?.rest_namespace)&&void 0!==n?n:"wp/v2";return{kind:"postType",baseURL:`/${i}/${t.rest_base}`,baseURLParams:{context:"edit"},name:e,label:t.name,transientEdits:{blocks:!0,selection:!0},mergedEdits:{meta:!0},rawAttributes:bo,getTitle:e=>{var t,n,i;return e?.title?.rendered||e?.title||(r?(n=null!==(t=e.slug)&&void 0!==t?t:"",void 0===i&&(i={}),v(n,m({delimiter:" ",transform:R},i))):String(e.id))},__unstablePrePersist:r?void 0:vo,__unstable_rest_base:t.rest_base,syncConfig:{fetch:async e=>T()({path:`/${i}/${t.rest_base}/${e}?context=edit`}),applyChangesToDoc:(e,t)=>{const n=e.getMap("document");Object.entries(t).forEach((([e,t])=>{"function"!=typeof t&&("blocks"===e&&(Eo.has(t)||Eo.set(t,So(t)),t=Eo.get(t)),n.get(e)!==t&&n.set(e,t))}))},fromCRDTDoc:e=>e.getMap("document").toJSON()},syncObjectType:"postType/"+t.name,getSyncObjectId:e=>e,supportsPagination:!0,getRevisionsUrl:(e,n)=>`/${i}/${t.rest_base}/${e}/revisions${n?"/"+n:""}`,revisionKey:r?"wp_id":mo}}))}},{kind:"taxonomy",loadEntities:async function(){const e=await T()({path:"/wp/v2/taxonomies?context=view"});return Object.entries(null!=e?e:{}).map((([e,t])=>{var n;return{kind:"taxonomy",baseURL:`/${null!==(n=t?.rest_namespace)&&void 0!==n?n:"wp/v2"}/${t.rest_base}`,baseURLParams:{context:"edit"},name:e,label:t.name}}))}},{kind:"root",name:"site",plural:"sites",loadEntities:async function(){var e;const t={label:(0,A.__)("Site"),name:"site",kind:"root",baseURL:"/wp/v2/settings",syncConfig:{fetch:async()=>T()({path:"/wp/v2/settings"}),applyChangesToDoc:(e,t)=>{const n=e.getMap("document");Object.entries(t).forEach((([e,t])=>{n.get(e)!==t&&n.set(e,t)}))},fromCRDTDoc:e=>e.getMap("document").toJSON()},syncObjectType:"root/site",getSyncObjectId:()=>"index",meta:{}},n=await T()({path:t.baseURL,method:"OPTIONS"}),r={};return Object.entries(null!==(e=n?.schema?.properties)&&void 0!==e?e:{}).forEach((([e,t])=>{"object"==typeof t&&t.title&&(r[e]=t.title)})),[{...t,meta:{labels:r}}]}}],vo=(e,t)=>{const n={};return"auto-draft"===e?.status&&(t.status||n.status||(n.status="draft"),t.title&&"Auto Draft"!==t.title||n.title||e?.title&&"Auto Draft"!==e?.title||(n.title="")),n},Eo=new WeakMap;function Ro(e){const t={...e};for(const[n,r]of Object.entries(e))r instanceof I.RichTextData&&(t[n]=r.valueOf());return t}function So(e){return e.map((e=>{const{innerBlocks:t,attributes:n,...r}=e;return{...r,attributes:Ro(n),innerBlocks:So(t)}}))}const Co=(e,t,n="get")=>`${n}${"root"===e?"":C(e)}${C(t)}`;function ko(e){e.forEach((({syncObjectType:e,syncConfig:t})=>{Ws().register(e,t);const n={...t};delete n.fetch,Ws().register(e+"--edit",n)}))}const To=(e,t)=>async({select:n,dispatch:r})=>{let i=n.getEntitiesConfig(e);const s=!!n.getEntityConfig(e,t);if(i?.length>0&&s)return window.__experimentalEnableSync&&ko(i),i;const o=wo.find((n=>t&&n.name?n.kind===e&&n.name===t:n.kind===e));return o?(i=await o.loadEntities(),window.__experimentalEnableSync&&ko(i),r($s(i)),i):[]},Ao=function(e){return"string"==typeof e?e.split(","):Array.isArray(e)?e:null},Io=function(e){const t=new WeakMap;return n=>{let r;return t.has(n)?r=t.get(n):(r=e(n),null!==n&&"object"==typeof n&&t.set(n,r)),r}}((function(e){const t={stableKey:"",page:1,perPage:10,fields:null,include:null,context:"default"},n=Object.keys(e).sort();for(let s=0;s<n.length;s++){const o=n[s];let a=e[o];switch(o){case"page":t[o]=Number(a);break;case"per_page":t.perPage=Number(a);break;case"context":t.context=a;break;default:var r,i;"_fields"===o&&(t.fields=null!==(r=Ao(a))&&void 0!==r?r:[],a=t.fields.join()),"include"===o&&("number"==typeof a&&(a=a.toString()),t.include=(null!==(i=Ao(a))&&void 0!==i?i:[]).map(Number),a=t.include.join()),t.stableKey+=(t.stableKey?"&":"")+(0,j.addQueryArgs)("",{[o]:a}).slice(1)}}return t}));function Oo(e){const{query:t}=e;return t?Io(t).context:"default"}function Do(e,t,n,r){var i;if(1===n&&-1===r)return t;const s=(n-1)*r,o=Math.max(null!==(i=e?.length)&&void 0!==i?i:0,s+t.length),a=new Array(o);for(let n=0;n<o;n++){const i=n>=s&&n<s+r;a[n]=i?t[n-s]:e?.[n]}return a}function Lo(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>!t.some((t=>Number.isInteger(t)?t===+e:t===e)))))}const xo=(0,l.compose)([p((e=>"query"in e)),g((e=>e.query?{...e,...Io(e.query)}:e)),y("context"),y("stableKey")])(((e={},t)=>{const{type:n,page:r,perPage:i,key:s=mo}=t;return"RECEIVE_ITEMS"!==n?e:{itemIds:Do(e?.itemIds||[],t.items.map((e=>e?.[s])).filter(Boolean),r,i),meta:t.meta}})),No=(0,o.combineReducers)({items:function(e={},t){switch(t.type){case"RECEIVE_ITEMS":{const n=Oo(t),r=t.key||mo;return{...e,[n]:{...e[n],...t.items.reduce(((t,i)=>{const s=i?.[r];return t[s]=function(e,t){if(!e)return t;let n=!1;const r={};for(const i in t)c()(e[i],t[i])?r[i]=e[i]:(n=!0,r[i]=t[i]);if(!n)return e;for(const t in e)r.hasOwnProperty(t)||(r[t]=e[t]);return r}(e?.[n]?.[s],i),t}),{})}}}case"REMOVE_ITEMS":return Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Lo(n,t.itemIds)])))}return e},itemIsComplete:function(e={},t){switch(t.type){case"RECEIVE_ITEMS":{const n=Oo(t),{query:r,key:i=mo}=t,s=r?Io(r):{},o=!r||!Array.isArray(s.fields);return{...e,[n]:{...e[n],...t.items.reduce(((t,r)=>{const s=r?.[i];return t[s]=e?.[n]?.[s]||o,t}),{})}}}case"REMOVE_ITEMS":return Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Lo(n,t.itemIds)])))}return e},queries:(e={},t)=>{switch(t.type){case"RECEIVE_ITEMS":return xo(e,t);case"REMOVE_ITEMS":const n=t.itemIds.reduce(((e,t)=>(e[t]=!0,e)),{});return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,Object.fromEntries(Object.entries(t).map((([e,t])=>[e,{...t,itemIds:t.itemIds.filter((e=>!n[e]))}])))])));default:return e}}}),Mo=e=>(t,n)=>{if("UNDO"===n.type||"REDO"===n.type){const{record:r}=n;let i=t;return r.forEach((({id:{kind:t,name:r,recordId:s},changes:o})=>{i=e(i,{type:"EDIT_ENTITY_RECORD",kind:t,name:r,recordId:s,edits:Object.entries(o).reduce(((e,[t,r])=>(e[t]="UNDO"===n.type?r.from:r.to,e)),{})})})),i}return e(t,n)};function Uo(e){return(0,l.compose)([Mo,p((t=>t.name&&t.kind&&t.name===e.name&&t.kind===e.kind)),g((t=>({key:e.key||mo,...t})))])((0,o.combineReducers)({queriedData:No,edits:(e={},t)=>{var n;switch(t.type){case"RECEIVE_ITEMS":if("default"!==(null!==(n=t?.query?.context)&&void 0!==n?n:"default"))return e;const r={...e};for(const e of t.items){const n=e?.[t.key],i=r[n];if(!i)continue;const s=Object.keys(i).reduce(((n,r)=>{var s;return c()(i[r],null!==(s=e[r]?.raw)&&void 0!==s?s:e[r])||t.persistedEdits&&c()(i[r],t.persistedEdits[r])||(n[r]=i[r]),n}),{});Object.keys(s).length?r[n]=s:delete r[n]}return r;case"EDIT_ENTITY_RECORD":const i={...e[t.recordId],...t.edits};return Object.keys(i).forEach((e=>{void 0===i[e]&&delete i[e]})),{...e,[t.recordId]:i}}return e},saving:(e={},t)=>{switch(t.type){case"SAVE_ENTITY_RECORD_START":case"SAVE_ENTITY_RECORD_FINISH":return{...e,[t.recordId]:{pending:"SAVE_ENTITY_RECORD_START"===t.type,error:t.error,isAutosave:t.isAutosave}}}return e},deleting:(e={},t)=>{switch(t.type){case"DELETE_ENTITY_RECORD_START":case"DELETE_ENTITY_RECORD_FINISH":return{...e,[t.recordId]:{pending:"DELETE_ENTITY_RECORD_START"===t.type,error:t.error}}}return e},revisions:(e={},t)=>{if("RECEIVE_ITEM_REVISIONS"===t.type){const n=t.recordKey;delete t.recordKey;const r=No(e[n],{...t,type:"RECEIVE_ITEMS"});return{...e,[n]:r}}return"REMOVE_ITEMS"===t.type?Object.fromEntries(Object.entries(e).filter((([e])=>!t.itemIds.some((t=>Number.isInteger(t)?t===+e:t===e))))):e}}))}const Po=(0,o.combineReducers)({terms:function(e={},t){return"RECEIVE_TERMS"===t.type?{...e,[t.taxonomy]:t.terms}:e},users:function(e={byId:{},queries:{}},t){return"RECEIVE_USER_QUERY"===t.type?{byId:{...e.byId,...t.users.reduce(((e,t)=>({...e,[t.id]:t})),{})},queries:{...e.queries,[t.queryID]:t.users.map((e=>e.id))}}:e},currentTheme:function(e=void 0,t){return"RECEIVE_CURRENT_THEME"===t.type?t.currentTheme.stylesheet:e},currentGlobalStylesId:function(e=void 0,t){return"RECEIVE_CURRENT_GLOBAL_STYLES_ID"===t.type?t.id:e},currentUser:function(e={},t){return"RECEIVE_CURRENT_USER"===t.type?t.currentUser:e},themeGlobalStyleVariations:function(e={},t){return"RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS"===t.type?{...e,[t.stylesheet]:t.variations}:e},themeBaseGlobalStyles:function(e={},t){return"RECEIVE_THEME_GLOBAL_STYLES"===t.type?{...e,[t.stylesheet]:t.globalStyles}:e},themeGlobalStyleRevisions:function(e={},t){return"RECEIVE_THEME_GLOBAL_STYLE_REVISIONS"===t.type?{...e,[t.currentId]:t.revisions}:e},taxonomies:function(e=[],t){return"RECEIVE_TAXONOMIES"===t.type?t.taxonomies:e},entities:(e={},t)=>{const n=function(e=_o,t){return"ADD_ENTITIES"===t.type?[...e,...t.entities]:e}(e.config,t);let r=e.reducer;if(!r||n!==e.config){const e=n.reduce(((e,t)=>{const{kind:n}=t;return e[n]||(e[n]=[]),e[n].push(t),e}),{});r=(0,o.combineReducers)(Object.entries(e).reduce(((e,[t,n])=>{const r=(0,o.combineReducers)(n.reduce(((e,t)=>({...e,[t.name]:Uo(t)})),{}));return e[t]=r,e}),{}))}const i=r(e.records,t);return i===e.records&&n===e.config&&r===e.reducer?e:{reducer:r,records:i,config:n}},editsReference:function(e={},t){switch(t.type){case"EDIT_ENTITY_RECORD":case"UNDO":case"REDO":return{}}return e},undoManager:function(e=function(){let e=[],t=[],n=0;const r=()=>{e=e.slice(0,n||void 0),n=0},i=()=>{var n;const r=0===e.length?0:e.length-1;let i=null!==(n=e[r])&&void 0!==n?n:[];t.forEach((e=>{i=f(i,e)})),t=[],e[r]=i};return{addRecord(n,s=!1){const o=!n||(e=>!e.filter((({changes:e})=>Object.values(e).some((({from:e,to:t})=>"function"!=typeof e&&"function"!=typeof t&&!d()(e,t))))).length)(n);if(s){if(o)return;n.forEach((e=>{t=f(t,e)}))}else{if(r(),t.length&&i(),o)return;e.push(n)}},undo(){t.length&&(r(),i());const s=e[e.length-1+n];if(s)return n-=1,s},redo(){const t=e[e.length+n];if(t)return n+=1,t},hasUndo:()=>!!e[e.length-1+n],hasRedo:()=>!!e[e.length+n]}}()){return e},embedPreviews:function(e={},t){if("RECEIVE_EMBED_PREVIEW"===t.type){const{url:n,preview:r}=t;return{...e,[n]:r}}return e},userPermissions:function(e={},t){return"RECEIVE_USER_PERMISSION"===t.type?{...e,[t.key]:t.isAllowed}:e},autosaves:function(e={},t){if("RECEIVE_AUTOSAVES"===t.type){const{postId:n,autosaves:r}=t;return{...e,[n]:r}}return e},blockPatterns:function(e=[],t){return"RECEIVE_BLOCK_PATTERNS"===t.type?t.patterns:e},blockPatternCategories:function(e=[],t){return"RECEIVE_BLOCK_PATTERN_CATEGORIES"===t.type?t.categories:e},userPatternCategories:function(e=[],t){return"RECEIVE_USER_PATTERN_CATEGORIES"===t.type?t.patternCategories:e},navigationFallbackId:function(e=null,t){return"RECEIVE_NAVIGATION_FALLBACK_ID"===t.type?t.fallbackId:e},defaultTemplates:function(e={},t){return"RECEIVE_DEFAULT_TEMPLATE"===t.type?{...e,[JSON.stringify(t.query)]:t.templateId}:e}});var jo=n(2167),Bo=n.n(jo);const Fo=new WeakMap,Vo=(0,o.createSelector)(((e,t={})=>{let n=Fo.get(e);if(n){const e=n.get(t);if(void 0!==e)return e}else n=new(Bo()),Fo.set(e,n);const r=function(e,t){const{stableKey:n,page:r,perPage:i,include:s,fields:o,context:a}=Io(t);let c;if(e.queries?.[a]?.[n]&&(c=e.queries[a][n].itemIds),!c)return null;const l=-1===i?0:(r-1)*i,u=-1===i?c.length:Math.min(l+i,c.length),d=[];for(let t=l;t<u;t++){const n=c[t];if(Array.isArray(s)&&!s.includes(n))continue;if(void 0===n)continue;if(!e.items[a]?.hasOwnProperty(n))return null;const r=e.items[a][n];let i;if(Array.isArray(o)){i={};for(let e=0;e<o.length;e++){const t=o[e].split(".");let n=r;t.forEach((e=>{n=n?.[e]})),V(i,t,n)}}else{if(!e.itemIsComplete[a]?.[n])return null;i=r}d.push(i)}return d}(e,t);return n.set(t,r),r}));function qo(e,t={}){var n;const{stableKey:r,context:i}=Io(t);return null!==(n=e.queries?.[i]?.[r]?.meta?.totalItems)&&void 0!==n?n:null}const Wo=["create","read","update","delete"];function Go(e){const t={},n=e.headers?.get("allow")||"",r={create:"POST",read:"GET",update:"PUT",delete:"DELETE"};for(const[e,i]of Object.entries(r))t[e]=n.includes(i);return t}function Ho(e,t,n){return("object"==typeof t?[e,t.kind,t.name,t.id]:[e,t,n]).filter(Boolean).join("/")}const $o={},zo=(0,o.createRegistrySelector)((e=>(t,n)=>e(Y).isResolving("getEmbedPreview",[n])));function Yo(e,t){F()("select( 'core' ).getAuthors()",{since:"5.9",alternative:"select( 'core' ).getUsers({ who: 'authors' })"});const n=(0,j.addQueryArgs)("/wp/v2/users/?who=authors&per_page=100",t);return Jo(e,n)}function Ko(e){return e.currentUser}const Jo=(0,o.createSelector)(((e,t)=>{var n;return(null!==(n=e.users.queries[t])&&void 0!==n?n:[]).map((t=>e.users.byId[t]))}),((e,t)=>[e.users.queries[t],e.users.byId]));function Qo(e,t){return F()("wp.data.select( 'core' ).getEntitiesByKind()",{since:"6.0",alternative:"wp.data.select( 'core' ).getEntitiesConfig()"}),Xo(e,t)}const Xo=(0,o.createSelector)(((e,t)=>e.entities.config.filter((e=>e.kind===t))),((e,t)=>e.entities.config));function Zo(e,t,n){return F()("wp.data.select( 'core' ).getEntity()",{since:"6.0",alternative:"wp.data.select( 'core' ).getEntityConfig()"}),ea(e,t,n)}function ea(e,t,n){return e.entities.config?.find((e=>e.kind===t&&e.name===n))}const ta=(0,o.createSelector)(((e,t,n,r,i)=>{var s;const o=e.entities.records?.[t]?.[n]?.queriedData;if(!o)return;const a=null!==(s=i?.context)&&void 0!==s?s:"default";if(void 0===i){if(!o.itemIsComplete[a]?.[r])return;return o.items[a][r]}const c=o.items[a]?.[r];if(c&&i._fields){var l;const e={},t=null!==(l=Ao(i._fields))&&void 0!==l?l:[];for(let n=0;n<t.length;n++){const r=t[n].split(".");let i=c;r.forEach((e=>{i=i?.[e]})),V(e,r,i)}return e}return c}),((e,t,n,r,i)=>{var s;const o=null!==(s=i?.context)&&void 0!==s?s:"default";return[e.entities.records?.[t]?.[n]?.queriedData?.items[o]?.[r],e.entities.records?.[t]?.[n]?.queriedData?.itemIsComplete[o]?.[r]]}));function na(e,t,n,r){return ta(e,t,n,r)}ta.__unstableNormalizeArgs=e=>{const t=[...e],n=t?.[2];return t[2]=function(e){return/^\s*\d+\s*$/.test(e)}(n)?Number(n):n,t};const ra=(0,o.createSelector)(((e,t,n,r)=>{const i=ta(e,t,n,r);return i&&Object.keys(i).reduce(((r,s)=>{var o;return!function(e,t){return(e.rawAttributes||[]).includes(t)}(ea(e,t,n),s)?r[s]=i[s]:r[s]=null!==(o=i[s]?.raw)&&void 0!==o?o:i[s],r}),{})}),((e,t,n,r,i)=>{var s;const o=null!==(s=i?.context)&&void 0!==s?s:"default";return[e.entities.config,e.entities.records?.[t]?.[n]?.queriedData?.items[o]?.[r],e.entities.records?.[t]?.[n]?.queriedData?.itemIsComplete[o]?.[r]]}));function ia(e,t,n,r){return Array.isArray(sa(e,t,n,r))}const sa=(e,t,n,r)=>{const i=e.entities.records?.[t]?.[n]?.queriedData;return i?Vo(i,r):null},oa=(e,t,n,r)=>{const i=e.entities.records?.[t]?.[n]?.queriedData;return i?qo(i,r):null},aa=(e,t,n,r)=>{const i=e.entities.records?.[t]?.[n]?.queriedData;if(!i)return null;if(-1===r.per_page)return 1;const s=qo(i,r);return s?r.per_page?Math.ceil(s/r.per_page):function(e,t={}){var n;const{stableKey:r,context:i}=Io(t);return null!==(n=e.queries?.[i]?.[r]?.meta?.totalPages)&&void 0!==n?n:null}(i,r):s},ca=(0,o.createSelector)((e=>{const{entities:{records:t}}=e,n=[];return Object.keys(t).forEach((r=>{Object.keys(t[r]).forEach((i=>{const s=Object.keys(t[r][i].edits).filter((t=>ta(e,r,i,t)&&ha(e,r,i,t)));if(s.length){const t=ea(e,r,i);s.forEach((s=>{const o=fa(e,r,i,s);n.push({key:o?o[t.key||mo]:void 0,title:t?.getTitle?.(o)||"",name:i,kind:r})}))}}))})),n}),(e=>[e.entities.records])),la=(0,o.createSelector)((e=>{const{entities:{records:t}}=e,n=[];return Object.keys(t).forEach((r=>{Object.keys(t[r]).forEach((i=>{const s=Object.keys(t[r][i].saving).filter((t=>ga(e,r,i,t)));if(s.length){const t=ea(e,r,i);s.forEach((s=>{const o=fa(e,r,i,s);n.push({key:o?o[t.key||mo]:void 0,title:t?.getTitle?.(o)||"",name:i,kind:r})}))}}))})),n}),(e=>[e.entities.records]));function ua(e,t,n,r){return e.entities.records?.[t]?.[n]?.edits?.[r]}const da=(0,o.createSelector)(((e,t,n,r)=>{const{transientEdits:i}=ea(e,t,n)||{},s=ua(e,t,n,r)||{};return i?Object.keys(s).reduce(((e,t)=>(i[t]||(e[t]=s[t]),e)),{}):s}),((e,t,n,r)=>[e.entities.config,e.entities.records?.[t]?.[n]?.edits?.[r]]));function ha(e,t,n,r){return ga(e,t,n,r)||Object.keys(da(e,t,n,r)).length>0}const fa=(0,o.createSelector)(((e,t,n,r)=>{const i=ra(e,t,n,r),s=ua(e,t,n,r);return!(!i&&!s)&&{...i,...s}}),((e,t,n,r,i)=>{var s;const o=null!==(s=i?.context)&&void 0!==s?s:"default";return[e.entities.config,e.entities.records?.[t]?.[n]?.queriedData.items[o]?.[r],e.entities.records?.[t]?.[n]?.queriedData.itemIsComplete[o]?.[r],e.entities.records?.[t]?.[n]?.edits?.[r]]}));function pa(e,t,n,r){var i;const{pending:s,isAutosave:o}=null!==(i=e.entities.records?.[t]?.[n]?.saving?.[r])&&void 0!==i?i:{};return Boolean(s&&o)}function ga(e,t,n,r){var i;return null!==(i=e.entities.records?.[t]?.[n]?.saving?.[r]?.pending)&&void 0!==i&&i}function ya(e,t,n,r){var i;return null!==(i=e.entities.records?.[t]?.[n]?.deleting?.[r]?.pending)&&void 0!==i&&i}function ma(e,t,n,r){return e.entities.records?.[t]?.[n]?.saving?.[r]?.error}function ba(e,t,n,r){return e.entities.records?.[t]?.[n]?.deleting?.[r]?.error}function _a(e){F()("select( 'core' ).getUndoEdit()",{since:"6.3"})}function wa(e){F()("select( 'core' ).getRedoEdit()",{since:"6.3"})}function va(e){return e.undoManager.hasUndo()}function Ea(e){return e.undoManager.hasRedo()}function Ra(e){return e.currentTheme?ta(e,"root","theme",e.currentTheme):null}function Sa(e){return e.currentGlobalStylesId}function Ca(e){var t;return null!==(t=Ra(e)?.theme_supports)&&void 0!==t?t:$o}function ka(e,t){return e.embedPreviews[t]}function Ta(e,t){const n=e.embedPreviews[t],r='<a href="'+t+'">'+t+"</a>";return!!n&&n.html===r}function Aa(e,t,n,r){if(!("object"!=typeof n||n.kind&&n.name))return!1;const i=Ho(t,n,r);return e.userPermissions[i]}function Ia(e,t,n,r){return F()("wp.data.select( 'core' ).canUserEditEntityRecord()",{since:"6.7",alternative:"wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )"}),Aa(e,"update",{kind:t,name:n,id:r})}function Oa(e,t,n){return e.autosaves[n]}function Da(e,t,n,r){if(void 0===r)return;const i=e.autosaves[n];return i?.find((e=>e.author===r))}const La=(0,o.createRegistrySelector)((e=>(t,n,r)=>e(Y).hasFinishedResolution("getAutosaves",[n,r])));function xa(e){return e.editsReference}function Na(e,t){const n=sa(e,"postType","wp_template",{"find-template":t});return n?.length?fa(e,"postType","wp_template",n[0].id):null}function Ma(e){const t=Ra(e);return t?e.themeBaseGlobalStyles[t.stylesheet]:null}function Ua(e){const t=Ra(e);return t?e.themeGlobalStyleVariations[t.stylesheet]:null}function Pa(e){return e.blockPatterns}function ja(e){return e.blockPatternCategories}function Ba(e){return e.userPatternCategories}function Fa(e){F()("select( 'core' ).getCurrentThemeGlobalStylesRevisions()",{since:"6.5.0",alternative:"select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )"});const t=Sa(e);return t?e.themeGlobalStyleRevisions[t]:null}function Va(e,t){return e.defaultTemplates[JSON.stringify(t)]}const qa=(e,t,n,r,i)=>{const s=e.entities.records?.[t]?.[n]?.revisions?.[r];return s?Vo(s,i):null},Wa=(0,o.createSelector)(((e,t,n,r,i,s)=>{var o;const a=e.entities.records?.[t]?.[n]?.revisions?.[r];if(!a)return;const c=null!==(o=s?.context)&&void 0!==o?o:"default";if(void 0===s){if(!a.itemIsComplete[c]?.[i])return;return a.items[c][i]}const l=a.items[c]?.[i];if(l&&s._fields){var u;const e={},t=null!==(u=Ao(s._fields))&&void 0!==u?u:[];for(let n=0;n<t.length;n++){const r=t[n].split(".");let i=l;r.forEach((e=>{i=i?.[e]})),V(e,r,i)}return e}return l}),((e,t,n,r,i,s)=>{var o;const a=null!==(o=s?.context)&&void 0!==o?o:"default";return[e.entities.records?.[t]?.[n]?.revisions?.[r]?.items?.[a]?.[i],e.entities.records?.[t]?.[n]?.revisions?.[r]?.itemIsComplete?.[a]?.[i]]}));function Ga(e){return e.undoManager}function Ha(e){return e.navigationFallbackId}const $a=(0,o.createRegistrySelector)((e=>(0,o.createSelector)(((t,n)=>e(Y).getBlockPatterns().filter((({postTypes:e})=>!e||Array.isArray(e)&&e.includes(n)))),(()=>[e(Y).getBlockPatterns()]))));function za(e,t){return 0===t?e.toLowerCase():S(e,t)}function Ya(e,t){return void 0===t&&(t={}),C(e,m({transform:za},t))}const Ka=window.wp.htmlEntities,Ja=e=>(...t)=>async({resolveSelect:n})=>{await n[e](...t)};async function Qa(e,t={},n={}){const r=t.isInitialSuggestions&&t.initialSuggestionsSearchOptions?{...t,...t.initialSuggestionsSearchOptions}:t,{type:i,subtype:s,page:o,perPage:a=(t.isInitialSuggestions?3:20)}=r,{disablePostFormats:c=!1}=n,l=[];i&&"post"!==i||l.push(T()({path:(0,j.addQueryArgs)("/wp/v2/search",{search:e,page:o,per_page:a,type:"post",subtype:s})}).then((e=>e.map((e=>({id:e.id,url:e.url,title:(0,Ka.decodeEntities)(e.title||"")||(0,A.__)("(no title)"),type:e.subtype||e.type,kind:"post-type"}))))).catch((()=>[]))),i&&"term"!==i||l.push(T()({path:(0,j.addQueryArgs)("/wp/v2/search",{search:e,page:o,per_page:a,type:"term",subtype:s})}).then((e=>e.map((e=>({id:e.id,url:e.url,title:(0,Ka.decodeEntities)(e.title||"")||(0,A.__)("(no title)"),type:e.subtype||e.type,kind:"taxonomy"}))))).catch((()=>[]))),c||i&&"post-format"!==i||l.push(T()({path:(0,j.addQueryArgs)("/wp/v2/search",{search:e,page:o,per_page:a,type:"post-format",subtype:s})}).then((e=>e.map((e=>({id:e.id,url:e.url,title:(0,Ka.decodeEntities)(e.title||"")||(0,A.__)("(no title)"),type:e.subtype||e.type,kind:"taxonomy"}))))).catch((()=>[]))),i&&"attachment"!==i||l.push(T()({path:(0,j.addQueryArgs)("/wp/v2/media",{search:e,page:o,per_page:a})}).then((e=>e.map((e=>({id:e.id,url:e.source_url,title:(0,Ka.decodeEntities)(e.title.rendered||"")||(0,A.__)("(no title)"),type:e.type,kind:"media"}))))).catch((()=>[])));let u=(await Promise.all(l)).flat();return u=u.filter((e=>!!e.id)),u=function(e,t){const n=Xa(t),r={};for(const t of e)if(t.title){const e=Xa(t.title),i=e.filter((e=>n.some((t=>e.includes(t)))));r[t.id]=i.length/e.length}else r[t.id]=0;return e.sort(((e,t)=>r[t.id]-r[e.id]))}(u,e),u=u.slice(0,a),u}function Xa(e){return e.toLowerCase().match(/[\p{L}\p{N}]+/gu)||[]}const Za=new Map,ec=async(e,t={})=>{const n={url:(0,j.prependHTTP)(e)};if(!(0,j.isURL)(e))return Promise.reject(`${e} is not a valid URL.`);const r=(0,j.getProtocol)(e);return r&&(0,j.isValidProtocol)(r)&&r.startsWith("http")&&/^https?:\/\/[^\/\s]/i.test(e)?Za.has(e)?Za.get(e):T()({path:(0,j.addQueryArgs)("/wp-block-editor/v1/url-details",n),...t}).then((t=>(Za.set(e,t),t))):Promise.reject(`${e} does not have a valid protocol. URLs must be "http" based`)};async function tc(){const e=await T()({path:"/wp/v2/block-patterns/patterns"});return e?e.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[Ya(e),t]))))):[]}const nc=e=>async({dispatch:t})=>{const n=(0,j.addQueryArgs)("/wp/v2/users/?who=authors&per_page=100",e),r=await T()({path:n});t.receiveUserQuery(n,r)},rc=()=>async({dispatch:e})=>{const t=await T()({path:"/wp/v2/users/me"});e.receiveCurrentUser(t)},ic=(e,t,n="",r)=>async({select:i,dispatch:s,registry:o})=>{const a=(await s(To(e,t))).find((n=>n.name===t&&n.kind===e));if(!a)return;const c=await s.__unstableAcquireStoreLock(Y,["entities","records",e,t,n],{exclusive:!1});try{if(window.__experimentalEnableSync&&a.syncConfig&&!r){const i=a.getSyncObjectId(n);await Ws().bootstrap(a.syncObjectType,i,(n=>{s.receiveEntityRecords(e,t,n,r)})),await Ws().bootstrap(a.syncObjectType+"--edit",i,(r=>{s({type:"EDIT_ENTITY_RECORD",kind:e,name:t,recordId:n,edits:r,meta:{undo:void 0}})}))}else{void 0!==r&&r._fields&&(r={...r,_fields:[...new Set([...Ao(r._fields)||[],a.key||mo])].join()});const c=(0,j.addQueryArgs)(a.baseURL+(n?"/"+n:""),{...a.baseURLParams,...r});if(void 0!==r&&(r={...r,include:[n]},i.hasEntityRecords(e,t,r)))return;const l=await T()({path:c,parse:!1}),u=await l.json(),d=Go(l);o.batch((()=>{s.receiveEntityRecords(e,t,u,r);for(const r of Wo){const i=Ho(r,{kind:e,name:t,id:n});s.receiveUserPermission(i,d[r]),s.finishResolution("canUser",[r,{kind:e,name:t,id:n}])}}))}}finally{s.__unstableReleaseStoreLock(c)}},sc=Ja("getEntityRecord"),oc=Ja("getEntityRecord"),ac=(e,t,n={})=>async({dispatch:r,registry:i})=>{const s=(await r(To(e,t))).find((n=>n.name===t&&n.kind===e));if(!s)return;const o=await r.__unstableAcquireStoreLock(Y,["entities","records",e,t],{exclusive:!1});try{n._fields&&(n={...n,_fields:[...new Set([...Ao(n._fields)||[],s.key||mo])].join()});const a=(0,j.addQueryArgs)(s.baseURL,{...s.baseURLParams,...n});let c,l;if(s.supportsPagination&&-1!==n.per_page){const e=await T()({path:a,parse:!1});c=Object.values(await e.json()),l={totalItems:parseInt(e.headers.get("X-WP-Total")),totalPages:parseInt(e.headers.get("X-WP-TotalPages"))}}else c=Object.values(await T()({path:a}));n._fields&&(c=c.map((e=>(n._fields.split(",").forEach((t=>{e.hasOwnProperty(t)||(e[t]=void 0)})),e)))),i.batch((()=>{if(r.receiveEntityRecords(e,t,c,n,!1,void 0,l),!n?._fields&&!n.context){const n=s.key||mo,i=c.filter((e=>e?.[n])).map((r=>[e,t,r[n]]));r.finishResolutions("getEntityRecord",i)}r.__unstableReleaseStoreLock(o)}))}catch(e){r.__unstableReleaseStoreLock(o)}};ac.shouldInvalidate=(e,t,n)=>("RECEIVE_ITEMS"===e.type||"REMOVE_ITEMS"===e.type)&&e.invalidateCache&&t===e.kind&&n===e.name;const cc=()=>async({dispatch:e,resolveSelect:t})=>{const n=await t.getEntityRecords("root","theme",{status:"active"});e.receiveCurrentTheme(n[0])},lc=Ja("getCurrentTheme"),uc=e=>async({dispatch:t})=>{try{const n=await T()({path:(0,j.addQueryArgs)("/oembed/1.0/proxy",{url:e})});t.receiveEmbedPreview(e,n)}catch(n){t.receiveEmbedPreview(e,!1)}},dc=(e,t,n)=>async({dispatch:r,registry:i})=>{if(!Wo.includes(e))throw new Error(`'${e}' is not a valid action.`);let s=null;if("object"==typeof t){if(!t.kind||!t.name)throw new Error("The entity resource object is not valid.");const e=(await r(To(t.kind,t.name))).find((e=>e.name===t.name&&e.kind===t.kind));if(!e)return;s=e.baseURL+(t.id?"/"+t.id:"")}else s=`/wp/v2/${t}`+(n?"/"+n:"");const{hasStartedResolution:o}=i.select(Y);for(const r of Wo)if(r!==e&&o("canUser",[r,t,n]))return;let a;try{a=await T()({path:s,method:"OPTIONS",parse:!1})}catch(e){return}const c=Go(a);i.batch((()=>{for(const i of Wo){const s=Ho(i,t,n);r.receiveUserPermission(s,c[i]),i!==e&&r.finishResolution("canUser",[i,t,n])}}))},hc=(e,t,n)=>async({dispatch:r})=>{await r(dc("update",{kind:e,name:t,id:n}))},fc=(e,t)=>async({dispatch:n,resolveSelect:r})=>{const{rest_base:i,rest_namespace:s="wp/v2"}=await r.getPostType(e),o=await T()({path:`/${s}/${i}/${t}/autosaves?context=edit`});o&&o.length&&n.receiveAutosaves(t,o)},pc=(e,t)=>async({resolveSelect:n})=>{await n.getAutosaves(e,t)},gc=e=>async({dispatch:t,resolveSelect:n})=>{let r;try{r=await T()({url:(0,j.addQueryArgs)(e,{"_wp-find-template":!0})}).then((({data:e})=>e))}catch(e){}if(!r)return;const i=await n.getEntityRecord("postType","wp_template",r.id);i&&t.receiveEntityRecords("postType","wp_template",[i],{"find-template":e})};gc.shouldInvalidate=e=>("RECEIVE_ITEMS"===e.type||"REMOVE_ITEMS"===e.type)&&e.invalidateCache&&"postType"===e.kind&&"wp_template"===e.name;const yc=()=>async({dispatch:e,resolveSelect:t})=>{const n=await t.getEntityRecords("root","theme",{status:"active"}),r=n?.[0]?._links?.["wp:user-global-styles"]?.[0]?.href;if(!r)return;const i=r.match(/\/(\d+)(?:\?|$)/),s=i?Number(i[1]):null;s&&e.__experimentalReceiveCurrentGlobalStylesId(s)},mc=()=>async({resolveSelect:e,dispatch:t})=>{const n=await e.getCurrentTheme(),r=await T()({path:`/wp/v2/global-styles/themes/${n.stylesheet}`});t.__experimentalReceiveThemeBaseGlobalStyles(n.stylesheet,r)},bc=()=>async({resolveSelect:e,dispatch:t})=>{const n=await e.getCurrentTheme(),r=await T()({path:`/wp/v2/global-styles/themes/${n.stylesheet}/variations`});t.__experimentalReceiveThemeGlobalStyleVariations(n.stylesheet,r)},_c=()=>async({resolveSelect:e,dispatch:t})=>{const n=await e.__experimentalGetCurrentGlobalStylesId(),r=n?await e.getEntityRecord("root","globalStyles",n):void 0,i=r?._links?.["version-history"]?.[0]?.href;if(i){const e=await T()({url:i}),r=e?.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[Ya(e),t])))));t.receiveThemeGlobalStyleRevisions(n,r)}};_c.shouldInvalidate=e=>"SAVE_ENTITY_RECORD_FINISH"===e.type&&"root"===e.kind&&!e.error&&"globalStyles"===e.name;const wc=()=>async({dispatch:e})=>{e({type:"RECEIVE_BLOCK_PATTERNS",patterns:await tc()})},vc=()=>async({dispatch:e})=>{e({type:"RECEIVE_BLOCK_PATTERN_CATEGORIES",categories:await T()({path:"/wp/v2/block-patterns/categories"})})},Ec=()=>async({dispatch:e,resolveSelect:t})=>{const n=await t.getEntityRecords("taxonomy","wp_pattern_category",{per_page:-1,_fields:"id,name,description,slug",context:"view"});e({type:"RECEIVE_USER_PATTERN_CATEGORIES",patternCategories:n?.map((e=>({...e,label:(0,Ka.decodeEntities)(e.name),name:e.slug})))||[]})},Rc=()=>async({dispatch:e,select:t})=>{const n=await T()({path:(0,j.addQueryArgs)("/wp-block-editor/v1/navigation-fallback",{_embed:!0})}),r=n?._embedded?.self;if(e.receiveNavigationFallbackId(n?.id),r){const i=!t.getEntityRecord("postType","wp_navigation",n.id);e.receiveEntityRecords("postType","wp_navigation",r,void 0,i),e.finishResolution("getEntityRecord",["postType","wp_navigation",n.id])}},Sc=e=>async({dispatch:t})=>{const n=await T()({path:(0,j.addQueryArgs)("/wp/v2/templates/lookup",e)});n?.id&&t.receiveDefaultTemplateId(e,n.id)},Cc=(e,t,n,r={})=>async({dispatch:i})=>{const s=(await i(To(e,t))).find((n=>n.name===t&&n.kind===e));if(!s)return;r._fields&&(r={...r,_fields:[...new Set([...Ao(r._fields)||[],s.revisionKey||mo])].join()});const o=(0,j.addQueryArgs)(s.getRevisionsUrl(n),r);let a,c;const l={},u=s.supportsPagination&&-1!==r.per_page;try{c=await T()({path:o,parse:!u})}catch(e){return}if(c&&(u?(a=Object.values(await c.json()),l.totalItems=parseInt(c.headers.get("X-WP-Total"))):a=Object.values(c),r._fields&&(a=a.map((e=>(r._fields.split(",").forEach((t=>{e.hasOwnProperty(t)||(e[t]=void 0)})),e)))),i.receiveRevisions(e,t,n,a,r,!1,l),!r?._fields&&!r.context)){const r=s.key||mo,o=a.filter((e=>e[r])).map((i=>[e,t,n,i[r]]));i.startResolutions("getRevision",o),i.finishResolutions("getRevision",o)}};Cc.shouldInvalidate=(e,t,n,r)=>"SAVE_ENTITY_RECORD_FINISH"===e.type&&n===e.name&&t===e.kind&&!e.error&&r===e.recordId;const kc=(e,t,n,r,i)=>async({dispatch:s})=>{const o=(await s(To(e,t))).find((n=>n.name===t&&n.kind===e));if(!o)return;void 0!==i&&i._fields&&(i={...i,_fields:[...new Set([...Ao(i._fields)||[],o.revisionKey||mo])].join()});const a=(0,j.addQueryArgs)(o.getRevisionsUrl(n,r),i);let c;try{c=await T()({path:a})}catch(e){return}c&&s.receiveRevisions(e,t,n,c,i)};function Tc(e,t){const n={...e};let r=n;for(const e of t)r.children={...r.children,[e]:{locks:[],children:{},...r.children[e]}},r=r.children[e];return n}function Ac(e,t){let n=e;for(const e of t){const t=n.children[e];if(!t)return null;n=t}return n}function Ic({exclusive:e},t){return!(!e||!t.length)||!(e||!t.filter((e=>e.exclusive)).length)}const Oc={requests:[],tree:{locks:[],children:{}}};function Dc(e=Oc,t){switch(t.type){case"ENQUEUE_LOCK_REQUEST":{const{request:n}=t;return{...e,requests:[n,...e.requests]}}case"GRANT_LOCK_REQUEST":{const{lock:n,request:r}=t,{store:i,path:s}=r,o=[i,...s],a=Tc(e.tree,o),c=Ac(a,o);return c.locks=[...c.locks,n],{...e,requests:e.requests.filter((e=>e!==r)),tree:a}}case"RELEASE_LOCK":{const{lock:n}=t,r=[n.store,...n.path],i=Tc(e.tree,r),s=Ac(i,r);return s.locks=s.locks.filter((e=>e!==n)),{...e,tree:i}}}return e}function Lc(e,t,n,{exclusive:r}){const i=[t,...n],s=e.tree;for(const e of function*(e,t){let n=e;yield n;for(const e of t){const t=n.children[e];if(!t)break;yield t,n=t}}(s,i))if(Ic({exclusive:r},e.locks))return!1;const o=Ac(s,i);if(!o)return!0;for(const e of function*(e){const t=Object.values(e.children);for(;t.length;){const e=t.pop();yield e,t.push(...Object.values(e.children))}}(o))if(Ic({exclusive:r},e.locks))return!1;return!0}function xc(){let e=Dc(void 0,{type:"@@INIT"});function t(){for(const t of function(e){return e.requests}(e)){const{store:n,path:r,exclusive:i,notifyAcquired:s}=t;if(Lc(e,n,r,{exclusive:i})){const o={store:n,path:r,exclusive:i};e=Dc(e,{type:"GRANT_LOCK_REQUEST",lock:o,request:t}),s(o)}}}return{acquire:function(n,r,i){return new Promise((s=>{e=Dc(e,{type:"ENQUEUE_LOCK_REQUEST",request:{store:n,path:r,exclusive:i,notifyAcquired:s}}),t()}))},release:function(n){e=Dc(e,{type:"RELEASE_LOCK",lock:n}),t()}}}const Nc=window.wp.privateApis,{lock:Mc,unlock:Uc}=(0,Nc.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/core-data"),Pc=window.wp.element,jc=(0,Pc.createContext)({}),Bc=window.ReactJSXRuntime;function Fc({kind:e,type:t,id:n,children:r}){const i=(0,Pc.useContext)(jc),s=(0,Pc.useMemo)((()=>({...i,[e]:{...i?.[e],[t]:n}})),[i,e,t,n]);return(0,Bc.jsx)(jc.Provider,{value:s,children:r})}let Vc=function(e){return e.Idle="IDLE",e.Resolving="RESOLVING",e.Error="ERROR",e.Success="SUCCESS",e}({});const qc=["getIsResolving","hasStartedResolution","hasFinishedResolution","isResolving","getCachedResolvers"];function Wc(e,t){return(0,o.useSelect)(((t,n)=>e((e=>Gc(t(e))),n)),t)}const Gc=function(e,t){var n,r,i=0;function s(){var s,o,a=n,c=arguments.length;e:for(;a;){if(a.args.length===arguments.length){for(o=0;o<c;o++)if(a.args[o]!==arguments[o]){a=a.next;continue e}return a!==n&&(a===r&&(r=a.prev),a.prev.next=a.next,a.next&&(a.next.prev=a.prev),a.next=n,a.prev=null,n.prev=a,n=a),a.val}a=a.next}for(s=new Array(c),o=0;o<c;o++)s[o]=arguments[o];return a={args:s,val:e.apply(null,s)},n?(n.prev=a,a.next=n):r=a,i===t.maxSize?(r=r.prev).next=null:i++,n=a,a.val}return t=t||{},s.clear=function(){n=null,r=null,i=0},s}((e=>{const t={};for(const n in e)qc.includes(n)||Object.defineProperty(t,n,{get:()=>(...t)=>{const r=e[n](...t),i=e.getResolutionState(n,t)?.status;let s;switch(i){case"resolving":s=Vc.Resolving;break;case"finished":s=Vc.Success;break;case"error":s=Vc.Error;break;case void 0:s=Vc.Idle}return{data:r,status:s,isResolving:s===Vc.Resolving,hasStarted:s!==Vc.Idle,hasResolved:s===Vc.Success||s===Vc.Error}}});return t})),Hc={};function $c(e,t,n,r={enabled:!0}){const{editEntityRecord:i,saveEditedEntityRecord:s}=(0,o.useDispatch)(yl),a=(0,Pc.useMemo)((()=>({edit:(r,s={})=>i(e,t,n,r,s),save:(r={})=>s(e,t,n,{throwOnError:!0,...r})})),[i,e,t,n,s]),{editedRecord:c,hasEdits:l,edits:u}=(0,o.useSelect)((i=>r.enabled?{editedRecord:i(yl).getEditedEntityRecord(e,t,n),hasEdits:i(yl).hasEditsForEntityRecord(e,t,n),edits:i(yl).getEntityRecordNonTransientEdits(e,t,n)}:{editedRecord:Hc,hasEdits:!1,edits:Hc}),[e,t,n,r.enabled]),{data:d,...h}=Wc((i=>r.enabled?i(yl).getEntityRecord(e,t,n):{data:null}),[e,t,n,r.enabled]);return{record:d,editedRecord:c,hasEdits:l,edits:u,...h,...a}}function zc(e,t,n,r){return F()("wp.data.__experimentalUseEntityRecord",{alternative:"wp.data.useEntityRecord",since:"6.1"}),$c(e,t,n,r)}const Yc=[];function Kc(e,t,n={},r={enabled:!0}){const i=(0,j.addQueryArgs)("",n),{data:s,...a}=Wc((i=>r.enabled?i(yl).getEntityRecords(e,t,n):{data:Yc}),[e,t,i,r.enabled]),{totalItems:c,totalPages:l}=(0,o.useSelect)((i=>r.enabled?{totalItems:i(yl).getEntityRecordsTotalItems(e,t,n),totalPages:i(yl).getEntityRecordsTotalPages(e,t,n)}:{totalItems:null,totalPages:null}),[e,t,i,r.enabled]);return{records:s,totalItems:c,totalPages:l,...a}}function Jc(e,t,n,r){return F()("wp.data.__experimentalUseEntityRecords",{alternative:"wp.data.useEntityRecords",since:"6.1"}),Kc(e,t,n,r)}function Qc(e,t){const n="object"==typeof e;return Wc((r=>{const i=n?!!e.id:!!t,{canUser:s}=r(yl),o=s("create",n?{kind:e.kind,name:e.name}:e);if(!i){const t=s("read",e),n=o.isResolving||t.isResolving,r=o.hasResolved&&t.hasResolved;let i=Vc.Idle;return n?i=Vc.Resolving:r&&(i=Vc.Success),{status:i,isResolving:n,hasResolved:r,canCreate:o.hasResolved&&o.data,canRead:t.hasResolved&&t.data}}const a=s("read",e,t),c=s("update",e,t),l=s("delete",e,t),u=a.isResolving||o.isResolving||c.isResolving||l.isResolving,d=a.hasResolved&&o.hasResolved&&c.hasResolved&&l.hasResolved;let h=Vc.Idle;return u?h=Vc.Resolving:d&&(h=Vc.Success),{status:h,isResolving:u,hasResolved:d,canRead:d&&a.data,canCreate:d&&o.data,canUpdate:d&&c.data,canDelete:d&&l.data}}),[n?JSON.stringify(e):e,t])}window.wp.warning;const Xc=Qc;function Zc(e,t){return F()("wp.data.__experimentalUseResourcePermissions",{alternative:"wp.data.useResourcePermissions",since:"6.1"}),Qc(e,t)}const el=window.wp.blocks;function tl(e,t){const n=(0,Pc.useContext)(jc);return n?.[e]?.[t]}const nl=window.wp.blockEditor;let rl;const il=new WeakMap,sl=new WeakMap;function ol(e){if(!sl.has(e)){const t=[];for(const n of function(e){if(rl||(rl=Uc(nl.privateApis)),!il.has(e)){const t=rl.getRichTextValues([e]);il.set(e,t)}return il.get(e)}(e))n&&n.replacements.forEach((({type:e,attributes:n})=>{"core/footnote"===e&&t.push(n["data-fn"])}));sl.set(e,t)}return sl.get(e)}let al={};const cl=[],ll=new WeakMap;function ul(e,t,{id:n}={}){const r=tl(e,t),i=null!=n?n:r,{getEntityRecord:s,getEntityRecordEdits:a}=(0,o.useSelect)(Y),{content:c,editedBlocks:l,meta:u}=(0,o.useSelect)((n=>{if(!i)return{};const{getEditedEntityRecord:r}=n(Y),s=r(e,t,i);return{editedBlocks:s.blocks,content:s.content,meta:s.meta}}),[e,t,i]),{__unstableCreateUndoLevel:d,editEntityRecord:h}=(0,o.useDispatch)(Y),f=(0,Pc.useMemo)((()=>{if(!i)return;if(l)return l;if(!c||"string"!=typeof c)return cl;const n=a(e,t,i),r=n&&Object.keys(n).length?n:s(e,t,i);let o=ll.get(r);return o||(o=(0,el.parse)(c),ll.set(r,o)),o}),[e,t,i,l,c,s,a]),p=(0,Pc.useCallback)((e=>function(e,t){const n={blocks:e};if(!t)return n;if(void 0===t.footnotes)return n;const r=function(e){return e.flatMap(ol)}(e),i=t.footnotes?JSON.parse(t.footnotes):[];if(i.map((e=>e.id)).join("")===r.join(""))return n;const s=r.map((e=>i.find((t=>t.id===e))||al[e]||{id:e,content:""}));function o(e){if(!e||Array.isArray(e)||"object"!=typeof e)return e;e={...e};for(const t in e){const n=e[t];if(Array.isArray(n)){e[t]=n.map(o);continue}if("string"!=typeof n&&!(n instanceof I.RichTextData))continue;const i="string"==typeof n?I.RichTextData.fromHTMLString(n):new I.RichTextData(n);i.replacements.forEach((e=>{if("core/footnote"===e.type){const t=e.attributes["data-fn"],n=r.indexOf(t),i=(0,I.create)({html:e.innerHTML});i.text=String(n+1),i.formats=Array.from({length:i.text.length},(()=>i.formats[0])),i.replacements=Array.from({length:i.text.length},(()=>i.replacements[0])),e.innerHTML=(0,I.toHTMLString)({value:i})}})),e[t]="string"==typeof n?i.toHTMLString():i}return e}const a=function e(t){return t.map((t=>({...t,attributes:o(t.attributes),innerBlocks:e(t.innerBlocks)})))}(e);return al={...al,...i.reduce(((e,t)=>(r.includes(t.id)||(e[t.id]=t),e)),{})},{meta:{...t,footnotes:JSON.stringify(s)},blocks:a}}(e,u)),[u]),g=(0,Pc.useCallback)(((n,r)=>{if(f===n)return d(e,t,i);const{selection:s,...o}=r,a={selection:s,content:({blocks:e=[]})=>(0,el.__unstableSerializeAndClean)(e),...p(n)};h(e,t,i,a,{isCached:!1,...o})}),[e,t,i,f,p,d,h]),y=(0,Pc.useCallback)(((n,r)=>{const{selection:s,...o}=r,a={selection:s,...p(n)};h(e,t,i,a,{isCached:!0,...o})}),[e,t,i,p,h]);return[f,y,g]}function dl(e,t,n,r){const i=tl(e,t),s=null!=r?r:i,{value:a,fullValue:c}=(0,o.useSelect)((r=>{const{getEntityRecord:i,getEditedEntityRecord:o}=r(Y),a=i(e,t,s),c=o(e,t,s);return a&&c?{value:c[n],fullValue:a[n]}:{}}),[e,t,s,n]),{editEntityRecord:l}=(0,o.useDispatch)(Y);return[a,(0,Pc.useCallback)((r=>{l(e,t,s,{[n]:r})}),[l,e,t,s,n]),c]}const hl=[..._o,...wo.filter((e=>!!e.name))],fl=hl.reduce(((e,t)=>{const{kind:n,name:r,plural:i}=t;return e[Co(n,r)]=(e,t,i)=>ta(e,n,r,t,i),i&&(e[Co(n,i,"get")]=(e,t)=>sa(e,n,r,t)),e}),{}),pl=hl.reduce(((e,t)=>{const{kind:n,name:r,plural:i}=t;if(e[Co(n,r)]=(e,t)=>ic(n,r,e,t),i){const t=Co(n,i,"get");e[t]=(...e)=>ac(n,r,...e),e[t].shouldInvalidate=e=>ac.shouldInvalidate(e,n,r)}return e}),{}),gl=hl.reduce(((e,t)=>{const{kind:n,name:r}=t;return e[Co(n,r,"save")]=(e,t)=>oo(n,r,e,t),e[Co(n,r,"delete")]=(e,t,i)=>to(n,r,e,t,i),e}),{}),yl=(0,o.createReduxStore)(Y,{reducer:Po,actions:{...e,...gl,...function(){const e=xc();return{__unstableAcquireStoreLock:function(t,n,{exclusive:r}){return()=>e.acquire(t,n,r)},__unstableReleaseStoreLock:function(t){return()=>e.release(t)}}}()},selectors:{...t,...fl},resolvers:{...s,...pl}});Uc(yl).registerPrivateSelectors(i),(0,o.register)(yl)})(),(window.wp=window.wp||{}).coreData=r})(); //# sourceMappingURL=index.min.js.map